From owner-svn-src-stable@freebsd.org Sun Dec 1 15:29:49 2019 Return-Path: Delivered-To: svn-src-stable@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 450601AECF1; Sun, 1 Dec 2019 15:29: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 47QscY17HHz3Qdp; Sun, 1 Dec 2019 15:29: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 0572A18B74; Sun, 1 Dec 2019 15:29: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 xB1FTmNx032597; Sun, 1 Dec 2019 15:29:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1FTm1F032596; Sun, 1 Dec 2019 15:29:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912011529.xB1FTm1F032596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Dec 2019 15:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355261 - stable/12/sys/fs/tmpfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/tmpfs X-SVN-Commit-Revision: 355261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 15:29:49 -0000 Author: kib Date: Sun Dec 1 15:29:48 2019 New Revision: 355261 URL: https://svnweb.freebsd.org/changeset/base/355261 Log: MFC r355061: tmpfs: resolve deadlock between rename and unmount. Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 08:04:22 2019 (r355260) +++ stable/12/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 15:29:48 2019 (r355261) @@ -792,7 +792,6 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tdvp = v->a_tdvp; struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; - struct mount *mp = NULL; char *newname; struct tmpfs_dirent *de; struct tmpfs_mount *tmp; @@ -829,18 +828,10 @@ tmpfs_rename(struct vop_rename_args *v) */ if (fdvp != tdvp && fdvp != tvp) { if (vn_lock(fdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { - mp = tdvp->v_mount; - error = vfs_busy(mp, 0); - if (error != 0) { - mp = NULL; - goto out; - } error = tmpfs_rename_relock(fdvp, &fvp, tdvp, &tvp, fcnp, tcnp); - if (error != 0) { - vfs_unbusy(mp); + if (error != 0) return (error); - } ASSERT_VOP_ELOCKED(fdvp, "tmpfs_rename: fdvp not locked"); ASSERT_VOP_ELOCKED(tdvp, @@ -1083,9 +1074,6 @@ out: /* Release source nodes. */ vrele(fdvp); vrele(fvp); - - if (mp != NULL) - vfs_unbusy(mp); return (error); } From owner-svn-src-stable@freebsd.org Sun Dec 1 15:59:04 2019 Return-Path: Delivered-To: svn-src-stable@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 D43B31AFB28; Sun, 1 Dec 2019 15:59:04 +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 47QtGJ5L2gz3xWb; Sun, 1 Dec 2019 15:59:04 +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 9605C190C7; Sun, 1 Dec 2019 15:59:04 +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 xB1Fx4ub050895; Sun, 1 Dec 2019 15:59:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1Fx4nP050894; Sun, 1 Dec 2019 15:59:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912011559.xB1Fx4nP050894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Dec 2019 15:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355262 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/fs/tmpfs X-SVN-Commit-Revision: 355262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 15:59:04 -0000 Author: kib Date: Sun Dec 1 15:59:04 2019 New Revision: 355262 URL: https://svnweb.freebsd.org/changeset/base/355262 Log: MFC r355061: tmpfs: resolve deadlock between rename and unmount. Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 15:29:48 2019 (r355261) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 15:59:04 2019 (r355262) @@ -786,7 +786,6 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tdvp = v->a_tdvp; struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; - struct mount *mp = NULL; char *newname; struct tmpfs_dirent *de; struct tmpfs_mount *tmp; @@ -823,18 +822,10 @@ tmpfs_rename(struct vop_rename_args *v) */ if (fdvp != tdvp && fdvp != tvp) { if (vn_lock(fdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { - mp = tdvp->v_mount; - error = vfs_busy(mp, 0); - if (error != 0) { - mp = NULL; - goto out; - } error = tmpfs_rename_relock(fdvp, &fvp, tdvp, &tvp, fcnp, tcnp); - if (error != 0) { - vfs_unbusy(mp); + if (error != 0) return (error); - } ASSERT_VOP_ELOCKED(fdvp, "tmpfs_rename: fdvp not locked"); ASSERT_VOP_ELOCKED(tdvp, @@ -1077,9 +1068,6 @@ out: /* Release source nodes. */ vrele(fdvp); vrele(fvp); - - if (mp != NULL) - vfs_unbusy(mp); return (error); } From owner-svn-src-stable@freebsd.org Sun Dec 1 16:02:16 2019 Return-Path: Delivered-To: svn-src-stable@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 32D581AFD75; Sun, 1 Dec 2019 16:02:16 +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 47QtL00gdrz3xrf; Sun, 1 Dec 2019 16:02:16 +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 EFE0B1926D; Sun, 1 Dec 2019 16:02: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 xB1G2F29055677; Sun, 1 Dec 2019 16:02:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1G2FMA055676; Sun, 1 Dec 2019 16:02:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912011602.xB1G2FMA055676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Dec 2019 16:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355263 - stable/12/sys/amd64/include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/include X-SVN-Commit-Revision: 355263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 16:02:16 -0000 Author: kib Date: Sun Dec 1 16:02:15 2019 New Revision: 355263 URL: https://svnweb.freebsd.org/changeset/base/355263 Log: MFC r355060: amd64: assert that EARLY_COUNTER does not corrupt memory. Modified: stable/12/sys/amd64/include/counter.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/include/counter.h ============================================================================== --- stable/12/sys/amd64/include/counter.h Sun Dec 1 15:59:04 2019 (r355262) +++ stable/12/sys/amd64/include/counter.h Sun Dec 1 16:02:15 2019 (r355263) @@ -82,6 +82,7 @@ static inline void counter_u64_add(counter_u64_t c, int64_t inc) { + KASSERT(IS_BSP() || c != EARLY_COUNTER, ("EARLY_COUNTER used on AP")); __asm __volatile("addq\t%1,%%gs:(%0)" : : "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc) From owner-svn-src-stable@freebsd.org Mon Dec 2 00:39:59 2019 Return-Path: Delivered-To: svn-src-stable@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 74DD11BEA0F; Mon, 2 Dec 2019 00:39:59 +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 47R5qM23TSz4Rbh; Mon, 2 Dec 2019 00:39:59 +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 238CD1EFEF; Mon, 2 Dec 2019 00:39:59 +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 xB20dwc0059999; Mon, 2 Dec 2019 00:39:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB20dwYS059998; Mon, 2 Dec 2019 00:39:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912020039.xB20dwYS059998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 2 Dec 2019 00:39:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355279 - stable/12/sys/fs/nfsclient X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/nfsclient X-SVN-Commit-Revision: 355279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 00:39:59 -0000 Author: kib Date: Mon Dec 2 00:39:58 2019 New Revision: 355279 URL: https://svnweb.freebsd.org/changeset/base/355279 Log: MFC r355210: In nfs_lock(), recheck vp->v_data after lock before accessing it. PR: 242184 Modified: stable/12/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clvnops.c Mon Dec 2 00:11:12 2019 (r355278) +++ stable/12/sys/fs/nfsclient/nfs_clvnops.c Mon Dec 2 00:39:58 2019 (r355279) @@ -287,6 +287,8 @@ nfs_lock(struct vop_lock1_args *ap) if (error != 0 || vp->v_op != &newnfs_vnodeops) return (error); np = VTONFS(vp); + if (np == NULL) + return (0); NFSLOCKNODE(np); if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED && lktype != LK_EXCLUSIVE && lktype != LK_UPGRADE && @@ -320,6 +322,9 @@ nfs_lock(struct vop_lock1_args *ap) error = VOP_LOCK1_APV(&default_vnodeops, ap); if (error != 0 || vp->v_op != &newnfs_vnodeops) return (error); + if (vp->v_data == NULL) + goto downgrade; + MPASS(vp->v_data == np); NFSLOCKNODE(np); if ((np->n_flag & NVNSETSZSKIP) == 0) { NFSUNLOCKNODE(np); From owner-svn-src-stable@freebsd.org Mon Dec 2 07:20:32 2019 Return-Path: Delivered-To: svn-src-stable@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 DA5511C837A; Mon, 2 Dec 2019 07:20:32 +0000 (UTC) (envelope-from avg@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 47RGjX5Tgcz4kZv; Mon, 2 Dec 2019 07:20:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F6562379B; Mon, 2 Dec 2019 07:20:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB27KWZm095546; Mon, 2 Dec 2019 07:20:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB27KWh5095545; Mon, 2 Dec 2019 07:20:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912020720.xB27KWh5095545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 2 Dec 2019 07:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355281 - stable/12/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 355281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 07:20:32 -0000 Author: avg Date: Mon Dec 2 07:20:32 2019 New Revision: 355281 URL: https://svnweb.freebsd.org/changeset/base/355281 Log: MFC r354886: zpool.8: remove a paragraph about quorum disks Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 05:24:16 2019 (r355280) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 07:20:32 2019 (r355281) @@ -863,10 +863,6 @@ Displays the configuration that would be used without .Ar vdev Ns s. The actual pool creation can still fail due to insufficient privileges or device sharing. -.Pp -Do not add a disk that is currently configured as a quorum device to a zpool. -After a disk is in the pool, that disk can then be configured as a quorum -device. .El .It Xo .Nm From owner-svn-src-stable@freebsd.org Mon Dec 2 07:22:02 2019 Return-Path: Delivered-To: svn-src-stable@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 948161C853D; Mon, 2 Dec 2019 07:22:02 +0000 (UTC) (envelope-from avg@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 47RGlG3T6qz4kmw; Mon, 2 Dec 2019 07:22:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BBB32391A; Mon, 2 Dec 2019 07:22:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB27M2Yr000472; Mon, 2 Dec 2019 07:22:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB27M2qP000471; Mon, 2 Dec 2019 07:22:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912020722.xB27M2qP000471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 2 Dec 2019 07:22:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355282 - stable/12/sys/i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/i386/i386 X-SVN-Commit-Revision: 355282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 07:22:02 -0000 Author: avg Date: Mon Dec 2 07:22:01 2019 New Revision: 355282 URL: https://svnweb.freebsd.org/changeset/base/355282 Log: MFC r354627: db_nextframe/i386: reduce the number of special frame types Modified: stable/12/sys/i386/i386/db_trace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/i386/i386/db_trace.c ============================================================================== --- stable/12/sys/i386/i386/db_trace.c Mon Dec 2 07:20:32 2019 (r355281) +++ stable/12/sys/i386/i386/db_trace.c Mon Dec 2 07:22:01 2019 (r355282) @@ -191,8 +191,6 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int o #define INTERRUPT 2 #define SYSCALL 3 #define DOUBLE_FAULT 4 -#define TRAP_INTERRUPT 5 -#define TRAP_TIMERINT 6 static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *); static int db_numargs(struct i386_frame *); @@ -299,6 +297,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st { struct trapframe *tf; int frame_type; + int narg; int eip, esp, ebp; db_expr_t offset; c_db_sym_t sym; @@ -317,6 +316,15 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st * actually made the call. */ frame_type = NORMAL; + + /* + * This is the number of arguments that a syscall / trap / interrupt + * service routine passes to its callee. This number is used only for + * special frame types. In most cases there is one argument: the trap + * frame address. + */ + narg = 1; + if (eip >= PMAP_TRM_MIN_ADDRESS) { sym = db_search_symbol(eip - 1 - setidt_disp, DB_STGY_ANY, &offset); @@ -329,20 +337,24 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st strcmp(name, "fork_trampoline") == 0) frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || - strncmp(name, "Xapic_isr", 9) == 0) + strncmp(name, "Xapic_isr", 9) == 0) { + /* Additional argument: vector number. */ + narg = 2; frame_type = INTERRUPT; - else if (strcmp(name, "Xlcall_syscall") == 0 || + } else if (strcmp(name, "Xlcall_syscall") == 0 || strcmp(name, "Xint0x80_syscall") == 0) frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; - /* XXX: These are interrupts with trap frames. */ else if (strcmp(name, "Xtimerint") == 0) - frame_type = TRAP_TIMERINT; + frame_type = INTERRUPT; else if (strcmp(name, "Xcpustop") == 0 || strcmp(name, "Xrendezvous") == 0 || - strcmp(name, "Xipi_intr_bitmap_handler") == 0) - frame_type = TRAP_INTERRUPT; + strcmp(name, "Xipi_intr_bitmap_handler") == 0) { + /* No arguments. */ + narg = 0; + frame_type = INTERRUPT; + } } /* @@ -375,14 +387,11 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st /* * Point to base of trapframe which is just above the - * current frame. + * current frame. Note that struct i386_frame already accounts for one + * argument. */ - if (frame_type == INTERRUPT) - tf = (struct trapframe *)((int)*fp + 16); - else if (frame_type == TRAP_INTERRUPT) - tf = (struct trapframe *)((int)*fp + 8); - else - tf = (struct trapframe *)((int)*fp + 12); + tf = (struct trapframe *)((char *)*fp + sizeof(struct i386_frame) + + 4 * (narg - 1)); esp = get_esp(tf); eip = tf->tf_eip; @@ -395,8 +404,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st db_printf("--- syscall"); decode_syscall(tf->tf_eax, td); break; - case TRAP_TIMERINT: - case TRAP_INTERRUPT: case INTERRUPT: db_printf("--- interrupt"); break; @@ -407,8 +414,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st switch (frame_type) { case TRAP: - case TRAP_TIMERINT: - case TRAP_INTERRUPT: case INTERRUPT: if ((tf->tf_eflags & PSL_VM) != 0 || (tf->tf_cs & SEL_RPL_MASK) != 0) @@ -418,7 +423,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st ebp = 0; break; } - + *ip = (db_addr_t) eip; *fp = (struct i386_frame *) ebp; } From owner-svn-src-stable@freebsd.org Mon Dec 2 07:39:57 2019 Return-Path: Delivered-To: svn-src-stable@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 C63981C88D9; Mon, 2 Dec 2019 07:39:57 +0000 (UTC) (envelope-from avg@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 47RH7x4wqrz4lQy; Mon, 2 Dec 2019 07:39:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C59023B26; Mon, 2 Dec 2019 07:39:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB27dvpm007478; Mon, 2 Dec 2019 07:39:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB27dtpY007470; Mon, 2 Dec 2019 07:39:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912020739.xB27dtpY007470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 2 Dec 2019 07:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355283 - in stable/12: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/co... X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/cont... X-SVN-Commit-Revision: 355283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 07:39:57 -0000 Author: avg Date: Mon Dec 2 07:39:55 2019 New Revision: 355283 URL: https://svnweb.freebsd.org/changeset/base/355283 Log: MFC r354436: MFV r354377: 10554 Implemented zpool sync command This addition will enable us to sync an open TXG to the main pool on demand. The functionality is similar to sync(2) but 'zpool sync' will return when data has hit the main storage instead of potentially just the ZIL as is the case with the sync(2) cmd. Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 07:39:55 2019 (r355283) @@ -193,6 +193,9 @@ .Ar ... .Op Ar interval Op Ar count .Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Nm .Cm upgrade .Op Fl v .Nm @@ -1907,6 +1910,19 @@ unavailable. Warnings about pools not using the latest on-disk format, having non-native block size or disabled features will not be included. .El +.It Xo +.Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Xc +Forces all in-core dirty data to be written to the primary pool storage and +not the ZIL. +It will also update administrative information including quota reporting. +Without arguments, +.Nm zpool Cm sync +will sync all pools on the system. +Otherwise, it will only sync the specified +.Ar pool . .It Xo .Nm .Cm upgrade Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Dec 2 07:39:55 2019 (r355283) @@ -100,6 +100,8 @@ static int zpool_do_history(int, char **); static int zpool_do_get(int, char **); static int zpool_do_set(int, char **); +static int zpool_do_sync(int, char **); + /* * These libumem hooks provide a reasonable set of defaults for the allocator's * debugging facilities. @@ -144,6 +146,7 @@ typedef enum { HELP_GET, HELP_SET, HELP_SPLIT, + HELP_SYNC, HELP_REGUID, HELP_REOPEN } zpool_help_t; @@ -200,6 +203,7 @@ static zpool_command_t command_table[] = { { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, { "set", zpool_do_set, HELP_SET }, + { "sync", zpool_do_sync, HELP_SYNC }, }; #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) @@ -285,6 +289,8 @@ get_usage(zpool_help_t idx) "[ ...]\n")); case HELP_REGUID: return (gettext("\treguid \n")); + case HELP_SYNC: + return (gettext("\tsync [pool] ...\n")); } abort(); @@ -2646,6 +2652,45 @@ error: free(searchdirs); return (err ? 1 : 0); +} + +/* + * zpool sync [-f] [pool] ... + * + * -f (undocumented) force uberblock (and config including zpool cache file) + * update. + * + * Sync the specified pool(s). + * Without arguments "zpool sync" will sync all pools. + * This command initiates TXG sync(s) and will return after the TXG(s) commit. + * + */ +static int +zpool_do_sync(int argc, char **argv) +{ + int ret; + boolean_t force = B_FALSE; + + /* check options */ + while ((ret = getopt(argc, argv, "f")) != -1) { + switch (ret) { + case 'f': + force = B_TRUE; + break; + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + + argc -= optind; + argv += optind; + + /* if argc == 0 we will execute zpool_sync_one on all pools */ + ret = for_each_pool(argc, argv, B_FALSE, NULL, zpool_sync_one, &force); + + return (ret); } typedef struct iostat_cbdata { Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Dec 2 07:39:55 2019 (r355283) @@ -271,6 +271,8 @@ extern int zpool_clear(zpool_handle_t *, const char *, extern int zpool_reguid(zpool_handle_t *); extern int zpool_reopen(zpool_handle_t *); +extern int zpool_sync_one(zpool_handle_t *, void *); + extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Dec 2 07:39:55 2019 (r355283) @@ -3515,6 +3515,27 @@ zpool_reopen(zpool_handle_t *zhp) return (zpool_standard_error(hdl, errno, msg)); } +/* call into libzfs_core to execute the sync IOCTL per pool */ +int +zpool_sync_one(zpool_handle_t *zhp, void *data) +{ + int ret; + libzfs_handle_t *hdl = zpool_get_handle(zhp); + const char *pool_name = zpool_get_name(zhp); + boolean_t *force = data; + nvlist_t *innvl = fnvlist_alloc(); + + fnvlist_add_boolean_value(innvl, "force", *force); + if ((ret = lzc_sync(pool_name, innvl, NULL)) != 0) { + nvlist_free(innvl); + return (zpool_standard_error_fmt(hdl, ret, + dgettext(TEXT_DOMAIN, "sync '%s' failed"), pool_name)); + } + nvlist_free(innvl); + + return (0); +} + /* * Convert from a devid string to a path. */ Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Mon Dec 2 07:39:55 2019 (r355283) @@ -24,6 +24,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ /* @@ -137,16 +138,17 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, { zfs_cmd_t zc = { 0 }; int error = 0; - char *packed; + char *packed = NULL; #ifdef __FreeBSD__ nvlist_t *oldsource; #endif - size_t size; + size_t size = 0; ASSERT3S(g_refcount, >, 0); VERIFY3S(g_fd, !=, -1); - (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); + if (name != NULL) + (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); #ifdef __FreeBSD__ if (zfs_ioctl_version == ZFS_IOCVER_UNDEF) @@ -160,9 +162,11 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, } #endif - packed = fnvlist_pack(source, &size); - zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; - zc.zc_nvlist_src_size = size; + if (source != NULL) { + packed = fnvlist_pack(source, &size); + zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; + zc.zc_nvlist_src_size = size; + } if (resultp != NULL) { *resultp = NULL; @@ -463,6 +467,18 @@ lzc_exists(const char *dataset) } /* + * outnvl is unused. + * It was added to preserve the function signature in case it is + * needed in the future. + */ +/*ARGSUSED*/ +int +lzc_sync(const char *pool_name, nvlist_t *innvl, nvlist_t **outnvl) +{ + return (lzc_ioctl(ZFS_IOC_POOL_SYNC, pool_name, innvl, NULL)); +} + +/* * Create "user holds" on snapshots. If there is a hold on a snapshot, * the snapshot can not be destroyed. (However, it can be marked for deletion * by lzc_destroy_snaps(defer=B_TRUE).) @@ -562,11 +578,7 @@ lzc_release(nvlist_t *holds, nvlist_t **errlist) int lzc_get_holds(const char *snapname, nvlist_t **holdsp) { - int error; - nvlist_t *innvl = fnvlist_alloc(); - error = lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, innvl, holdsp); - fnvlist_free(innvl); - return (error); + return (lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, NULL, holdsp)); } /* Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Mon Dec 2 07:39:55 2019 (r355283) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Martin Matuska . All rights reserved. * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ #ifndef _LIBZFS_CORE_H @@ -90,6 +91,8 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); + +int lzc_sync(const char *, nvlist_t *, nvlist_t **); int lzc_rename(const char *, const char *); int lzc_destroy(const char *); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Dec 2 07:39:55 2019 (r355283) @@ -5836,6 +5836,7 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_ static int zfs_ioc_get_holds(const char *snapname, nvlist_t *args, nvlist_t *outnvl) { + ASSERT3P(args, ==, NULL); return (dsl_dataset_get_holds(snapname, outnvl)); } @@ -6134,6 +6135,44 @@ out: return (error); } +/* + * Sync the currently open TXG to disk for the specified pool. + * This is somewhat similar to 'zfs_sync()'. + * For cases that do not result in error this ioctl will wait for + * the currently open TXG to commit before returning back to the caller. + * + * innvl: { + * "force" -> when true, force uberblock update even if there is no dirty data. + * In addition this will cause the vdev configuration to be written + * out including updating the zpool cache file. (boolean_t) + * } + * + * onvl is unused + */ +/* ARGSUSED */ +static int +zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl) +{ + int err; + boolean_t force; + spa_t *spa; + + if ((err = spa_open(pool, &spa, FTAG)) != 0) + return (err); + + force = fnvlist_lookup_boolean_value(innvl, "force"); + if (force) { + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER); + vdev_config_dirty(spa->spa_root_vdev); + spa_config_exit(spa, SCL_CONFIG, FTAG); + } + txg_wait_synced(spa_get_dsl(spa), 0); + + spa_close(spa, FTAG); + + return (err); +} + static zfs_ioc_vec_t zfs_ioc_vec[ZFS_IOC_LAST - ZFS_IOC_FIRST]; static void @@ -6323,6 +6362,10 @@ zfs_ioctl_init(void) zfs_ioctl_register("initialize", ZFS_IOC_POOL_INITIALIZE, zfs_ioc_pool_initialize, zfs_secpolicy_config, POOL_NAME, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_TRUE, B_TRUE); + + zfs_ioctl_register("sync", ZFS_IOC_POOL_SYNC, + zfs_ioc_pool_sync, zfs_secpolicy_none, POOL_NAME, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_FALSE, B_FALSE); /* IOCTLS that use the legacy function signature */ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Dec 2 07:39:55 2019 (r355283) @@ -1016,6 +1016,7 @@ typedef enum zfs_ioc { ZFS_IOC_POOL_CHECKPOINT, ZFS_IOC_POOL_DISCARD_CHECKPOINT, ZFS_IOC_POOL_INITIALIZE, + ZFS_IOC_POOL_SYNC, ZFS_IOC_LAST } zfs_ioc_t; From owner-svn-src-stable@freebsd.org Mon Dec 2 09:57:08 2019 Return-Path: Delivered-To: svn-src-stable@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 B2B571CC4FF; Mon, 2 Dec 2019 09:57:08 +0000 (UTC) (envelope-from tsoome@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 47RLBD4B3xz4t5D; Mon, 2 Dec 2019 09:57:08 +0000 (UTC) (envelope-from tsoome@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 72D8525420; Mon, 2 Dec 2019 09:57:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB29v82U090030; Mon, 2 Dec 2019 09:57:08 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB29v8jF090028; Mon, 2 Dec 2019 09:57:08 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912020957.xB29v8jF090028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 09:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355284 - in stable/12/stand/efi: boot1 gptboot X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/12/stand/efi: boot1 gptboot X-SVN-Commit-Revision: 355284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 09:57:08 -0000 Author: tsoome Date: Mon Dec 2 09:57:07 2019 New Revision: 355284 URL: https://svnweb.freebsd.org/changeset/base/355284 Log: r353501 did mimerge r350654 boot1 and gptboot were left out Replace left over BS->HandleProtocol by OpenProtocolByHandle. Reported by: Harry Schmalzbauer Modified: stable/12/stand/efi/boot1/proto.c stable/12/stand/efi/gptboot/proto.c Modified: stable/12/stand/efi/boot1/proto.c ============================================================================== --- stable/12/stand/efi/boot1/proto.c Mon Dec 2 07:39:55 2019 (r355283) +++ stable/12/stand/efi/boot1/proto.c Mon Dec 2 09:57:07 2019 (r355284) @@ -61,7 +61,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) int preferred; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status == EFI_UNSUPPORTED) return (0); @@ -77,7 +77,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) efi_free_devpath_name(text); } #endif - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (0); Modified: stable/12/stand/efi/gptboot/proto.c ============================================================================== --- stable/12/stand/efi/gptboot/proto.c Mon Dec 2 07:39:55 2019 (r355283) +++ stable/12/stand/efi/gptboot/proto.c Mon Dec 2 09:57:07 2019 (r355284) @@ -146,7 +146,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) EFI_STATUS status; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status != EFI_SUCCESS) return; #ifdef EFI_DEBUG @@ -169,7 +169,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) return; } } - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status != EFI_SUCCESS) { DPRINTF("Can't get the block I/O protocol block\n"); return; From owner-svn-src-stable@freebsd.org Mon Dec 2 11:44:42 2019 Return-Path: Delivered-To: svn-src-stable@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 C30E41CEB23; Mon, 2 Dec 2019 11:44:42 +0000 (UTC) (envelope-from tsoome@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 47RNZL4l9wz3G9p; Mon, 2 Dec 2019 11:44:42 +0000 (UTC) (envelope-from tsoome@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 8624226785; Mon, 2 Dec 2019 11:44:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2Big6D054273; Mon, 2 Dec 2019 11:44:42 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2BieqZ054262; Mon, 2 Dec 2019 11:44:40 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021144.xB2BieqZ054262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 11:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355285 - in stable/12: cddl/lib/libzpool stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/common/lz4 ... X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/12: cddl/lib/libzpool stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/common/lz4 sys/cddl/contrib/opensola... X-SVN-Commit-Revision: 355285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 11:44:42 -0000 Author: tsoome Date: Mon Dec 2 11:44:39 2019 New Revision: 355285 URL: https://svnweb.freebsd.org/changeset/base/355285 Log: MFC r354253, r354254, r354264, r354265 Remove duplicate lz4 implementations Port illumos change: https://www.illumos.org/issues/11667 Move lz4.c out of zfs tree to opensolaris/common/lz4, adjust it to be usable from kernel/stand/userland builds, so we can use just one single source. Add lz4.h to declare lz4_compress() and lz4_decompress(). Differential Revision: https://reviews.freebsd.org/D22037 Added: stable/12/sys/cddl/contrib/opensolaris/common/lz4/ - copied from r354265, head/sys/cddl/contrib/opensolaris/common/lz4/ Deleted: stable/12/sys/cddl/boot/zfs/lz4.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Modified: stable/12/cddl/lib/libzpool/Makefile stable/12/stand/efi/boot1/Makefile stable/12/stand/i386/gptzfsboot/Makefile stable/12/stand/i386/zfsboot/Makefile stable/12/stand/libsa/Makefile stable/12/stand/libsa/zfs/Makefile.inc stable/12/sys/cddl/boot/zfs/zfssubr.c stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files stable/12/sys/conf/files stable/12/sys/conf/kern.pre.mk stable/12/sys/modules/zfs/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/lib/libzpool/Makefile ============================================================================== --- stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -8,6 +8,8 @@ .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua # ZFS_SHARED_SRCS .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs +# LZ4_COMMON_SRCS +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 # KERNEL_SRCS .PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common # LIST_SRCS @@ -32,6 +34,7 @@ LIB= zpool ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} trim_map.c ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/} +LZ4_COMMON_SRCS= lz4.c LUA_SRCS= ${LUA_OBJS:C/.o$/.c/} KERNEL_SRCS= kernel.c taskq.c util.c LIST_SRCS= list.c @@ -39,7 +42,7 @@ UNICODE_SRCS= u8_textprep.c LIBCMDUTILS_SRCS=nicenum.c SRCS= ${ZFS_COMMON_SRCS} ${ZFS_SHARED_SRCS} ${LUA_SRCS} \ - ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ + ${LZ4_COMMON_SRCS} ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ ${UNICODE_SRCS} ${LIBCMDUTILS_SRCS} WARNS?= 0 @@ -50,6 +53,7 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libz CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair @@ -61,6 +65,8 @@ CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${SRCTOP}/lib/libpthread/thread CFLAGS+= -I${SRCTOP}/lib/libpthread/sys CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include +CFLAGS.lz4.o+= -D_FAKE_KERNEL +CFLAGS.lz4.pico+= -D_FAKE_KERNEL CFLAGS.gcc+= -fms-extensions LIBADD= md pthread z nvpair avl umem Modified: stable/12/stand/efi/boot1/Makefile ============================================================================== --- stable/12/stand/efi/boot1/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/efi/boot1/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -37,6 +37,7 @@ CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common +CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 CFLAGS+= -DEFI_ZFS_BOOT .endif Modified: stable/12/stand/i386/gptzfsboot/Makefile ============================================================================== --- stable/12/stand/i386/gptzfsboot/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/i386/gptzfsboot/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -29,6 +29,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ + -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \ -I${BOOTSRC}/i386/btx/lib \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast \ Modified: stable/12/stand/i386/zfsboot/Makefile ============================================================================== --- stable/12/stand/i386/zfsboot/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/i386/zfsboot/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -28,6 +28,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ + -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ Modified: stable/12/stand/libsa/Makefile ============================================================================== --- stable/12/stand/libsa/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/libsa/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -102,6 +102,11 @@ CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c +# lz4 decompression functionality +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 +SRCS+= lz4.c +CFLAGS.lz4.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 + # Create a subset of includes that are safe, as well as adjusting those that aren't # The lists may drive people nuts, but they are explicitly opt-in FAKE_DIRS=xlocale arpa Modified: stable/12/stand/libsa/zfs/Makefile.inc ============================================================================== --- stable/12/stand/libsa/zfs/Makefile.inc Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/libsa/zfs/Makefile.inc Mon Dec 2 11:44:39 2019 (r355285) @@ -12,4 +12,6 @@ CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SYSDIR}/crypto/skein +CFLAGS.zfs.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 + CFLAGS+= -Wformat -Wall Modified: stable/12/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- stable/12/sys/cddl/boot/zfs/zfssubr.c Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/cddl/boot/zfs/zfssubr.c Mon Dec 2 11:44:39 2019 (r355285) @@ -26,6 +26,8 @@ #include __FBSDID("$FreeBSD$"); +#include + static uint64_t zfs_crc64_table[256]; #define ECKSUM 666 @@ -161,7 +163,6 @@ typedef struct zio_compress_info { #include "lzjb.c" #include "zle.c" -#include "lz4.c" /* * Compression vectors. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Mon Dec 2 11:44:39 2019 (r355285) @@ -98,7 +98,6 @@ ZFS_COMMON_OBJS += \ dsl_scan.o \ zfeature.o \ gzip.o \ - lz4.o \ lzjb.o \ metaslab.o \ multilist.o \ Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/conf/files Mon Dec 2 11:44:39 2019 (r355285) @@ -139,6 +139,7 @@ cddl/compat/opensolaris/kern/opensolaris_vm.c optio cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/lz4/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" @@ -189,7 +190,6 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" -cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c optional zfs compile-with "${ZFS_C}" Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/conf/kern.pre.mk Mon Dec 2 11:44:39 2019 (r355285) @@ -163,6 +163,7 @@ CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${PROF} ${. ZFS_CFLAGS= -DBUILDING_ZFS -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs/lua ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common/zmod +ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/lz4 ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/zfs ZFS_CFLAGS+= ${CDDL_CFLAGS} ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS} Modified: stable/12/sys/modules/zfs/Makefile ============================================================================== --- stable/12/sys/modules/zfs/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/modules/zfs/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -18,6 +18,8 @@ SRCS+= opensolaris_nvpair_alloc_fixed.c SRCS+= opensolaris_fnvpair.c .PATH: ${SYSDIR}/cddl/contrib/opensolaris/common/unicode SRCS+= u8_textprep.c +.PATH: ${SUNW}/common/lz4 +SRCS+= lz4.c .PATH: ${SYSDIR}/cddl/compat/opensolaris/kern SRCS+= opensolaris_acl.c @@ -93,6 +95,7 @@ CFLAGS+=-I${SUNW}/uts/common/zmod CFLAGS+=-I${SUNW}/uts/common CFLAGS+=-I${SYSDIR} CFLAGS+=-I${SUNW}/common/zfs +CFLAGS+=-I${SUNW}/common/lz4 CFLAGS+=-I${SUNW}/common CFLAGS+=-DBUILDING_ZFS CFLAGS.gcc+=-fms-extensions From owner-svn-src-stable@freebsd.org Mon Dec 2 12:26:48 2019 Return-Path: Delivered-To: svn-src-stable@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 5BC641A8A8F; Mon, 2 Dec 2019 12:26:48 +0000 (UTC) (envelope-from tsoome@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 47RPVw1nXnz3JZn; Mon, 2 Dec 2019 12:26:48 +0000 (UTC) (envelope-from tsoome@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 2128D26EBE; Mon, 2 Dec 2019 12:26:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2CQmB4077611; Mon, 2 Dec 2019 12:26:48 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2CQmLX077610; Mon, 2 Dec 2019 12:26:48 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021226.xB2CQmLX077610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 12:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355286 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 355286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 12:26:48 -0000 Author: tsoome Date: Mon Dec 2 12:26:47 2019 New Revision: 355286 URL: https://svnweb.freebsd.org/changeset/base/355286 Log: MFC r354267: r354264 did mix up the directory path The correct path is sys/cddl/contrib/opensolaris/common/lz4, not sys/cddl/contrib/opensolaris/lz4 Reported by: Michael Butler Modified: stable/12/sys/conf/files Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Dec 2 11:44:39 2019 (r355285) +++ stable/12/sys/conf/files Mon Dec 2 12:26:47 2019 (r355286) @@ -139,7 +139,7 @@ cddl/compat/opensolaris/kern/opensolaris_vm.c optio cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" -cddl/contrib/opensolaris/lz4/lz4.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/common/lz4/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" From owner-svn-src-stable@freebsd.org Mon Dec 2 15:28:06 2019 Return-Path: Delivered-To: svn-src-stable@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 D7E241AD44F; Mon, 2 Dec 2019 15:28:06 +0000 (UTC) (envelope-from tsoome@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 47RTX65GDFz3y9J; Mon, 2 Dec 2019 15:28:06 +0000 (UTC) (envelope-from tsoome@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 97C36F44; Mon, 2 Dec 2019 15:28:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2FS65M083355; Mon, 2 Dec 2019 15:28:06 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2FS6RW083354; Mon, 2 Dec 2019 15:28:06 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021528.xB2FS6RW083354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 15:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355290 - stable/12/cddl/lib/libzpool X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/cddl/lib/libzpool X-SVN-Commit-Revision: 355290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:28:06 -0000 Author: tsoome Date: Mon Dec 2 15:28:06 2019 New Revision: 355290 URL: https://svnweb.freebsd.org/changeset/base/355290 Log: libzpool: lz4.c build needs CFLAGS.lz4.c For some reason the setup from CURRENT did not work, probably I did mix something up. Modified: stable/12/cddl/lib/libzpool/Makefile Modified: stable/12/cddl/lib/libzpool/Makefile ============================================================================== --- stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 15:07:06 2019 (r355289) +++ stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 15:28:06 2019 (r355290) @@ -65,8 +65,7 @@ CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${SRCTOP}/lib/libpthread/thread CFLAGS+= -I${SRCTOP}/lib/libpthread/sys CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include -CFLAGS.lz4.o+= -D_FAKE_KERNEL -CFLAGS.lz4.pico+= -D_FAKE_KERNEL +CFLAGS.lz4.c += -D_FAKE_KERNEL CFLAGS.gcc+= -fms-extensions LIBADD= md pthread z nvpair avl umem From owner-svn-src-stable@freebsd.org Mon Dec 2 15:44:36 2019 Return-Path: Delivered-To: svn-src-stable@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 E313A1ADCC0; Mon, 2 Dec 2019 15:44:36 +0000 (UTC) (envelope-from tsoome@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 47RTv85gJnz40Z4; Mon, 2 Dec 2019 15:44:36 +0000 (UTC) (envelope-from tsoome@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 8CABD1303; Mon, 2 Dec 2019 15:44:36 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2Fiamx095517; Mon, 2 Dec 2019 15:44:36 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2FiagV095516; Mon, 2 Dec 2019 15:44:36 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021544.xB2FiagV095516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 15:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355292 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 355292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:44:37 -0000 Author: tsoome Date: Mon Dec 2 15:44:36 2019 New Revision: 355292 URL: https://svnweb.freebsd.org/changeset/base/355292 Log: MFC r355291: Fix mergeinfo. Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-stable@freebsd.org Mon Dec 2 15:56:02 2019 Return-Path: Delivered-To: svn-src-stable@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 0BB3A1AE6BA; Mon, 2 Dec 2019 15:56:02 +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 47RV8K6Y7dz41pq; Mon, 2 Dec 2019 15:56:01 +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 C40D914C2; Mon, 2 Dec 2019 15:56:01 +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 xB2Fu1RI001301; Mon, 2 Dec 2019 15:56:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Fu14t001300; Mon, 2 Dec 2019 15:56:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912021556.xB2Fu14t001300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 2 Dec 2019 15:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355293 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 355293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:56:02 -0000 Author: markj Date: Mon Dec 2 15:56:01 2019 New Revision: 355293 URL: https://svnweb.freebsd.org/changeset/base/355293 Log: MFC r354816: Implement vm.pmap.kernel_maps for arm64. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:44:36 2019 (r355292) +++ stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:56:01 2019 (r355293) @@ -120,6 +120,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -5972,3 +5973,212 @@ pmap_is_valid_memattr(pmap_t pmap __unused, vm_memattr return (mode >= VM_MEMATTR_DEVICE && mode <= VM_MEMATTR_WRITE_THROUGH); } + +/* + * Track a range of the kernel's virtual address space that is contiguous + * in various mapping attributes. + */ +struct pmap_kernel_map_range { + vm_offset_t sva; + pt_entry_t attrs; + int l3pages; + int l3contig; + int l2blocks; + int l1blocks; +}; + +static void +sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range, + vm_offset_t eva) +{ + const char *mode; + int index; + + if (eva <= range->sva) + return; + + index = range->attrs & ATTR_IDX_MASK; + switch (index) { + case ATTR_IDX(VM_MEMATTR_DEVICE): + mode = "DEV"; + break; + case ATTR_IDX(VM_MEMATTR_UNCACHEABLE): + mode = "UC"; + break; + case ATTR_IDX(VM_MEMATTR_WRITE_BACK): + mode = "WB"; + break; + case ATTR_IDX(VM_MEMATTR_WRITE_THROUGH): + mode = "WT"; + break; + default: + printf( + "%s: unknown memory type %x for range 0x%016lx-0x%016lx\n", + __func__, index, range->sva, eva); + mode = "??"; + break; + } + + sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c %3s %d %d %d %d\n", + range->sva, eva, + (range->attrs & ATTR_AP_RW_BIT) == ATTR_AP_RW ? 'w' : '-', + (range->attrs & ATTR_PXN) != 0 ? '-' : 'x', + (range->attrs & ATTR_AP_USER) != 0 ? 'u' : 's', + mode, range->l1blocks, range->l2blocks, range->l3contig, + range->l3pages); + + /* Reset to sentinel value. */ + range->sva = 0xfffffffffffffffful; +} + +/* + * Determine whether the attributes specified by a page table entry match those + * being tracked by the current range. + */ +static bool +sysctl_kmaps_match(struct pmap_kernel_map_range *range, pt_entry_t attrs) +{ + + return (range->attrs == attrs); +} + +static void +sysctl_kmaps_reinit(struct pmap_kernel_map_range *range, vm_offset_t va, + pt_entry_t attrs) +{ + + memset(range, 0, sizeof(*range)); + range->sva = va; + range->attrs = attrs; +} + +/* + * Given a leaf PTE, derive the mapping's attributes. If they do not match + * those of the current run, dump the address range and its attributes, and + * begin a new run. + */ +static void +sysctl_kmaps_check(struct sbuf *sb, struct pmap_kernel_map_range *range, + vm_offset_t va, pd_entry_t l0e, pd_entry_t l1e, pd_entry_t l2e, + pt_entry_t l3e) +{ + pt_entry_t attrs; + + attrs = l0e & (ATTR_AP_MASK | ATTR_XN); + attrs |= l1e & (ATTR_AP_MASK | ATTR_XN); + if ((l1e & ATTR_DESCR_MASK) == L1_BLOCK) + attrs |= l1e & ATTR_IDX_MASK; + attrs |= l2e & (ATTR_AP_MASK | ATTR_XN); + if ((l2e & ATTR_DESCR_MASK) == L2_BLOCK) + attrs |= l2e & ATTR_IDX_MASK; + attrs |= l3e & (ATTR_AP_MASK | ATTR_XN | ATTR_IDX_MASK); + + if (range->sva > va || !sysctl_kmaps_match(range, attrs)) { + sysctl_kmaps_dump(sb, range, va); + sysctl_kmaps_reinit(range, va, attrs); + } +} + +static int +sysctl_kmaps(SYSCTL_HANDLER_ARGS) +{ + struct pmap_kernel_map_range range; + struct sbuf sbuf, *sb; + pd_entry_t l0e, *l1, l1e, *l2, l2e; + pt_entry_t *l3, l3e; + vm_offset_t sva; + vm_paddr_t pa; + int error, i, j, k, l; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sb = &sbuf; + sbuf_new_for_sysctl(sb, NULL, PAGE_SIZE, req); + + /* Sentinel value. */ + range.sva = 0xfffffffffffffffful; + + /* + * Iterate over the kernel page tables without holding the kernel pmap + * lock. Kernel page table pages are never freed, so at worst we will + * observe inconsistencies in the output. + */ + for (sva = 0xffff000000000000ul, i = pmap_l0_index(sva); i < Ln_ENTRIES; + i++) { + if (i == pmap_l0_index(DMAP_MIN_ADDRESS)) + sbuf_printf(sb, "\nDirect map:\n"); + else if (i == pmap_l0_index(VM_MIN_KERNEL_ADDRESS)) + sbuf_printf(sb, "\nKernel map:\n"); + + l0e = kernel_pmap->pm_l0[i]; + if ((l0e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L0_SIZE; + continue; + } + pa = l0e & ~ATTR_MASK; + l1 = (pd_entry_t *)PHYS_TO_DMAP(pa); + + for (j = pmap_l1_index(sva); j < Ln_ENTRIES; j++) { + l1e = l1[j]; + if ((l1e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L1_SIZE; + continue; + } + if ((l1e & ATTR_DESCR_MASK) == L1_BLOCK) { + sysctl_kmaps_check(sb, &range, sva, l0e, l1e, + 0, 0); + range.l1blocks++; + sva += L1_SIZE; + continue; + } + pa = l1e & ~ATTR_MASK; + l2 = (pd_entry_t *)PHYS_TO_DMAP(pa); + + for (k = pmap_l2_index(sva); k < Ln_ENTRIES; k++) { + l2e = l2[k]; + if ((l2e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L2_SIZE; + continue; + } + if ((l2e & ATTR_DESCR_MASK) == L2_BLOCK) { + sysctl_kmaps_check(sb, &range, sva, + l0e, l1e, l2e, 0); + range.l2blocks++; + sva += L2_SIZE; + continue; + } + pa = l2e & ~ATTR_MASK; + l3 = (pt_entry_t *)PHYS_TO_DMAP(pa); + + for (l = pmap_l3_index(sva); l < Ln_ENTRIES; + l++, sva += L3_SIZE) { + l3e = l3[l]; + if ((l3e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, + sva); + continue; + } + sysctl_kmaps_check(sb, &range, sva, + l0e, l1e, l2e, l3e); + if ((l3e & ATTR_CONTIGUOUS) != 0) + range.l3contig += l % 16 == 0 ? + 1 : 0; + else + range.l3pages++; + } + } + } + } + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} +SYSCTL_OID(_vm_pmap, OID_AUTO, kernel_maps, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, sysctl_kmaps, "A", + "Dump kernel address layout"); From owner-svn-src-stable@freebsd.org Mon Dec 2 15:57:26 2019 Return-Path: Delivered-To: svn-src-stable@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 364611AE7BF; Mon, 2 Dec 2019 15:57: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 47RV9y0fgQz41yM; Mon, 2 Dec 2019 15:57: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 EE77714C3; Mon, 2 Dec 2019 15:57:25 +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 xB2FvPIm001403; Mon, 2 Dec 2019 15:57:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2FvPXn001402; Mon, 2 Dec 2019 15:57:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912021557.xB2FvPXn001402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 2 Dec 2019 15:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355294 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 355294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:57:26 -0000 Author: markj Date: Mon Dec 2 15:57:25 2019 New Revision: 355294 URL: https://svnweb.freebsd.org/changeset/base/355294 Log: MFC r354815: Let arm64 pmap_qenter() and pmap_kenter() unconditionally set NX. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:56:01 2019 (r355293) +++ stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:57:25 2019 (r355294) @@ -1179,10 +1179,8 @@ pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_ KASSERT((size & PAGE_MASK) == 0, ("pmap_kenter: Mapping is not page-sized")); - attr = ATTR_DEFAULT | ATTR_IDX(mode) | L3_PAGE; - if (mode == DEVICE_MEMORY) - attr |= ATTR_XN; - + attr = ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) | ATTR_XN | ATTR_IDX(mode) | + L3_PAGE; va = sva; while (size != 0) { pde = pmap_pde(kernel_pmap, va, &lvl); @@ -1297,9 +1295,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) m = ma[i]; pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) | - ATTR_IDX(m->md.pv_memattr) | L3_PAGE; - if (m->md.pv_memattr == DEVICE_MEMORY) - pa |= ATTR_XN; + ATTR_XN | ATTR_IDX(m->md.pv_memattr) | L3_PAGE; pte = pmap_l2_to_l3(pde, va); pmap_load_store(pte, pa); From owner-svn-src-stable@freebsd.org Mon Dec 2 17:28:21 2019 Return-Path: Delivered-To: svn-src-stable@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 817641B113E; Mon, 2 Dec 2019 17:28:21 +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 47RXBs2wzTz46dl; Mon, 2 Dec 2019 17:28:21 +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 47D732576; Mon, 2 Dec 2019 17:28:21 +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 xB2HSLAk053970; Mon, 2 Dec 2019 17:28:21 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2HSLRT053969; Mon, 2 Dec 2019 17:28:21 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912021728.xB2HSLRT053969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Mon, 2 Dec 2019 17:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355296 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 17:28:21 -0000 Author: dougm Date: Mon Dec 2 17:28:20 2019 New Revision: 355296 URL: https://svnweb.freebsd.org/changeset/base/355296 Log: MFC r348749 - Speed-up vm_reserv_reclaim_config. Requested by: markj Modified: stable/12/sys/vm/vm_reserv.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_reserv.c ============================================================================== --- stable/12/sys/vm/vm_reserv.c Mon Dec 2 16:15:18 2019 (r355295) +++ stable/12/sys/vm/vm_reserv.c Mon Dec 2 17:28:20 2019 (r355296) @@ -1278,10 +1278,89 @@ vm_reserv_reclaim_inactive(int domain) } /* + * Determine whether this reservation has free pages that satisfy the given + * request for contiguous physical memory. Start searching from the lower + * bound, defined by low_index. + * + * The free page queue lock must be held. + */ +static bool +vm_reserv_test_contig(vm_reserv_t rv, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary) +{ + vm_paddr_t pa, size; + u_long changes; + int bitpos, bits_left, i, hi, lo, n; + + vm_reserv_assert_locked(rv); + size = npages << PAGE_SHIFT; + pa = VM_PAGE_TO_PHYS(&rv->pages[0]); + lo = (pa < low) ? + ((low + PAGE_MASK - pa) >> PAGE_SHIFT) : 0; + i = lo / NBPOPMAP; + changes = rv->popmap[i] | ((1UL << (lo % NBPOPMAP)) - 1); + hi = (pa + VM_LEVEL_0_SIZE > high) ? + ((high + PAGE_MASK - pa) >> PAGE_SHIFT) : VM_LEVEL_0_NPAGES; + n = hi / NBPOPMAP; + bits_left = hi % NBPOPMAP; + hi = lo = -1; + for (;;) { + /* + * "changes" is a bitmask that marks where a new sequence of + * 0s or 1s begins in popmap[i], with last bit in popmap[i-1] + * considered to be 1 if and only if lo == hi. The bits of + * popmap[-1] and popmap[NPOPMAP] are considered all 1s. + */ + changes ^= (changes << 1) | (lo == hi); + while (changes != 0) { + /* + * If the next change marked begins a run of 0s, set + * lo to mark that position. Otherwise set hi and + * look for a satisfactory first page from lo up to hi. + */ + bitpos = ffsl(changes) - 1; + changes ^= 1UL << bitpos; + if (lo == hi) { + lo = NBPOPMAP * i + bitpos; + continue; + } + hi = NBPOPMAP * i + bitpos; + pa = VM_PAGE_TO_PHYS(&rv->pages[lo]); + if ((pa & (alignment - 1)) != 0) { + /* Skip to next aligned page. */ + lo += (((pa - 1) | (alignment - 1)) + 1) >> + PAGE_SHIFT; + if (lo >= VM_LEVEL_0_NPAGES) + return (false); + pa = VM_PAGE_TO_PHYS(&rv->pages[lo]); + } + if (((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) { + /* Skip to next boundary-matching page. */ + lo += (((pa - 1) | (boundary - 1)) + 1) >> + PAGE_SHIFT; + if (lo >= VM_LEVEL_0_NPAGES) + return (false); + pa = VM_PAGE_TO_PHYS(&rv->pages[lo]); + } + if (lo * PAGE_SIZE + size <= hi * PAGE_SIZE) + return (true); + lo = hi; + } + if (++i < n) + changes = rv->popmap[i]; + else if (i == n) + changes = bits_left == 0 ? -1UL : + (rv->popmap[n] | (-1UL << bits_left)); + else + return (false); + } +} + +/* * Searches the partially populated reservation queue for the least recently * changed reservation with free pages that satisfy the given request for * contiguous physical memory. If a satisfactory reservation is found, it is - * broken. Returns TRUE if a reservation is broken and FALSE otherwise. + * broken. Returns true if a reservation is broken and false otherwise. * * The free page queue lock must be held. */ @@ -1291,21 +1370,19 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm { vm_paddr_t pa, size; vm_reserv_t rv, rvn; - int hi, i, lo, low_index, next_free; if (npages > VM_LEVEL_0_NPAGES - 1) - return (FALSE); + return (false); size = npages << PAGE_SHIFT; vm_reserv_domain_lock(domain); again: for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { rvn = TAILQ_NEXT(rv, partpopq); - pa = VM_PAGE_TO_PHYS(&rv->pages[VM_LEVEL_0_NPAGES - 1]); - if (pa + PAGE_SIZE - size < low) { + pa = VM_PAGE_TO_PHYS(&rv->pages[0]); + if (pa + VM_LEVEL_0_SIZE - size < low) { /* This entire reservation is too low; go to next. */ continue; } - pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + size > high) { /* This entire reservation is too high; go to next. */ continue; @@ -1321,73 +1398,19 @@ again: } } else vm_reserv_domain_unlock(domain); - if (pa < low) { - /* Start the search for free pages at "low". */ - low_index = (low + PAGE_MASK - pa) >> PAGE_SHIFT; - i = low_index / NBPOPMAP; - hi = low_index % NBPOPMAP; - } else - i = hi = 0; - do { - /* Find the next free page. */ - lo = ffsl(~(((1UL << hi) - 1) | rv->popmap[i])); - while (lo == 0 && ++i < NPOPMAP) - lo = ffsl(~rv->popmap[i]); - if (i == NPOPMAP) - break; - /* Convert from ffsl() to ordinary bit numbering. */ - lo--; - next_free = NBPOPMAP * i + lo; - pa = VM_PAGE_TO_PHYS(&rv->pages[next_free]); - KASSERT(pa >= low, - ("vm_reserv_reclaim_contig: pa is too low")); - if (pa + size > high) { - /* The rest of this reservation is too high. */ - break; - } else if ((pa & (alignment - 1)) != 0 || - ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) { - /* - * The current page doesn't meet the alignment - * and/or boundary requirements. Continue - * searching this reservation until the rest - * of its free pages are either excluded or - * exhausted. - */ - hi = lo + 1; - if (hi >= NBPOPMAP) { - hi = 0; - i++; - } - continue; - } - /* Find the next used page. */ - hi = ffsl(rv->popmap[i] & ~((1UL << lo) - 1)); - while (hi == 0 && ++i < NPOPMAP) { - if ((NBPOPMAP * i - next_free) * PAGE_SIZE >= - size) { - vm_reserv_reclaim(rv); - vm_reserv_unlock(rv); - return (TRUE); - } - hi = ffsl(rv->popmap[i]); - } - /* Convert from ffsl() to ordinary bit numbering. */ - if (i != NPOPMAP) - hi--; - if ((NBPOPMAP * i + hi - next_free) * PAGE_SIZE >= - size) { - vm_reserv_reclaim(rv); - vm_reserv_unlock(rv); - return (TRUE); - } - } while (i < NPOPMAP); + if (vm_reserv_test_contig(rv, npages, low, high, + alignment, boundary)) { + vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); + return (true); + } vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); if (rvn != NULL && !rvn->inpartpopq) goto again; } vm_reserv_domain_unlock(domain); - return (FALSE); + return (false); } /* From owner-svn-src-stable@freebsd.org Mon Dec 2 17:53:32 2019 Return-Path: Delivered-To: svn-src-stable@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 C36541B1BA0; Mon, 2 Dec 2019 17:53: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 47RXlw4bJSz4897; Mon, 2 Dec 2019 17:53: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 80DCE2B09; Mon, 2 Dec 2019 17:53:32 +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 xB2HrWZ2071607; Mon, 2 Dec 2019 17:53:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2HrWGW071606; Mon, 2 Dec 2019 17:53:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912021753.xB2HrWGW071606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 2 Dec 2019 17:53:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355297 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 17:53:32 -0000 Author: markj Date: Mon Dec 2 17:53:32 2019 New Revision: 355297 URL: https://svnweb.freebsd.org/changeset/base/355297 Log: MFC r354821: Group per-domain reservation data in the same structure. Modified: stable/12/sys/vm/vm_reserv.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_reserv.c ============================================================================== --- stable/12/sys/vm/vm_reserv.c Mon Dec 2 17:28:20 2019 (r355296) +++ stable/12/sys/vm/vm_reserv.c Mon Dec 2 17:53:32 2019 (r355297) @@ -188,15 +188,15 @@ popmap_is_set(popmap_t popmap[], int i) */ struct vm_reserv { struct mtx lock; /* reservation lock. */ - TAILQ_ENTRY(vm_reserv) partpopq; /* (d) per-domain queue. */ + TAILQ_ENTRY(vm_reserv) partpopq; /* (d, r) per-domain queue. */ LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ vm_object_t object; /* (o, r) containing object */ vm_pindex_t pindex; /* (o, r) offset in object */ vm_page_t pages; /* (c) first page */ - uint16_t domain; /* (c) NUMA domain. */ uint16_t popcnt; /* (r) # of pages in use */ + uint8_t domain; /* (c) NUMA domain. */ + char inpartpopq; /* (d, r) */ int lasttick; /* (r) last pop update tick. */ - char inpartpopq; /* (d) */ popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ }; @@ -207,12 +207,6 @@ struct vm_reserv { #define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) #define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) -static struct mtx_padalign vm_reserv_domain_locks[MAXMEMDOM]; - -#define vm_reserv_domain_lockptr(d) &vm_reserv_domain_locks[(d)] -#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) -#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) - /* * The reservation array * @@ -237,16 +231,25 @@ static struct mtx_padalign vm_reserv_domain_locks[MAXM static vm_reserv_t vm_reserv_array; /* - * The partially populated reservation queue + * The per-domain partially populated reservation queues * - * This queue enables the fast recovery of an unused free small page from a - * partially populated reservation. The reservation at the head of this queue + * These queues enable the fast recovery of an unused free small page from a + * partially populated reservation. The reservation at the head of a queue * is the least recently changed, partially populated reservation. * - * Access to this queue is synchronized by the free page queue lock. + * Access to this queue is synchronized by the per-domain reservation lock. */ -static TAILQ_HEAD(, vm_reserv) vm_rvq_partpop[MAXMEMDOM]; +struct vm_reserv_domain { + struct mtx lock; + TAILQ_HEAD(, vm_reserv) partpop; +} __aligned(CACHE_LINE_SIZE); +static struct vm_reserv_domain vm_rvd[MAXMEMDOM]; + +#define vm_reserv_domain_lockptr(d) (&vm_rvd[(d)].lock) +#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) + static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); static counter_u64_t vm_reserv_broken = EARLY_COUNTER; @@ -301,8 +304,8 @@ static void vm_reserv_reclaim(vm_reserv_t rv); /* * Returns the current number of full reservations. * - * Since the number of full reservations is computed without acquiring the - * free page queue lock, the returned value may be inexact. + * Since the number of full reservations is computed without acquiring any + * locks, the returned value is inexact. */ static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS) @@ -346,7 +349,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) counter = 0; unused_pages = 0; vm_reserv_domain_lock(domain); - TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { + TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } @@ -449,12 +452,13 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) rv->popcnt == 0) { vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } if (rv->popcnt != 0) { rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, + partpopq); } vm_reserv_domain_unlock(rv->domain); rv->lasttick = ticks; @@ -531,8 +535,6 @@ vm_reserv_has_pindex(vm_reserv_t rv, vm_pindex_t pinde /* * Increases the given reservation's population count. Moves the reservation * to the tail of the partially populated reservation queue. - * - * The free page queue must be locked. */ static void vm_reserv_populate(vm_reserv_t rv, int index) @@ -561,12 +563,12 @@ vm_reserv_populate(vm_reserv_t rv, int index) rv->lasttick = ticks; vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } if (rv->popcnt < VM_LEVEL_0_NPAGES) { rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, partpopq); } else { KASSERT(rv->pages->psind == 0, ("vm_reserv_populate: reserv %p is already promoted", @@ -1026,7 +1028,7 @@ vm_reserv_alloc_page(int req, vm_object_t object, vm_p * population count and map are reset to their initial state. * * The given reservation must not be in the partially populated reservation - * queue. The free page queue lock must be held. + * queue. */ static void vm_reserv_break(vm_reserv_t rv) @@ -1108,7 +1110,7 @@ vm_reserv_break_all(vm_object_t object) } vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } vm_reserv_domain_unlock(rv->domain); @@ -1120,8 +1122,6 @@ vm_reserv_break_all(vm_object_t object) /* * Frees the given page if it belongs to a reservation. Returns TRUE if the * page is freed and FALSE otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_free_page(vm_page_t m) @@ -1175,9 +1175,8 @@ vm_reserv_init(void) } } for (i = 0; i < MAXMEMDOM; i++) { - mtx_init(&vm_reserv_domain_locks[i], "VM reserv domain", NULL, - MTX_DEF); - TAILQ_INIT(&vm_rvq_partpop[i]); + mtx_init(&vm_rvd[i].lock, "VM reserv domain", NULL, MTX_DEF); + TAILQ_INIT(&vm_rvd[i].partpop); } for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) @@ -1229,8 +1228,6 @@ vm_reserv_level_iffullpop(vm_page_t m) /* * Breaks the given partially populated reservation, releasing its free pages * to the physical memory allocator. - * - * The free page queue lock must be held. */ static void vm_reserv_reclaim(vm_reserv_t rv) @@ -1245,7 +1242,7 @@ vm_reserv_reclaim(vm_reserv_t rv) KASSERT(rv->domain < vm_ndomains, ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", rv, rv->domain)); - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); @@ -1256,17 +1253,15 @@ vm_reserv_reclaim(vm_reserv_t rv) * Breaks the reservation at the head of the partially populated reservation * queue, releasing its free pages to the physical memory allocator. Returns * TRUE if a reservation is broken and FALSE otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - while ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + while ((rv = TAILQ_FIRST(&vm_rvd[domain].partpop)) != NULL) { vm_reserv_lock(rv); - if (rv != TAILQ_FIRST(&vm_rvq_partpop[domain])) { + if (rv != TAILQ_FIRST(&vm_rvd[domain].partpop)) { vm_reserv_unlock(rv); continue; } @@ -1281,8 +1276,6 @@ vm_reserv_reclaim_inactive(int domain) * Determine whether this reservation has free pages that satisfy the given * request for contiguous physical memory. Start searching from the lower * bound, defined by low_index. - * - * The free page queue lock must be held. */ static bool vm_reserv_test_contig(vm_reserv_t rv, u_long npages, vm_paddr_t low, @@ -1361,8 +1354,6 @@ vm_reserv_test_contig(vm_reserv_t rv, u_long npages, v * changed reservation with free pages that satisfy the given request for * contiguous physical memory. If a satisfactory reservation is found, it is * broken. Returns true if a reservation is broken and false otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, @@ -1376,7 +1367,7 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm size = npages << PAGE_SHIFT; vm_reserv_domain_lock(domain); again: - for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { + for (rv = TAILQ_FIRST(&vm_rvd[domain].partpop); rv != NULL; rv = rvn) { rvn = TAILQ_NEXT(rv, partpopq); pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + VM_LEVEL_0_SIZE - size < low) { From owner-svn-src-stable@freebsd.org Mon Dec 2 20:55:09 2019 Return-Path: Delivered-To: svn-src-stable@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 2AEC81B6D88; Mon, 2 Dec 2019 20:55:09 +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 47RcnT0NMyz4Ldt; Mon, 2 Dec 2019 20:55:09 +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 E47F04F3E; Mon, 2 Dec 2019 20:55:08 +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 xB2Kt8Uu080182; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kt8xb080181; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022055.xB2Kt8xb080181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355302 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:55:09 -0000 Author: cy Date: Mon Dec 2 20:55:08 2019 New Revision: 355302 URL: https://svnweb.freebsd.org/changeset/base/355302 Log: MFC r355140: Remove redundant #ifdef'd function definitions. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:51:46 2019 (r355301) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) @@ -10279,7 +10279,6 @@ ipf_inet6_mask_del(bits, mask, mtab) ASSERT(mtab->imt6_max >= 0); } -#ifdef _KERNEL static u_int ipf_pcksum6(fin, ip6, off, len) fr_info_t *fin; @@ -10287,6 +10286,7 @@ ipf_pcksum6(fin, ip6, off, len) u_int32_t off; u_int32_t len; { +#ifdef _KERNEL struct mbuf *m; int sum; @@ -10297,15 +10297,7 @@ ipf_pcksum6(fin, ip6, off, len) sum = in6_cksum(m, ip6->ip6_nxt, off, len); return(sum); -} #else -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ u_short *sp; u_int sum; @@ -10327,6 +10319,6 @@ ipf_pcksum6(fin, ip6, off, len) sum += *sp++; sum += *sp++; return(ipf_pcksum(fin, off, sum)); -} #endif +} #endif From owner-svn-src-stable@freebsd.org Mon Dec 2 20:55:08 2019 Return-Path: Delivered-To: svn-src-stable@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 CEC2E1B6D83; Mon, 2 Dec 2019 20:55:08 +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 47RcnS57YMz4Ldr; Mon, 2 Dec 2019 20:55:08 +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 932F04F3D; Mon, 2 Dec 2019 20:55:08 +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 xB2Kt8Rx080176; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kt8uU080175; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022055.xB2Kt8uU080175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355302 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:55:08 -0000 Author: cy Date: Mon Dec 2 20:55:08 2019 New Revision: 355302 URL: https://svnweb.freebsd.org/changeset/base/355302 Log: MFC r355140: Remove redundant #ifdef'd function definitions. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:51:46 2019 (r355301) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) @@ -10279,7 +10279,6 @@ ipf_inet6_mask_del(bits, mask, mtab) ASSERT(mtab->imt6_max >= 0); } -#ifdef _KERNEL static u_int ipf_pcksum6(fin, ip6, off, len) fr_info_t *fin; @@ -10287,6 +10286,7 @@ ipf_pcksum6(fin, ip6, off, len) u_int32_t off; u_int32_t len; { +#ifdef _KERNEL struct mbuf *m; int sum; @@ -10297,15 +10297,7 @@ ipf_pcksum6(fin, ip6, off, len) sum = in6_cksum(m, ip6->ip6_nxt, off, len); return(sum); -} #else -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ u_short *sp; u_int sum; @@ -10327,6 +10319,6 @@ ipf_pcksum6(fin, ip6, off, len) sum += *sp++; sum += *sp++; return(ipf_pcksum(fin, off, sum)); -} #endif +} #endif From owner-svn-src-stable@freebsd.org Mon Dec 2 20:57:14 2019 Return-Path: Delivered-To: svn-src-stable@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 B16D71B6EE9; Mon, 2 Dec 2019 20:57:14 +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 47Rcqt4JYjz4Ltc; Mon, 2 Dec 2019 20:57:14 +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 771B84F40; Mon, 2 Dec 2019 20:57:14 +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 xB2KvEYt080319; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2KvETo080318; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022057.xB2KvETo080318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355303 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:57:14 -0000 Author: cy Date: Mon Dec 2 20:57:13 2019 New Revision: 355303 URL: https://svnweb.freebsd.org/changeset/base/355303 Log: MFC r355141: Save a little stack by removing a used once intermediate variable. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:57:13 2019 (r355303) @@ -10288,15 +10288,13 @@ ipf_pcksum6(fin, ip6, off, len) { #ifdef _KERNEL struct mbuf *m; - int sum; m = fin->fin_m; if (m->m_len < sizeof(struct ip6_hdr)) { return 0xffff; } - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); + return(in6_cksum(m, ip6->ip6_nxt, off, len)); #else u_short *sp; u_int sum; From owner-svn-src-stable@freebsd.org Mon Dec 2 20:57:14 2019 Return-Path: Delivered-To: svn-src-stable@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 6ED6B1B6EE2; Mon, 2 Dec 2019 20:57:14 +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 47Rcqt2Hrtz4Ltb; Mon, 2 Dec 2019 20:57:14 +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 2DE004F3F; Mon, 2 Dec 2019 20:57:14 +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 xB2KvEXV080313; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2KvEsk080312; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022057.xB2KvEsk080312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355303 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:57:14 -0000 Author: cy Date: Mon Dec 2 20:57:13 2019 New Revision: 355303 URL: https://svnweb.freebsd.org/changeset/base/355303 Log: MFC r355141: Save a little stack by removing a used once intermediate variable. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:57:13 2019 (r355303) @@ -10288,15 +10288,13 @@ ipf_pcksum6(fin, ip6, off, len) { #ifdef _KERNEL struct mbuf *m; - int sum; m = fin->fin_m; if (m->m_len < sizeof(struct ip6_hdr)) { return 0xffff; } - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); + return(in6_cksum(m, ip6->ip6_nxt, off, len)); #else u_short *sp; u_int sum; From owner-svn-src-stable@freebsd.org Mon Dec 2 20:58:56 2019 Return-Path: Delivered-To: svn-src-stable@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 3943E1B7120; Mon, 2 Dec 2019 20:58:56 +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 47Rcsr0rXTz4MPs; Mon, 2 Dec 2019 20:58:56 +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 012AB4F91; Mon, 2 Dec 2019 20:58:56 +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 xB2KwtiV080488; Mon, 2 Dec 2019 20:58:55 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kwtm6080485; Mon, 2 Dec 2019 20:58:55 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022058.xB2Kwtm6080485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355305 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:58:56 -0000 Author: cy Date: Mon Dec 2 20:58:55 2019 New Revision: 355305 URL: https://svnweb.freebsd.org/changeset/base/355305 Log: MFC r355142: Move ipf_pcksum6() to its rightful place, in ip_fil_freebsd.c. This FreeBSD-only function should live in the O/S specific source file. This essentially reverts r349929 Now that ipftest and ipfreplay are disabled in FreeBSD 11-stable. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) @@ -179,10 +179,6 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); -#ifdef USE_INET6 -static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10277,46 +10273,5 @@ ipf_inet6_mask_del(bits, mask, mtab) } mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); -} - -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ -#ifdef _KERNEL - struct mbuf *m; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - return(in6_cksum(m, ip6->ip6_nxt, off, len)); -#else - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -#endif } #endif Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:04 2019 (r355304) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:55 2019 (r355305) @@ -1839,6 +1839,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:55 2019 (r355305) @@ -1447,3 +1447,48 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } + +#ifdef USE_INET6 +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ +#ifdef _KERNEL + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +#else + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +#endif +} +#endif From owner-svn-src-stable@freebsd.org Mon Dec 2 20:58:57 2019 Return-Path: Delivered-To: svn-src-stable@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 0A8911B7136; Mon, 2 Dec 2019 20:58:57 +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 47Rcsr6bc6z4MQ3; Mon, 2 Dec 2019 20:58:56 +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 C45A04F92; Mon, 2 Dec 2019 20:58:56 +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 xB2KwufI080496; Mon, 2 Dec 2019 20:58:56 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kwuqr080493; Mon, 2 Dec 2019 20:58:56 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022058.xB2Kwuqr080493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355305 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:58:57 -0000 Author: cy Date: Mon Dec 2 20:58:55 2019 New Revision: 355305 URL: https://svnweb.freebsd.org/changeset/base/355305 Log: MFC r355142: Move ipf_pcksum6() to its rightful place, in ip_fil_freebsd.c. This FreeBSD-only function should live in the O/S specific source file. This essentially reverts r349929 Now that ipftest and ipfreplay are disabled in FreeBSD 11-stable. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) @@ -179,10 +179,6 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); -#ifdef USE_INET6 -static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10277,46 +10273,5 @@ ipf_inet6_mask_del(bits, mask, mtab) } mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); -} - -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ -#ifdef _KERNEL - struct mbuf *m; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - return(in6_cksum(m, ip6->ip6_nxt, off, len)); -#else - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -#endif } #endif Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:04 2019 (r355304) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:55 2019 (r355305) @@ -1839,6 +1839,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:55 2019 (r355305) @@ -1451,3 +1451,48 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } + +#ifdef USE_INET6 +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ +#ifdef _KERNEL + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +#else + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +#endif +} +#endif From owner-svn-src-stable@freebsd.org Mon Dec 2 21:00:30 2019 Return-Path: Delivered-To: svn-src-stable@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 3748F1B73BA; Mon, 2 Dec 2019 21:00:30 +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 47Rcvf0LsBz4MjL; Mon, 2 Dec 2019 21:00:30 +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 E42E04FA8; Mon, 2 Dec 2019 21:00:29 +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 xB2L0Tph080678; Mon, 2 Dec 2019 21:00:29 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2L0T2p080677; Mon, 2 Dec 2019 21:00:29 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022100.xB2L0T2p080677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 21:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355306 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:00:30 -0000 Author: cy Date: Mon Dec 2 21:00:29 2019 New Revision: 355306 URL: https://svnweb.freebsd.org/changeset/base/355306 Log: MFC r355156: Include fin, the packet information structure (fr_info_t), in the l4sums DTrace probe, making more information available for the diagnosis of IPv6 checksum errors. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 21:00:29 2019 (r355306) @@ -6742,7 +6742,7 @@ ipf_checkl4sum(fin) FR_DEBUG(("checkl4sum: %hx != %hx\n", sum, hdrsum)); } #endif - DT2(l4sums, u_short, hdrsum, u_short, sum); + DT3(l4sums, u_short, hdrsum, u_short, sum, fr_info_t *, fin); #ifdef USE_INET6 if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { #else From owner-svn-src-stable@freebsd.org Mon Dec 2 21:00:30 2019 Return-Path: Delivered-To: svn-src-stable@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 84DED1B73CB; Mon, 2 Dec 2019 21:00:30 +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 47Rcvf2nYdz4MjM; Mon, 2 Dec 2019 21:00:30 +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 432634FA9; Mon, 2 Dec 2019 21:00:30 +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 xB2L0U86080684; Mon, 2 Dec 2019 21:00:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2L0UrE080683; Mon, 2 Dec 2019 21:00:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022100.xB2L0UrE080683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 21:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355306 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:00:30 -0000 Author: cy Date: Mon Dec 2 21:00:29 2019 New Revision: 355306 URL: https://svnweb.freebsd.org/changeset/base/355306 Log: MFC r355156: Include fin, the packet information structure (fr_info_t), in the l4sums DTrace probe, making more information available for the diagnosis of IPv6 checksum errors. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 21:00:29 2019 (r355306) @@ -6742,7 +6742,7 @@ ipf_checkl4sum(fin) FR_DEBUG(("checkl4sum: %hx != %hx\n", sum, hdrsum)); } #endif - DT2(l4sums, u_short, hdrsum, u_short, sum); + DT3(l4sums, u_short, hdrsum, u_short, sum, fr_info_t *, fin); #ifdef USE_INET6 if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { #else From owner-svn-src-stable@freebsd.org Tue Dec 3 07:19:28 2019 Return-Path: Delivered-To: svn-src-stable@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 EB14D1CB064; Tue, 3 Dec 2019 07:19:28 +0000 (UTC) (envelope-from avg@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 47Rtdr5ytWz40Tj; Tue, 3 Dec 2019 07:19:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B138BC2A4; Tue, 3 Dec 2019 07:19:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB37JSS0049656; Tue, 3 Dec 2019 07:19:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB37JSjp049655; Tue, 3 Dec 2019 07:19:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912030719.xB37JSjp049655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Dec 2019 07:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355319 - in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 355319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:19:29 -0000 Author: avg Date: Tue Dec 3 07:19:28 2019 New Revision: 355319 URL: https://svnweb.freebsd.org/changeset/base/355319 Log: MFC r354638: teach db_nextframe/x86 about [X]xen_intr_upcall interrupt handler Modified: stable/12/sys/amd64/amd64/db_trace.c stable/12/sys/i386/i386/db_trace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/db_trace.c ============================================================================== --- stable/12/sys/amd64/amd64/db_trace.c Tue Dec 3 07:03:25 2019 (r355318) +++ stable/12/sys/amd64/amd64/db_trace.c Tue Dec 3 07:19:28 2019 (r355319) @@ -203,6 +203,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || strncmp(name, "Xapic_isr", 9) == 0 || + strcmp(name, "Xxen_intr_upcall") == 0 || strcmp(name, "Xtimerint") == 0 || strcmp(name, "Xipi_intr_bitmap_handler") == 0 || strcmp(name, "Xcpustop") == 0 || Modified: stable/12/sys/i386/i386/db_trace.c ============================================================================== --- stable/12/sys/i386/i386/db_trace.c Tue Dec 3 07:03:25 2019 (r355318) +++ stable/12/sys/i386/i386/db_trace.c Tue Dec 3 07:19:28 2019 (r355319) @@ -346,7 +346,8 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; - else if (strcmp(name, "Xtimerint") == 0) + else if (strcmp(name, "Xtimerint") == 0 || + strcmp(name, "Xxen_intr_upcall") == 0) frame_type = INTERRUPT; else if (strcmp(name, "Xcpustop") == 0 || strcmp(name, "Xrendezvous") == 0 || From owner-svn-src-stable@freebsd.org Tue Dec 3 07:20:48 2019 Return-Path: Delivered-To: svn-src-stable@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 4DFEA1CB100; Tue, 3 Dec 2019 07:20:48 +0000 (UTC) (envelope-from avg@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 47RtgN1P54z40cR; Tue, 3 Dec 2019 07:20:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13399C2BC; Tue, 3 Dec 2019 07:20:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB37KlNF049809; Tue, 3 Dec 2019 07:20:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB37KlnQ049808; Tue, 3 Dec 2019 07:20:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912030720.xB37KlnQ049808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Dec 2019 07:20:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355320 - stable/12/sys/dev/hyperv/storvsc X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/hyperv/storvsc X-SVN-Commit-Revision: 355320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:20:48 -0000 Author: avg Date: Tue Dec 3 07:20:47 2019 New Revision: 355320 URL: https://svnweb.freebsd.org/changeset/base/355320 Log: MFC r354849: hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb Modified: stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Dec 3 07:19:28 2019 (r355319) +++ stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Dec 3 07:20:47 2019 (r355320) @@ -1915,6 +1915,7 @@ create_storvsc_request(union ccb *ccb, struct hv_storv reqp->sense_info_len = csio->sense_len; reqp->ccb = ccb; + ccb->ccb_h.spriv_ptr0 = reqp; if (0 == csio->dxfer_len) { return (0); From owner-svn-src-stable@freebsd.org Tue Dec 3 07:22:17 2019 Return-Path: Delivered-To: svn-src-stable@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 8A9511CB2A6; Tue, 3 Dec 2019 07:22:17 +0000 (UTC) (envelope-from avg@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 47Rtj53CP1z40w7; Tue, 3 Dec 2019 07:22:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5237CC440; Tue, 3 Dec 2019 07:22:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB37MHo8055174; Tue, 3 Dec 2019 07:22:17 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB37MHbP055172; Tue, 3 Dec 2019 07:22:17 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912030722.xB37MHbP055172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Dec 2019 07:22:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355321 - stable/12/sys/dev/ixgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ixgbe X-SVN-Commit-Revision: 355321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:22:17 -0000 Author: avg Date: Tue Dec 3 07:22:16 2019 New Revision: 355321 URL: https://svnweb.freebsd.org/changeset/base/355321 Log: MFC r354349: if_ixv: disable RSS configuration on 82599 and X540 VFs It is reported that those VFs share their RSS configuration with PF and, thus, they cannot be configured independently. Also: - add missing opt_rss.h to if_ixv.c, otherwise RSS kernel option could not be seen - do not enable IXGBE_FEATURE_RSS on the older VFs - set flowid / hash type to M_HASHTYPE_NONE or M_HASHTYPE_OPAQUE_HASH (based on what the hardware reports) if IXGBE_FEATURE_RSS is not set Modified: stable/12/sys/dev/ixgbe/if_ixv.c stable/12/sys/dev/ixgbe/ix_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/if_ixv.c ============================================================================== --- stable/12/sys/dev/ixgbe/if_ixv.c Tue Dec 3 07:20:47 2019 (r355320) +++ stable/12/sys/dev/ixgbe/if_ixv.c Tue Dec 3 07:22:16 2019 (r355321) @@ -35,6 +35,7 @@ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_rss.h" #include "ixgbe.h" #include "ifdi_if.h" @@ -1457,7 +1458,12 @@ ixv_initialize_receive_units(if_ctx_t ctx) scctx->isc_nrxd[0] - 1); } - ixv_initialize_rss_mapping(adapter); + /* + * Do not touch RSS and RETA settings for older hardware + * as those are shared among PF and all VF. + */ + if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) + ixv_initialize_rss_mapping(adapter); } /* ixv_initialize_receive_units */ /************************************************************************ @@ -1892,7 +1898,6 @@ ixv_init_device_features(struct adapter *adapter) { adapter->feat_cap = IXGBE_FEATURE_NETMAP | IXGBE_FEATURE_VF - | IXGBE_FEATURE_RSS | IXGBE_FEATURE_LEGACY_TX; /* A tad short on feature flags for VFs, atm. */ @@ -1905,6 +1910,7 @@ ixv_init_device_features(struct adapter *adapter) case ixgbe_mac_X550EM_x_vf: case ixgbe_mac_X550EM_a_vf: adapter->feat_cap |= IXGBE_FEATURE_NEEDS_CTXD; + adapter->feat_cap |= IXGBE_FEATURE_RSS; break; default: break; Modified: stable/12/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- stable/12/sys/dev/ixgbe/ix_txrx.c Tue Dec 3 07:20:47 2019 (r355320) +++ stable/12/sys/dev/ixgbe/ix_txrx.c Tue Dec 3 07:22:16 2019 (r355321) @@ -464,6 +464,12 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss); ri->iri_rsstype = ixgbe_determine_rsstype(pkt_info); + if ((adapter->feat_en & IXGBE_FEATURE_RSS) == 0) { + if (ri->iri_rsstype == M_HASHTYPE_OPAQUE) + ri->iri_rsstype = M_HASHTYPE_NONE; + else + ri->iri_rsstype = M_HASHTYPE_OPAQUE_HASH; + } ri->iri_vtag = vtag; ri->iri_nfrags = i; if (vtag) From owner-svn-src-stable@freebsd.org Tue Dec 3 13:48:03 2019 Return-Path: Delivered-To: svn-src-stable@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 4504D1AF768; Tue, 3 Dec 2019 13:48:03 +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 47S3GC1bk4z4PJZ; Tue, 3 Dec 2019 13:48:03 +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 15BB918943; Tue, 3 Dec 2019 13:48:03 +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 xB3Dm3DP081627; Tue, 3 Dec 2019 13:48:03 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3DllgD081603; Tue, 3 Dec 2019 13:47:47 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912031347.xB3DllgD081603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 3 Dec 2019 13:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355326 - in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Commit-Revision: 355326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 13:48:03 -0000 Author: cy Date: Tue Dec 3 13:47:46 2019 New Revision: 355326 URL: https://svnweb.freebsd.org/changeset/base/355326 Log: MFC r354269: MFV r354257: Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100) Modified: stable/11/contrib/sqlite3/Makefile.msc stable/11/contrib/sqlite3/configure stable/11/contrib/sqlite3/configure.ac stable/11/contrib/sqlite3/shell.c stable/11/contrib/sqlite3/sqlite3.c stable/11/contrib/sqlite3/sqlite3.h stable/11/contrib/sqlite3/sqlite3ext.h stable/11/contrib/sqlite3/tea/configure stable/11/contrib/sqlite3/tea/configure.ac stable/11/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/sqlite3/Makefile.msc stable/12/contrib/sqlite3/configure stable/12/contrib/sqlite3/configure.ac stable/12/contrib/sqlite3/shell.c stable/12/contrib/sqlite3/sqlite3.c stable/12/contrib/sqlite3/sqlite3.h stable/12/contrib/sqlite3/sqlite3ext.h stable/12/contrib/sqlite3/tea/configure stable/12/contrib/sqlite3/tea/configure.ac stable/12/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/sqlite3/Makefile.msc ============================================================================== --- stable/11/contrib/sqlite3/Makefile.msc Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/Makefile.msc Tue Dec 3 13:47:46 2019 (r355326) @@ -73,7 +73,7 @@ API_ARMOR = 0 !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206 -NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706 +NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706 !ENDIF !ENDIF Modified: stable/11/contrib/sqlite3/configure ============================================================================== --- stable/11/contrib/sqlite3/configure Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/configure Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.29.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.30.1. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.29.0' -PACKAGE_STRING='sqlite 3.29.0' +PACKAGE_VERSION='3.30.1' +PACKAGE_STRING='sqlite 3.30.1' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.29.0:";; + short | recursive ) echo "Configuration of sqlite 3.30.1:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.29.0 +sqlite configure 3.30.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.29.0, which was +It was created by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.29.0' + VERSION='3.30.1' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.29.0, which was +This file was extended by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.29.0 +sqlite config.status 3.30.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/sqlite3/configure.ac ============================================================================== --- stable/11/contrib/sqlite3/configure.ac Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/configure.ac Tue Dec 3 13:47:46 2019 (r355326) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.29.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.30.1, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: stable/11/contrib/sqlite3/shell.c ============================================================================== --- stable/11/contrib/sqlite3/shell.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/shell.c Tue Dec 3 13:47:46 2019 (r355326) @@ -9801,12 +9801,12 @@ static void editFunc( } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ - x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_blob(argv[0]), 1, (size_t)sz, f); }else{ const char *z = (const char*)sqlite3_value_text(argv[0]); /* Remember whether or not the value originally contained \r\n */ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1; - x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_text(argv[0]), 1, (size_t)sz, f); } fclose(f); f = 0; @@ -9834,12 +9834,12 @@ static void editFunc( fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); - p = sqlite3_malloc64( sz+(bBin==0) ); + p = sqlite3_malloc64( sz+1 ); if( p==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } - x = fread(p, 1, sz, f); + x = fread(p, 1, (size_t)sz, f); fclose(f); f = 0; if( x!=sz ){ @@ -10311,7 +10311,8 @@ static void eqp_render_level(ShellState *p, int iEqpId for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; - utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); + utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, + pNext ? "|--" : "`--", z); if( n<(int)sizeof(p->sGraph.zPrefix)-7 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); eqp_render_level(p, pRow->iEqpId); @@ -10502,7 +10503,7 @@ static int shell_callback( while( j>0 && IsSpace(z[j-1]) ){ j--; } z[j] = 0; if( strlen30(z)>=79 ){ - for(i=j=0; (c = z[i])!=0; i++){ /* Copy changes from z[i] back to z[j] */ + for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */ if( c==cEnd ){ cEnd = 0; }else if( c=='"' || c=='\'' || c=='`' ){ @@ -11081,7 +11082,7 @@ static int display_stats( raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE, bReset); + iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset); raw_printf(pArg->out, "Reprepare operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset); raw_printf(pArg->out, "Number of times run: %d\n", iCur); @@ -12004,20 +12005,20 @@ static const char *(azHelp[]) = { ".archive ... Manage SQL archives", " Each command must have exactly one of the following options:", " -c, --create Create a new archive", - " -u, --update Add files or update files with changed mtime", - " -i, --insert Like -u but always add even if mtime unchanged", + " -u, --update Add or update files with changed mtime", + " -i, --insert Like -u but always add even if unchanged", " -t, --list List contents of archive", " -x, --extract Extract files from archive", " Optional arguments:", " -v, --verbose Print each filename as it is processed", - " -f FILE, --file FILE Operate on archive FILE (default is current db)", - " -a FILE, --append FILE Operate on FILE opened using the apndvfs VFS", - " -C DIR, --directory DIR Change to directory DIR to read/extract files", + " -f FILE, --file FILE Use archive FILE (default is current db)", + " -a FILE, --append FILE Open FILE using the apndvfs VFS", + " -C DIR, --directory DIR Read/extract files from directory DIR", " -n, --dryrun Show the SQL that would have occurred", " Examples:", - " .ar -cf archive.sar foo bar # Create archive.sar from files foo and bar", - " .ar -tf archive.sar # List members of archive.sar", - " .ar -xvf archive.sar # Verbosely extract files from archive.sar", + " .ar -cf ARCHIVE foo bar # Create ARCHIVE from files foo and bar", + " .ar -tf ARCHIVE # List members of ARCHIVE", + " .ar -xvf ARCHIVE # Verbosely extract files from ARCHIVE", " See also:", " http://sqlite.org/cli.html#sqlar_archive_support", #endif @@ -12026,7 +12027,7 @@ static const char *(azHelp[]) = { #endif ".backup ?DB? FILE Backup DB (default \"main\") to FILE", " --append Use the appendvfs", - " --async Write to FILE without a journal and without fsync()", + " --async Write to FILE without journal and fsync()", ".bail on|off Stop after hitting an error. Default OFF", ".binary on|off Turn binary output on or off. Default OFF", ".cd DIRECTORY Change the working directory to DIRECTORY", @@ -12046,15 +12047,15 @@ static const char *(azHelp[]) = { " Other Modes:", #ifdef SQLITE_DEBUG " test Show raw EXPLAIN QUERY PLAN output", - " trace Like \"full\" but also enable \"PRAGMA vdbe_trace\"", + " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"", #endif " trigger Like \"full\" but also show trigger bytecode", - ".excel Display the output of next command in a spreadsheet", + ".excel Display the output of next command in spreadsheet", ".exit ?CODE? Exit this program with return-code CODE", - ".expert EXPERIMENTAL. Suggest indexes for specified queries", + ".expert EXPERIMENTAL. Suggest indexes for queries", /* Because explain mode comes on automatically now, the ".explain" mode -** is removed from the help screen. It is still supported for legacy, however */ -/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic",*/ +** is removed from the help screen. It is still supported for legacy, however */ +/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off",*/ ".filectrl CMD ... Run various sqlite3_file_control() operations", " Run \".filectrl\" with no arguments for details", ".fullschema ?--indent? Show schema and the content of sqlite_stat tables", @@ -12101,7 +12102,7 @@ static const char *(azHelp[]) = { " --append Use appendvfs to append database to the end of FILE", #ifdef SQLITE_ENABLE_DESERIALIZE " --deserialize Load into memory useing sqlite3_deserialize()", - " --hexdb Load the output of \"dbtotxt\" as an in-memory database", + " --hexdb Load the output of \"dbtotxt\" as an in-memory db", " --maxsize N Maximum size for --hexdb or --deserialized database", #endif " --new Initialize FILE to an empty database", @@ -12114,7 +12115,7 @@ static const char *(azHelp[]) = { " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", - " PARAMETER should start with '$', ':', '@', or '?'", + " PARAMETER should start with one of: $ : @ ?", " unset PARAMETER Remove PARAMETER from the binding table", ".print STRING... Print literal STRING", #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -12129,6 +12130,11 @@ static const char *(azHelp[]) = { ".read FILE Read input from FILE", #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ".recover Recover as much data as possible from corrupt db.", + " --freelist-corrupt Assume the freelist is corrupt", + " --recovery-db NAME Store recovery metadata in database file NAME", + " --lost-and-found TABLE Alternative name for the lost-and-found table", + " --no-rowids Do not attempt to recover rowid values", + " that are not also INTEGER PRIMARY KEYs", #endif ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE", ".save FILE Write in-memory database into FILE", @@ -12160,7 +12166,7 @@ static const char *(azHelp[]) = { " Options:", " --schema Also hash the sqlite_master table", " --sha3-224 Use the sha3-224 algorithm", - " --sha3-256 Use the sha3-256 algorithm. This is the default.", + " --sha3-256 Use the sha3-256 algorithm (default)", " --sha3-384 Use the sha3-384 algorithm", " --sha3-512 Use the sha3-512 algorithm", " Any other argument is a LIKE pattern for tables to hash", @@ -12194,6 +12200,10 @@ static const char *(azHelp[]) = { " --row Trace each row (SQLITE_TRACE_ROW)", " --close Trace connection close (SQLITE_TRACE_CLOSE)", #endif /* SQLITE_OMIT_TRACE */ +#ifdef SQLITE_DEBUG + ".unmodule NAME ... Unregister virtual table modules", + " --allexcept Unregister everything except those named", +#endif ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", @@ -12436,6 +12446,8 @@ static unsigned char *readHexDb(ShellState *p, int *pn rc = sscanf(zLine, "| size %d pagesize %d", &n, &pgsz); if( rc!=2 ) goto readHexDb_error; if( n<0 ) goto readHexDb_error; + if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error; + n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */ a = sqlite3_malloc( n ? n : 1 ); if( a==0 ){ utf8_printf(stderr, "Out of memory!\n"); @@ -12521,6 +12533,23 @@ static void shellInt32( } /* +** Scalar function "shell_idquote(X)" returns string X quoted as an identifier, +** using "..." with internal double-quote characters doubled. +*/ +static void shellIdQuote( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const char *zName = (const char*)sqlite3_value_text(argv[0]); + UNUSED_PARAMETER(argc); + if( zName ){ + char *z = sqlite3_mprintf("\"%w\"", zName); + sqlite3_result_text(context, z, -1, sqlite3_free); + } +} + +/* ** Scalar function "shell_escape_crnl" used by the .recover command. ** The argument passed to this function is the output of built-in ** function quote(). If the first character of the input is "'", @@ -12696,6 +12725,8 @@ static void open_db(ShellState *p, int openFlags){ shellEscapeCrnl, 0, 0); sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0, shellInt32, 0, 0); + sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); #ifndef SQLITE_NOHAVE_SYSTEM sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0, editFunc, 0, 0); @@ -14043,7 +14074,7 @@ void shellReset( #endif /* !defined SQLITE_OMIT_VIRTUALTABLE */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) -/********************************************************************************* +/****************************************************************************** ** The ".archive" or ".ar" command. */ /* @@ -14241,7 +14272,8 @@ static int arParseCommand( i = n; }else{ if( iArg>=(nArg-1) ){ - return arErrorMsg(pAr, "option requires an argument: %c",z[i]); + return arErrorMsg(pAr, "option requires an argument: %c", + z[i]); } zArg = azArg[++iArg]; } @@ -14629,10 +14661,10 @@ end_ar_transaction: ** Implementation of ".ar" dot command. */ static int arDotCommand( - ShellState *pState, /* Current shell tool state */ - int fromCmdLine, /* True if -A command-line option, not .ar cmd */ - char **azArg, /* Array of arguments passed to dot command */ - int nArg /* Number of entries in azArg[] */ + ShellState *pState, /* Current shell tool state */ + int fromCmdLine, /* True if -A command-line option, not .ar cmd */ + char **azArg, /* Array of arguments passed to dot command */ + int nArg /* Number of entries in azArg[] */ ){ ArCommand cmd; int rc; @@ -14732,7 +14764,7 @@ end_ar_command: return rc; } /* End of the ".archive" or ".ar" command logic -**********************************************************************************/ +*******************************************************************************/ #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) @@ -14874,6 +14906,10 @@ static RecoverTable *recoverNewTable( rc = sqlite3_open("", &dbtmp); if( rc==SQLITE_OK ){ + sqlite3_create_function(dbtmp, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); + } + if( rc==SQLITE_OK ){ rc = sqlite3_exec(dbtmp, "PRAGMA writable_schema = on", 0, 0, 0); } if( rc==SQLITE_OK ){ @@ -14929,18 +14965,18 @@ static RecoverTable *recoverNewTable( } } - pTab->zQuoted = shellMPrintf(&rc, "%Q", zName); + pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName); pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1)); pTab->nCol = nSqlCol; if( bIntkey ){ - pTab->azlCol[0] = shellMPrintf(&rc, "%Q", zPk); + pTab->azlCol[0] = shellMPrintf(&rc, "\"%w\"", zPk); }else{ pTab->azlCol[0] = shellMPrintf(&rc, ""); } i = 1; shellPreparePrintf(dbtmp, &rc, &pStmt, - "SELECT %Q || group_concat(name, ', ') " + "SELECT %Q || group_concat(shell_idquote(name), ', ') " " FILTER (WHERE cid!=%d) OVER (ORDER BY %s cid) " "FROM pragma_table_info(%Q)", bIntkey ? ", " : "", pTab->iPk, @@ -15054,7 +15090,7 @@ static RecoverTable *recoverOrphanTable( pTab = (RecoverTable*)shellMalloc(pRc, sizeof(RecoverTable)); if( pTab ){ - pTab->zQuoted = shellMPrintf(pRc, "%Q", zTab); + pTab->zQuoted = shellMPrintf(pRc, "\"%w\"", zTab); pTab->nCol = nCol; pTab->iPk = -2; if( nCol>0 ){ @@ -15103,6 +15139,7 @@ static int recoverDatabaseCmd(ShellState *pState, int RecoverTable *pOrphan = 0; int bFreelist = 1; /* 0 if --freelist-corrupt is specified */ + int bRowids = 1; /* 0 if --no-rowids */ for(i=1; iout, azArg[0]); return 1; } } @@ -15132,6 +15169,7 @@ static int recoverDatabaseCmd(ShellState *pState, int shellExecPrintf(pState->db, &rc, /* Attach an in-memory database named 'recovery'. Create an indexed ** cache of the sqlite_dbptr virtual table. */ + "PRAGMA writable_schema = on;" "ATTACH %Q AS recovery;" "DROP TABLE IF EXISTS recovery.dbptr;" "DROP TABLE IF EXISTS recovery.freelist;" @@ -15162,7 +15200,22 @@ static int recoverDatabaseCmd(ShellState *pState, int ); } + /* If this is an auto-vacuum database, add all pointer-map pages to + ** the freelist table. Do this regardless of whether or not + ** --freelist-corrupt was specified. */ shellExec(pState->db, &rc, + "WITH ptrmap(pgno) AS (" + " SELECT 2 WHERE shell_int32(" + " (SELECT data FROM sqlite_dbpage WHERE pgno=1), 13" + " )" + " UNION ALL " + " SELECT pgno+1+(SELECT page_size FROM pragma_page_size)/5 AS pp " + " FROM ptrmap WHERE pp<=(SELECT page_count FROM pragma_page_count)" + ")" + "REPLACE INTO recovery.freelist SELECT pgno FROM ptrmap" + ); + + shellExec(pState->db, &rc, "CREATE TABLE recovery.dbptr(" " pgno, child, PRIMARY KEY(child, pgno)" ") WITHOUT ROWID;" @@ -15210,7 +15263,7 @@ static int recoverDatabaseCmd(ShellState *pState, int " )" " SELECT pgno FROM p WHERE (parent IS NULL OR pgno = orig)" ") " - "FROM pages WHERE maxlen > 0 AND i NOT IN freelist;" + "FROM pages WHERE maxlen IS NOT NULL AND i NOT IN freelist;" "UPDATE recovery.map AS o SET intkey = (" " SELECT substr(data, 1, 1)==X'0D' FROM sqlite_dbpage WHERE pgno=o.pgno" ");" @@ -15235,6 +15288,11 @@ static int recoverDatabaseCmd(ShellState *pState, int ** CREATE TABLE statements that extracted from the existing schema. */ if( rc==SQLITE_OK ){ sqlite3_stmt *pStmt = 0; + /* ".recover" might output content in an order which causes immediate + ** foreign key constraints to be violated. So disable foreign-key + ** constraint enforcement to prevent problems when running the output + ** script. */ + raw_printf(pState->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(pState->out, "BEGIN;\n"); raw_printf(pState->out, "PRAGMA writable_schema = on;\n"); shellPrepare(pState->db, &rc, @@ -15265,8 +15323,12 @@ static int recoverDatabaseCmd(ShellState *pState, int shellPrepare(pState->db, &rc, "SELECT pgno FROM recovery.map WHERE root=?", &pPages ); + shellPrepare(pState->db, &rc, - "SELECT max(field), group_concat(shell_escape_crnl(quote(value)), ', ')" + "SELECT max(field), group_concat(shell_escape_crnl(quote" + "(case when (? AND field<0) then NULL else value end)" + "), ', ')" + ", min(field) " "FROM sqlite_dbdata WHERE pgno = ? AND field != ?" "GROUP BY cell", &pCells ); @@ -15285,6 +15347,7 @@ static int recoverDatabaseCmd(ShellState *pState, int int bNoop = 0; RecoverTable *pTab; + assert( bIntkey==0 || bIntkey==1 ); pTab = recoverFindTable(pState, &rc, iRoot, bIntkey, nCol, &bNoop); if( bNoop || rc ) continue; if( pTab==0 ){ @@ -15295,29 +15358,44 @@ static int recoverDatabaseCmd(ShellState *pState, int if( pTab==0 ) break; } - if( 0==sqlite3_stricmp(pTab->zQuoted, "'sqlite_sequence'") ){ + if( 0==sqlite3_stricmp(pTab->zQuoted, "\"sqlite_sequence\"") ){ raw_printf(pState->out, "DELETE FROM sqlite_sequence;\n"); } sqlite3_bind_int(pPages, 1, iRoot); - sqlite3_bind_int(pCells, 2, pTab->iPk); + if( bRowids==0 && pTab->iPk<0 ){ + sqlite3_bind_int(pCells, 1, 1); + }else{ + sqlite3_bind_int(pCells, 1, 0); + } + sqlite3_bind_int(pCells, 3, pTab->iPk); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPages) ){ int iPgno = sqlite3_column_int(pPages, 0); - sqlite3_bind_int(pCells, 1, iPgno); + sqlite3_bind_int(pCells, 2, iPgno); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pCells) ){ int nField = sqlite3_column_int(pCells, 0); + int iMin = sqlite3_column_int(pCells, 2); const char *zVal = (const char*)sqlite3_column_text(pCells, 1); + RecoverTable *pTab2 = pTab; + if( pTab!=pOrphan && (iMin<0)!=bIntkey ){ + if( pOrphan==0 ){ + pOrphan = recoverOrphanTable(pState, &rc, zLostAndFound, nOrphan); + } + pTab2 = pOrphan; + if( pTab2==0 ) break; + } + nField = nField+1; - if( pTab==pOrphan ){ + if( pTab2==pOrphan ){ raw_printf(pState->out, "INSERT INTO %s VALUES(%d, %d, %d, %s%s%s);\n", - pTab->zQuoted, iRoot, iPgno, nField, - bIntkey ? "" : "NULL, ", zVal, pTab->azlCol[nField] + pTab2->zQuoted, iRoot, iPgno, nField, + iMin<0 ? "" : "NULL, ", zVal, pTab2->azlCol[nField] ); }else{ raw_printf(pState->out, "INSERT INTO %s(%s) VALUES( %s );\n", - pTab->zQuoted, pTab->azlCol[nField], zVal + pTab2->zQuoted, pTab2->azlCol[nField], zVal ); } } @@ -15376,7 +15454,7 @@ static int do_meta_command(char *zLine, ShellState *p) int nArg = 0; int n, c; int rc = 0; - char *azArg[50]; + char *azArg[52]; #ifndef SQLITE_OMIT_VIRTUALTABLE if( p->expert.pExpert ){ @@ -15386,7 +15464,7 @@ static int do_meta_command(char *zLine, ShellState *p) /* Parse the input line into tokens. */ - while( zLine[h] && nArgout, "ANALYZE sqlite_master;\n"); @@ -16615,12 +16693,8 @@ static int do_meta_command(char *zLine, ShellState *p) ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && strcmp(azArg[1],"clear")==0 ){ - int wrSchema = 0; - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", 0, 0, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); }else /* .parameter list @@ -16933,7 +17007,7 @@ static int do_meta_command(char *zLine, ShellState *p) zDiv = " UNION ALL "; appendText(&sSelect, "SELECT shell_add_schema(sql,", 0); if( sqlite3_stricmp(zDb, "main")!=0 ){ - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, '\''); }else{ appendText(&sSelect, "NULL", 0); } @@ -16942,15 +17016,16 @@ static int do_meta_command(char *zLine, ShellState *p) appendText(&sSelect, " AS snum, ", 0); appendText(&sSelect, zDb, '\''); appendText(&sSelect, " AS sname FROM ", 0); - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, quoteChar(zDb)); appendText(&sSelect, ".sqlite_master", 0); } sqlite3_finalize(pStmt); -#ifdef SQLITE_INTROSPECTION_PRAGMAS +#ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS if( zName ){ appendText(&sSelect, " UNION ALL SELECT shell_module_schema(name)," - " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", 0); + " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", + 0); } #endif appendText(&sSelect, ") WHERE ", 0); @@ -17049,7 +17124,8 @@ static int do_meta_command(char *zLine, ShellState *p) if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ - utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", azCmd[1]); + utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", + azCmd[1]); }else{ int szChng; void *pChng; @@ -17370,8 +17446,7 @@ static int do_meta_command(char *zLine, ShellState *p) { utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); - raw_printf(stderr, "Should be one of: --schema" - " --sha3-224 --sha3-256 --sha3-384 --sha3-512\n"); + showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; } @@ -17417,8 +17492,7 @@ static int do_meta_command(char *zLine, ShellState *p) }else if( strcmp(zTab, "sqlite_stat1")==0 ){ appendText(&sQuery,"SELECT tbl,idx,stat FROM sqlite_stat1" " ORDER BY tbl,idx;", 0); - }else if( strcmp(zTab, "sqlite_stat3")==0 - || strcmp(zTab, "sqlite_stat4")==0 ){ + }else if( strcmp(zTab, "sqlite_stat4")==0 ){ appendText(&sQuery, "SELECT * FROM ", 0); appendText(&sQuery, zTab, 0); appendText(&sQuery, " ORDER BY tbl, idx, rowid;\n", 0); @@ -17650,25 +17724,26 @@ static int do_meta_command(char *zLine, ShellState *p) int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { - { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, - { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, - /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ - /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ - { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, - /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */ - { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, - { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, - { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, - { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, - { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, + { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, + { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, + /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ + /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ + { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, + { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" }, + /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/ + { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, + { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, + { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, + { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, + { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, #ifdef YYCOVERAGE - { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, + { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, #endif - { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, - { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET, "" }, - { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, - { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, - { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE" }, + { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, + { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, + { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, + { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" }, + { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE"}, }; int testctrl = -1; int iCtrl = -1; @@ -17749,6 +17824,27 @@ static int do_meta_command(char *zLine, ShellState *p) } break; + /* sqlite3_test_control(int, int, sqlite3*) */ + case SQLITE_TESTCTRL_PRNG_SEED: + if( nArg==3 || nArg==4 ){ + int ii = (int)integerValue(azArg[2]); + sqlite3 *db; + if( ii==0 && strcmp(azArg[2],"random")==0 ){ + sqlite3_randomness(sizeof(ii),&ii); + printf("-- random seed: %d\n", ii); + } + if( nArg==3 ){ + db = 0; + }else{ + db = p->db; + /* Make sure the schema has been loaded */ + sqlite3_table_column_metadata(db, 0, "x", 0, 0, 0, 0, 0, 0); + } + rc2 = sqlite3_test_control(testctrl, ii, db); + isOk = 3; + } + break; + /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: @@ -17790,7 +17886,7 @@ static int do_meta_command(char *zLine, ShellState *p) } } if( isOk==0 && iCtrl>=0 ){ - utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd, aCtrl[iCtrl].zUsage); + utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ raw_printf(p->out, "%d\n", rc2); @@ -17868,6 +17964,31 @@ static int do_meta_command(char *zLine, ShellState *p) }else #endif /* !defined(SQLITE_OMIT_TRACE) */ +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_VIRTUALTABLE) + if( c=='u' && strncmp(azArg[0], "unmodule", n)==0 ){ + int ii; + int lenOpt; + char *zOpt; + if( nArg<2 ){ + raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n"); + rc = 1; + goto meta_command_exit; + } + open_db(p, 0); + zOpt = azArg[1]; + if( zOpt[0]=='-' && zOpt[1]=='-' && zOpt[2]!=0 ) zOpt++; + lenOpt = (int)strlen(zOpt); + if( lenOpt>=3 && strncmp(zOpt, "-allexcept",lenOpt)==0 ){ + assert( azArg[nArg]==0 ); + sqlite3_drop_modules(p->db, nArg>2 ? (const char**)(azArg+2) : 0); + }else{ + for(ii=1; iidb, azArg[ii], 0, 0); + } + } + }else +#endif + #if SQLITE_USER_AUTHENTICATION if( c=='u' && strncmp(azArg[0], "user", n)==0 ){ if( nArg<2 ){ @@ -17882,7 +18003,8 @@ static int do_meta_command(char *zLine, ShellState *p) rc = 1; goto meta_command_exit; } - rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], strlen30(azArg[3])); + rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], + strlen30(azArg[3])); if( rc ){ utf8_printf(stderr, "Authentication failed for user %s\n", azArg[2]); rc = 1; Modified: stable/11/contrib/sqlite3/sqlite3.c ============================================================================== --- stable/11/contrib/sqlite3/sqlite3.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/sqlite3.c Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.29.0. By combining all the individual C code files into this +** version 3.30.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -331,8 +331,6 @@ static const char * const sqlite3azCompileOpt[] = { #endif #if defined(SQLITE_ENABLE_STAT4) "ENABLE_STAT4", -#elif defined(SQLITE_ENABLE_STAT3) - "ENABLE_STAT3", #endif #if SQLITE_ENABLE_STMTVTAB "ENABLE_STMTVTAB", @@ -1167,9 +1165,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.29.0" -#define SQLITE_VERSION_NUMBER 3029000 -#define SQLITE_SOURCE_ID "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6" +#define SQLITE_VERSION "3.30.1" +#define SQLITE_VERSION_NUMBER 3030001 +#define SQLITE_SOURCE_ID "2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -3137,6 +3135,17 @@ struct sqlite3_mem_methods { ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. ** +** [[SQLITE_DBCONFIG_ENABLE_VIEW]] +**
SQLITE_DBCONFIG_ENABLE_VIEW
+**
^This option is used to enable or disable [CREATE VIEW | views]. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable views, +** positive to enable views or negative to leave the setting unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether views are disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the view setting is not reported back.
+** ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] **
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
**
^This option is used to enable or disable the @@ -3309,7 +3318,8 @@ struct sqlite3_mem_methods { #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ -#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */ +#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ +#define SQLITE_DBCONFIG_MAX 1015 /* Largest DBCONFIG */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes @@ -4858,7 +4868,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int new ** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. +** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. ** ** ** @@ -5893,6 +5903,12 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** perform additional optimizations on deterministic functions, so use ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. ** +** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY] +** flag, which if present prevents the function from being invoked from +** within VIEWs or TRIGGERs. For security reasons, the [SQLITE_DIRECTONLY] +** flag is recommended for any application-defined SQL function that has +** side-effects. +** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** @@ -6009,8 +6025,30 @@ SQLITE_API int sqlite3_create_window_function( ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. +** +** The SQLITE_DETERMINISTIC flag means that the new function will always +** maps the same inputs into the same output. The abs() function is +** deterministic, for example, but randomblob() is not. +** +** The SQLITE_DIRECTONLY flag means that the function may only be invoked +** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is +** a security feature which is recommended for all +** [application-defined SQL functions] that have side-effects. This flag +** prevents an attacker from adding triggers and views to a schema then +** tricking a high-privilege application into causing unintended side-effects +** while performing ordinary queries. +** +** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call +** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. +** Specifying this flag makes no difference for scalar or aggregate user +** functions. However, if it is not specified for a user-defined window +** function, then any sub-types belonging to arguments passed to the window +** function may be discarded before the window function is called (i.e. +** sqlite3_value_subtype() will always return 0). */ -#define SQLITE_DETERMINISTIC 0x800 +#define SQLITE_DETERMINISTIC 0x000000800 +#define SQLITE_DIRECTONLY 0x000080000 +#define SQLITE_SUBTYPE 0x000100000 /* ** CAPI3REF: Deprecated Functions @@ -7656,6 +7694,12 @@ struct sqlite3_index_info { ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. +** +** ^If the third parameter (the pointer to the sqlite3_module object) is +** NULL then no new module is create and any existing modules with the +** same name are dropped. +** +** See also: [sqlite3_drop_modules()] */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ @@ -7672,6 +7716,23 @@ SQLITE_API int sqlite3_create_module_v2( ); /* +** CAPI3REF: Remove Unnecessary Virtual Table Implementations +** METHOD: sqlite3 +** +** ^The sqlite3_drop_modules(D,L) interface removes all virtual +** table modules from database connection D except those named on list L. +** The L parameter must be either NULL or a pointer to an array of pointers +** to strings where the array is terminated by a single NULL pointer. +** ^If the L parameter is NULL, then all virtual table modules are removed. +** +** See also: [sqlite3_create_module()] +*/ +SQLITE_API int sqlite3_drop_modules( + sqlite3 *db, /* Remove modules from this connection */ + const char **azKeep /* Except, do not remove the ones named here */ +); + +/* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** @@ -8379,7 +8440,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 -#define SQLITE_TESTCTRL_PRNG_RESET 7 +#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 @@ -8402,7 +8463,9 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 -#define SQLITE_TESTCTRL_LAST 27 /* Largest TESTCTRL */ +#define SQLITE_TESTCTRL_PRNG_SEED 28 +#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 +#define SQLITE_TESTCTRL_LAST 29 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking @@ -13099,15 +13162,15 @@ struct fts5_api { ** So we have to define the macros in different ways depending on the ** compiler. */ -#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ +#if defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ +# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) +#elif defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) #elif !defined(__GNUC__) /* Works for compilers other than LLVM */ # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) -#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ -# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) #else /* Generates a warning - but it always works */ # define SQLITE_INT_TO_PTR(X) ((void*)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(X)) @@ -13597,100 +13660,103 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_VIEW 79 #define TK_VIRTUAL 80 #define TK_WITH 81 -#define TK_CURRENT 82 -#define TK_FOLLOWING 83 -#define TK_PARTITION 84 -#define TK_PRECEDING 85 -#define TK_RANGE 86 -#define TK_UNBOUNDED 87 -#define TK_EXCLUDE 88 -#define TK_GROUPS 89 -#define TK_OTHERS 90 -#define TK_TIES 91 -#define TK_REINDEX 92 -#define TK_RENAME 93 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Dec 3 13:48:19 2019 Return-Path: Delivered-To: svn-src-stable@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 10A3C1AF7FB; Tue, 3 Dec 2019 13:48:19 +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 47S3GW0NSVz4PQ7; Tue, 3 Dec 2019 13:48:19 +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 E43DA18944; Tue, 3 Dec 2019 13:48:18 +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 xB3DmIG3081653; Tue, 3 Dec 2019 13:48:18 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Dm3cE081632; Tue, 3 Dec 2019 13:48:03 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912031348.xB3Dm3cE081632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 3 Dec 2019 13:48:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355326 - in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Commit-Revision: 355326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 13:48:19 -0000 Author: cy Date: Tue Dec 3 13:47:46 2019 New Revision: 355326 URL: https://svnweb.freebsd.org/changeset/base/355326 Log: MFC r354269: MFV r354257: Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100) Modified: stable/12/contrib/sqlite3/Makefile.msc stable/12/contrib/sqlite3/configure stable/12/contrib/sqlite3/configure.ac stable/12/contrib/sqlite3/shell.c stable/12/contrib/sqlite3/sqlite3.c stable/12/contrib/sqlite3/sqlite3.h stable/12/contrib/sqlite3/sqlite3ext.h stable/12/contrib/sqlite3/tea/configure stable/12/contrib/sqlite3/tea/configure.ac stable/12/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/sqlite3/Makefile.msc stable/11/contrib/sqlite3/configure stable/11/contrib/sqlite3/configure.ac stable/11/contrib/sqlite3/shell.c stable/11/contrib/sqlite3/sqlite3.c stable/11/contrib/sqlite3/sqlite3.h stable/11/contrib/sqlite3/sqlite3ext.h stable/11/contrib/sqlite3/tea/configure stable/11/contrib/sqlite3/tea/configure.ac stable/11/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/sqlite3/Makefile.msc ============================================================================== --- stable/12/contrib/sqlite3/Makefile.msc Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/Makefile.msc Tue Dec 3 13:47:46 2019 (r355326) @@ -73,7 +73,7 @@ API_ARMOR = 0 !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206 -NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706 +NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706 !ENDIF !ENDIF Modified: stable/12/contrib/sqlite3/configure ============================================================================== --- stable/12/contrib/sqlite3/configure Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/configure Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.29.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.30.1. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.29.0' -PACKAGE_STRING='sqlite 3.29.0' +PACKAGE_VERSION='3.30.1' +PACKAGE_STRING='sqlite 3.30.1' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.29.0:";; + short | recursive ) echo "Configuration of sqlite 3.30.1:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.29.0 +sqlite configure 3.30.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.29.0, which was +It was created by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.29.0' + VERSION='3.30.1' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.29.0, which was +This file was extended by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.29.0 +sqlite config.status 3.30.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/12/contrib/sqlite3/configure.ac ============================================================================== --- stable/12/contrib/sqlite3/configure.ac Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/configure.ac Tue Dec 3 13:47:46 2019 (r355326) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.29.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.30.1, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: stable/12/contrib/sqlite3/shell.c ============================================================================== --- stable/12/contrib/sqlite3/shell.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/shell.c Tue Dec 3 13:47:46 2019 (r355326) @@ -9801,12 +9801,12 @@ static void editFunc( } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ - x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_blob(argv[0]), 1, (size_t)sz, f); }else{ const char *z = (const char*)sqlite3_value_text(argv[0]); /* Remember whether or not the value originally contained \r\n */ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1; - x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_text(argv[0]), 1, (size_t)sz, f); } fclose(f); f = 0; @@ -9834,12 +9834,12 @@ static void editFunc( fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); - p = sqlite3_malloc64( sz+(bBin==0) ); + p = sqlite3_malloc64( sz+1 ); if( p==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } - x = fread(p, 1, sz, f); + x = fread(p, 1, (size_t)sz, f); fclose(f); f = 0; if( x!=sz ){ @@ -10311,7 +10311,8 @@ static void eqp_render_level(ShellState *p, int iEqpId for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; - utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); + utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, + pNext ? "|--" : "`--", z); if( n<(int)sizeof(p->sGraph.zPrefix)-7 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); eqp_render_level(p, pRow->iEqpId); @@ -10502,7 +10503,7 @@ static int shell_callback( while( j>0 && IsSpace(z[j-1]) ){ j--; } z[j] = 0; if( strlen30(z)>=79 ){ - for(i=j=0; (c = z[i])!=0; i++){ /* Copy changes from z[i] back to z[j] */ + for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */ if( c==cEnd ){ cEnd = 0; }else if( c=='"' || c=='\'' || c=='`' ){ @@ -11081,7 +11082,7 @@ static int display_stats( raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE, bReset); + iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset); raw_printf(pArg->out, "Reprepare operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset); raw_printf(pArg->out, "Number of times run: %d\n", iCur); @@ -12004,20 +12005,20 @@ static const char *(azHelp[]) = { ".archive ... Manage SQL archives", " Each command must have exactly one of the following options:", " -c, --create Create a new archive", - " -u, --update Add files or update files with changed mtime", - " -i, --insert Like -u but always add even if mtime unchanged", + " -u, --update Add or update files with changed mtime", + " -i, --insert Like -u but always add even if unchanged", " -t, --list List contents of archive", " -x, --extract Extract files from archive", " Optional arguments:", " -v, --verbose Print each filename as it is processed", - " -f FILE, --file FILE Operate on archive FILE (default is current db)", - " -a FILE, --append FILE Operate on FILE opened using the apndvfs VFS", - " -C DIR, --directory DIR Change to directory DIR to read/extract files", + " -f FILE, --file FILE Use archive FILE (default is current db)", + " -a FILE, --append FILE Open FILE using the apndvfs VFS", + " -C DIR, --directory DIR Read/extract files from directory DIR", " -n, --dryrun Show the SQL that would have occurred", " Examples:", - " .ar -cf archive.sar foo bar # Create archive.sar from files foo and bar", - " .ar -tf archive.sar # List members of archive.sar", - " .ar -xvf archive.sar # Verbosely extract files from archive.sar", + " .ar -cf ARCHIVE foo bar # Create ARCHIVE from files foo and bar", + " .ar -tf ARCHIVE # List members of ARCHIVE", + " .ar -xvf ARCHIVE # Verbosely extract files from ARCHIVE", " See also:", " http://sqlite.org/cli.html#sqlar_archive_support", #endif @@ -12026,7 +12027,7 @@ static const char *(azHelp[]) = { #endif ".backup ?DB? FILE Backup DB (default \"main\") to FILE", " --append Use the appendvfs", - " --async Write to FILE without a journal and without fsync()", + " --async Write to FILE without journal and fsync()", ".bail on|off Stop after hitting an error. Default OFF", ".binary on|off Turn binary output on or off. Default OFF", ".cd DIRECTORY Change the working directory to DIRECTORY", @@ -12046,15 +12047,15 @@ static const char *(azHelp[]) = { " Other Modes:", #ifdef SQLITE_DEBUG " test Show raw EXPLAIN QUERY PLAN output", - " trace Like \"full\" but also enable \"PRAGMA vdbe_trace\"", + " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"", #endif " trigger Like \"full\" but also show trigger bytecode", - ".excel Display the output of next command in a spreadsheet", + ".excel Display the output of next command in spreadsheet", ".exit ?CODE? Exit this program with return-code CODE", - ".expert EXPERIMENTAL. Suggest indexes for specified queries", + ".expert EXPERIMENTAL. Suggest indexes for queries", /* Because explain mode comes on automatically now, the ".explain" mode -** is removed from the help screen. It is still supported for legacy, however */ -/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic",*/ +** is removed from the help screen. It is still supported for legacy, however */ +/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off",*/ ".filectrl CMD ... Run various sqlite3_file_control() operations", " Run \".filectrl\" with no arguments for details", ".fullschema ?--indent? Show schema and the content of sqlite_stat tables", @@ -12101,7 +12102,7 @@ static const char *(azHelp[]) = { " --append Use appendvfs to append database to the end of FILE", #ifdef SQLITE_ENABLE_DESERIALIZE " --deserialize Load into memory useing sqlite3_deserialize()", - " --hexdb Load the output of \"dbtotxt\" as an in-memory database", + " --hexdb Load the output of \"dbtotxt\" as an in-memory db", " --maxsize N Maximum size for --hexdb or --deserialized database", #endif " --new Initialize FILE to an empty database", @@ -12114,7 +12115,7 @@ static const char *(azHelp[]) = { " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", - " PARAMETER should start with '$', ':', '@', or '?'", + " PARAMETER should start with one of: $ : @ ?", " unset PARAMETER Remove PARAMETER from the binding table", ".print STRING... Print literal STRING", #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -12129,6 +12130,11 @@ static const char *(azHelp[]) = { ".read FILE Read input from FILE", #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ".recover Recover as much data as possible from corrupt db.", + " --freelist-corrupt Assume the freelist is corrupt", + " --recovery-db NAME Store recovery metadata in database file NAME", + " --lost-and-found TABLE Alternative name for the lost-and-found table", + " --no-rowids Do not attempt to recover rowid values", + " that are not also INTEGER PRIMARY KEYs", #endif ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE", ".save FILE Write in-memory database into FILE", @@ -12160,7 +12166,7 @@ static const char *(azHelp[]) = { " Options:", " --schema Also hash the sqlite_master table", " --sha3-224 Use the sha3-224 algorithm", - " --sha3-256 Use the sha3-256 algorithm. This is the default.", + " --sha3-256 Use the sha3-256 algorithm (default)", " --sha3-384 Use the sha3-384 algorithm", " --sha3-512 Use the sha3-512 algorithm", " Any other argument is a LIKE pattern for tables to hash", @@ -12194,6 +12200,10 @@ static const char *(azHelp[]) = { " --row Trace each row (SQLITE_TRACE_ROW)", " --close Trace connection close (SQLITE_TRACE_CLOSE)", #endif /* SQLITE_OMIT_TRACE */ +#ifdef SQLITE_DEBUG + ".unmodule NAME ... Unregister virtual table modules", + " --allexcept Unregister everything except those named", +#endif ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", @@ -12436,6 +12446,8 @@ static unsigned char *readHexDb(ShellState *p, int *pn rc = sscanf(zLine, "| size %d pagesize %d", &n, &pgsz); if( rc!=2 ) goto readHexDb_error; if( n<0 ) goto readHexDb_error; + if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error; + n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */ a = sqlite3_malloc( n ? n : 1 ); if( a==0 ){ utf8_printf(stderr, "Out of memory!\n"); @@ -12521,6 +12533,23 @@ static void shellInt32( } /* +** Scalar function "shell_idquote(X)" returns string X quoted as an identifier, +** using "..." with internal double-quote characters doubled. +*/ +static void shellIdQuote( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const char *zName = (const char*)sqlite3_value_text(argv[0]); + UNUSED_PARAMETER(argc); + if( zName ){ + char *z = sqlite3_mprintf("\"%w\"", zName); + sqlite3_result_text(context, z, -1, sqlite3_free); + } +} + +/* ** Scalar function "shell_escape_crnl" used by the .recover command. ** The argument passed to this function is the output of built-in ** function quote(). If the first character of the input is "'", @@ -12696,6 +12725,8 @@ static void open_db(ShellState *p, int openFlags){ shellEscapeCrnl, 0, 0); sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0, shellInt32, 0, 0); + sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); #ifndef SQLITE_NOHAVE_SYSTEM sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0, editFunc, 0, 0); @@ -14043,7 +14074,7 @@ void shellReset( #endif /* !defined SQLITE_OMIT_VIRTUALTABLE */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) -/********************************************************************************* +/****************************************************************************** ** The ".archive" or ".ar" command. */ /* @@ -14241,7 +14272,8 @@ static int arParseCommand( i = n; }else{ if( iArg>=(nArg-1) ){ - return arErrorMsg(pAr, "option requires an argument: %c",z[i]); + return arErrorMsg(pAr, "option requires an argument: %c", + z[i]); } zArg = azArg[++iArg]; } @@ -14629,10 +14661,10 @@ end_ar_transaction: ** Implementation of ".ar" dot command. */ static int arDotCommand( - ShellState *pState, /* Current shell tool state */ - int fromCmdLine, /* True if -A command-line option, not .ar cmd */ - char **azArg, /* Array of arguments passed to dot command */ - int nArg /* Number of entries in azArg[] */ + ShellState *pState, /* Current shell tool state */ + int fromCmdLine, /* True if -A command-line option, not .ar cmd */ + char **azArg, /* Array of arguments passed to dot command */ + int nArg /* Number of entries in azArg[] */ ){ ArCommand cmd; int rc; @@ -14732,7 +14764,7 @@ end_ar_command: return rc; } /* End of the ".archive" or ".ar" command logic -**********************************************************************************/ +*******************************************************************************/ #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) @@ -14874,6 +14906,10 @@ static RecoverTable *recoverNewTable( rc = sqlite3_open("", &dbtmp); if( rc==SQLITE_OK ){ + sqlite3_create_function(dbtmp, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); + } + if( rc==SQLITE_OK ){ rc = sqlite3_exec(dbtmp, "PRAGMA writable_schema = on", 0, 0, 0); } if( rc==SQLITE_OK ){ @@ -14929,18 +14965,18 @@ static RecoverTable *recoverNewTable( } } - pTab->zQuoted = shellMPrintf(&rc, "%Q", zName); + pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName); pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1)); pTab->nCol = nSqlCol; if( bIntkey ){ - pTab->azlCol[0] = shellMPrintf(&rc, "%Q", zPk); + pTab->azlCol[0] = shellMPrintf(&rc, "\"%w\"", zPk); }else{ pTab->azlCol[0] = shellMPrintf(&rc, ""); } i = 1; shellPreparePrintf(dbtmp, &rc, &pStmt, - "SELECT %Q || group_concat(name, ', ') " + "SELECT %Q || group_concat(shell_idquote(name), ', ') " " FILTER (WHERE cid!=%d) OVER (ORDER BY %s cid) " "FROM pragma_table_info(%Q)", bIntkey ? ", " : "", pTab->iPk, @@ -15054,7 +15090,7 @@ static RecoverTable *recoverOrphanTable( pTab = (RecoverTable*)shellMalloc(pRc, sizeof(RecoverTable)); if( pTab ){ - pTab->zQuoted = shellMPrintf(pRc, "%Q", zTab); + pTab->zQuoted = shellMPrintf(pRc, "\"%w\"", zTab); pTab->nCol = nCol; pTab->iPk = -2; if( nCol>0 ){ @@ -15103,6 +15139,7 @@ static int recoverDatabaseCmd(ShellState *pState, int RecoverTable *pOrphan = 0; int bFreelist = 1; /* 0 if --freelist-corrupt is specified */ + int bRowids = 1; /* 0 if --no-rowids */ for(i=1; iout, azArg[0]); return 1; } } @@ -15132,6 +15169,7 @@ static int recoverDatabaseCmd(ShellState *pState, int shellExecPrintf(pState->db, &rc, /* Attach an in-memory database named 'recovery'. Create an indexed ** cache of the sqlite_dbptr virtual table. */ + "PRAGMA writable_schema = on;" "ATTACH %Q AS recovery;" "DROP TABLE IF EXISTS recovery.dbptr;" "DROP TABLE IF EXISTS recovery.freelist;" @@ -15162,7 +15200,22 @@ static int recoverDatabaseCmd(ShellState *pState, int ); } + /* If this is an auto-vacuum database, add all pointer-map pages to + ** the freelist table. Do this regardless of whether or not + ** --freelist-corrupt was specified. */ shellExec(pState->db, &rc, + "WITH ptrmap(pgno) AS (" + " SELECT 2 WHERE shell_int32(" + " (SELECT data FROM sqlite_dbpage WHERE pgno=1), 13" + " )" + " UNION ALL " + " SELECT pgno+1+(SELECT page_size FROM pragma_page_size)/5 AS pp " + " FROM ptrmap WHERE pp<=(SELECT page_count FROM pragma_page_count)" + ")" + "REPLACE INTO recovery.freelist SELECT pgno FROM ptrmap" + ); + + shellExec(pState->db, &rc, "CREATE TABLE recovery.dbptr(" " pgno, child, PRIMARY KEY(child, pgno)" ") WITHOUT ROWID;" @@ -15210,7 +15263,7 @@ static int recoverDatabaseCmd(ShellState *pState, int " )" " SELECT pgno FROM p WHERE (parent IS NULL OR pgno = orig)" ") " - "FROM pages WHERE maxlen > 0 AND i NOT IN freelist;" + "FROM pages WHERE maxlen IS NOT NULL AND i NOT IN freelist;" "UPDATE recovery.map AS o SET intkey = (" " SELECT substr(data, 1, 1)==X'0D' FROM sqlite_dbpage WHERE pgno=o.pgno" ");" @@ -15235,6 +15288,11 @@ static int recoverDatabaseCmd(ShellState *pState, int ** CREATE TABLE statements that extracted from the existing schema. */ if( rc==SQLITE_OK ){ sqlite3_stmt *pStmt = 0; + /* ".recover" might output content in an order which causes immediate + ** foreign key constraints to be violated. So disable foreign-key + ** constraint enforcement to prevent problems when running the output + ** script. */ + raw_printf(pState->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(pState->out, "BEGIN;\n"); raw_printf(pState->out, "PRAGMA writable_schema = on;\n"); shellPrepare(pState->db, &rc, @@ -15265,8 +15323,12 @@ static int recoverDatabaseCmd(ShellState *pState, int shellPrepare(pState->db, &rc, "SELECT pgno FROM recovery.map WHERE root=?", &pPages ); + shellPrepare(pState->db, &rc, - "SELECT max(field), group_concat(shell_escape_crnl(quote(value)), ', ')" + "SELECT max(field), group_concat(shell_escape_crnl(quote" + "(case when (? AND field<0) then NULL else value end)" + "), ', ')" + ", min(field) " "FROM sqlite_dbdata WHERE pgno = ? AND field != ?" "GROUP BY cell", &pCells ); @@ -15285,6 +15347,7 @@ static int recoverDatabaseCmd(ShellState *pState, int int bNoop = 0; RecoverTable *pTab; + assert( bIntkey==0 || bIntkey==1 ); pTab = recoverFindTable(pState, &rc, iRoot, bIntkey, nCol, &bNoop); if( bNoop || rc ) continue; if( pTab==0 ){ @@ -15295,29 +15358,44 @@ static int recoverDatabaseCmd(ShellState *pState, int if( pTab==0 ) break; } - if( 0==sqlite3_stricmp(pTab->zQuoted, "'sqlite_sequence'") ){ + if( 0==sqlite3_stricmp(pTab->zQuoted, "\"sqlite_sequence\"") ){ raw_printf(pState->out, "DELETE FROM sqlite_sequence;\n"); } sqlite3_bind_int(pPages, 1, iRoot); - sqlite3_bind_int(pCells, 2, pTab->iPk); + if( bRowids==0 && pTab->iPk<0 ){ + sqlite3_bind_int(pCells, 1, 1); + }else{ + sqlite3_bind_int(pCells, 1, 0); + } + sqlite3_bind_int(pCells, 3, pTab->iPk); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPages) ){ int iPgno = sqlite3_column_int(pPages, 0); - sqlite3_bind_int(pCells, 1, iPgno); + sqlite3_bind_int(pCells, 2, iPgno); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pCells) ){ int nField = sqlite3_column_int(pCells, 0); + int iMin = sqlite3_column_int(pCells, 2); const char *zVal = (const char*)sqlite3_column_text(pCells, 1); + RecoverTable *pTab2 = pTab; + if( pTab!=pOrphan && (iMin<0)!=bIntkey ){ + if( pOrphan==0 ){ + pOrphan = recoverOrphanTable(pState, &rc, zLostAndFound, nOrphan); + } + pTab2 = pOrphan; + if( pTab2==0 ) break; + } + nField = nField+1; - if( pTab==pOrphan ){ + if( pTab2==pOrphan ){ raw_printf(pState->out, "INSERT INTO %s VALUES(%d, %d, %d, %s%s%s);\n", - pTab->zQuoted, iRoot, iPgno, nField, - bIntkey ? "" : "NULL, ", zVal, pTab->azlCol[nField] + pTab2->zQuoted, iRoot, iPgno, nField, + iMin<0 ? "" : "NULL, ", zVal, pTab2->azlCol[nField] ); }else{ raw_printf(pState->out, "INSERT INTO %s(%s) VALUES( %s );\n", - pTab->zQuoted, pTab->azlCol[nField], zVal + pTab2->zQuoted, pTab2->azlCol[nField], zVal ); } } @@ -15376,7 +15454,7 @@ static int do_meta_command(char *zLine, ShellState *p) int nArg = 0; int n, c; int rc = 0; - char *azArg[50]; + char *azArg[52]; #ifndef SQLITE_OMIT_VIRTUALTABLE if( p->expert.pExpert ){ @@ -15386,7 +15464,7 @@ static int do_meta_command(char *zLine, ShellState *p) /* Parse the input line into tokens. */ - while( zLine[h] && nArgout, "ANALYZE sqlite_master;\n"); @@ -16615,12 +16693,8 @@ static int do_meta_command(char *zLine, ShellState *p) ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && strcmp(azArg[1],"clear")==0 ){ - int wrSchema = 0; - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", 0, 0, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); }else /* .parameter list @@ -16933,7 +17007,7 @@ static int do_meta_command(char *zLine, ShellState *p) zDiv = " UNION ALL "; appendText(&sSelect, "SELECT shell_add_schema(sql,", 0); if( sqlite3_stricmp(zDb, "main")!=0 ){ - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, '\''); }else{ appendText(&sSelect, "NULL", 0); } @@ -16942,15 +17016,16 @@ static int do_meta_command(char *zLine, ShellState *p) appendText(&sSelect, " AS snum, ", 0); appendText(&sSelect, zDb, '\''); appendText(&sSelect, " AS sname FROM ", 0); - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, quoteChar(zDb)); appendText(&sSelect, ".sqlite_master", 0); } sqlite3_finalize(pStmt); -#ifdef SQLITE_INTROSPECTION_PRAGMAS +#ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS if( zName ){ appendText(&sSelect, " UNION ALL SELECT shell_module_schema(name)," - " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", 0); + " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", + 0); } #endif appendText(&sSelect, ") WHERE ", 0); @@ -17049,7 +17124,8 @@ static int do_meta_command(char *zLine, ShellState *p) if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ - utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", azCmd[1]); + utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", + azCmd[1]); }else{ int szChng; void *pChng; @@ -17370,8 +17446,7 @@ static int do_meta_command(char *zLine, ShellState *p) { utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); - raw_printf(stderr, "Should be one of: --schema" - " --sha3-224 --sha3-256 --sha3-384 --sha3-512\n"); + showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; } @@ -17417,8 +17492,7 @@ static int do_meta_command(char *zLine, ShellState *p) }else if( strcmp(zTab, "sqlite_stat1")==0 ){ appendText(&sQuery,"SELECT tbl,idx,stat FROM sqlite_stat1" " ORDER BY tbl,idx;", 0); - }else if( strcmp(zTab, "sqlite_stat3")==0 - || strcmp(zTab, "sqlite_stat4")==0 ){ + }else if( strcmp(zTab, "sqlite_stat4")==0 ){ appendText(&sQuery, "SELECT * FROM ", 0); appendText(&sQuery, zTab, 0); appendText(&sQuery, " ORDER BY tbl, idx, rowid;\n", 0); @@ -17650,25 +17724,26 @@ static int do_meta_command(char *zLine, ShellState *p) int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { - { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, - { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, - /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ - /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ - { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, - /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */ - { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, - { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, - { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, - { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, - { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, + { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, + { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, + /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ + /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ + { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, + { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" }, + /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/ + { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, + { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, + { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, + { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, + { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, #ifdef YYCOVERAGE - { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, + { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, #endif - { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, - { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET, "" }, - { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, - { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, - { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE" }, + { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, + { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, + { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, + { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" }, + { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE"}, }; int testctrl = -1; int iCtrl = -1; @@ -17749,6 +17824,27 @@ static int do_meta_command(char *zLine, ShellState *p) } break; + /* sqlite3_test_control(int, int, sqlite3*) */ + case SQLITE_TESTCTRL_PRNG_SEED: + if( nArg==3 || nArg==4 ){ + int ii = (int)integerValue(azArg[2]); + sqlite3 *db; + if( ii==0 && strcmp(azArg[2],"random")==0 ){ + sqlite3_randomness(sizeof(ii),&ii); + printf("-- random seed: %d\n", ii); + } + if( nArg==3 ){ + db = 0; + }else{ + db = p->db; + /* Make sure the schema has been loaded */ + sqlite3_table_column_metadata(db, 0, "x", 0, 0, 0, 0, 0, 0); + } + rc2 = sqlite3_test_control(testctrl, ii, db); + isOk = 3; + } + break; + /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: @@ -17790,7 +17886,7 @@ static int do_meta_command(char *zLine, ShellState *p) } } if( isOk==0 && iCtrl>=0 ){ - utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd, aCtrl[iCtrl].zUsage); + utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ raw_printf(p->out, "%d\n", rc2); @@ -17868,6 +17964,31 @@ static int do_meta_command(char *zLine, ShellState *p) }else #endif /* !defined(SQLITE_OMIT_TRACE) */ +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_VIRTUALTABLE) + if( c=='u' && strncmp(azArg[0], "unmodule", n)==0 ){ + int ii; + int lenOpt; + char *zOpt; + if( nArg<2 ){ + raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n"); + rc = 1; + goto meta_command_exit; + } + open_db(p, 0); + zOpt = azArg[1]; + if( zOpt[0]=='-' && zOpt[1]=='-' && zOpt[2]!=0 ) zOpt++; + lenOpt = (int)strlen(zOpt); + if( lenOpt>=3 && strncmp(zOpt, "-allexcept",lenOpt)==0 ){ + assert( azArg[nArg]==0 ); + sqlite3_drop_modules(p->db, nArg>2 ? (const char**)(azArg+2) : 0); + }else{ + for(ii=1; iidb, azArg[ii], 0, 0); + } + } + }else +#endif + #if SQLITE_USER_AUTHENTICATION if( c=='u' && strncmp(azArg[0], "user", n)==0 ){ if( nArg<2 ){ @@ -17882,7 +18003,8 @@ static int do_meta_command(char *zLine, ShellState *p) rc = 1; goto meta_command_exit; } - rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], strlen30(azArg[3])); + rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], + strlen30(azArg[3])); if( rc ){ utf8_printf(stderr, "Authentication failed for user %s\n", azArg[2]); rc = 1; Modified: stable/12/contrib/sqlite3/sqlite3.c ============================================================================== --- stable/12/contrib/sqlite3/sqlite3.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/sqlite3.c Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.29.0. By combining all the individual C code files into this +** version 3.30.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -331,8 +331,6 @@ static const char * const sqlite3azCompileOpt[] = { #endif #if defined(SQLITE_ENABLE_STAT4) "ENABLE_STAT4", -#elif defined(SQLITE_ENABLE_STAT3) - "ENABLE_STAT3", #endif #if SQLITE_ENABLE_STMTVTAB "ENABLE_STMTVTAB", @@ -1167,9 +1165,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.29.0" -#define SQLITE_VERSION_NUMBER 3029000 -#define SQLITE_SOURCE_ID "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6" +#define SQLITE_VERSION "3.30.1" +#define SQLITE_VERSION_NUMBER 3030001 +#define SQLITE_SOURCE_ID "2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -3137,6 +3135,17 @@ struct sqlite3_mem_methods { ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back.
** +** [[SQLITE_DBCONFIG_ENABLE_VIEW]] +**
SQLITE_DBCONFIG_ENABLE_VIEW
+**
^This option is used to enable or disable [CREATE VIEW | views]. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable views, +** positive to enable views or negative to leave the setting unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether views are disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the view setting is not reported back.
+** ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] **
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
**
^This option is used to enable or disable the @@ -3309,7 +3318,8 @@ struct sqlite3_mem_methods { #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ -#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */ +#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ +#define SQLITE_DBCONFIG_MAX 1015 /* Largest DBCONFIG */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes @@ -4858,7 +4868,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int new ** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. +** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. ** ** ** @@ -5893,6 +5903,12 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** perform additional optimizations on deterministic functions, so use ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. ** +** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY] +** flag, which if present prevents the function from being invoked from +** within VIEWs or TRIGGERs. For security reasons, the [SQLITE_DIRECTONLY] +** flag is recommended for any application-defined SQL function that has +** side-effects. +** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** @@ -6009,8 +6025,30 @@ SQLITE_API int sqlite3_create_window_function( ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. +** +** The SQLITE_DETERMINISTIC flag means that the new function will always +** maps the same inputs into the same output. The abs() function is +** deterministic, for example, but randomblob() is not. +** +** The SQLITE_DIRECTONLY flag means that the function may only be invoked +** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is +** a security feature which is recommended for all +** [application-defined SQL functions] that have side-effects. This flag +** prevents an attacker from adding triggers and views to a schema then +** tricking a high-privilege application into causing unintended side-effects +** while performing ordinary queries. +** +** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call +** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. +** Specifying this flag makes no difference for scalar or aggregate user +** functions. However, if it is not specified for a user-defined window +** function, then any sub-types belonging to arguments passed to the window +** function may be discarded before the window function is called (i.e. +** sqlite3_value_subtype() will always return 0). */ -#define SQLITE_DETERMINISTIC 0x800 +#define SQLITE_DETERMINISTIC 0x000000800 +#define SQLITE_DIRECTONLY 0x000080000 +#define SQLITE_SUBTYPE 0x000100000 /* ** CAPI3REF: Deprecated Functions @@ -7656,6 +7694,12 @@ struct sqlite3_index_info { ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. +** +** ^If the third parameter (the pointer to the sqlite3_module object) is +** NULL then no new module is create and any existing modules with the +** same name are dropped. +** +** See also: [sqlite3_drop_modules()] */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ @@ -7672,6 +7716,23 @@ SQLITE_API int sqlite3_create_module_v2( ); /* +** CAPI3REF: Remove Unnecessary Virtual Table Implementations +** METHOD: sqlite3 +** +** ^The sqlite3_drop_modules(D,L) interface removes all virtual +** table modules from database connection D except those named on list L. +** The L parameter must be either NULL or a pointer to an array of pointers +** to strings where the array is terminated by a single NULL pointer. +** ^If the L parameter is NULL, then all virtual table modules are removed. +** +** See also: [sqlite3_create_module()] +*/ +SQLITE_API int sqlite3_drop_modules( + sqlite3 *db, /* Remove modules from this connection */ + const char **azKeep /* Except, do not remove the ones named here */ +); + +/* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** @@ -8379,7 +8440,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 -#define SQLITE_TESTCTRL_PRNG_RESET 7 +#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 @@ -8402,7 +8463,9 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 -#define SQLITE_TESTCTRL_LAST 27 /* Largest TESTCTRL */ +#define SQLITE_TESTCTRL_PRNG_SEED 28 +#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 +#define SQLITE_TESTCTRL_LAST 29 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking @@ -13099,15 +13162,15 @@ struct fts5_api { ** So we have to define the macros in different ways depending on the ** compiler. */ -#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ +#if defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ +# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) +#elif defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) #elif !defined(__GNUC__) /* Works for compilers other than LLVM */ # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) -#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ -# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) #else /* Generates a warning - but it always works */ # define SQLITE_INT_TO_PTR(X) ((void*)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(X)) @@ -13597,100 +13660,103 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_VIEW 79 #define TK_VIRTUAL 80 #define TK_WITH 81 -#define TK_CURRENT 82 -#define TK_FOLLOWING 83 -#define TK_PARTITION 84 -#define TK_PRECEDING 85 -#define TK_RANGE 86 -#define TK_UNBOUNDED 87 -#define TK_EXCLUDE 88 -#define TK_GROUPS 89 -#define TK_OTHERS 90 -#define TK_TIES 91 -#define TK_REINDEX 92 -#define TK_RENAME 93 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Dec 3 14:47:50 2019 Return-Path: Delivered-To: svn-src-stable@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 F14061B14CA; Tue, 3 Dec 2019 14:47:50 +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 47S4bB670Rz4SXy; Tue, 3 Dec 2019 14:47:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B57A91940F; Tue, 3 Dec 2019 14:47:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Elo76017761; Tue, 3 Dec 2019 14:47:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3EloFR017759; Tue, 3 Dec 2019 14:47:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031447.xB3EloFR017759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 14:47:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355328 - in stable/12/sys/dev: ahci usb/controller X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/dev: ahci usb/controller X-SVN-Commit-Revision: 355328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 14:47:51 -0000 Author: mav Date: Tue Dec 3 14:47:50 2019 New Revision: 355328 URL: https://svnweb.freebsd.org/changeset/base/355328 Log: MFC r355113: Add some IDs of Intel Wildcat Point-LP. Modified: stable/12/sys/dev/ahci/ahci_pci.c stable/12/sys/dev/usb/controller/ehci_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:46:38 2019 (r355327) +++ stable/12/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:47:50 2019 (r355328) @@ -212,6 +212,10 @@ static const struct { {0x9c078086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0e8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0f8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c838086, 0x00, "Intel Wildcat Point-LP", 0}, + {0x9c858086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c878086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c8f8086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, {0x9d038086, 0x00, "Intel Sunrise Point-LP", 0}, {0x9d058086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, {0x9d078086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, Modified: stable/12/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/12/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:46:38 2019 (r355327) +++ stable/12/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:47:50 2019 (r355328) @@ -182,6 +182,8 @@ ehci_pci_match(device_t self) return ("Intel Wellsburg USB 2.0 controller"); case 0x9c268086: return ("Intel Lynx Point-LP USB 2.0 controller"); + case 0x9ca68086: + return ("Intel Wildcat Point-LP USB 2.0 controller"); case 0x00e01033: return ("NEC uPD 72010x USB 2.0 controller"); From owner-svn-src-stable@freebsd.org Tue Dec 3 14:48:14 2019 Return-Path: Delivered-To: svn-src-stable@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 314A61B156B; Tue, 3 Dec 2019 14:48:14 +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 47S4bf0ZGZz4Sfw; Tue, 3 Dec 2019 14:48:14 +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 EB19A19410; Tue, 3 Dec 2019 14:48:13 +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 xB3EmDH6017837; Tue, 3 Dec 2019 14:48:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3EmD2S017835; Tue, 3 Dec 2019 14:48:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031448.xB3EmD2S017835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 14:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355329 - in stable/11/sys/dev: ahci usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: ahci usb/controller X-SVN-Commit-Revision: 355329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 14:48:14 -0000 Author: mav Date: Tue Dec 3 14:48:13 2019 New Revision: 355329 URL: https://svnweb.freebsd.org/changeset/base/355329 Log: MFC r355113: Add some IDs of Intel Wildcat Point-LP. Modified: stable/11/sys/dev/ahci/ahci_pci.c stable/11/sys/dev/usb/controller/ehci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:47:50 2019 (r355328) +++ stable/11/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:48:13 2019 (r355329) @@ -212,6 +212,10 @@ static const struct { {0x9c078086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0e8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0f8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c838086, 0x00, "Intel Wildcat Point-LP", 0}, + {0x9c858086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c878086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c8f8086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, {0x9d038086, 0x00, "Intel Sunrise Point-LP", 0}, {0x9d058086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, {0x9d078086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, Modified: stable/11/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:47:50 2019 (r355328) +++ stable/11/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:48:13 2019 (r355329) @@ -180,6 +180,8 @@ ehci_pci_match(device_t self) return ("Intel Wellsburg USB 2.0 controller"); case 0x9c268086: return ("Intel Lynx Point-LP USB 2.0 controller"); + case 0x9ca68086: + return ("Intel Wildcat Point-LP USB 2.0 controller"); case 0x00e01033: return ("NEC uPD 72010x USB 2.0 controller"); From owner-svn-src-stable@freebsd.org Tue Dec 3 16:32:31 2019 Return-Path: Delivered-To: svn-src-stable@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 6FAC61B4AA8; Tue, 3 Dec 2019 16:32:31 +0000 (UTC) (envelope-from cognet@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 47S6vz2P4Zz4Zjr; Tue, 3 Dec 2019 16:32:31 +0000 (UTC) (envelope-from cognet@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 358D11A806; Tue, 3 Dec 2019 16:32:31 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3GWVb9083447; Tue, 3 Dec 2019 16:32:31 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GWVuU083446; Tue, 3 Dec 2019 16:32:31 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201912031632.xB3GWVuU083446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Tue, 3 Dec 2019 16:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355331 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 355331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:32:31 -0000 Author: cognet Date: Tue Dec 3 16:32:30 2019 New Revision: 355331 URL: https://svnweb.freebsd.org/changeset/base/355331 Log: MFC r354602 linprocfs: Make sure to report -1 as tty when we have no controlling tty. When reporting a process' stats, we can't just provide the tty as an unsigned long, as if we have no controlling tty, the tty would be NODEV, or -1. Instaed, just special-case NODEV. Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Tue Dec 3 15:48:28 2019 (r355330) +++ stable/12/sys/compat/linprocfs/linprocfs.c Tue Dec 3 16:32:30 2019 (r355331) @@ -737,7 +737,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + if (kp.ki_tdev == NODEV) + PS_ADD("tty", "%s", "-1"); + else + PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt); From owner-svn-src-stable@freebsd.org Tue Dec 3 16:33:35 2019 Return-Path: Delivered-To: svn-src-stable@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 D24011B4B36; Tue, 3 Dec 2019 16:33:35 +0000 (UTC) (envelope-from cognet@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 47S6xC5BSZz4ZrJ; Tue, 3 Dec 2019 16:33:35 +0000 (UTC) (envelope-from cognet@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 951A11A80A; Tue, 3 Dec 2019 16:33:35 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3GXZXa083574; Tue, 3 Dec 2019 16:33:35 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GXZ6q083573; Tue, 3 Dec 2019 16:33:35 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201912031633.xB3GXZ6q083573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Tue, 3 Dec 2019 16:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355332 - stable/11/sys/compat/linprocfs X-SVN-Group: stable-11 X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: stable/11/sys/compat/linprocfs X-SVN-Commit-Revision: 355332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:33:35 -0000 Author: cognet Date: Tue Dec 3 16:33:35 2019 New Revision: 355332 URL: https://svnweb.freebsd.org/changeset/base/355332 Log: MFC r354602 linprocfs: Make sure to report -1 as tty when we have no controlling tty. When reporting a process' stats, we can't just provide the tty as an unsigned long, as if we have no controlling tty, the tty would be NODEV, or -1. Instaed, just special-case NODEV. Modified: stable/11/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/11/sys/compat/linprocfs/linprocfs.c Tue Dec 3 16:32:30 2019 (r355331) +++ stable/11/sys/compat/linprocfs/linprocfs.c Tue Dec 3 16:33:35 2019 (r355332) @@ -618,7 +618,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + if (kp.ki_tdev == NODEV) + PS_ADD("tty", "%s", "-1"); + else + PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt); From owner-svn-src-stable@freebsd.org Tue Dec 3 16:42:33 2019 Return-Path: Delivered-To: svn-src-stable@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 929861B4E5E; Tue, 3 Dec 2019 16:42:33 +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 47S77Y3QJZz4bHg; Tue, 3 Dec 2019 16:42:33 +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 58AB11A9C3; Tue, 3 Dec 2019 16:42:33 +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 xB3GgXU7089747; Tue, 3 Dec 2019 16:42:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GgXRD089746; Tue, 3 Dec 2019 16:42:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031642.xB3GgXRD089746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355333 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 355333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:42:33 -0000 Author: mav Date: Tue Dec 3 16:42:32 2019 New Revision: 355333 URL: https://svnweb.freebsd.org/changeset/base/355333 Log: MFC r341756 (by scottl): Don't allocate the config_intrhook separately from the softc, it's small enough that it costs more code to handle the malloc/free than it saves. Modified: stable/12/sys/cam/cam_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:33:35 2019 (r355332) +++ stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:42:32 2019 (r355333) @@ -129,7 +129,7 @@ struct xpt_softc { TAILQ_HEAD(,cam_eb) xpt_busses; u_int bus_generation; - struct intr_config_hook *xpt_config_hook; + struct intr_config_hook xpt_config_hook; int boot_delay; struct callout boot_callout; @@ -982,17 +982,8 @@ xpt_init(void *dummy) /* * Register a callback for when interrupts are enabled. */ - xsoftc.xpt_config_hook = - (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook), - M_CAMXPT, M_NOWAIT | M_ZERO); - if (xsoftc.xpt_config_hook == NULL) { - printf("xpt_init: Cannot malloc config hook " - "- failing attach\n"); - return (ENOMEM); - } - xsoftc.xpt_config_hook->ich_func = xpt_config; - if (config_intrhook_establish(xsoftc.xpt_config_hook) != 0) { - free (xsoftc.xpt_config_hook, M_CAMXPT); + xsoftc.xpt_config_hook.ich_func = xpt_config; + if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) { printf("xpt_init: config_intrhook_establish failed " "- failing attach\n"); } @@ -5262,9 +5253,7 @@ xpt_finishconfig_task(void *context, int pending) xpt_for_all_devices(xptpassannouncefunc, NULL); /* Release our hook so that the boot can continue. */ - config_intrhook_disestablish(xsoftc.xpt_config_hook); - free(xsoftc.xpt_config_hook, M_CAMXPT); - xsoftc.xpt_config_hook = NULL; + config_intrhook_disestablish(&xsoftc.xpt_config_hook); free(context, M_CAMXPT); } From owner-svn-src-stable@freebsd.org Tue Dec 3 16:46:45 2019 Return-Path: Delivered-To: svn-src-stable@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 4DBBA1B5071; Tue, 3 Dec 2019 16:46:45 +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 47S7DP1PpZz4bbT; Tue, 3 Dec 2019 16:46:45 +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 14D861A9E9; Tue, 3 Dec 2019 16:46:45 +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 xB3Gki1i090049; Tue, 3 Dec 2019 16:46:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GkiB6090048; Tue, 3 Dec 2019 16:46:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031646.xB3GkiB6090048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355335 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 355335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:46:45 -0000 Author: mav Date: Tue Dec 3 16:46:44 2019 New Revision: 355335 URL: https://svnweb.freebsd.org/changeset/base/355335 Log: MFC r354914: Set handling for some "Logical unit not ready" errors. Modified: stable/12/sys/cam/scsi/scsi_all.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_all.c Tue Dec 3 16:45:53 2019 (r355334) +++ stable/12/sys/cam/scsi/scsi_all.c Tue Dec 3 16:46:44 2019 (r355335) @@ -1112,7 +1112,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x08, SS_FATAL | EBUSY, "Logical unit not ready, long write in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x09, SS_FATAL | EBUSY, "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ { SST(0x04, 0x0A, SS_WAIT | ENXIO, @@ -1130,37 +1130,37 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x0E, SS_RDEF, /* XXX TBD */ "Logical unit not ready, security session in progress") }, /* DT WROM B */ - { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x10, SS_FATAL | ENODEV, "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_WAIT | EBUSY, + { SST(0x04, 0x11, SS_WAIT | ENXIO, "Logical unit not ready, notify (enable spinup) required") }, /* M V */ - { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x12, SS_FATAL | ENXIO, "Logical unit not ready, offline") }, /* DT R MAEBKV */ - { SST(0x04, 0x13, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x13, SS_WAIT | EBUSY, "Logical unit not ready, SA creation in progress") }, /* D B */ - { SST(0x04, 0x14, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x14, SS_WAIT | ENOSPC, "Logical unit not ready, space allocation in progress") }, /* M */ - { SST(0x04, 0x15, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x15, SS_FATAL | ENXIO, "Logical unit not ready, robotics disabled") }, /* M */ - { SST(0x04, 0x16, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x16, SS_FATAL | ENXIO, "Logical unit not ready, configuration required") }, /* M */ - { SST(0x04, 0x17, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x17, SS_FATAL | ENXIO, "Logical unit not ready, calibration required") }, /* M */ - { SST(0x04, 0x18, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x18, SS_FATAL | ENXIO, "Logical unit not ready, a door is open") }, /* M */ - { SST(0x04, 0x19, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x19, SS_FATAL | ENODEV, "Logical unit not ready, operating in sequential mode") }, /* DT B */ - { SST(0x04, 0x1A, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1A, SS_WAIT | EBUSY, "Logical unit not ready, START/STOP UNIT command in progress") }, /* D B */ { SST(0x04, 0x1B, SS_WAIT | EBUSY, @@ -1169,7 +1169,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1C, SS_START | SSQ_DECREMENT_COUNT | ENXIO, "Logical unit not ready, additional power use not yet granted") }, /* D */ - { SST(0x04, 0x1D, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1D, SS_WAIT | EBUSY, "Logical unit not ready, configuration in progress") }, /* D */ { SST(0x04, 0x1E, SS_FATAL | ENXIO, @@ -1178,14 +1178,20 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1F, SS_FATAL | ENXIO, "Logical unit not ready, microcode download required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x20, SS_FATAL | ENXIO, "Logical unit not ready, logical unit reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x21, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x21, SS_FATAL | ENXIO, "Logical unit not ready, hard reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x22, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x22, SS_FATAL | ENXIO, "Logical unit not ready, power cycle required") }, + /* D */ + { SST(0x04, 0x23, SS_FATAL | ENXIO, + "Logical unit not ready, affiliation required") }, + /* D */ + { SST(0x04, 0x24, SS_FATAL | EBUSY, + "Depopulation in progress") }, /* DTL WROMAEBKVF */ { SST(0x05, 0x00, SS_RDEF, "Logical unit does not respond to selection") }, @@ -3384,7 +3390,7 @@ scsi_error_action(struct ccb_scsiio *csio, struct scsi if (!scsi_extract_sense_ccb((union ccb *)csio, &error_code, &sense_key, &asc, &ascq)) { - action = SS_RETRY | SSQ_DECREMENT_COUNT | SSQ_PRINT_SENSE | EIO; + action = SS_RDEF; } else if ((error_code == SSD_DEFERRED_ERROR) || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* From owner-svn-src-stable@freebsd.org Tue Dec 3 16:47:05 2019 Return-Path: Delivered-To: svn-src-stable@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 6BEC91B50F4; Tue, 3 Dec 2019 16:47:05 +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 47S7Dn2GwXz4bjG; Tue, 3 Dec 2019 16:47:05 +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 329921A9EA; Tue, 3 Dec 2019 16:47:05 +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 xB3Gl4Zg090124; Tue, 3 Dec 2019 16:47:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Gl4mE090123; Tue, 3 Dec 2019 16:47:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031647.xB3Gl4mE090123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355336 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 355336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:47:05 -0000 Author: mav Date: Tue Dec 3 16:47:04 2019 New Revision: 355336 URL: https://svnweb.freebsd.org/changeset/base/355336 Log: MFC r354914: Set handling for some "Logical unit not ready" errors. Modified: stable/11/sys/cam/scsi/scsi_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Tue Dec 3 16:46:44 2019 (r355335) +++ stable/11/sys/cam/scsi/scsi_all.c Tue Dec 3 16:47:04 2019 (r355336) @@ -1110,7 +1110,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x08, SS_FATAL | EBUSY, "Logical unit not ready, long write in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x09, SS_FATAL | EBUSY, "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ { SST(0x04, 0x0A, SS_WAIT | ENXIO, @@ -1128,37 +1128,37 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x0E, SS_RDEF, /* XXX TBD */ "Logical unit not ready, security session in progress") }, /* DT WROM B */ - { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x10, SS_FATAL | ENODEV, "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_WAIT | EBUSY, + { SST(0x04, 0x11, SS_WAIT | ENXIO, "Logical unit not ready, notify (enable spinup) required") }, /* M V */ - { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x12, SS_FATAL | ENXIO, "Logical unit not ready, offline") }, /* DT R MAEBKV */ - { SST(0x04, 0x13, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x13, SS_WAIT | EBUSY, "Logical unit not ready, SA creation in progress") }, /* D B */ - { SST(0x04, 0x14, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x14, SS_WAIT | ENOSPC, "Logical unit not ready, space allocation in progress") }, /* M */ - { SST(0x04, 0x15, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x15, SS_FATAL | ENXIO, "Logical unit not ready, robotics disabled") }, /* M */ - { SST(0x04, 0x16, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x16, SS_FATAL | ENXIO, "Logical unit not ready, configuration required") }, /* M */ - { SST(0x04, 0x17, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x17, SS_FATAL | ENXIO, "Logical unit not ready, calibration required") }, /* M */ - { SST(0x04, 0x18, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x18, SS_FATAL | ENXIO, "Logical unit not ready, a door is open") }, /* M */ - { SST(0x04, 0x19, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x19, SS_FATAL | ENODEV, "Logical unit not ready, operating in sequential mode") }, /* DT B */ - { SST(0x04, 0x1A, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1A, SS_WAIT | EBUSY, "Logical unit not ready, START/STOP UNIT command in progress") }, /* D B */ { SST(0x04, 0x1B, SS_WAIT | EBUSY, @@ -1167,7 +1167,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1C, SS_RDEF, /* XXX TBD */ "Logical unit not ready, additional power use not yet granted") }, /* D */ - { SST(0x04, 0x1D, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1D, SS_WAIT | EBUSY, "Logical unit not ready, configuration in progress") }, /* D */ { SST(0x04, 0x1E, SS_FATAL | ENXIO, @@ -1176,14 +1176,20 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1F, SS_FATAL | ENXIO, "Logical unit not ready, microcode download required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x20, SS_FATAL | ENXIO, "Logical unit not ready, logical unit reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x21, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x21, SS_FATAL | ENXIO, "Logical unit not ready, hard reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x22, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x22, SS_FATAL | ENXIO, "Logical unit not ready, power cycle required") }, + /* D */ + { SST(0x04, 0x23, SS_FATAL | ENXIO, + "Logical unit not ready, affiliation required") }, + /* D */ + { SST(0x04, 0x24, SS_FATAL | EBUSY, + "Depopulation in progress") }, /* DTL WROMAEBKVF */ { SST(0x05, 0x00, SS_RDEF, "Logical unit does not respond to selection") }, @@ -3382,7 +3388,7 @@ scsi_error_action(struct ccb_scsiio *csio, struct scsi if (!scsi_extract_sense_ccb((union ccb *)csio, &error_code, &sense_key, &asc, &ascq)) { - action = SS_RETRY | SSQ_DECREMENT_COUNT | SSQ_PRINT_SENSE | EIO; + action = SS_RDEF; } else if ((error_code == SSD_DEFERRED_ERROR) || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* From owner-svn-src-stable@freebsd.org Tue Dec 3 16:48:04 2019 Return-Path: Delivered-To: svn-src-stable@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 01A0D1B5192 for ; Tue, 3 Dec 2019 16:48:04 +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 47S7Fv4GcZz4bqp for ; Tue, 3 Dec 2019 16:48:03 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575391682; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=PxPXEPjPTIT9kpT+ANYnOt2qk3bHbSFrvvj9q9cs8v4kzg31oiivjxD0MemBWJexQASEVWp+klpwW gGQibYBxr8NzkcUxpN14mmhf1hcdvgQiO/uilz/WjzkxNkLyyipSoB69/uTdnmYxi5QFNF4W378Gto BEGdBS3hH+EcZ6d+2TJe47znm+25MtleA5EVO+4KKjX41546/i4QrnvUFS9TGebJYrLtE2FIIniIK3 I5PhShH0fjtmBsjjIfJra6PFHNlT4uS64R3NkaGf3+ttnBww0Q+UmEjrl/R89UMxFXyJGEVRHXSkAc rgHW66aQk45DaC/MjG3jBq+c3kF0mjw== 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=fVScYyi6OOvqH/jbzWTFs83auAKgqy/7ruZ2m0sxJ0I=; b=oGrYQt96a8eiSYroQhwt/lhqHBJ8ayh2q9i8YvsRh+TxMlVB10Vx45E0WzyivfO+WqajKvIOPtfoE GYP2oHxcAhaeGzQlYxOFI2TrNPhU/X6gBignTicYdWvoNfOApxQl5gmDb4jUKPzdW/zS2UpA2yyo3/ ttE/XwmE07n/lthpQDbLDQeUzn+AKwsvJ1IbGhFgSOixf1alWX74nYTMexhm9RDXBjq8qXIgfQVFN3 b1sSsYuGcCYeC8pGeY+ZocJBWPMQKyoUv8u6udH1Z3sA2aKua2hbchK/XNktcBbpRWVeCixyMlOhBP 3mBTneAzr+uttZpYKqE53HhJCyeTBfg== 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:to:from:subject:message-id:from; bh=fVScYyi6OOvqH/jbzWTFs83auAKgqy/7ruZ2m0sxJ0I=; b=cFJeuh5zJaJlGf7hjHv3PhE8braZPJHq7O8uhsMoL9B0ye5JlGXllLFLgVIxNUDfy9fjynxt0tndP p/iHR27k2PwmGzcmD8Ncslgx22YrN09RZRQknX/Qm0f/Y5ikt9iOVIwMT0f5xb25Bo9pRBIgXToMrh /Xbf8OALDDmfiw3QqMYEUlZ2phN7mwlDeBPr+2RN8O35bW/MF56ZZFgpPH4/X4vnjO6ect8+EgIURb MfxihCgDypS/33t5SdrbMP9fEpaO2skM8drgS1NSWtmZ/0kjSGKx+9XAP77VPFru0ty1oMgU9U18em KLmRqgrxj2b1beyo11stqKWK61enqgA== X-MHO-RoutePath: aGlwcGll X-MHO-User: aa0acccf-15ec-11ea-b80c-052b4a66b6b2 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 aa0acccf-15ec-11ea-b80c-052b4a66b6b2; Tue, 03 Dec 2019 16:48:00 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB3GlxRH000203; Tue, 3 Dec 2019 09:47:59 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r355333 - stable/12/sys/cam From: Ian Lepore To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Date: Tue, 03 Dec 2019 09:47:59 -0700 In-Reply-To: <201912031642.xB3GgXRD089746@repo.freebsd.org> References: <201912031642.xB3GgXRD089746@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: 47S7Fv4GcZz4bqp X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.968,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-0.94)[-0.943,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:48:04 -0000 On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: > Author: mav > Date: Tue Dec 3 16:42:32 2019 > New Revision: 355333 > URL: https://svnweb.freebsd.org/changeset/base/355333 > > Log: > MFC r341756 (by scottl): > Don't allocate the config_intrhook separately from the softc, it's > small > enough that it costs more code to handle the malloc/free than it > saves. > If it's a situation where the called hook routine always does a disestablish of the hook (and nothing else does so), just use config_intrhook_oneshot() and you don't need to manage the data struct yourself at all. -- Ian From owner-svn-src-stable@freebsd.org Tue Dec 3 16:48:22 2019 Return-Path: Delivered-To: svn-src-stable@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 ED71C1B522C; Tue, 3 Dec 2019 16:48: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 47S7GG5YB9z4bxg; Tue, 3 Dec 2019 16:48: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 A1A5C1A9EC; Tue, 3 Dec 2019 16:48: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 xB3GmMeo090239; Tue, 3 Dec 2019 16:48:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GmM3j090234; Tue, 3 Dec 2019 16:48:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031648.xB3GmM3j090234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355337 - in stable/12/sys/cam: . scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/cam: . scsi X-SVN-Commit-Revision: 355337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:48:23 -0000 Author: mav Date: Tue Dec 3 16:48:21 2019 New Revision: 355337 URL: https://svnweb.freebsd.org/changeset/base/355337 Log: MFC r355010: Make CAM use root_mount_hold_token() to delay boot. Before this change CAM used config_intrhook_establish() for this purpose, but that approach does not allow to delay it again after releasing once. USB stack uses root_mount_hold() to delay boot until bus scan is complete. But once it is, CAM had no time to scan SCSI bus, registered by umass(4), if it already done other scans and called config_intrhook_disestablish(). The new approach makes it work smooth, assuming the USB device is found during the initial bus scan. Devices appearing on USB bus later may still require setting kern.cam.boot_delay, but hopefully those are minority. Modified: stable/12/sys/cam/cam_xpt.c stable/12/sys/cam/scsi/scsi_enc.c stable/12/sys/cam/scsi/scsi_enc_internal.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:47:04 2019 (r355336) +++ stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:48:21 2019 (r355337) @@ -99,13 +99,6 @@ MALLOC_DEFINE(M_CAMDEV, "CAM DEV", "CAM devices"); MALLOC_DEFINE(M_CAMCCB, "CAM CCB", "CAM CCBs"); MALLOC_DEFINE(M_CAMPATH, "CAM path", "CAM paths"); -/* Object for defering XPT actions to a taskqueue */ -struct xpt_task { - struct task task; - void *data1; - uintptr_t data2; -}; - struct xpt_softc { uint32_t xpt_generation; @@ -129,10 +122,10 @@ struct xpt_softc { TAILQ_HEAD(,cam_eb) xpt_busses; u_int bus_generation; - struct intr_config_hook xpt_config_hook; - int boot_delay; struct callout boot_callout; + struct task boot_task; + struct root_hold_token xpt_rootmount; struct mtx xpt_topo_lock; struct mtx xpt_lock; @@ -273,6 +266,7 @@ static struct cam_et* static struct cam_ed* xpt_find_device(struct cam_et *target, lun_id_t lun_id); static void xpt_config(void *arg); +static void xpt_hold_boot_locked(void); static int xpt_schedule_dev(struct camq *queue, cam_pinfo *dev_pinfo, u_int32_t new_priority); static xpt_devicefunc_t xptpassannouncefunc; @@ -881,7 +875,7 @@ xpt_rescan(union ccb *ccb) } } TAILQ_INSERT_TAIL(&xsoftc.ccb_scanq, &ccb->ccb_h, sim_links.tqe); - xsoftc.buses_to_config++; + xpt_hold_boot_locked(); wakeup(&xsoftc.ccb_scanq); xpt_unlock_buses(); } @@ -913,6 +907,7 @@ xpt_init(void *dummy) */ xsoftc.boot_delay = CAM_BOOT_DELAY; #endif + /* * The xpt layer is, itself, the equivalent of a SIM. * Allow 16 ccbs in the ccb pool for it. This should @@ -979,14 +974,11 @@ xpt_init(void *dummy) "- failing attach\n"); return (ENOMEM); } + /* * Register a callback for when interrupts are enabled. */ - xsoftc.xpt_config_hook.ich_func = xpt_config; - if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) { - printf("xpt_init: config_intrhook_establish failed " - "- failing attach\n"); - } + config_intrhook_oneshot(xpt_config, NULL); return (0); } @@ -5148,6 +5140,10 @@ xpt_stop_tags(struct cam_path *path) xpt_action((union ccb *)&crs); } +/* + * Assume all possible buses are detected by this time, so allow boot + * as soon as they all are scanned. + */ static void xpt_boot_delay(void *arg) { @@ -5155,12 +5151,26 @@ xpt_boot_delay(void *arg) xpt_release_boot(); } +/* + * Now that all config hooks have completed, start boot_delay timer, + * waiting for possibly still undetected buses (USB) to appear. + */ static void +xpt_ch_done(void *arg) +{ + + callout_init(&xsoftc.boot_callout, 1); + callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0, + xpt_boot_delay, NULL, 0); +} +SYSINIT(xpt_hw_delay, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, xpt_ch_done, NULL); + +/* + * Now that interrupts are enabled, go find our devices + */ +static void xpt_config(void *arg) { - /* - * Now that interrupts are enabled, go find our devices - */ if (taskqueue_start_threads(&xsoftc.xpt_taskq, 1, PRIBIO, "CAM taskq")) printf("xpt_config: failed to create taskqueue thread.\n"); @@ -5179,9 +5189,7 @@ xpt_config(void *arg) periphdriver_init(1); xpt_hold_boot(); - callout_init(&xsoftc.boot_callout, 1); - callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0, - xpt_boot_delay, NULL, 0); + /* Fire up rescan thread. */ if (kproc_kthread_add(xpt_scanner_thread, NULL, &cam_proc, NULL, 0, 0, "cam", "scanner")) { @@ -5190,31 +5198,38 @@ xpt_config(void *arg) } void +xpt_hold_boot_locked(void) +{ + + if (xsoftc.buses_to_config++ == 0) + root_mount_hold_token("CAM", &xsoftc.xpt_rootmount); +} + +void xpt_hold_boot(void) { + xpt_lock_buses(); - xsoftc.buses_to_config++; + xpt_hold_boot_locked(); xpt_unlock_buses(); } void xpt_release_boot(void) { - xpt_lock_buses(); - xsoftc.buses_to_config--; - if (xsoftc.buses_to_config == 0 && xsoftc.buses_config_done == 0) { - struct xpt_task *task; - xsoftc.buses_config_done = 1; - xpt_unlock_buses(); - /* Call manually because we don't have any buses */ - task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT); - if (task != NULL) { - TASK_INIT(&task->task, 0, xpt_finishconfig_task, task); - taskqueue_enqueue(taskqueue_thread, &task->task); - } - } else - xpt_unlock_buses(); + xpt_lock_buses(); + if (--xsoftc.buses_to_config == 0) { + if (xsoftc.buses_config_done == 0) { + xsoftc.buses_config_done = 1; + xsoftc.buses_to_config++; + TASK_INIT(&xsoftc.boot_task, 0, xpt_finishconfig_task, + NULL); + taskqueue_enqueue(taskqueue_thread, &xsoftc.boot_task); + } else + root_mount_rel(&xsoftc.xpt_rootmount); + } + xpt_unlock_buses(); } /* @@ -5252,10 +5267,7 @@ xpt_finishconfig_task(void *context, int pending) if (!bootverbose) xpt_for_all_devices(xptpassannouncefunc, NULL); - /* Release our hook so that the boot can continue. */ - config_intrhook_disestablish(&xsoftc.xpt_config_hook); - - free(context, M_CAMXPT); + xpt_release_boot(); } cam_status Modified: stable/12/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc.c Tue Dec 3 16:47:04 2019 (r355336) +++ stable/12/sys/cam/scsi/scsi_enc.c Tue Dec 3 16:48:21 2019 (r355337) @@ -205,10 +205,7 @@ enc_dtor(struct cam_periph *periph) if (enc->enc_vec.softc_cleanup != NULL) enc->enc_vec.softc_cleanup(enc); - if (enc->enc_boot_hold_ch.ich_func != NULL) { - config_intrhook_disestablish(&enc->enc_boot_hold_ch); - enc->enc_boot_hold_ch.ich_func = NULL; - } + root_mount_rel(&enc->enc_rootmount); ENC_FREE(enc); } @@ -835,7 +832,6 @@ enc_daemon(void *arg) cam_periph_lock(enc->periph); while ((enc->enc_flags & ENC_FLAG_SHUTDOWN) == 0) { if (enc->pending_actions == 0) { - struct intr_config_hook *hook; /* * Reset callout and msleep, or @@ -848,11 +844,7 @@ enc_daemon(void *arg) * We've been through our state machine at least * once. Allow the transition to userland. */ - hook = &enc->enc_boot_hold_ch; - if (hook->ich_func != NULL) { - config_intrhook_disestablish(hook); - hook->ich_func = NULL; - } + root_mount_rel(&enc->enc_rootmount); callout_reset(&enc->status_updater, 60*hz, enc_status_updater, enc); @@ -891,22 +883,6 @@ enc_kproc_init(enc_softc_t *enc) cam_periph_release(enc->periph); return (result); } - -/** - * \brief Interrupt configuration hook callback associated with - * enc_boot_hold_ch. - * - * Since interrupts are always functional at the time of enclosure - * configuration, there is nothing to be done when the callback occurs. - * This hook is only registered to hold up boot processing while initial - * eclosure processing occurs. - * - * \param arg The enclosure softc, but currently unused in this callback. - */ -static void -enc_nop_confighook_cb(void *arg __unused) -{ -} static cam_status enc_ctor(struct cam_periph *periph, void *arg) @@ -964,9 +940,7 @@ enc_ctor(struct cam_periph *periph, void *arg) * present. */ if (enc->enc_vec.poll_status != NULL) { - enc->enc_boot_hold_ch.ich_func = enc_nop_confighook_cb; - enc->enc_boot_hold_ch.ich_arg = enc; - config_intrhook_establish(&enc->enc_boot_hold_ch); + root_mount_hold_token(periph->periph_name, &enc->enc_rootmount); } /* Modified: stable/12/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_internal.h Tue Dec 3 16:47:04 2019 (r355336) +++ stable/12/sys/cam/scsi/scsi_enc_internal.h Tue Dec 3 16:48:21 2019 (r355337) @@ -163,7 +163,7 @@ struct enc_softc { struct enc_fsm_state *enc_fsm_states; - struct intr_config_hook enc_boot_hold_ch; + struct root_hold_token enc_rootmount; #define ENC_ANNOUNCE_SZ 400 char announce_buf[ENC_ANNOUNCE_SZ]; From owner-svn-src-stable@freebsd.org Tue Dec 3 16:50:07 2019 Return-Path: Delivered-To: svn-src-stable@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 5BE2F1B5362; Tue, 3 Dec 2019 16:50: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 47S7JH1dMwz4c7y; Tue, 3 Dec 2019 16:50: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 1CA981AA07; Tue, 3 Dec 2019 16:50: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 xB3Go66R090417; Tue, 3 Dec 2019 16:50:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Go6LG090416; Tue, 3 Dec 2019 16:50:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031650.xB3Go6LG090416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355338 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 355338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:50:07 -0000 Author: mav Date: Tue Dec 3 16:50:06 2019 New Revision: 355338 URL: https://svnweb.freebsd.org/changeset/base/355338 Log: MFC r355013: Remove xpt_lock mutex. CAM does not require SIM locks for years, and obviously does not require it for completely virtual XPT SIM. Modified: stable/12/sys/cam/cam_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:48:21 2019 (r355337) +++ stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:50:06 2019 (r355338) @@ -128,7 +128,6 @@ struct xpt_softc { struct root_hold_token xpt_rootmount; struct mtx xpt_topo_lock; - struct mtx xpt_lock; struct taskqueue *xpt_taskq; }; @@ -895,7 +894,6 @@ xpt_init(void *dummy) STAILQ_INIT(&xsoftc.highpowerq); xsoftc.num_highpower = CAM_MAX_HIGHPOWER; - mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF); mtx_init(&xsoftc.xpt_highpower_lock, "XPT highpower lock", NULL, MTX_DEF); xsoftc.xpt_taskq = taskqueue_create("CAM XPT task", M_WAITOK, taskqueue_thread_enqueue, /*context*/&xsoftc.xpt_taskq); @@ -920,21 +918,18 @@ xpt_init(void *dummy) "xpt", /*softc*/NULL, /*unit*/0, - /*mtx*/&xsoftc.xpt_lock, + /*mtx*/NULL, /*max_dev_transactions*/0, /*max_tagged_dev_transactions*/0, devq); if (xpt_sim == NULL) return (ENOMEM); - mtx_lock(&xsoftc.xpt_lock); if ((status = xpt_bus_register(xpt_sim, NULL, 0)) != CAM_SUCCESS) { - mtx_unlock(&xsoftc.xpt_lock); printf("xpt_init: xpt_bus_register failed with status %#x," " failing attach\n", status); return (EINVAL); } - mtx_unlock(&xsoftc.xpt_lock); /* * Looking at the XPT from the SIM layer, the XPT is From owner-svn-src-stable@freebsd.org Tue Dec 3 16:51:27 2019 Return-Path: Delivered-To: svn-src-stable@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 410701B5464; Tue, 3 Dec 2019 16:51:27 +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 47S7Kq11QLz4cKv; Tue, 3 Dec 2019 16:51:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 069761AB56; Tue, 3 Dec 2019 16:51:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3GpQvW091237; Tue, 3 Dec 2019 16:51:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GpQMI091235; Tue, 3 Dec 2019 16:51:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031651.xB3GpQMI091235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:51:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355339 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 355339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:51:27 -0000 Author: mav Date: Tue Dec 3 16:51:26 2019 New Revision: 355339 URL: https://svnweb.freebsd.org/changeset/base/355339 Log: MFC r355023: Do not retry long ready waits if previous gave nothing. I have some disks reporting "Logical unit is in process of becoming ready" for about half an hour before finally reporting failure. During that time CAM waits for the readiness during ~2 minutes for each request, that makes system boot take very long time. This change reduces wait times for the following requests to ~1 second if previously long wait for that device has timed out. Modified: stable/12/sys/cam/cam_periph.c stable/12/sys/cam/cam_periph.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_periph.c ============================================================================== --- stable/12/sys/cam/cam_periph.c Tue Dec 3 16:50:06 2019 (r355338) +++ stable/12/sys/cam/cam_periph.c Tue Dec 3 16:51:26 2019 (r355339) @@ -1428,6 +1428,14 @@ camperiphdone(struct cam_periph *periph, union ccb *do xpt_async(AC_INQ_CHANGED, done_ccb->ccb_h.path, NULL); } + /* If we tried long wait and still failed, remember that. */ + if ((periph->flags & CAM_PERIPH_RECOVERY_WAIT) && + (done_ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY)) { + periph->flags &= ~CAM_PERIPH_RECOVERY_WAIT; + if (error != 0 && done_ccb->ccb_h.retry_count == 0) + periph->flags |= CAM_PERIPH_RECOVERY_WAIT_FAILED; + } + /* * After recovery action(s) completed, return to the original CCB. * If the recovery CCB has failed, considering its own possible @@ -1783,7 +1791,9 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **or */ int retries; - if ((err_action & SSQ_MANY) != 0) { + if ((err_action & SSQ_MANY) != 0 && (periph->flags & + CAM_PERIPH_RECOVERY_WAIT_FAILED) == 0) { + periph->flags |= CAM_PERIPH_RECOVERY_WAIT; *action_string = "Polling device for readiness"; retries = 120; } else { Modified: stable/12/sys/cam/cam_periph.h ============================================================================== --- stable/12/sys/cam/cam_periph.h Tue Dec 3 16:50:06 2019 (r355338) +++ stable/12/sys/cam/cam_periph.h Tue Dec 3 16:51:26 2019 (r355339) @@ -132,6 +132,8 @@ struct cam_periph { #define CAM_PERIPH_RUN_TASK 0x40 #define CAM_PERIPH_FREE 0x80 #define CAM_PERIPH_ANNOUNCED 0x100 +#define CAM_PERIPH_RECOVERY_WAIT 0x200 +#define CAM_PERIPH_RECOVERY_WAIT_FAILED 0x400 uint32_t scheduled_priority; uint32_t immediate_priority; int periph_allocating; From owner-svn-src-stable@freebsd.org Tue Dec 3 16:52:40 2019 Return-Path: Delivered-To: svn-src-stable@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 224321B572B; Tue, 3 Dec 2019 16:52:40 +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 47S7MD0499z4cqF; Tue, 3 Dec 2019 16:52:40 +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 D9FD51ABBA; Tue, 3 Dec 2019 16:52:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3GqdF4096220; Tue, 3 Dec 2019 16:52:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Gqd5d096219; Tue, 3 Dec 2019 16:52:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031652.xB3Gqd5d096219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355341 - stable/11/sys/cam X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam X-SVN-Commit-Revision: 355341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:52:40 -0000 Author: mav Date: Tue Dec 3 16:52:39 2019 New Revision: 355341 URL: https://svnweb.freebsd.org/changeset/base/355341 Log: MFC r355023: Do not retry long ready waits if previous gave nothing. I have some disks reporting "Logical unit is in process of becoming ready" for about half an hour before finally reporting failure. During that time CAM waits for the readiness during ~2 minutes for each request, that makes system boot take very long time. This change reduces wait times for the following requests to ~1 second if previously long wait for that device has timed out. Modified: stable/11/sys/cam/cam_periph.c stable/11/sys/cam/cam_periph.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Tue Dec 3 16:52:03 2019 (r355340) +++ stable/11/sys/cam/cam_periph.c Tue Dec 3 16:52:39 2019 (r355341) @@ -1345,6 +1345,14 @@ camperiphdone(struct cam_periph *periph, union ccb *do xpt_async(AC_INQ_CHANGED, done_ccb->ccb_h.path, NULL); } + /* If we tried long wait and still failed, remember that. */ + if ((periph->flags & CAM_PERIPH_RECOVERY_WAIT) && + (done_ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY)) { + periph->flags &= ~CAM_PERIPH_RECOVERY_WAIT; + if (error != 0 && done_ccb->ccb_h.retry_count == 0) + periph->flags |= CAM_PERIPH_RECOVERY_WAIT_FAILED; + } + /* * After recovery action(s) completed, return to the original CCB. * If the recovery CCB has failed, considering its own possible @@ -1695,7 +1703,9 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **or */ int retries; - if ((err_action & SSQ_MANY) != 0) { + if ((err_action & SSQ_MANY) != 0 && (periph->flags & + CAM_PERIPH_RECOVERY_WAIT_FAILED) == 0) { + periph->flags |= CAM_PERIPH_RECOVERY_WAIT; *action_string = "Polling device for readiness"; retries = 120; } else { Modified: stable/11/sys/cam/cam_periph.h ============================================================================== --- stable/11/sys/cam/cam_periph.h Tue Dec 3 16:52:03 2019 (r355340) +++ stable/11/sys/cam/cam_periph.h Tue Dec 3 16:52:39 2019 (r355341) @@ -129,6 +129,8 @@ struct cam_periph { #define CAM_PERIPH_RUN_TASK 0x40 #define CAM_PERIPH_FREE 0x80 #define CAM_PERIPH_ANNOUNCED 0x100 +#define CAM_PERIPH_RECOVERY_WAIT 0x200 +#define CAM_PERIPH_RECOVERY_WAIT_FAILED 0x400 uint32_t scheduled_priority; uint32_t immediate_priority; int periph_allocating; From owner-svn-src-stable@freebsd.org Tue Dec 3 16:54:56 2019 Return-Path: Delivered-To: svn-src-stable@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 1C5361B584C; Tue, 3 Dec 2019 16:54:56 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) (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 47S7Pq1bBMz4cyj; Tue, 3 Dec 2019 16:54:54 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb32.google.com with SMTP id r201so1777543ybc.10; Tue, 03 Dec 2019 08:54:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=z8f2nuog4WbLaQ8N1AanFKFNKJc0cQRxjbwPa7+Dmew=; b=WCRtQCgFzgoNnSOd4xLby4Bu6uDyiCjWPyTpTg6X+fhYNEt2H5TU6uMhb7DZnQozQu lu70/WW/6Sq7gaFlfhwjZmwwwOIVqe8MJeRcOZM0yK3LYjv9YXgYvtcwMHcwFewByDsc kXIWY9MSzxKeQiOK2TKEaMSmFtTfumy42sUWupP6eqgiNjIANiyxb08MzH6zmoTmXQ+0 ZHVswb9Qwf6M+4KBQsEAiPdptpWVPTzbk2Nyp0vVH/ISJF6HtJv86PYGxkMvjEAp3plw xamZ0Pg5pbs8wMLRW+CT8GPnEupbo9NCzckYqt1MbHLGPaUeiyeijLIaXjTwh6r8ZgmF nNNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=z8f2nuog4WbLaQ8N1AanFKFNKJc0cQRxjbwPa7+Dmew=; b=AGHmhQvXdyFPPgRGV9+8nBlZG5cnpNTC8Zto7ctHkNpUtElMyQcjSTxrezFff7xN02 WALgcY6vY9heyo5QWwA+wuE3s6rnqfK6TB7tfZ7Yy9O6jX6MN1YWDkBnHGogK0fGcUhv zJpVSWwnpv41066g58UuoAVF/X3l8FgPA36IsOjL2VOB+Rn410ZNhN5Gd6wp2FIpNbAK 8s6CjgFtcUU1EdxDs86vqJ0fDfLHFNSzRv9ljckpCRIa40SMHWk0rf6H2jvgm52/++px GQcWrZtCKDyKX/L+5KMW+PY8hry27ZKAkta6s6GdIe/ChoIwrtWfnybEtJA08O6iGVHE j7Ww== X-Gm-Message-State: APjAAAWEH2mZQuwRHwOBzw0jDPsy79SnPqUd1cxgPuKomkB7bVbrofZg IapFAH3Sv5wxpOmsxUst3TfVFB8g X-Google-Smtp-Source: APXvYqzlAyw+s8xGRO4aNwenHfaKJXFP+DjWNgmF5ZYyF+3ey+IdrjwTVDJSlg3L79G6YwZYgFTrOQ== X-Received: by 2002:a25:c881:: with SMTP id y123mr4972768ybf.516.1575392093130; Tue, 03 Dec 2019 08:54:53 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id k144sm1642510ywe.14.2019.12.03.08.54.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 08:54:52 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r355333 - stable/12/sys/cam To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201912031642.xB3GgXRD089746@repo.freebsd.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@FreeBSD.org> Date: Tue, 3 Dec 2019 11:54:51 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47S7Pq1bBMz4cyj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=WCRtQCgF; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::b32 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-4.98 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.78)[ip: (-9.67), ipnet: 2607:f8b0::/32(-2.24), asn: 15169(-1.94), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.3.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]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:54:56 -0000 On 03.12.2019 11:47, Ian Lepore wrote: > On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: >> Author: mav >> Date: Tue Dec 3 16:42:32 2019 >> New Revision: 355333 >> URL: https://svnweb.freebsd.org/changeset/base/355333 >> >> Log: >> MFC r341756 (by scottl): >> Don't allocate the config_intrhook separately from the softc, it's >> small >> enough that it costs more code to handle the malloc/free than it >> saves. >> > > If it's a situation where the called hook routine always does a > disestablish of the hook (and nothing else does so), just use > config_intrhook_oneshot() and you don't need to manage the data struct > yourself at all. Right. That is what I have done in my later commit. The only downside of config_intrhook_oneshot() is that it require memory allocation unlike previous. -- Alexander Motin From owner-svn-src-stable@freebsd.org Tue Dec 3 17:00:35 2019 Return-Path: Delivered-To: svn-src-stable@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 D57A41B5C36 for ; Tue, 3 Dec 2019 17:00:35 +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 47S7XM4Bprz4dLs for ; Tue, 3 Dec 2019 17:00:35 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575392434; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=wONFw9wBDoKYXDaZqllah+3qGvk6GWe82kF0D4E5vgacIccfO2G5YJhMqzrgSo1b8ZkG73FsxHTFb 3HSxrLNJrKgl+rutL9ae/P/hzJMikE1Wq0AiBjUedF5QgI3eV+Iq5kIs9usFtS5WtqG0mFuNbk3NV5 4Ykrl8nKdsLlewPw9yffo4AsMqVzqA3SqU2XPwAFrVh1XDw3MtZsI1rV6NCzAO9z6bGNTt7doftiu8 56x/nDPxlZucevTFU/wt5wb9nw+9XabZ3JK0yqncDMmMwiXCqtVEUgnO4WaV8wwtsfHhgDlDiSjP5p RTegGmekYxwRHWGRqKAEOSAB3KMBE/A== 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=KafL3a0EFxRKXs7cUc2ZtU0uM4lUtociBjkQiqbPaGg=; b=MEAEal4eU4XtVp3p0eTD7yDZy8AC7GFDHo7vf9xtrh5mf/keX5cGdK4Us4thLD1/blDt0CFRPmS+e pEG3jwJUQE2Lnp6KscJg7zoJYLkXqfpGMoGXnyuZgWIcxbC+CB5mE3jn7f9mH3wpJTqd7H15CvpMoA Z422EETjCS4casanYDpvoIfZa9hNIlt7nA+gonVcuxSmV6B1rOnxoZByhta49F3Hys2GH0mo+UwxcK ak8ElAr2lgFDI3ZMRyAVGC695pw6nMUWdXEXzpSQqtHV+RjJrIjVy/3qscpjkmRZ0E4YQMgFEOgE7R 6PtYnYI4Qn3vREZ1ggdbjTmIPNCkFOw== 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:to:from:subject:message-id:from; bh=KafL3a0EFxRKXs7cUc2ZtU0uM4lUtociBjkQiqbPaGg=; b=xG0ewZpueYg0mHO+U2lub5HtPNLX+BX1Wvkvyp5r/4gUw94F8txFseo3bW/9O67XTGU3F2jLnvfWl 7yoUSLuMIKfI5iG7kTuvL4mKdma+Q5O3mJJI5HickAhrmN6Szw/iGUy9kAzk3wTYLE8mv1Lo6M6u57 yojffL96cLK79ZZrWXxia/7lX/qs1SjvxYJ4sv1JkkGbNpUqC6Dd10XsczdxiEqTXI11/TsLHOMlIm xKba5VuDQafarPXfJdcbodHnbeaLVLtcMA2umgNjSrh0rG+SSs0wI9/eqkfsIfjGnBzjNL+Hm03gEO 5n6/qGmPLD2b4H3q573fiXvr9YD9rhA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 6a7cf7ee-15ee-11ea-b80c-052b4a66b6b2 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 6a7cf7ee-15ee-11ea-b80c-052b4a66b6b2; Tue, 03 Dec 2019 17:00:33 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB3H0VIs000276; Tue, 3 Dec 2019 10:00:32 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1dbc23eac25b2c0cece884fc54734e02868d75c6.camel@freebsd.org> Subject: Re: svn commit: r355333 - stable/12/sys/cam From: Ian Lepore To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Date: Tue, 03 Dec 2019 10:00:31 -0700 In-Reply-To: <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@FreeBSD.org> References: <201912031642.xB3GgXRD089746@repo.freebsd.org> <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@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: 47S7XM4Bprz4dLs X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.96)[-0.965,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-0.93)[-0.934,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:00:35 -0000 On Tue, 2019-12-03 at 11:54 -0500, Alexander Motin wrote: > On 03.12.2019 11:47, Ian Lepore wrote: > > On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: > > > Author: mav > > > Date: Tue Dec 3 16:42:32 2019 > > > New Revision: 355333 > > > URL: https://svnweb.freebsd.org/changeset/base/355333 > > > > > > Log: > > > MFC r341756 (by scottl): > > > Don't allocate the config_intrhook separately from the softc, > > > it's > > > small > > > enough that it costs more code to handle the malloc/free than > > > it > > > saves. > > > > > > > If it's a situation where the called hook routine always does a > > disestablish of the hook (and nothing else does so), just use > > config_intrhook_oneshot() and you don't need to manage the data > > struct > > yourself at all. > > Right. That is what I have done in my later commit. The only downside > of config_intrhook_oneshot() is that it require memory allocation unlike > previous. > Yeah, it's all about convenience rather than peformance. Usually when I need an intrhook it's a "one device instance once at bootup" kind of thing where performance doesn't matter much. -- Ian From owner-svn-src-stable@freebsd.org Tue Dec 3 17:06:49 2019 Return-Path: Delivered-To: svn-src-stable@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 1038E1B61BF; Tue, 3 Dec 2019 17:06:49 +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 47S7gX6gKjz4f3V; Tue, 3 Dec 2019 17:06: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 AE77C1ADA6; Tue, 3 Dec 2019 17:06: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 xB3H6mPo002361; Tue, 3 Dec 2019 17:06:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3H6mNP002359; Tue, 3 Dec 2019 17:06:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031706.xB3H6mNP002359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 17:06:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355342 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 355342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:06:49 -0000 Author: mav Date: Tue Dec 3 17:06:48 2019 New Revision: 355342 URL: https://svnweb.freebsd.org/changeset/base/355342 Log: MFC r354986: Add variant of root_mount_hold() without allocation. It allows to use this KPI in non-sleepable contexts. Modified: stable/12/sys/kern/vfs_mountroot.c stable/12/sys/sys/systm.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_mountroot.c ============================================================================== --- stable/12/sys/kern/vfs_mountroot.c Tue Dec 3 16:52:39 2019 (r355341) +++ stable/12/sys/kern/vfs_mountroot.c Tue Dec 3 17:06:48 2019 (r355342) @@ -110,14 +110,9 @@ char *rootdevnames[2] = {NULL, NULL}; struct mtx root_holds_mtx; MTX_SYSINIT(root_holds, &root_holds_mtx, "root_holds", MTX_DEF); -struct root_hold_token { - const char *who; - LIST_ENTRY(root_hold_token) list; -}; +static TAILQ_HEAD(, root_hold_token) root_holds = + TAILQ_HEAD_INITIALIZER(root_holds); -static LIST_HEAD(, root_hold_token) root_holds = - LIST_HEAD_INITIALIZER(root_holds); - enum action { A_CONTINUE, A_PANIC, @@ -125,6 +120,12 @@ enum action { A_RETRY }; +enum rh_flags { + RH_FREE, + RH_ALLOC, + RH_ARG, +}; + static enum action root_mount_onfail = A_CONTINUE; static int root_mount_mddev; @@ -154,8 +155,8 @@ sysctl_vfs_root_mount_hold(SYSCTL_HANDLER_ARGS) sbuf_new(&sb, NULL, 256, SBUF_AUTOEXTEND | SBUF_INCLUDENUL); mtx_lock(&root_holds_mtx); - LIST_FOREACH(h, &root_holds, list) { - if (h != LIST_FIRST(&root_holds)) + TAILQ_FOREACH(h, &root_holds, list) { + if (h != TAILQ_FIRST(&root_holds)) sbuf_putc(&sb, ' '); sbuf_printf(&sb, "%s", h->who); } @@ -174,27 +175,54 @@ root_mount_hold(const char *identifier) struct root_hold_token *h; h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK); + h->flags = RH_ALLOC; h->who = identifier; mtx_lock(&root_holds_mtx); TSHOLD("root mount"); - LIST_INSERT_HEAD(&root_holds, h, list); + TAILQ_INSERT_TAIL(&root_holds, h, list); mtx_unlock(&root_holds_mtx); return (h); } void +root_mount_hold_token(const char *identifier, struct root_hold_token *h) +{ +#ifdef INVARIANTS + struct root_hold_token *t; +#endif + + h->flags = RH_ARG; + h->who = identifier; + mtx_lock(&root_holds_mtx); +#ifdef INVARIANTS + TAILQ_FOREACH(t, &root_holds, list) { + if (t == h) { + panic("Duplicate mount hold by '%s' on %p", + identifier, h); + } + } +#endif + TSHOLD("root mount"); + TAILQ_INSERT_TAIL(&root_holds, h, list); + mtx_unlock(&root_holds_mtx); +} + +void root_mount_rel(struct root_hold_token *h) { - if (h == NULL) + if (h == NULL || h->flags == RH_FREE) return; mtx_lock(&root_holds_mtx); - LIST_REMOVE(h, list); + TAILQ_REMOVE(&root_holds, h, list); TSRELEASE("root mount"); wakeup(&root_holds); mtx_unlock(&root_holds_mtx); - free(h, M_DEVBUF); + if (h->flags == RH_ALLOC) { + free(h, M_DEVBUF); + } else + h->flags = RH_FREE; } int @@ -961,13 +989,13 @@ vfs_mountroot_wait(void) while (1) { g_waitidle(); mtx_lock(&root_holds_mtx); - if (LIST_EMPTY(&root_holds)) { + if (TAILQ_EMPTY(&root_holds)) { mtx_unlock(&root_holds_mtx); break; } if (ppsratecheck(&lastfail, &curfail, 1)) { printf("Root mount waiting for:"); - LIST_FOREACH(h, &root_holds, list) + TAILQ_FOREACH(h, &root_holds, list) printf(" %s", h->who); printf("\n"); } Modified: stable/12/sys/sys/systm.h ============================================================================== --- stable/12/sys/sys/systm.h Tue Dec 3 16:52:39 2019 (r355341) +++ stable/12/sys/sys/systm.h Tue Dec 3 17:06:48 2019 (r355342) @@ -503,9 +503,14 @@ int poll_no_poll(int events); void DELAY(int usec); /* Root mount holdback API */ -struct root_hold_token; +struct root_hold_token { + int flags; + const char *who; + TAILQ_ENTRY(root_hold_token) list; +}; struct root_hold_token *root_mount_hold(const char *identifier); +void root_mount_hold_token(const char *identifier, struct root_hold_token *h); void root_mount_rel(struct root_hold_token *h); int root_mounted(void); From owner-svn-src-stable@freebsd.org Tue Dec 3 17:34:58 2019 Return-Path: Delivered-To: svn-src-stable@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 E26621B7002; Tue, 3 Dec 2019 17:34:58 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) (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 47S8J15FLRz3C7c; Tue, 3 Dec 2019 17:34:57 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb41.google.com with SMTP id v15so1826222ybp.13; Tue, 03 Dec 2019 09:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+JbBfahZMu12RKD+yWuHKyVRyVJzng6jEawyu9FpCUU=; b=POqr0jLxzfKrHayjxaDmzlyxgEIkj/RL5XNluVaznoQmcVlf94InXcs8s3kdAHrZYn 93UwRZA7dcYgd+zlurpbASG5tcx1KlNh5rywdX1R8IVtFKRRKafRQcebQrAc/7/I73LQ jT0l9NtCanzJ55FJVPMRaEmgx4CaQXVIXERVs9vQTWWZ9/ZN311uW4yBGQr7izp20JG+ +XQ9JzOQMQpl8KqUMBw0yRFnE2e+w5levHREIOXzxUTKulcSiKfU14agT1JV+bJL+zxV wjBVZxh7+ibgdQOs8pp+2QfEZl4YfvLnYU7XKxQpnB4XCCzlofg3vSwRh0wRZiHknBMh DK4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=+JbBfahZMu12RKD+yWuHKyVRyVJzng6jEawyu9FpCUU=; b=StMUWize400e2TP2ZGFWKYwSciZqmdV1WXzEDEUhmsB8fevm3ypWACAgnik4bZZJew erh4A/Wp4n2L5OSCZzMvfXCchsQDojaW/v1SMb1iwpzhOxhkyKur2/Y7IofqMPVjQd6M bRVQoljJqlspMlxWNQltuVx33Dbryw2fP7zocJh/2Oy2EokXG5qCg+CwRZJpgvBVWjRk K7VA76IMN0QMdHY165yabJpII07xYv9uQJli13LZaUzgOXUMlDd5JvtiyaCDqO8Un2CP OLDyzPHcpHBRxcj47u6Q6zzRT4k+bNXnvr27/VOsBKECCGNdLcUXT8XWKMAalmS8Ln7u /Ibw== X-Gm-Message-State: APjAAAXgswiDy1h3VibU0V1Y6bciiW/YYXcHFpxir9Jm6Jarvlzei+ma alg+Kxoonwj8sKg7RZQ7G0iZUw/B X-Google-Smtp-Source: APXvYqwpG13Snsr/ZBfbTOPIAvB+sggSagaWQriHCCmAHiT2qt54GWqU/tw3m2bwV3602DwGWFdsfw== X-Received: by 2002:a25:d6cd:: with SMTP id n196mr5039293ybg.198.1575394496181; Tue, 03 Dec 2019 09:34:56 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id o69sm1723331ywd.38.2019.12.03.09.34.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 09:34:55 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r355333 - stable/12/sys/cam To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201912031642.xB3GgXRD089746@repo.freebsd.org> <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@FreeBSD.org> <1dbc23eac25b2c0cece884fc54734e02868d75c6.camel@freebsd.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <9f7bcc85-42a0-2a4c-2a78-1d65f64cca4a@FreeBSD.org> Date: Tue, 3 Dec 2019 12:34:55 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <1dbc23eac25b2c0cece884fc54734e02868d75c6.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47S8J15FLRz3C7c X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=POqr0jLx; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::b41 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-2.65 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.45)[ip: (1.98), ipnet: 2607:f8b0::/32(-2.24), asn: 15169(-1.94), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.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]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:34:58 -0000 On 03.12.2019 12:00, Ian Lepore wrote: > On Tue, 2019-12-03 at 11:54 -0500, Alexander Motin wrote: >> On 03.12.2019 11:47, Ian Lepore wrote: >>> On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: >>>> Author: mav >>>> Date: Tue Dec 3 16:42:32 2019 >>>> New Revision: 355333 >>>> URL: https://svnweb.freebsd.org/changeset/base/355333 >>>> >>>> Log: >>>> MFC r341756 (by scottl): >>>> Don't allocate the config_intrhook separately from the softc, >>>> it's >>>> small >>>> enough that it costs more code to handle the malloc/free than >>>> it >>>> saves. >>>> >>> >>> If it's a situation where the called hook routine always does a >>> disestablish of the hook (and nothing else does so), just use >>> config_intrhook_oneshot() and you don't need to manage the data >>> struct >>> yourself at all. >> >> Right. That is what I have done in my later commit. The only downside >> of config_intrhook_oneshot() is that it require memory allocation unlike >> previous. > > Yeah, it's all about convenience rather than peformance. Usually when > I need an intrhook it's a "one device instance once at bootup" kind of > thing where performance doesn't matter much. I don't worry so much about performance as about need to have sleepable context. -- Alexander Motin From owner-svn-src-stable@freebsd.org Tue Dec 3 18:25:20 2019 Return-Path: Delivered-To: svn-src-stable@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 9A3B61B8758; Tue, 3 Dec 2019 18:25:20 +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 47S9Q83Xwcz3Fwg; Tue, 3 Dec 2019 18:25:20 +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 5D1DA1BC7D; Tue, 3 Dec 2019 18:25:20 +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 xB3IPKKp049224; Tue, 3 Dec 2019 18:25:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IPIOZ049214; Tue, 3 Dec 2019 18:25:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031825.xB3IPIOZ049214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355345 - in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stan... X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stand/liblua 12/stand/lua X-SVN-Commit-Revision: 355345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:25:20 -0000 Author: kevans Date: Tue Dec 3 18:25:16 2019 New Revision: 355345 URL: https://svnweb.freebsd.org/changeset/base/355345 Log: MFC r354245, r354833, r354837: add flua to the base system r354245: stand: consolidate knowledge of lua path Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. r354833: Add flua to the base system, install to /usr/libexec FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever extensions we need for base system operations. We currently support a subset of lfs and lposix that are used in the rewrite of makesyscall.sh into lua, added in r354786. flua is intentionally written such that one can install standard lua and some set of lua modules from ports and achieve the same effect. linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added in. This is similar to what we do in stand/. linit.c has been renamed to make it clear that this has flua-specific bits. luaconf has been slightly obfuscated to make extensions more difficult. Part of the problem is that flua is already hard enough to use as a bootstrap tool because it's not in PATH- attempting to do extension loading would require a special bootstrap version of flua with paths changed to protect the innocent. src.lua.mk has been added to make it easy for in-tree stuff to find flua, whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1. r354837: flua: newer GCC complains about format-nonliteral at WARNS=2 Disable that one, too. Added: stable/12/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/12/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/12/stand/liblua/lfs.c stable/12/stand/liblua/lfs.h Modified: stable/12/libexec/Makefile stable/12/libexec/flua/Makefile stable/12/stand/common/interp_lua.c stable/12/stand/defs.mk stable/12/stand/liblua/Makefile stable/12/stand/liblua/luaconf.h stable/12/stand/loader.mk stable/12/stand/lua/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/11/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/11/stand/liblua/lfs.c stable/11/stand/liblua/lfs.h Modified: stable/11/libexec/Makefile stable/11/libexec/flua/Makefile stable/11/stand/common/interp_lua.c stable/11/stand/defs.mk stable/11/stand/liblua/Makefile stable/11/stand/liblua/luaconf.h stable/11/stand/loader.mk stable/11/stand/lua/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/libexec/Makefile ============================================================================== --- stable/12/libexec/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/libexec/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -8,6 +8,7 @@ SUBDIR= ${_atf} \ ${_blacklistd-helper} \ ${_comsat} \ ${_dma} \ + flua \ getty \ ${_mail.local} \ ${_makewhatis.local} \ Modified: stable/12/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Mon Nov 18 23:21:13 2019 (r354833) +++ stable/12/libexec/flua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -9,6 +9,8 @@ PROG= flua WARNS?= 2 MAN= # No manpage; this is internal. +CWARNFLAGS.gcc+= -Wno-format-nonliteral + LIBADD= m # Core functions Copied: stable/12/share/mk/src.lua.mk (from r354833, head/share/mk/src.lua.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/mk/src.lua.mk Tue Dec 3 18:25:16 2019 (r355345, copy of r354833, head/share/mk/src.lua.mk) @@ -0,0 +1,45 @@ +# $FreeBSD$ +# +# Lua helper file for FreeBSD /usr/src builds. +# +# This file provides any necessary assistance for consumers of Lua in the base +# system. + +.if !target(____) +____: + +.include + +# +# LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been +# installed to, along with the name of the internal command. The default +# name is flua. +# +# LUA_CMD can be overwritten to point to a Lua that isn't flua. This is fine, +# but parts of the src build that use it may have certain expectations that +# may only be fulfilled by the in-tree Lua. The user overwriting it is expected +# to understand these and provide the expectations. +# +# flua is currently equivalent to Lua 5.3, with the following modules: +# - luafilesystem +# - lua-posix +# +LUA_INSTALL_PATH?= ${LIBEXECDIR} +LUA_CMD?= flua + +# +# Some standalone usage may want a variable that tries to find the lua command, +# and cannot necessarily embed the logic for trying to find it amongst bootstrap +# tools. For these, we provide the LUA variable. +# +# The LUA variable should point to LUA_CMD on the system, if it exists. +# Otherwise, consumers will have to settle for a PATH search and PATH being +# appropriately set. +# +.if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD}) +LUA= ${LUA_INSTALL_PATH}/${LUA_CMD} +.else +LUA?= ${LUA_CMD} +.endif + +.endif # !target(____) Modified: stable/12/stand/common/interp_lua.c ============================================================================== --- stable/12/stand/common/interp_lua.c Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/common/interp_lua.c Tue Dec 3 18:25:16 2019 (r355345) @@ -60,6 +60,8 @@ static struct interp_lua_softc lua_softc; #define LDBG(...) #endif +#define LOADER_LUA LUA_PATH "/loader.lua" + INTERP_DEFINE("lua"); static void * @@ -120,7 +122,7 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } - filename = "/boot/lua/loader.lua"; + filename = LOADER_LUA; if (interp_include(filename) != 0) { const char *errstr = lua_tostring(luap, -1); errstr = errstr == NULL ? "unknown" : errstr; Modified: stable/12/stand/defs.mk ============================================================================== --- stable/12/stand/defs.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/defs.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -40,6 +40,10 @@ BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot +# LUAPATH is where we search for and install lua scripts. +LUAPATH?= /boot/lua +FLUASRC?= ${SRCTOP}/libexec/flua + LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} Modified: stable/12/stand/liblua/Makefile ============================================================================== --- stable/12/stand/liblua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/liblua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -23,11 +23,14 @@ SRCS+= lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+= lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lerrno.c lfs.c lstd.c lutils.c +SRCS+= lerrno.c lstd.c lutils.c +.PATH: ${FLUASRC}/modules +SRCS+= lfs.c + WARNS= 3 -CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\" +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" -DLUA_PATH_DEFAULT=\"${LUAPATH}/\?.lua\" CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} Modified: stable/12/stand/liblua/luaconf.h ============================================================================== --- stable/12/stand/liblua/luaconf.h Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/liblua/luaconf.h Tue Dec 3 18:25:16 2019 (r355345) @@ -202,7 +202,7 @@ #else /* }{ */ -#define LUA_ROOT "/boot/lua/" LUA_VDIR "/" +#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" #define LUA_LDIR LUA_ROOT "share/" #define LUA_CDIR LUA_ROOT "lib/" #ifndef LUA_PATH_DEFAULT Modified: stable/12/stand/loader.mk ============================================================================== --- stable/12/stand/loader.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/loader.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -62,6 +62,7 @@ SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} +CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules .elif ${LOADER_INTERP} == "4th" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" Modified: stable/12/stand/lua/Makefile ============================================================================== --- stable/12/stand/lua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/lua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -12,7 +12,7 @@ MAN= cli.lua.8 \ password.lua.8 \ screen.lua.8 -FILESDIR= /boot/lua +FILESDIR= ${LUAPATH} FILES= cli.lua \ color.lua \ config.lua \ From owner-svn-src-stable@freebsd.org Tue Dec 3 18:25:18 2019 Return-Path: Delivered-To: svn-src-stable@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 9FC091B873F; Tue, 3 Dec 2019 18:25:18 +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 47S9Q63g6bz3Fwd; Tue, 3 Dec 2019 18:25:18 +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 60D331BC7C; Tue, 3 Dec 2019 18:25:18 +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 xB3IPIud049209; Tue, 3 Dec 2019 18:25:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IPGSo049200; Tue, 3 Dec 2019 18:25:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031825.xB3IPGSo049200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355345 - in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stan... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stand/liblua 12/stand/lua X-SVN-Commit-Revision: 355345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:25:18 -0000 Author: kevans Date: Tue Dec 3 18:25:16 2019 New Revision: 355345 URL: https://svnweb.freebsd.org/changeset/base/355345 Log: MFC r354245, r354833, r354837: add flua to the base system r354245: stand: consolidate knowledge of lua path Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. r354833: Add flua to the base system, install to /usr/libexec FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever extensions we need for base system operations. We currently support a subset of lfs and lposix that are used in the rewrite of makesyscall.sh into lua, added in r354786. flua is intentionally written such that one can install standard lua and some set of lua modules from ports and achieve the same effect. linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added in. This is similar to what we do in stand/. linit.c has been renamed to make it clear that this has flua-specific bits. luaconf has been slightly obfuscated to make extensions more difficult. Part of the problem is that flua is already hard enough to use as a bootstrap tool because it's not in PATH- attempting to do extension loading would require a special bootstrap version of flua with paths changed to protect the innocent. src.lua.mk has been added to make it easy for in-tree stuff to find flua, whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1. r354837: flua: newer GCC complains about format-nonliteral at WARNS=2 Disable that one, too. Added: stable/11/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/11/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/11/stand/liblua/lfs.c stable/11/stand/liblua/lfs.h Modified: stable/11/libexec/Makefile stable/11/libexec/flua/Makefile stable/11/stand/common/interp_lua.c stable/11/stand/defs.mk stable/11/stand/liblua/Makefile stable/11/stand/liblua/luaconf.h stable/11/stand/loader.mk stable/11/stand/lua/Makefile Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/12/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/12/stand/liblua/lfs.c stable/12/stand/liblua/lfs.h Modified: stable/12/libexec/Makefile stable/12/libexec/flua/Makefile stable/12/stand/common/interp_lua.c stable/12/stand/defs.mk stable/12/stand/liblua/Makefile stable/12/stand/liblua/luaconf.h stable/12/stand/loader.mk stable/12/stand/lua/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/11/libexec/Makefile ============================================================================== --- stable/11/libexec/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/libexec/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -8,6 +8,7 @@ SUBDIR= ${_atf} \ ${_blacklistd-helper} \ ${_comsat} \ ${_dma} \ + flua \ getty \ ${_mail.local} \ ${_makewhatis.local} \ Modified: stable/11/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Mon Nov 18 23:21:13 2019 (r354833) +++ stable/11/libexec/flua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -9,6 +9,8 @@ PROG= flua WARNS?= 2 MAN= # No manpage; this is internal. +CWARNFLAGS.gcc+= -Wno-format-nonliteral + LIBADD= m # Core functions Copied: stable/11/share/mk/src.lua.mk (from r354833, head/share/mk/src.lua.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/mk/src.lua.mk Tue Dec 3 18:25:16 2019 (r355345, copy of r354833, head/share/mk/src.lua.mk) @@ -0,0 +1,45 @@ +# $FreeBSD$ +# +# Lua helper file for FreeBSD /usr/src builds. +# +# This file provides any necessary assistance for consumers of Lua in the base +# system. + +.if !target(____) +____: + +.include + +# +# LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been +# installed to, along with the name of the internal command. The default +# name is flua. +# +# LUA_CMD can be overwritten to point to a Lua that isn't flua. This is fine, +# but parts of the src build that use it may have certain expectations that +# may only be fulfilled by the in-tree Lua. The user overwriting it is expected +# to understand these and provide the expectations. +# +# flua is currently equivalent to Lua 5.3, with the following modules: +# - luafilesystem +# - lua-posix +# +LUA_INSTALL_PATH?= ${LIBEXECDIR} +LUA_CMD?= flua + +# +# Some standalone usage may want a variable that tries to find the lua command, +# and cannot necessarily embed the logic for trying to find it amongst bootstrap +# tools. For these, we provide the LUA variable. +# +# The LUA variable should point to LUA_CMD on the system, if it exists. +# Otherwise, consumers will have to settle for a PATH search and PATH being +# appropriately set. +# +.if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD}) +LUA= ${LUA_INSTALL_PATH}/${LUA_CMD} +.else +LUA?= ${LUA_CMD} +.endif + +.endif # !target(____) Modified: stable/11/stand/common/interp_lua.c ============================================================================== --- stable/11/stand/common/interp_lua.c Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/common/interp_lua.c Tue Dec 3 18:25:16 2019 (r355345) @@ -60,6 +60,8 @@ static struct interp_lua_softc lua_softc; #define LDBG(...) #endif +#define LOADER_LUA LUA_PATH "/loader.lua" + INTERP_DEFINE("lua"); static void * @@ -120,7 +122,7 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } - filename = "/boot/lua/loader.lua"; + filename = LOADER_LUA; if (interp_include(filename) != 0) { const char *errstr = lua_tostring(luap, -1); errstr = errstr == NULL ? "unknown" : errstr; Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/defs.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -40,6 +40,10 @@ BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot +# LUAPATH is where we search for and install lua scripts. +LUAPATH?= /boot/lua +FLUASRC?= ${SRCTOP}/libexec/flua + LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} Modified: stable/11/stand/liblua/Makefile ============================================================================== --- stable/11/stand/liblua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/liblua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -23,11 +23,14 @@ SRCS+= lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+= lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lerrno.c lfs.c lstd.c lutils.c +SRCS+= lerrno.c lstd.c lutils.c +.PATH: ${FLUASRC}/modules +SRCS+= lfs.c + WARNS= 3 -CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\" +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" -DLUA_PATH_DEFAULT=\"${LUAPATH}/\?.lua\" CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} Modified: stable/11/stand/liblua/luaconf.h ============================================================================== --- stable/11/stand/liblua/luaconf.h Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/liblua/luaconf.h Tue Dec 3 18:25:16 2019 (r355345) @@ -202,7 +202,7 @@ #else /* }{ */ -#define LUA_ROOT "/boot/lua/" LUA_VDIR "/" +#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" #define LUA_LDIR LUA_ROOT "share/" #define LUA_CDIR LUA_ROOT "lib/" #ifndef LUA_PATH_DEFAULT Modified: stable/11/stand/loader.mk ============================================================================== --- stable/11/stand/loader.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/loader.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -64,6 +64,7 @@ SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} +CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules .elif ${LOADER_INTERP} == "4th" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" Modified: stable/11/stand/lua/Makefile ============================================================================== --- stable/11/stand/lua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/lua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -12,7 +12,7 @@ MAN= cli.lua.8 \ password.lua.8 \ screen.lua.8 -FILESDIR= /boot/lua +FILESDIR= ${LUAPATH} FILES= cli.lua \ color.lua \ config.lua \ From owner-svn-src-stable@freebsd.org Tue Dec 3 18:28:40 2019 Return-Path: Delivered-To: svn-src-stable@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 0F4C11B88C3; Tue, 3 Dec 2019 18:28:40 +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 47S9Tz6hd2z3GCv; Tue, 3 Dec 2019 18:28:39 +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 C91951BC86; Tue, 3 Dec 2019 18:28:39 +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 xB3ISdwN049462; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3ISd82049461; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031828.xB3ISd82049461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355346 - in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Commit-Revision: 355346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:28:40 -0000 Author: kevans Date: Tue Dec 3 18:28:39 2019 New Revision: 355346 URL: https://svnweb.freebsd.org/changeset/base/355346 Log: MFC rarm: correct kernelstack allocation size This appears to be a copy-pasto from previous lines that propagated to v6 over the years. Indeed, nothing references kernelstack beyond USPACE_SVC_STACK_TOP and it would be odd if anything did. Modified: stable/12/sys/arm/arm/machdep.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/arm/arm/machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/arm/arm/machdep.c ============================================================================== --- stable/12/sys/arm/arm/machdep.c Tue Dec 3 18:25:16 2019 (r355345) +++ stable/12/sys/arm/arm/machdep.c Tue Dec 3 18:28:39 2019 (r355346) @@ -942,7 +942,7 @@ initarm(struct arm_boot_params *abp) valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU); valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU); valloc_pages(undstack, UND_STACK_SIZE * MAXCPU); - valloc_pages(kernelstack, kstack_pages * MAXCPU); + valloc_pages(kernelstack, kstack_pages); valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* @@ -1207,7 +1207,7 @@ initarm(struct arm_boot_params *abp) irqstack = pmap_preboot_get_vpages(IRQ_STACK_SIZE * MAXCPU); abtstack = pmap_preboot_get_vpages(ABT_STACK_SIZE * MAXCPU); undstack = pmap_preboot_get_vpages(UND_STACK_SIZE * MAXCPU ); - kernelstack = pmap_preboot_get_vpages(kstack_pages * MAXCPU); + kernelstack = pmap_preboot_get_vpages(kstack_pages); /* Allocate message buffer. */ msgbufp = (void *)pmap_preboot_get_vpages( From owner-svn-src-stable@freebsd.org Tue Dec 3 18:28:39 2019 Return-Path: Delivered-To: svn-src-stable@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 B21F51B88BD; Tue, 3 Dec 2019 18:28:39 +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 47S9Tz4GZ6z3GCt; Tue, 3 Dec 2019 18:28:39 +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 75FA91BC85; Tue, 3 Dec 2019 18:28:39 +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 xB3ISd1u049456; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3ISdhx049455; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031828.xB3ISdhx049455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355346 - in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Commit-Revision: 355346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:28:39 -0000 Author: kevans Date: Tue Dec 3 18:28:39 2019 New Revision: 355346 URL: https://svnweb.freebsd.org/changeset/base/355346 Log: MFC rarm: correct kernelstack allocation size This appears to be a copy-pasto from previous lines that propagated to v6 over the years. Indeed, nothing references kernelstack beyond USPACE_SVC_STACK_TOP and it would be odd if anything did. Modified: stable/11/sys/arm/arm/machdep.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/arm/arm/machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/arm/arm/machdep.c ============================================================================== --- stable/11/sys/arm/arm/machdep.c Tue Dec 3 18:25:16 2019 (r355345) +++ stable/11/sys/arm/arm/machdep.c Tue Dec 3 18:28:39 2019 (r355346) @@ -908,7 +908,7 @@ initarm(struct arm_boot_params *abp) valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU); valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU); valloc_pages(undstack, UND_STACK_SIZE * MAXCPU); - valloc_pages(kernelstack, kstack_pages * MAXCPU); + valloc_pages(kernelstack, kstack_pages); valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* @@ -1173,7 +1173,7 @@ initarm(struct arm_boot_params *abp) irqstack = pmap_preboot_get_vpages(IRQ_STACK_SIZE * MAXCPU); abtstack = pmap_preboot_get_vpages(ABT_STACK_SIZE * MAXCPU); undstack = pmap_preboot_get_vpages(UND_STACK_SIZE * MAXCPU ); - kernelstack = pmap_preboot_get_vpages(kstack_pages * MAXCPU); + kernelstack = pmap_preboot_get_vpages(kstack_pages); /* Allocate message buffer. */ msgbufp = (void *)pmap_preboot_get_vpages( From owner-svn-src-stable@freebsd.org Tue Dec 3 18:36:15 2019 Return-Path: Delivered-To: svn-src-stable@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 5A8611B8D0C for ; Tue, 3 Dec 2019 18:36:15 +0000 (UTC) (envelope-from kevans@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 47S9fl1qDyz3Gsc for ; Tue, 3 Dec 2019 18:36:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 13F5B1FDB2 for ; Tue, 3 Dec 2019 18:36:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f179.google.com with SMTP id z22so4797673qto.7 for ; Tue, 03 Dec 2019 10:36:15 -0800 (PST) X-Gm-Message-State: APjAAAXtPmVqXfLgZ7p9AiqSfFhRURU2xwcsybNdOllT4TqK1RLGU4Xs gFzgZX4BV1M1+eJ+aKHgysDVjJwzC0Q2CZ0Z/2k= X-Received: by 2002:ac8:5319:: with SMTP id t25mt6861705qtn.242.1575398174636; Tue, 03 Dec 2019 10:36:14 -0800 (PST) MIME-Version: 1.0 References: <201912031828.xB3ISd82049461@repo.freebsd.org> In-Reply-To: <201912031828.xB3ISd82049461@repo.freebsd.org> From: Kyle Evans Date: Tue, 3 Dec 2019 12:36:02 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355346 - in stable: 11/sys/arm/arm 12/sys/arm/arm Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:36:15 -0000 On Tue, Dec 3, 2019 at 12:28 PM Kyle Evans wrote: > > Author: kevans > Date: Tue Dec 3 18:28:39 2019 > New Revision: 355346 > URL: https://svnweb.freebsd.org/changeset/base/355346 > > Log: > MFC rarm: correct kernelstack allocation size > > This appears to be a copy-pasto from previous lines that propagated to v6 > over the years. Indeed, nothing references kernelstack beyond > USPACE_SVC_STACK_TOP and it would be odd if anything did. > This should have read: "MFC r353902" From owner-svn-src-stable@freebsd.org Tue Dec 3 18:38:52 2019 Return-Path: Delivered-To: svn-src-stable@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 EAC781B8F10; Tue, 3 Dec 2019 18:38: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 47S9jm5xv2z3H9l; Tue, 3 Dec 2019 18:38: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 AAD731BE49; Tue, 3 Dec 2019 18:38:52 +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 xB3IcqIo055628; Tue, 3 Dec 2019 18:38:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Icq3f055626; Tue, 3 Dec 2019 18:38:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031838.xB3Icq3f055626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355348 - in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Commit-Revision: 355348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:38:53 -0000 Author: kevans Date: Tue Dec 3 18:38:51 2019 New Revision: 355348 URL: https://svnweb.freebsd.org/changeset/base/355348 Log: MFC r354236: mdmfs(8): add -k skel option to populate fs from a skeleton mdmfs(8) lacks the ability to populate throwaway memory filesystems from an existing directory. This features permits an interesting setup where /var for instance lives on a device where wear-leveling is something you want to avoid as much as possible and nonetheless you don't want to lose your logs, ports metadata, etc. Here are the steps: 1. Copy /var to /var.bak; 2. Mount an mfs into /var using -k /var.bak at startup; 3. Synchronize /var to /var.bak weekly and on shutdown. Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag. PR: 146254 Modified: stable/11/sbin/mdmfs/mdmfs.8 stable/11/sbin/mdmfs/mdmfs.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sbin/mdmfs/mdmfs.8 stable/12/sbin/mdmfs/mdmfs.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sbin/mdmfs/mdmfs.8 ============================================================================== --- stable/11/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:36:39 2019 (r355347) +++ stable/11/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:38:51 2019 (r355348) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2017 +.Dd October 31, 2019 .Dt MDMFS 8 .Os .Sh NAME @@ -48,6 +48,7 @@ filesystem .Op Fl F Ar file .Op Fl f Ar frag-size .Op Fl i Ar bytes +.Op Fl k Ar skel .Op Fl m Ar percent-free .Op Fl O Ar optimization .Op Fl o Ar mount-options @@ -192,6 +193,11 @@ memory disk backed by The fragment size of the file system in bytes. .It Fl i Ar bytes Number of bytes per inode. +.It Fl k Ar skel +Copy the content of directory +.Ar skel +into +.Ar mount-point . .It Fl l Enable multilabel MAC on the new file system. .It Fl L Modified: stable/11/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/11/sbin/mdmfs/mdmfs.c Tue Dec 3 18:36:39 2019 (r355347) +++ stable/11/sbin/mdmfs/mdmfs.c Tue Dec 3 18:38:51 2019 (r355348) @@ -88,6 +88,7 @@ static void do_mount_md(const char *, const char *); static void do_mount_tmpfs(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); static void do_newfs(const char *); +static void do_copy(const char *, const char *); static void extract_ugid(const char *, struct mtpt_info *); static int run(int *, const char *, ...) __printflike(2, 3); static void usage(void); @@ -102,7 +103,7 @@ main(int argc, char **argv) enum md_types mdtype; /* The type of our memory disk. */ bool have_mdtype, mlmac; bool detach, softdep, autounit, newfs; - const char *mtpoint, *size_arg, *unitstr; + const char *mtpoint, *size_arg, *skel, *unitstr; char *p; int ch, idx; void *set; @@ -116,6 +117,7 @@ main(int argc, char **argv) mlmac = false; newfs = true; have_mdtype = false; + skel = NULL; mdtype = MD_SWAP; mdname = MD_NAME; mdnamelen = strlen(mdname); @@ -140,7 +142,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:k:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -182,6 +184,9 @@ main(int argc, char **argv) case 'i': argappend(&newfs_arg, "-i %s", optarg); break; + case 'k': + skel = optarg; + break; case 'L': loudsubs = true; break; @@ -357,6 +362,8 @@ main(int argc, char **argv) } do_mtptsetup(mtpoint, &mi); + if (skel != NULL) + do_copy(mtpoint, skel); return (0); } @@ -608,7 +615,24 @@ do_newfs(const char *args) errx(1, "newfs exited with error code %d", rv); } + /* + * Copy skel into the mountpoint. + */ +static void +do_copy(const char *mtpoint, const char *skel) +{ + int rv; + + rv = chdir(skel); + if (rv != 0) + err(1, "chdir to %s", skel); + rv = run(NULL, "/bin/pax -rw -pe . %s", mtpoint); + if (rv != 0) + errx(1, "skel copy failed"); +} + +/* * 'str' should be a user and group name similar to the last argument * to chown(1); i.e., a user, followed by a colon, followed by a * group. The user and group in 'str' may be either a [ug]id or a @@ -783,8 +807,8 @@ usage(void) fprintf(stderr, "usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" -"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" -"\t[-O optimization] [-o mount-options]\n" +"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-k skel]\n" +"\t[-m percent-free] [-O optimization] [-o mount-options]\n" "\t[-p permissions] [-s size] [-v version] [-w user:group]\n" "\tmd-device mount-point\n", getprogname()); exit(1); From owner-svn-src-stable@freebsd.org Tue Dec 3 18:38:53 2019 Return-Path: Delivered-To: svn-src-stable@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 740831B8F1C; Tue, 3 Dec 2019 18:38:53 +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 47S9jn2VCRz3H9m; Tue, 3 Dec 2019 18:38:53 +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 390BD1BE4A; Tue, 3 Dec 2019 18:38:53 +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 xB3Icrrn055637; Tue, 3 Dec 2019 18:38:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IcqAR055635; Tue, 3 Dec 2019 18:38:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031838.xB3IcqAR055635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355348 - in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Commit-Revision: 355348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:38:53 -0000 Author: kevans Date: Tue Dec 3 18:38:51 2019 New Revision: 355348 URL: https://svnweb.freebsd.org/changeset/base/355348 Log: MFC r354236: mdmfs(8): add -k skel option to populate fs from a skeleton mdmfs(8) lacks the ability to populate throwaway memory filesystems from an existing directory. This features permits an interesting setup where /var for instance lives on a device where wear-leveling is something you want to avoid as much as possible and nonetheless you don't want to lose your logs, ports metadata, etc. Here are the steps: 1. Copy /var to /var.bak; 2. Mount an mfs into /var using -k /var.bak at startup; 3. Synchronize /var to /var.bak weekly and on shutdown. Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag. PR: 146254 Modified: stable/12/sbin/mdmfs/mdmfs.8 stable/12/sbin/mdmfs/mdmfs.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sbin/mdmfs/mdmfs.8 stable/11/sbin/mdmfs/mdmfs.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sbin/mdmfs/mdmfs.8 ============================================================================== --- stable/12/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:36:39 2019 (r355347) +++ stable/12/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:38:51 2019 (r355348) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2017 +.Dd October 31, 2019 .Dt MDMFS 8 .Os .Sh NAME @@ -48,6 +48,7 @@ filesystem .Op Fl F Ar file .Op Fl f Ar frag-size .Op Fl i Ar bytes +.Op Fl k Ar skel .Op Fl m Ar percent-free .Op Fl O Ar optimization .Op Fl o Ar mount-options @@ -193,6 +194,11 @@ memory disk backed by The fragment size of the file system in bytes. .It Fl i Ar bytes Number of bytes per inode. +.It Fl k Ar skel +Copy the content of directory +.Ar skel +into +.Ar mount-point . .It Fl l Enable multilabel MAC on the new file system. .It Fl L Modified: stable/12/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/12/sbin/mdmfs/mdmfs.c Tue Dec 3 18:36:39 2019 (r355347) +++ stable/12/sbin/mdmfs/mdmfs.c Tue Dec 3 18:38:51 2019 (r355348) @@ -88,6 +88,7 @@ static void do_mount_md(const char *, const char *); static void do_mount_tmpfs(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); static void do_newfs(const char *); +static void do_copy(const char *, const char *); static void extract_ugid(const char *, struct mtpt_info *); static int run(int *, const char *, ...) __printflike(2, 3); static void usage(void); @@ -102,7 +103,7 @@ main(int argc, char **argv) enum md_types mdtype; /* The type of our memory disk. */ bool have_mdtype, mlmac; bool detach, softdep, autounit, newfs; - const char *mtpoint, *size_arg, *unitstr; + const char *mtpoint, *size_arg, *skel, *unitstr; char *p; int ch, idx; void *set; @@ -116,6 +117,7 @@ main(int argc, char **argv) mlmac = false; newfs = true; have_mdtype = false; + skel = NULL; mdtype = MD_SWAP; mdname = MD_NAME; mdnamelen = strlen(mdname); @@ -140,7 +142,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:k:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -182,6 +184,9 @@ main(int argc, char **argv) case 'i': argappend(&newfs_arg, "-i %s", optarg); break; + case 'k': + skel = optarg; + break; case 'L': loudsubs = true; break; @@ -357,6 +362,8 @@ main(int argc, char **argv) } do_mtptsetup(mtpoint, &mi); + if (skel != NULL) + do_copy(mtpoint, skel); return (0); } @@ -608,7 +615,24 @@ do_newfs(const char *args) errx(1, "newfs exited with error code %d", rv); } + /* + * Copy skel into the mountpoint. + */ +static void +do_copy(const char *mtpoint, const char *skel) +{ + int rv; + + rv = chdir(skel); + if (rv != 0) + err(1, "chdir to %s", skel); + rv = run(NULL, "/bin/pax -rw -pe . %s", mtpoint); + if (rv != 0) + errx(1, "skel copy failed"); +} + +/* * 'str' should be a user and group name similar to the last argument * to chown(1); i.e., a user, followed by a colon, followed by a * group. The user and group in 'str' may be either a [ug]id or a @@ -783,8 +807,8 @@ usage(void) fprintf(stderr, "usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" -"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" -"\t[-O optimization] [-o mount-options]\n" +"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-k skel]\n" +"\t[-m percent-free] [-O optimization] [-o mount-options]\n" "\t[-p permissions] [-s size] [-v version] [-w user:group]\n" "\tmd-device mount-point\n", getprogname()); exit(1); From owner-svn-src-stable@freebsd.org Tue Dec 3 18:50:19 2019 Return-Path: Delivered-To: svn-src-stable@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 6EE531B959D; Tue, 3 Dec 2019 18:50:19 +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 47S9yz2HPHz3J8B; Tue, 3 Dec 2019 18:50:19 +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 3191E1C018; Tue, 3 Dec 2019 18:50:19 +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 xB3IoJPu061999; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IoJwT061998; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031850.xB3IoJwT061998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355350 - in stable: 11/stand/liblua 12/stand/liblua X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/liblua 12/stand/liblua X-SVN-Commit-Revision: 355350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:50:19 -0000 Author: kevans Date: Tue Dec 3 18:50:18 2019 New Revision: 355350 URL: https://svnweb.freebsd.org/changeset/base/355350 Log: MFC r354246: liblua: add loader.lua_path As described previously, loader.lua_path is absolute path where scripts are installed. A future commit will use this to build paths for dofile in try_include, rather than the current pcall/require setup that makes it more difficult to coordinate loader aborts from local.lua -- we do not need the flexibility of require(), and local.lua is in-fact not a 'module-like' file as we will not be referencing anything from it. Modified: stable/11/stand/liblua/lutils.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/stand/liblua/lutils.c Directory Properties: stable/12/ (props changed) Modified: stable/11/stand/liblua/lutils.c ============================================================================== --- stable/11/stand/liblua/lutils.c Tue Dec 3 18:44:19 2019 (r355349) +++ stable/11/stand/liblua/lutils.c Tue Dec 3 18:50:18 2019 (r355350) @@ -384,6 +384,8 @@ luaopen_loader(lua_State *L) lua_setfield(L, -2, "machine"); lua_pushstring(L, MACHINE_ARCH); lua_setfield(L, -2, "machine_arch"); + lua_pushstring(L, LUA_PATH); + lua_setfield(L, -2, "lua_path"); /* Set global printc to loader.printc */ lua_register(L, "printc", lua_printc); return 1; From owner-svn-src-stable@freebsd.org Tue Dec 3 18:50:19 2019 Return-Path: Delivered-To: svn-src-stable@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 BEE861B95A5; Tue, 3 Dec 2019 18:50:19 +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 47S9yz4hKsz3J8C; Tue, 3 Dec 2019 18:50:19 +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 846501C019; Tue, 3 Dec 2019 18:50:19 +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 xB3IoJRi062005; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IoJGk062004; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031850.xB3IoJGk062004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355350 - in stable: 11/stand/liblua 12/stand/liblua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/liblua 12/stand/liblua X-SVN-Commit-Revision: 355350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:50:19 -0000 Author: kevans Date: Tue Dec 3 18:50:18 2019 New Revision: 355350 URL: https://svnweb.freebsd.org/changeset/base/355350 Log: MFC r354246: liblua: add loader.lua_path As described previously, loader.lua_path is absolute path where scripts are installed. A future commit will use this to build paths for dofile in try_include, rather than the current pcall/require setup that makes it more difficult to coordinate loader aborts from local.lua -- we do not need the flexibility of require(), and local.lua is in-fact not a 'module-like' file as we will not be referencing anything from it. Modified: stable/12/stand/liblua/lutils.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/liblua/lutils.c Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/liblua/lutils.c ============================================================================== --- stable/12/stand/liblua/lutils.c Tue Dec 3 18:44:19 2019 (r355349) +++ stable/12/stand/liblua/lutils.c Tue Dec 3 18:50:18 2019 (r355350) @@ -384,6 +384,8 @@ luaopen_loader(lua_State *L) lua_setfield(L, -2, "machine"); lua_pushstring(L, MACHINE_ARCH); lua_setfield(L, -2, "machine_arch"); + lua_pushstring(L, LUA_PATH); + lua_setfield(L, -2, "lua_path"); /* Set global printc to loader.printc */ lua_register(L, "printc", lua_printc); return 1; From owner-svn-src-stable@freebsd.org Tue Dec 3 18:55:11 2019 Return-Path: Delivered-To: svn-src-stable@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 194BA1B9997; Tue, 3 Dec 2019 18:55:11 +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 47SB4b0bHlz3JmM; Tue, 3 Dec 2019 18:55:11 +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 E871B1C1E1; Tue, 3 Dec 2019 18:55:10 +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 xB3ItAMS067488; Tue, 3 Dec 2019 18:55:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3It9Ca067480; Tue, 3 Dec 2019 18:55:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031855.xB3It9Ca067480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355351 - in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Commit-Revision: 355351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:55:11 -0000 Author: kevans Date: Tue Dec 3 18:55:09 2019 New Revision: 355351 URL: https://svnweb.freebsd.org/changeset/base/355351 Log: MFC r351836, r351866, r354328: patch(1) /dev/null testing+improvement r351836: patch(1): add some basic tests Summary: - basic: test application of patches created by diff -u at the beginning/middle/end of file, which have differing amounts of context before and after chunks being added - limited_ctx: stems from PR 74127 in which a rogue line was getting added when the patch should have been rejected. Similar behavior was reproducible with larger contexts near the beginning/end of a file. See r326084 for details - file_creation: patch sourced from /dev/null should create the file - file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents when re-applied (personal vendetta, WIP, see comment) - file_removal: this follows from nodupe; the reverse of a patch sourced from /dev/null is most naturally deleting the file, as is expected based on GNU patch behavior (WIP) r351866: patch(1): fix the file removal test, strengthen it a bit To remain compatible with GNU patch, we should ensure that once we're removing empty files after a reversed /dev/null patch we don't remove files that have been modified. GNU patch leaves these intact and just reverses the hunk that created the file, effectively implying --remove-empty-files for reversed /dev/null patches. r354328: patch(1): give /dev/null patches special treatment We have a bad habit of duplicating contents of files that are sourced from /dev/null and applied more than once... take the more sane (in most ways) GNU route and complain if the file exists and offer reversal options. This still falls short a little bit as selecting "don't reverse, apply anyway" will still give you duplicated file contents. There's probably other issues as well, but awareness is the first step to happiness. Added: stable/11/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/patch/Makefile stable/11/usr.bin/patch/patch.1 stable/11/usr.bin/patch/patch.c stable/11/usr.bin/patch/pch.c stable/11/usr.bin/patch/pch.h stable/11/usr.bin/patch/tests/unified_patch_test.sh stable/11/usr.bin/patch/util.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/usr.bin/patch/Makefile stable/12/usr.bin/patch/patch.1 stable/12/usr.bin/patch/patch.c stable/12/usr.bin/patch/pch.c stable/12/usr.bin/patch/pch.h stable/12/usr.bin/patch/tests/unified_patch_test.sh stable/12/usr.bin/patch/util.c Directory Properties: stable/12/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/etc/mtree/BSD.tests.dist Tue Dec 3 18:55:09 2019 (r355351) @@ -692,6 +692,8 @@ .. opensm .. + patch + .. pr .. printf Modified: stable/11/usr.bin/patch/Makefile ============================================================================== --- stable/11/usr.bin/patch/Makefile Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/Makefile Tue Dec 3 18:55:09 2019 (r355351) @@ -1,8 +1,13 @@ # $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $ # $FreeBSD$ +.include + PROG= patch SRCS= backupfile.c inp.c mkpath.c patch.c pch.c util.c + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/usr.bin/patch/patch.1 ============================================================================== --- stable/11/usr.bin/patch/patch.1 Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/patch.1 Tue Dec 3 18:55:09 2019 (r355351) @@ -21,7 +21,7 @@ .\" .\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $ .\" $FreeBSD$ -.Dd August 15, 2015 +.Dd November 3, 2019 .Dt PATCH 1 .Os .Sh NAME @@ -559,8 +559,10 @@ option as needed. .Pp Third, you can create a file by sending out a diff that compares a null file to the file you want to create. -This will only work if the file you want to create does not exist already in -the target directory. +If the file you want to create already exists in the target directory when the +diff is applied, then +.Nm +will identify the patch as potentially reversed and offer to reverse the patch. .Pp Fourth, take care not to send out reversed patches, since it makes people wonder whether they already applied the patch. Modified: stable/11/usr.bin/patch/patch.c ============================================================================== --- stable/11/usr.bin/patch/patch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/patch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,7 @@ static void dump_line(LINENUM, bool); static bool patch_match(LINENUM, LINENUM, LINENUM); static bool similar(const char *, const char *, int); static void usage(void); +static bool handle_creation(bool, bool *); /* true if -E was specified on command line. */ static bool remove_empty_files = false; @@ -147,8 +149,10 @@ static char end_defined[128]; int main(int argc, char *argv[]) { + struct stat statbuf; int error = 0, hunk, failed, i, fd; - bool patch_seen, reverse_seen; + bool out_creating, out_existed, patch_seen, remove_file; + bool reverse_seen; LINENUM where = 0, newwhere, fuzz, mymaxfuzz; const char *tmpdir; char *v; @@ -219,6 +223,12 @@ main(int argc, char *argv[]) reinitialize_almost_everything()) { /* for each patch in patch file */ + if (source_file != NULL && (diff_type == CONTEXT_DIFF || + diff_type == NEW_CONTEXT_DIFF || + diff_type == UNI_DIFF)) + out_creating = strcmp(source_file, _PATH_DEVNULL) == 0; + else + out_creating = false; patch_seen = true; warn_on_invalid_line = true; @@ -226,6 +236,19 @@ main(int argc, char *argv[]) if (outname == NULL) outname = xstrdup(filearg[0]); + /* + * At this point, we know if we're supposed to be creating the + * file and we know if we should be trying to handle a conflict + * between the patch and the file already existing. We defer + * handling it until hunk processing because we want to swap + * the hunk if they opt to reverse it, but we want to make sure + * we *can* swap the hunk without running into memory issues + * before we offer it. We also want to be verbose if flags or + * user decision cause us to skip -- this is explained a little + * more later. + */ + out_existed = stat(outname, &statbuf) == 0; + /* for ed script just up and do it and exit */ if (diff_type == ED_DIFF) { do_ed_script(); @@ -252,9 +275,28 @@ main(int argc, char *argv[]) failed = 0; reverse_seen = false; out_of_mem = false; + remove_file = false; while (another_hunk()) { + assert(!out_creating || hunk == 0); hunk++; fuzz = 0; + + /* + * There are only three cases in handle_creation() that + * results in us skipping hunk location, in order: + * + * 1.) Potentially reversed but -f/--force'd, + * 2.) Potentially reversed but -N/--forward'd + * 3.) Reversed and the user's opted to not apply it. + * + * In all three cases, we still want to inform the user + * that we're ignoring it in the standard way, which is + * also tied to this hunk processing loop. + */ + if (out_creating) + reverse_seen = handle_creation(out_existed, + &remove_file); + mymaxfuzz = pch_context(); if (maxfuzz < mymaxfuzz) mymaxfuzz = maxfuzz; @@ -372,7 +414,6 @@ main(int argc, char *argv[]) /* and put the output where desired */ ignore_signals(); if (!skip_rest_of_patch) { - struct stat statbuf; char *realout = outname; if (!check_only) { @@ -383,7 +424,18 @@ main(int argc, char *argv[]) } else chmod(outname, filemode); - if (remove_empty_files && + /* + * remove_file is a per-patch flag indicating + * whether it's OK to remove the empty file. + * This is specifically set when we're reversing + * the creation of a file and it ends up empty. + * This is an exception to the global policy + * (remove_empty_files) because the user would + * likely not expect the reverse of file + * creation to leave an empty file laying + * around. + */ + if ((remove_empty_files || remove_file) && stat(realout, &statbuf) == 0 && statbuf.st_size == 0) { if (verbose) @@ -444,6 +496,9 @@ reinitialize_almost_everything(void) filearg[0] = NULL; } + free(source_file); + source_file = NULL; + free(outname); outname = NULL; @@ -1083,4 +1138,85 @@ similar(const char *a, const char *b, int len) } return true; /* actually, this is not reached */ /* since there is always a \n */ +} + +static bool +handle_creation(bool out_existed, bool *remove) +{ + bool reverse_seen; + + reverse_seen = false; + if (reverse && out_existed) { + /* + * If the patch creates the file and we're reversing the patch, + * then we need to indicate to the patch processor that it's OK + * to remove this file. + */ + *remove = true; + } else if (!reverse && out_existed) { + /* + * Otherwise, we need to blow the horn because the patch appears + * to be reversed/already applied. For non-batch jobs, we'll + * prompt to figure out what we should be trying to do to raise + * awareness of the issue. batch (-t) processing suppresses the + * questions and just assumes that we're reversed if it looks + * like we are, which is always the case if we've reached this + * branch. + */ + if (force) { + skip_rest_of_patch = true; + return (false); + } + if (noreverse) { + /* If -N is supplied, however, we bail out/ignore. */ + say("Ignoring previously applied (or reversed) patch.\n"); + skip_rest_of_patch = true; + return (false); + } + + /* Unreversed... suspicious if the file existed. */ + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + + reverse = !reverse; + + if (batch) { + if (verbose) + say("Patch creates file that already exists, %s %seversed", + reverse ? "Assuming" : "Ignoring", + reverse ? "R" : "Unr"); + } else { + ask("Patch creates file that already exists! %s -R? [y] ", + reverse ? "Assume" : "Ignore"); + + if (*buf == 'n') { + ask("Apply anyway? [n]"); + if (*buf != 'y') + /* Don't apply; error out. */ + skip_rest_of_patch = true; + else + /* Attempt to apply. */ + reverse_seen = true; + reverse = !reverse; + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + } else { + /* + * They've opted to assume -R; effectively the + * same as the first branch in this function, + * but the decision is here rather than in a + * prior patch/hunk as in that branch. + */ + *remove = true; + } + } + } + + /* + * The return value indicates if we offered a chance to reverse but the + * user declined. This keeps the main patch processor in the loop since + * we've taken this out of the normal flow of hunk processing to + * simplify logic a little bit. + */ + return (reverse_seen); } Modified: stable/11/usr.bin/patch/pch.c ============================================================================== --- stable/11/usr.bin/patch/pch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/pch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -70,6 +70,8 @@ static LINENUM p_bfake = -1; /* beg of faked up lines static FILE *pfp = NULL; /* patch file pointer */ static char *bestguess = NULL; /* guess at correct filename */ +char *source_file; + static void grow_hunkmax(void); static int intuit_diff_type(void); static void next_intuit_at(off_t, LINENUM); @@ -218,7 +220,12 @@ there_is_another_patch(void) bestguess = xstrdup(buf); filearg[0] = fetchname(buf, &exists, 0); } - if (!exists) { + /* + * fetchname can now return buf = NULL, exists = true, to + * indicate to the caller that /dev/null was specified. Retain + * previous behavior for now until this can be better evaluted. + */ + if (filearg[0] == NULL || !exists) { int def_skip = *bestguess == '\0'; ask("No file found--skip this patch? [%c] ", def_skip ? 'y' : 'n'); @@ -402,6 +409,24 @@ scan_exit: struct file_name tmp = names[OLD_FILE]; names[OLD_FILE] = names[NEW_FILE]; names[NEW_FILE] = tmp; + } + + /* Invalidated */ + free(source_file); + source_file = NULL; + + if (retval != 0) { + /* + * If we've successfully determined a diff type, stored in + * retval, path == NULL means _PATH_DEVNULL if exists is set. + * Explicitly specify it here to make it easier to detect later + * on that we're actually creating a file and not that we've + * just goofed something up. + */ + if (names[OLD_FILE].path != NULL) + source_file = xstrdup(names[OLD_FILE].path); + else if (names[OLD_FILE].exists) + source_file = xstrdup(_PATH_DEVNULL); } if (filearg[0] == NULL) { if (posix) Modified: stable/11/usr.bin/patch/pch.h ============================================================================== --- stable/11/usr.bin/patch/pch.h Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/pch.h Tue Dec 3 18:55:09 2019 (r355351) @@ -37,6 +37,8 @@ struct file_name { bool exists; }; +extern char *source_file; + void re_patch(void); void open_patch_file(const char *); void set_hunkmax(void); Modified: stable/11/usr.bin/patch/tests/unified_patch_test.sh ============================================================================== --- head/usr.bin/patch/tests/unified_patch_test.sh Thu Sep 5 03:16:14 2019 (r351836) +++ stable/11/usr.bin/patch/tests/unified_patch_test.sh Tue Dec 3 18:55:09 2019 (r355351) @@ -102,32 +102,44 @@ file_creation_body() # commits. If a file is created by a diff, patch(1) will happily duplicate the # contents as many times as you apply the diff. It should instead detect that # a source of /dev/null creates the file, so it shouldn't exist. Furthermore, -# the reverse of creation is deletion -- hence the next test. +# the reverse of creation is deletion -- hence the next test, which ensures that +# the file is removed if it's empty once the patch is reversed. The size checks +# are scattered throughout to make sure that we didn't get some kind of false +# error, and the first size check is merely a sanity check that should be +# trivially true as this is executed in a sandbox. atf_test_case file_nodupe file_nodupe_body() { - # WIP - atf_expect_fail "patch(1) erroneously duplicates created files" echo "x" > foo diff -u /dev/null foo > foo.diff - atf_check -x "patch -s < foo.diff" - atf_check -s not-exit:0 -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -Ns < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo } atf_test_case file_removal file_removal_body() { - # WIP - atf_expect_fail "patch(1) does not yet recognize /dev/null as creation" - echo "x" > foo diff -u /dev/null foo > foo.diff + # Check that the file is removed completely if it was sourced from + # /dev/null atf_check -x "patch -Rs < foo.diff" - atf_check -s not-exit:0 -o ignore stat foo + atf_check -s not-exit:0 -e ignore stat foo + + # But if it had been modified, we'll only remove the portion that the + # patch would have created. This makes us compatible with GNU patch's + # behavior, at least. Whether that is the sane action or not is a + # question for further study, and then this comment may be removed. + printf "x\ny\n" > foo + atf_check -x "patch -Rs < foo.diff" + atf_check -o inline:"y\n" cat foo } atf_init_test_cases() Modified: stable/11/usr.bin/patch/util.c ============================================================================== --- stable/11/usr.bin/patch/util.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/util.c Tue Dec 3 18:55:09 2019 (r355351) @@ -366,8 +366,10 @@ fetchname(const char *at, bool *exists, int strip_lead say("fetchname %s %d\n", at, strip_leading); #endif /* So files can be created by diffing against /dev/null. */ - if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) + if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) { + *exists = true; return NULL; + } name = fullname = t = savestr(at); tab = strchr(t, '\t') != NULL; From owner-svn-src-stable@freebsd.org Tue Dec 3 18:55:12 2019 Return-Path: Delivered-To: svn-src-stable@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 DEA7B1B99B2; Tue, 3 Dec 2019 18:55:12 +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 47SB4c6F5Wz3Jn9; Tue, 3 Dec 2019 18:55:12 +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 A21341C1E2; Tue, 3 Dec 2019 18:55:12 +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 xB3ItCj0067503; Tue, 3 Dec 2019 18:55:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3ItBjk067495; Tue, 3 Dec 2019 18:55:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031855.xB3ItBjk067495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:55:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355351 - in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Commit-Revision: 355351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:55:13 -0000 Author: kevans Date: Tue Dec 3 18:55:09 2019 New Revision: 355351 URL: https://svnweb.freebsd.org/changeset/base/355351 Log: MFC r351836, r351866, r354328: patch(1) /dev/null testing+improvement r351836: patch(1): add some basic tests Summary: - basic: test application of patches created by diff -u at the beginning/middle/end of file, which have differing amounts of context before and after chunks being added - limited_ctx: stems from PR 74127 in which a rogue line was getting added when the patch should have been rejected. Similar behavior was reproducible with larger contexts near the beginning/end of a file. See r326084 for details - file_creation: patch sourced from /dev/null should create the file - file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents when re-applied (personal vendetta, WIP, see comment) - file_removal: this follows from nodupe; the reverse of a patch sourced from /dev/null is most naturally deleting the file, as is expected based on GNU patch behavior (WIP) r351866: patch(1): fix the file removal test, strengthen it a bit To remain compatible with GNU patch, we should ensure that once we're removing empty files after a reversed /dev/null patch we don't remove files that have been modified. GNU patch leaves these intact and just reverses the hunk that created the file, effectively implying --remove-empty-files for reversed /dev/null patches. r354328: patch(1): give /dev/null patches special treatment We have a bad habit of duplicating contents of files that are sourced from /dev/null and applied more than once... take the more sane (in most ways) GNU route and complain if the file exists and offer reversal options. This still falls short a little bit as selecting "don't reverse, apply anyway" will still give you duplicated file contents. There's probably other issues as well, but awareness is the first step to happiness. Added: stable/12/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/usr.bin/patch/Makefile stable/12/usr.bin/patch/patch.1 stable/12/usr.bin/patch/patch.c stable/12/usr.bin/patch/pch.c stable/12/usr.bin/patch/pch.h stable/12/usr.bin/patch/tests/unified_patch_test.sh stable/12/usr.bin/patch/util.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/patch/Makefile stable/11/usr.bin/patch/patch.1 stable/11/usr.bin/patch/patch.c stable/11/usr.bin/patch/pch.c stable/11/usr.bin/patch/pch.h stable/11/usr.bin/patch/tests/unified_patch_test.sh stable/11/usr.bin/patch/util.c Directory Properties: stable/11/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/etc/mtree/BSD.tests.dist Tue Dec 3 18:55:09 2019 (r355351) @@ -1010,6 +1010,8 @@ .. opensm .. + patch + .. pr .. printf Modified: stable/12/usr.bin/patch/Makefile ============================================================================== --- stable/12/usr.bin/patch/Makefile Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/Makefile Tue Dec 3 18:55:09 2019 (r355351) @@ -1,8 +1,13 @@ # $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $ # $FreeBSD$ +.include + PROG= patch SRCS= backupfile.c inp.c mkpath.c patch.c pch.c util.c + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/12/usr.bin/patch/patch.1 ============================================================================== --- stable/12/usr.bin/patch/patch.1 Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/patch.1 Tue Dec 3 18:55:09 2019 (r355351) @@ -21,7 +21,7 @@ .\" .\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $ .\" $FreeBSD$ -.Dd August 15, 2015 +.Dd November 3, 2019 .Dt PATCH 1 .Os .Sh NAME @@ -559,8 +559,10 @@ option as needed. .Pp Third, you can create a file by sending out a diff that compares a null file to the file you want to create. -This will only work if the file you want to create does not exist already in -the target directory. +If the file you want to create already exists in the target directory when the +diff is applied, then +.Nm +will identify the patch as potentially reversed and offer to reverse the patch. .Pp Fourth, take care not to send out reversed patches, since it makes people wonder whether they already applied the patch. Modified: stable/12/usr.bin/patch/patch.c ============================================================================== --- stable/12/usr.bin/patch/patch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/patch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,7 @@ static void dump_line(LINENUM, bool); static bool patch_match(LINENUM, LINENUM, LINENUM); static bool similar(const char *, const char *, int); static void usage(void); +static bool handle_creation(bool, bool *); /* true if -E was specified on command line. */ static bool remove_empty_files = false; @@ -147,8 +149,10 @@ static char end_defined[128]; int main(int argc, char *argv[]) { + struct stat statbuf; int error = 0, hunk, failed, i, fd; - bool patch_seen, reverse_seen; + bool out_creating, out_existed, patch_seen, remove_file; + bool reverse_seen; LINENUM where = 0, newwhere, fuzz, mymaxfuzz; const char *tmpdir; char *v; @@ -219,6 +223,12 @@ main(int argc, char *argv[]) reinitialize_almost_everything()) { /* for each patch in patch file */ + if (source_file != NULL && (diff_type == CONTEXT_DIFF || + diff_type == NEW_CONTEXT_DIFF || + diff_type == UNI_DIFF)) + out_creating = strcmp(source_file, _PATH_DEVNULL) == 0; + else + out_creating = false; patch_seen = true; warn_on_invalid_line = true; @@ -226,6 +236,19 @@ main(int argc, char *argv[]) if (outname == NULL) outname = xstrdup(filearg[0]); + /* + * At this point, we know if we're supposed to be creating the + * file and we know if we should be trying to handle a conflict + * between the patch and the file already existing. We defer + * handling it until hunk processing because we want to swap + * the hunk if they opt to reverse it, but we want to make sure + * we *can* swap the hunk without running into memory issues + * before we offer it. We also want to be verbose if flags or + * user decision cause us to skip -- this is explained a little + * more later. + */ + out_existed = stat(outname, &statbuf) == 0; + /* for ed script just up and do it and exit */ if (diff_type == ED_DIFF) { do_ed_script(); @@ -252,9 +275,28 @@ main(int argc, char *argv[]) failed = 0; reverse_seen = false; out_of_mem = false; + remove_file = false; while (another_hunk()) { + assert(!out_creating || hunk == 0); hunk++; fuzz = 0; + + /* + * There are only three cases in handle_creation() that + * results in us skipping hunk location, in order: + * + * 1.) Potentially reversed but -f/--force'd, + * 2.) Potentially reversed but -N/--forward'd + * 3.) Reversed and the user's opted to not apply it. + * + * In all three cases, we still want to inform the user + * that we're ignoring it in the standard way, which is + * also tied to this hunk processing loop. + */ + if (out_creating) + reverse_seen = handle_creation(out_existed, + &remove_file); + mymaxfuzz = pch_context(); if (maxfuzz < mymaxfuzz) mymaxfuzz = maxfuzz; @@ -372,7 +414,6 @@ main(int argc, char *argv[]) /* and put the output where desired */ ignore_signals(); if (!skip_rest_of_patch) { - struct stat statbuf; char *realout = outname; if (!check_only) { @@ -383,7 +424,18 @@ main(int argc, char *argv[]) } else chmod(outname, filemode); - if (remove_empty_files && + /* + * remove_file is a per-patch flag indicating + * whether it's OK to remove the empty file. + * This is specifically set when we're reversing + * the creation of a file and it ends up empty. + * This is an exception to the global policy + * (remove_empty_files) because the user would + * likely not expect the reverse of file + * creation to leave an empty file laying + * around. + */ + if ((remove_empty_files || remove_file) && stat(realout, &statbuf) == 0 && statbuf.st_size == 0) { if (verbose) @@ -444,6 +496,9 @@ reinitialize_almost_everything(void) filearg[0] = NULL; } + free(source_file); + source_file = NULL; + free(outname); outname = NULL; @@ -1083,4 +1138,85 @@ similar(const char *a, const char *b, int len) } return true; /* actually, this is not reached */ /* since there is always a \n */ +} + +static bool +handle_creation(bool out_existed, bool *remove) +{ + bool reverse_seen; + + reverse_seen = false; + if (reverse && out_existed) { + /* + * If the patch creates the file and we're reversing the patch, + * then we need to indicate to the patch processor that it's OK + * to remove this file. + */ + *remove = true; + } else if (!reverse && out_existed) { + /* + * Otherwise, we need to blow the horn because the patch appears + * to be reversed/already applied. For non-batch jobs, we'll + * prompt to figure out what we should be trying to do to raise + * awareness of the issue. batch (-t) processing suppresses the + * questions and just assumes that we're reversed if it looks + * like we are, which is always the case if we've reached this + * branch. + */ + if (force) { + skip_rest_of_patch = true; + return (false); + } + if (noreverse) { + /* If -N is supplied, however, we bail out/ignore. */ + say("Ignoring previously applied (or reversed) patch.\n"); + skip_rest_of_patch = true; + return (false); + } + + /* Unreversed... suspicious if the file existed. */ + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + + reverse = !reverse; + + if (batch) { + if (verbose) + say("Patch creates file that already exists, %s %seversed", + reverse ? "Assuming" : "Ignoring", + reverse ? "R" : "Unr"); + } else { + ask("Patch creates file that already exists! %s -R? [y] ", + reverse ? "Assume" : "Ignore"); + + if (*buf == 'n') { + ask("Apply anyway? [n]"); + if (*buf != 'y') + /* Don't apply; error out. */ + skip_rest_of_patch = true; + else + /* Attempt to apply. */ + reverse_seen = true; + reverse = !reverse; + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + } else { + /* + * They've opted to assume -R; effectively the + * same as the first branch in this function, + * but the decision is here rather than in a + * prior patch/hunk as in that branch. + */ + *remove = true; + } + } + } + + /* + * The return value indicates if we offered a chance to reverse but the + * user declined. This keeps the main patch processor in the loop since + * we've taken this out of the normal flow of hunk processing to + * simplify logic a little bit. + */ + return (reverse_seen); } Modified: stable/12/usr.bin/patch/pch.c ============================================================================== --- stable/12/usr.bin/patch/pch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/pch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -70,6 +70,8 @@ static LINENUM p_bfake = -1; /* beg of faked up lines static FILE *pfp = NULL; /* patch file pointer */ static char *bestguess = NULL; /* guess at correct filename */ +char *source_file; + static void grow_hunkmax(void); static int intuit_diff_type(void); static void next_intuit_at(off_t, LINENUM); @@ -218,7 +220,12 @@ there_is_another_patch(void) bestguess = xstrdup(buf); filearg[0] = fetchname(buf, &exists, 0); } - if (!exists) { + /* + * fetchname can now return buf = NULL, exists = true, to + * indicate to the caller that /dev/null was specified. Retain + * previous behavior for now until this can be better evaluted. + */ + if (filearg[0] == NULL || !exists) { int def_skip = *bestguess == '\0'; ask("No file found--skip this patch? [%c] ", def_skip ? 'y' : 'n'); @@ -402,6 +409,24 @@ scan_exit: struct file_name tmp = names[OLD_FILE]; names[OLD_FILE] = names[NEW_FILE]; names[NEW_FILE] = tmp; + } + + /* Invalidated */ + free(source_file); + source_file = NULL; + + if (retval != 0) { + /* + * If we've successfully determined a diff type, stored in + * retval, path == NULL means _PATH_DEVNULL if exists is set. + * Explicitly specify it here to make it easier to detect later + * on that we're actually creating a file and not that we've + * just goofed something up. + */ + if (names[OLD_FILE].path != NULL) + source_file = xstrdup(names[OLD_FILE].path); + else if (names[OLD_FILE].exists) + source_file = xstrdup(_PATH_DEVNULL); } if (filearg[0] == NULL) { if (posix) Modified: stable/12/usr.bin/patch/pch.h ============================================================================== --- stable/12/usr.bin/patch/pch.h Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/pch.h Tue Dec 3 18:55:09 2019 (r355351) @@ -37,6 +37,8 @@ struct file_name { bool exists; }; +extern char *source_file; + void re_patch(void); void open_patch_file(const char *); void set_hunkmax(void); Modified: stable/12/usr.bin/patch/tests/unified_patch_test.sh ============================================================================== --- head/usr.bin/patch/tests/unified_patch_test.sh Thu Sep 5 03:16:14 2019 (r351836) +++ stable/12/usr.bin/patch/tests/unified_patch_test.sh Tue Dec 3 18:55:09 2019 (r355351) @@ -102,32 +102,44 @@ file_creation_body() # commits. If a file is created by a diff, patch(1) will happily duplicate the # contents as many times as you apply the diff. It should instead detect that # a source of /dev/null creates the file, so it shouldn't exist. Furthermore, -# the reverse of creation is deletion -- hence the next test. +# the reverse of creation is deletion -- hence the next test, which ensures that +# the file is removed if it's empty once the patch is reversed. The size checks +# are scattered throughout to make sure that we didn't get some kind of false +# error, and the first size check is merely a sanity check that should be +# trivially true as this is executed in a sandbox. atf_test_case file_nodupe file_nodupe_body() { - # WIP - atf_expect_fail "patch(1) erroneously duplicates created files" echo "x" > foo diff -u /dev/null foo > foo.diff - atf_check -x "patch -s < foo.diff" - atf_check -s not-exit:0 -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -Ns < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo } atf_test_case file_removal file_removal_body() { - # WIP - atf_expect_fail "patch(1) does not yet recognize /dev/null as creation" - echo "x" > foo diff -u /dev/null foo > foo.diff + # Check that the file is removed completely if it was sourced from + # /dev/null atf_check -x "patch -Rs < foo.diff" - atf_check -s not-exit:0 -o ignore stat foo + atf_check -s not-exit:0 -e ignore stat foo + + # But if it had been modified, we'll only remove the portion that the + # patch would have created. This makes us compatible with GNU patch's + # behavior, at least. Whether that is the sane action or not is a + # question for further study, and then this comment may be removed. + printf "x\ny\n" > foo + atf_check -x "patch -Rs < foo.diff" + atf_check -o inline:"y\n" cat foo } atf_init_test_cases() Modified: stable/12/usr.bin/patch/util.c ============================================================================== --- stable/12/usr.bin/patch/util.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/util.c Tue Dec 3 18:55:09 2019 (r355351) @@ -366,8 +366,10 @@ fetchname(const char *at, bool *exists, int strip_lead say("fetchname %s %d\n", at, strip_leading); #endif /* So files can be created by diffing against /dev/null. */ - if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) + if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) { + *exists = true; return NULL; + } name = fullname = t = savestr(at); tab = strchr(t, '\t') != NULL; From owner-svn-src-stable@freebsd.org Tue Dec 3 18:57:33 2019 Return-Path: Delivered-To: svn-src-stable@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 B4F031B9AE9; Tue, 3 Dec 2019 18:57:33 +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 47SB7K4MgFz3K34; Tue, 3 Dec 2019 18:57:33 +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 7498B1C1E3; Tue, 3 Dec 2019 18:57:33 +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 xB3IvXHP067666; Tue, 3 Dec 2019 18:57:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IvXLv067665; Tue, 3 Dec 2019 18:57:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031857.xB3IvXLv067665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355352 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 355352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:57:33 -0000 Author: kevans Date: Tue Dec 3 18:57:32 2019 New Revision: 355352 URL: https://svnweb.freebsd.org/changeset/base/355352 Log: MFC r354464: sys/conf/files.arm64: remove unnecessary soc_* dependencies These files already have 'device' lines that they require; adding a dependency on SOC_* options is an extra restriction that adds extra verbosity when future supported Broadcom-based SOC will also feature the same compatible device. Users wishing to not compile these devices in should remove the 'device' lines from their config. Modified: stable/12/sys/conf/files.arm64 Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files.arm64 ============================================================================== --- stable/12/sys/conf/files.arm64 Tue Dec 3 18:55:09 2019 (r355351) +++ stable/12/sys/conf/files.arm64 Tue Dec 3 18:57:32 2019 (r355352) @@ -82,18 +82,18 @@ arm/arm/pmu.c standard arm/arm/physmem.c standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq fdt \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" -arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc fdt arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 fdt arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_intr.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_mbox.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_rng.c optional random soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi fdt arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt From owner-svn-src-stable@freebsd.org Tue Dec 3 18:58:46 2019 Return-Path: Delivered-To: svn-src-stable@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 3A82A1B9BAB; Tue, 3 Dec 2019 18:58:46 +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 47SB8k0q6Hz3KB7; Tue, 3 Dec 2019 18:58:46 +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 F3CB91C1E8; Tue, 3 Dec 2019 18:58:45 +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 xB3IwjfM067772; Tue, 3 Dec 2019 18:58:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IwjOn067771; Tue, 3 Dec 2019 18:58:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031858.xB3IwjOn067771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355353 - stable/12/lib/csu/common X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/lib/csu/common X-SVN-Commit-Revision: 355353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:58:46 -0000 Author: kevans Date: Tue Dec 3 18:58:45 2019 New Revision: 355353 URL: https://svnweb.freebsd.org/changeset/base/355353 Log: MFC r354541: csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs .jcr still needs a 0-entry added in crtend, even on !HAVE_CTORS archs, as we're still getting .jcr sections added -- presumably due to the reference in crtbegin. Without this terminal, the .jcr section (without data) overlaps with the next section and register_classes in crtbegin will be examining the wrong item. PR: 241439 Modified: stable/12/lib/csu/common/crtend.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/csu/common/crtend.c ============================================================================== --- stable/12/lib/csu/common/crtend.c Tue Dec 3 18:57:32 2019 (r355352) +++ stable/12/lib/csu/common/crtend.c Tue Dec 3 18:58:45 2019 (r355353) @@ -26,9 +26,14 @@ __FBSDID("$FreeBSD$"); #include "crt.h" -#ifdef HAVE_CTORS typedef void (*crt_func)(void); +static crt_func __JCR_LIST__[] __section(".jcr") __used = { + (crt_func)0 +}; + +#ifdef HAVE_CTORS + /* * On some architectures and toolchains we may need to call the .ctors. * These are called in the reverse order they are in the ELF file. @@ -39,9 +44,6 @@ static crt_func __CTOR_END__[] __section(".ctors") __u (crt_func)0 }; static crt_func __DTOR_END__[] __section(".dtors") __used = { - (crt_func)0 -}; -static crt_func __JCR_LIST__[] __section(".jcr") __used = { (crt_func)0 }; From owner-svn-src-stable@freebsd.org Tue Dec 3 19:00:12 2019 Return-Path: Delivered-To: svn-src-stable@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 E242D1B9CBF; Tue, 3 Dec 2019 19:00:12 +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 47SBBN5ZyXz3KLV; Tue, 3 Dec 2019 19:00:12 +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 A2F2F1C1F7; Tue, 3 Dec 2019 19:00:12 +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 xB3J0CFX067981; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3J0CIF067980; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031900.xB3J0CIF067980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355354 - in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Commit-Revision: 355354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:00:13 -0000 Author: kevans Date: Tue Dec 3 19:00:12 2019 New Revision: 355354 URL: https://svnweb.freebsd.org/changeset/base/355354 Log: MFC r354712: arm64: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes For any size that isn't page-aligned, we end up not pre-allocating enough for a single mapping because we truncate the size instead of rounding up to make sure the last bit is accounted for, leaving us one page shy of what we need to fulfill a request. Modified: stable/11/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- stable/11/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 18:58:45 2019 (r355353) +++ stable/11/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 19:00:12 2019 (r355354) @@ -214,7 +214,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if (ptoa(bz->total_bpages) < maxsize) { int pages; - pages = atop(maxsize) - bz->total_bpages; + pages = atop(round_page(maxsize)) - bz->total_bpages; /* Add pages to our bounce pool */ if (alloc_bounce_pages(newtag, pages) < pages) From owner-svn-src-stable@freebsd.org Tue Dec 3 19:00:13 2019 Return-Path: Delivered-To: svn-src-stable@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 3722D1B9CD1; Tue, 3 Dec 2019 19:00:13 +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 47SBBP0kgRz3KLW; Tue, 3 Dec 2019 19:00:13 +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 F150C1C1F8; Tue, 3 Dec 2019 19:00:12 +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 xB3J0CTW067987; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3J0CKG067986; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031900.xB3J0CKG067986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355354 - in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Commit-Revision: 355354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:00:13 -0000 Author: kevans Date: Tue Dec 3 19:00:12 2019 New Revision: 355354 URL: https://svnweb.freebsd.org/changeset/base/355354 Log: MFC r354712: arm64: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes For any size that isn't page-aligned, we end up not pre-allocating enough for a single mapping because we truncate the size instead of rounding up to make sure the last bit is accounted for, leaving us one page shy of what we need to fulfill a request. Modified: stable/12/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- stable/12/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 18:58:45 2019 (r355353) +++ stable/12/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 19:00:12 2019 (r355354) @@ -214,7 +214,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if (ptoa(bz->total_bpages) < maxsize) { int pages; - pages = atop(maxsize) - bz->total_bpages; + pages = atop(round_page(maxsize)) - bz->total_bpages; /* Add pages to our bounce pool */ if (alloc_bounce_pages(newtag, pages) < pages) From owner-svn-src-stable@freebsd.org Tue Dec 3 19:14:02 2019 Return-Path: Delivered-To: svn-src-stable@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 F0FF41BA2ED; Tue, 3 Dec 2019 19:14:02 +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 47SBVL62qdz3LSS; Tue, 3 Dec 2019 19:14:02 +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 B229F1C565; Tue, 3 Dec 2019 19:14:02 +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 xB3JE2h7079215; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3JE2o8079214; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031914.xB3JE2o8079214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:14:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355355 - in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Commit-Revision: 355355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:14:03 -0000 Author: kevans Date: Tue Dec 3 19:14:02 2019 New Revision: 355355 URL: https://svnweb.freebsd.org/changeset/base/355355 Log: MFC r355205: snp: don't reference tp->t_mtx directly This is the only part of snp(4) that pokes around in struct tty directly; replace it with the tty_getlock accessor to avoid struct tty internals. Modified: stable/11/sys/dev/snp/snp.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/snp/snp.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/snp/snp.c ============================================================================== --- stable/11/sys/dev/snp/snp.c Tue Dec 3 19:00:12 2019 (r355354) +++ stable/11/sys/dev/snp/snp.c Tue Dec 3 19:14:02 2019 (r355355) @@ -174,7 +174,7 @@ snp_read(struct cdev *dev, struct uio *uio, int flag) error = EWOULDBLOCK; break; } - error = cv_wait_sig(&ss->snp_outwait, tp->t_mtx); + error = cv_wait_sig(&ss->snp_outwait, tty_getlock(tp)); if (error != 0) break; if (tty_gone(tp)) { From owner-svn-src-stable@freebsd.org Tue Dec 3 19:14:03 2019 Return-Path: Delivered-To: svn-src-stable@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 4C0C51BA2F2; Tue, 3 Dec 2019 19:14:03 +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 47SBVM1P8pz3LST; Tue, 3 Dec 2019 19:14:03 +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 133AF1C566; Tue, 3 Dec 2019 19:14:03 +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 xB3JE2F1079221; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3JE2IS079220; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031914.xB3JE2IS079220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:14:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355355 - in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Commit-Revision: 355355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:14:03 -0000 Author: kevans Date: Tue Dec 3 19:14:02 2019 New Revision: 355355 URL: https://svnweb.freebsd.org/changeset/base/355355 Log: MFC r355205: snp: don't reference tp->t_mtx directly This is the only part of snp(4) that pokes around in struct tty directly; replace it with the tty_getlock accessor to avoid struct tty internals. Modified: stable/12/sys/dev/snp/snp.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/snp/snp.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/snp/snp.c ============================================================================== --- stable/12/sys/dev/snp/snp.c Tue Dec 3 19:00:12 2019 (r355354) +++ stable/12/sys/dev/snp/snp.c Tue Dec 3 19:14:02 2019 (r355355) @@ -178,7 +178,7 @@ snp_read(struct cdev *dev, struct uio *uio, int flag) error = EWOULDBLOCK; break; } - error = cv_wait_sig(&ss->snp_outwait, tp->t_mtx); + error = cv_wait_sig(&ss->snp_outwait, tty_getlock(tp)); if (error != 0) break; if (tty_gone(tp)) { From owner-svn-src-stable@freebsd.org Tue Dec 3 22:01:46 2019 Return-Path: Delivered-To: svn-src-stable@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 2C0551BF151; Tue, 3 Dec 2019 22:01:46 +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 47SGCt0Qjsz41Bq; Tue, 3 Dec 2019 22:01:46 +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 E5E1D1E403; Tue, 3 Dec 2019 22:01:45 +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 xB3M1j20080135; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3M1jJ5080134; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912032201.xB3M1jJ5080134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Dec 2019 22:01:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355359 - in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Commit-Revision: 355359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:01:46 -0000 Author: jhb Date: Tue Dec 3 22:01:45 2019 New Revision: 355359 URL: https://svnweb.freebsd.org/changeset/base/355359 Log: MFC 342160: Work around BIOS quirks on HPE Proliant MicroServer Gen10 PR: 221350 Modified: stable/11/sys/dev/pci/pci.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/pci/pci.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/pci/pci.c ============================================================================== --- stable/11/sys/dev/pci/pci.c Tue Dec 3 21:05:33 2019 (r355358) +++ stable/11/sys/dev/pci/pci.c Tue Dec 3 22:01:45 2019 (r355359) @@ -229,6 +229,7 @@ struct pci_quirk { #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ #define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ +#define PCI_QUIRK_REALLOC_BAR 7 /* Can't allocate memory at the default address */ int arg1; int arg2; }; @@ -310,6 +311,12 @@ static const struct pci_quirk pci_quirks[] = { { 0x167814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715 */ { 0x167914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715S */ + /* + * HPE Gen 10 VGA has a memory range that can't be allocated in the + * expected place. + */ + { 0x98741002, PCI_QUIRK_REALLOC_BAR, 0, 0 }, + { 0 } }; @@ -3280,7 +3287,9 @@ pci_add_map(device_t bus, device_t dev, int reg, struc */ res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, flags); - if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0)) { + if ((pci_do_realloc_bars + || pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_REALLOC_BAR)) + && res == NULL && (start != 0 || end != ~0)) { /* * If the allocation fails, try to allocate a resource for * this BAR using any available range. The firmware felt From owner-svn-src-stable@freebsd.org Tue Dec 3 22:01:45 2019 Return-Path: Delivered-To: svn-src-stable@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 CB0421BF14C; Tue, 3 Dec 2019 22:01:45 +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 47SGCs55RPz41Bp; Tue, 3 Dec 2019 22:01:45 +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 923271E402; Tue, 3 Dec 2019 22:01:45 +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 xB3M1jw6080129; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3M1jSm080128; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912032201.xB3M1jSm080128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Dec 2019 22:01:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355359 - in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Commit-Revision: 355359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:01:45 -0000 Author: jhb Date: Tue Dec 3 22:01:45 2019 New Revision: 355359 URL: https://svnweb.freebsd.org/changeset/base/355359 Log: MFC 342160: Work around BIOS quirks on HPE Proliant MicroServer Gen10 PR: 221350 Modified: stable/12/sys/dev/pci/pci.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/pci/pci.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/pci/pci.c ============================================================================== --- stable/12/sys/dev/pci/pci.c Tue Dec 3 21:05:33 2019 (r355358) +++ stable/12/sys/dev/pci/pci.c Tue Dec 3 22:01:45 2019 (r355359) @@ -234,6 +234,7 @@ struct pci_quirk { #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ #define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ +#define PCI_QUIRK_REALLOC_BAR 7 /* Can't allocate memory at the default address */ int arg1; int arg2; }; @@ -315,6 +316,12 @@ static const struct pci_quirk pci_quirks[] = { { 0x167814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715 */ { 0x167914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715S */ + /* + * HPE Gen 10 VGA has a memory range that can't be allocated in the + * expected place. + */ + { 0x98741002, PCI_QUIRK_REALLOC_BAR, 0, 0 }, + { 0 } }; @@ -3293,7 +3300,9 @@ pci_add_map(device_t bus, device_t dev, int reg, struc */ res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, flags); - if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0)) { + if ((pci_do_realloc_bars + || pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_REALLOC_BAR)) + && res == NULL && (start != 0 || end != ~0)) { /* * If the allocation fails, try to allocate a resource for * this BAR using any available range. The firmware felt From owner-svn-src-stable@freebsd.org Tue Dec 3 22:49:26 2019 Return-Path: Delivered-To: svn-src-stable@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 16D2F1C041A; Tue, 3 Dec 2019 22:49:26 +0000 (UTC) (envelope-from rpokala@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 47SHGs6vG4z43xm; Tue, 3 Dec 2019 22:49:25 +0000 (UTC) (envelope-from rpokala@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 D040D1EC7A; Tue, 3 Dec 2019 22:49:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MnP8w004449; Tue, 3 Dec 2019 22:49:25 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MnOWT004438; Tue, 3 Dec 2019 22:49:24 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032249.xB3MnOWT004438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:49:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355362 - in stable/12: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Commit-Revision: 355362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:49:26 -0000 Author: rpokala Date: Tue Dec 3 22:49:24 2019 New Revision: 355362 URL: https://svnweb.freebsd.org/changeset/base/355362 Log: MFC r343583: Remove unecessary "All rights reserved" from files under my or Panasas's copyright. When all member nations of the Buenos Aires Convention adopted the Berne Convention, the phrase "All rights reserved" became unnecessary to assert copyright. Remove it from files under my or Panasas's copyright. The files related to jedec_dimm(4) also bear avg@'s copyright; he has approved this change. Modified: stable/12/share/man/man4/imcsmb.4 stable/12/share/man/man4/jedec_dimm.4 stable/12/sys/dev/imcsmb/imcsmb.c stable/12/sys/dev/imcsmb/imcsmb_pci.c stable/12/sys/dev/imcsmb/imcsmb_reg.h stable/12/sys/dev/imcsmb/imcsmb_var.h stable/12/sys/dev/jedec_dimm/jedec_dimm.c stable/12/sys/dev/jedec_dimm/jedec_dimm.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/imcsmb.4 ============================================================================== --- stable/12/share/man/man4/imcsmb.4 Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/share/man/man4/imcsmb.4 Tue Dec 3 22:49:24 2019 (r355362) @@ -2,7 +2,6 @@ .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD .\" .\" Copyright (c) 2018 Panasas -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/12/share/man/man4/jedec_dimm.4 ============================================================================== --- stable/12/share/man/man4/jedec_dimm.4 Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/share/man/man4/jedec_dimm.4 Tue Dec 3 22:49:24 2019 (r355362) @@ -3,7 +3,6 @@ .\" .\" Copyright (c) 2016 Andriy Gapon .\" Copyright (c) 2018 Ravi Pokala -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb.c ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb_pci.c ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb_reg.h ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb_var.h ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/jedec_dimm/jedec_dimm.c ============================================================================== --- stable/12/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:49:24 2019 (r355362) @@ -5,7 +5,6 @@ * * Copyright (c) 2016 Andriy Gapon * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/jedec_dimm/jedec_dimm.h ============================================================================== --- stable/12/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-stable@freebsd.org Tue Dec 3 22:51:25 2019 Return-Path: Delivered-To: svn-src-stable@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 EC28C1C0827; Tue, 3 Dec 2019 22:51:25 +0000 (UTC) (envelope-from rpokala@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 47SHK9601fz44DJ; Tue, 3 Dec 2019 22:51:25 +0000 (UTC) (envelope-from rpokala@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 AF16A1ECD2; Tue, 3 Dec 2019 22:51:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MpPFe008367; Tue, 3 Dec 2019 22:51:25 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MpP6X008366; Tue, 3 Dec 2019 22:51:25 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032251.xB3MpP6X008366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355363 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 355363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:51:26 -0000 Author: rpokala Date: Tue Dec 3 22:51:25 2019 New Revision: 355363 URL: https://svnweb.freebsd.org/changeset/base/355363 Log: MFC r354102: Args for buf_track() might be unused If neither FULL_BUF_TRACKING nor BUF_TRACKING are defined, then the body of buf_track() becomes empty. Mark the arguments with "__unused" so the compiler doesn't complain about unused arguments in that case. Modified: stable/12/sys/sys/buf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/buf.h ============================================================================== --- stable/12/sys/sys/buf.h Tue Dec 3 22:49:24 2019 (r355362) +++ stable/12/sys/sys/buf.h Tue Dec 3 22:51:25 2019 (r355363) @@ -450,7 +450,7 @@ buf_countdeps(struct buf *bp, int i) } static __inline void -buf_track(struct buf *bp, const char *location) +buf_track(struct buf *bp __unused, const char *location __unused) { #if defined(FULL_BUF_TRACKING) From owner-svn-src-stable@freebsd.org Tue Dec 3 22:53:07 2019 Return-Path: Delivered-To: svn-src-stable@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 A3F9D1C0950; Tue, 3 Dec 2019 22:53:07 +0000 (UTC) (envelope-from rpokala@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 47SHM73vCZz44YP; Tue, 3 Dec 2019 22:53:07 +0000 (UTC) (envelope-from rpokala@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 6A50C1EE36; Tue, 3 Dec 2019 22:53:07 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Mr7YS010120; Tue, 3 Dec 2019 22:53:07 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Mr7XJ010119; Tue, 3 Dec 2019 22:53:07 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032253.xB3Mr7XJ010119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355364 - stable/12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/12/stand/libsa X-SVN-Commit-Revision: 355364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:53:07 -0000 Author: rpokala Date: Tue Dec 3 22:53:07 2019 New Revision: 355364 URL: https://svnweb.freebsd.org/changeset/base/355364 Log: MFC r354673: Logging improvements to loader::nfs Include the server IP address when logging nfs_open(), add a few missing "\n"s, and correct a typo. Modified: stable/12/stand/libsa/nfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/nfs.c ============================================================================== --- stable/12/stand/libsa/nfs.c Tue Dec 3 22:51:25 2019 (r355363) +++ stable/12/stand/libsa/nfs.c Tue Dec 3 22:53:07 2019 (r355364) @@ -486,7 +486,8 @@ nfs_open(const char *upath, struct open_file *f) #ifdef NFS_DEBUG if (debug) - printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); + printf("nfs_open: %s (rootip=%s rootpath=%s)\n", upath, + inet_ntoa(rootip), rootpath); #endif if (!rootpath[0]) { printf("no rootpath, no nfs\n"); @@ -691,14 +692,14 @@ nfs_read(struct open_file *f, void *buf, size_t size, if (cc == -1) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: read: %s", strerror(errno)); + printf("nfs_read: read: %s\n", strerror(errno)); #endif return (errno); /* XXX - from nfs_readdata */ } if (cc == 0) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: hit EOF unexpectantly"); + printf("nfs_read: hit EOF unexpectedly\n"); #endif goto ret; } From owner-svn-src-stable@freebsd.org Tue Dec 3 22:53:23 2019 Return-Path: Delivered-To: svn-src-stable@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 93DE61C09E5; Tue, 3 Dec 2019 22:53:23 +0000 (UTC) (envelope-from rpokala@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 47SHMR3NCZz44gm; Tue, 3 Dec 2019 22:53:23 +0000 (UTC) (envelope-from rpokala@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 547FE1EE38; Tue, 3 Dec 2019 22:53:23 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MrNPN010344; Tue, 3 Dec 2019 22:53:23 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MrMw4010340; Tue, 3 Dec 2019 22:53:22 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032253.xB3MrMw4010340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355365 - in stable/12/usr.sbin: rpc.lockd rpc.statd X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/12/usr.sbin: rpc.lockd rpc.statd X-SVN-Commit-Revision: 355365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:53:23 -0000 Author: rpokala Date: Tue Dec 3 22:53:22 2019 New Revision: 355365 URL: https://svnweb.freebsd.org/changeset/base/355365 Log: MFC r355006: Add and document options to allow rpc.lockd and rpc.statd to run in the foreground. This allows a separate process to monitor when and how those programs exit. That process can then restart them if needed. Modified: stable/12/usr.sbin/rpc.lockd/lockd.c stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 stable/12/usr.sbin/rpc.statd/rpc.statd.8 stable/12/usr.sbin/rpc.statd/statd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- stable/12/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:53:22 2019 (r355365) @@ -120,6 +120,7 @@ main(int argc, char **argv) char *endptr, **hosts_bak; struct sigaction sigalarm; int grace_period = 30; + int foreground = 0; struct netconfig *nconf; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; @@ -127,7 +128,7 @@ main(int argc, char **argv) int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { + while ((ch = getopt(argc, argv, "d:Fg:h:p:")) != (-1)) { switch (ch) { case 'd': debug_level = atoi(optarg); @@ -136,6 +137,9 @@ main(int argc, char **argv) /* NOTREACHED */ } break; + case 'F': + foreground = 1; + break; case 'g': grace_period = atoi(optarg); if (!grace_period) { @@ -422,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if (daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, debug_level > 0)) { err(1, "cannot fork"); /* NOTREACHED */ } @@ -844,7 +848,7 @@ void usage() { errx(1, "usage: rpc.lockd [-d ]" - " [-g ] [-h ] [-p ]"); + " [-F] [-g ] [-h ] [-p ]"); } /* Modified: stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 ============================================================================== --- stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:53:22 2019 (r355365) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2007 +.Dd November 21, 2019 .Dt RPC.LOCKD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d Ar debug_level +.Op Fl F .Op Fl g Ar grace period .Op Fl h Ar bindip .Op Fl p Ar port @@ -70,6 +71,17 @@ in the generation of one log line per protocol operati Higher debug levels can be specified, causing display of operation arguments and internal operations of the daemon. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl g The .Fl g Modified: stable/12/usr.sbin/rpc.statd/rpc.statd.8 ============================================================================== --- stable/12/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:53:22 2019 (r355365) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2007 +.Dd November 21, 2019 .Dt RPC.STATD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d +.Op Fl F .Op Fl h Ar bindip .Op Fl p Ar port .Sh DESCRIPTION @@ -71,6 +72,17 @@ These messages are logged with level LOG_DEBUG and facility LOG_DAEMON. Error conditions are logged irrespective of this option, using level LOG_ERR. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl h Ar bindip Specify specific IP addresses to bind to. This option may be specified multiple times. Modified: stable/12/usr.sbin/rpc.statd/statd.c ============================================================================== --- stable/12/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:53:22 2019 (r355365) @@ -88,15 +88,19 @@ main(int argc, char **argv) int ch, i, s; char *endptr, **hosts_bak; int have_v6 = 1; + int foreground = 0; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "dh:p:")) != -1) + while ((ch = getopt(argc, argv, "dFh:p:")) != -1) switch (ch) { case 'd': debug = 1; break; + case 'F': + foreground = 1; + break; case 'h': ++nhosts; hosts_bak = hosts; @@ -287,7 +291,11 @@ main(int argc, char **argv) /* Note that it is NOT sensible to run this program from inetd - the */ /* protocol assumes that it will run immediately at boot time. */ - daemon(0, 0); + if ((foreground == 0) && daemon(0, 0) < 0) { + err(1, "cannot fork"); + /* NOTREACHED */ + } + openlog("rpc.statd", 0, LOG_DAEMON); if (debug) syslog(LOG_INFO, "Starting - debug enabled"); else syslog(LOG_INFO, "Starting"); @@ -617,7 +625,7 @@ clearout_service(void) static void usage(void) { - fprintf(stderr, "usage: rpc.statd [-d] [-h ] [-p ]\n"); + fprintf(stderr, "usage: rpc.statd [-d] [-F] [-h ] [-p ]\n"); exit(1); } From owner-svn-src-stable@freebsd.org Tue Dec 3 22:53:52 2019 Return-Path: Delivered-To: svn-src-stable@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 CBB521C0AA0; Tue, 3 Dec 2019 22:53:52 +0000 (UTC) (envelope-from rpokala@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 47SHN0557jz44tC; Tue, 3 Dec 2019 22:53:52 +0000 (UTC) (envelope-from rpokala@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 930C51EE39; Tue, 3 Dec 2019 22:53:52 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MrqUo010415; Tue, 3 Dec 2019 22:53:52 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MroZ7010407; Tue, 3 Dec 2019 22:53:50 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032253.xB3MroZ7010407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355366 - in stable/11: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Commit-Revision: 355366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:53:52 -0000 Author: rpokala Date: Tue Dec 3 22:53:50 2019 New Revision: 355366 URL: https://svnweb.freebsd.org/changeset/base/355366 Log: MFC r343583: Remove unecessary "All rights reserved" from files under my or Panasas's copyright. When all member nations of the Buenos Aires Convention adopted the Berne Convention, the phrase "All rights reserved" became unnecessary to assert copyright. Remove it from files under my or Panasas's copyright. The files related to jedec_dimm(4) also bear avg@'s copyright; he has approved this change. Modified: stable/11/share/man/man4/imcsmb.4 stable/11/share/man/man4/jedec_dimm.4 stable/11/sys/dev/imcsmb/imcsmb.c stable/11/sys/dev/imcsmb/imcsmb_pci.c stable/11/sys/dev/imcsmb/imcsmb_reg.h stable/11/sys/dev/imcsmb/imcsmb_var.h stable/11/sys/dev/jedec_dimm/jedec_dimm.c stable/11/sys/dev/jedec_dimm/jedec_dimm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/imcsmb.4 ============================================================================== --- stable/11/share/man/man4/imcsmb.4 Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/share/man/man4/imcsmb.4 Tue Dec 3 22:53:50 2019 (r355366) @@ -2,7 +2,6 @@ .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD .\" .\" Copyright (c) 2018 Panasas -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/11/share/man/man4/jedec_dimm.4 ============================================================================== --- stable/11/share/man/man4/jedec_dimm.4 Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/share/man/man4/jedec_dimm.4 Tue Dec 3 22:53:50 2019 (r355366) @@ -3,7 +3,6 @@ .\" .\" Copyright (c) 2016 Andriy Gapon .\" Copyright (c) 2018 Ravi Pokala -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb.c ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb_pci.c ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb_reg.h ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb_var.h ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/jedec_dimm/jedec_dimm.c ============================================================================== --- stable/11/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:53:50 2019 (r355366) @@ -5,7 +5,6 @@ * * Copyright (c) 2016 Andriy Gapon * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/jedec_dimm/jedec_dimm.h ============================================================================== --- stable/11/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-stable@freebsd.org Tue Dec 3 22:54:08 2019 Return-Path: Delivered-To: svn-src-stable@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 CD8F81C0B2E; Tue, 3 Dec 2019 22:54:08 +0000 (UTC) (envelope-from rpokala@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 47SHNJ56f4z451G; Tue, 3 Dec 2019 22:54:08 +0000 (UTC) (envelope-from rpokala@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 933C31EE3A; Tue, 3 Dec 2019 22:54:08 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Ms8qT010477; Tue, 3 Dec 2019 22:54:08 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Ms8b6010476; Tue, 3 Dec 2019 22:54:08 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032254.xB3Ms8b6010476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355367 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 355367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:54:08 -0000 Author: rpokala Date: Tue Dec 3 22:54:08 2019 New Revision: 355367 URL: https://svnweb.freebsd.org/changeset/base/355367 Log: MFC r354673: Logging improvements to loader::nfs Include the server IP address when logging nfs_open(), add a few missing "\n"s, and correct a typo. Modified: stable/11/stand/libsa/nfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/nfs.c ============================================================================== --- stable/11/stand/libsa/nfs.c Tue Dec 3 22:53:50 2019 (r355366) +++ stable/11/stand/libsa/nfs.c Tue Dec 3 22:54:08 2019 (r355367) @@ -486,7 +486,8 @@ nfs_open(const char *upath, struct open_file *f) #ifdef NFS_DEBUG if (debug) - printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); + printf("nfs_open: %s (rootip=%s rootpath=%s)\n", upath, + inet_ntoa(rootip), rootpath); #endif if (!rootpath[0]) { printf("no rootpath, no nfs\n"); @@ -691,14 +692,14 @@ nfs_read(struct open_file *f, void *buf, size_t size, if (cc == -1) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: read: %s", strerror(errno)); + printf("nfs_read: read: %s\n", strerror(errno)); #endif return (errno); /* XXX - from nfs_readdata */ } if (cc == 0) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: hit EOF unexpectantly"); + printf("nfs_read: hit EOF unexpectedly\n"); #endif goto ret; } From owner-svn-src-stable@freebsd.org Tue Dec 3 22:54:26 2019 Return-Path: Delivered-To: svn-src-stable@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 0D8CF1C0BE0; Tue, 3 Dec 2019 22:54:26 +0000 (UTC) (envelope-from rpokala@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 47SHNd6hX2z457c; Tue, 3 Dec 2019 22:54:25 +0000 (UTC) (envelope-from rpokala@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 C978C1EE3B; Tue, 3 Dec 2019 22:54:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MsPGT010536; Tue, 3 Dec 2019 22:54:25 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MsPts010533; Tue, 3 Dec 2019 22:54:25 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032254.xB3MsPts010533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355368 - in stable/11/usr.sbin: rpc.lockd rpc.statd X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/11/usr.sbin: rpc.lockd rpc.statd X-SVN-Commit-Revision: 355368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:54:26 -0000 Author: rpokala Date: Tue Dec 3 22:54:24 2019 New Revision: 355368 URL: https://svnweb.freebsd.org/changeset/base/355368 Log: MFC r355006: Add and document options to allow rpc.lockd and rpc.statd to run in the foreground. This allows a separate process to monitor when and how those programs exit. That process can then restart them if needed. Modified: stable/11/usr.sbin/rpc.lockd/lockd.c stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 stable/11/usr.sbin/rpc.statd/rpc.statd.8 stable/11/usr.sbin/rpc.statd/statd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- stable/11/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:54:24 2019 (r355368) @@ -118,6 +118,7 @@ main(int argc, char **argv) char *endptr, **hosts_bak; struct sigaction sigalarm; int grace_period = 30; + int foreground = 0; struct netconfig *nconf; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; @@ -125,7 +126,7 @@ main(int argc, char **argv) int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { + while ((ch = getopt(argc, argv, "d:Fg:h:p:")) != (-1)) { switch (ch) { case 'd': debug_level = atoi(optarg); @@ -134,6 +135,9 @@ main(int argc, char **argv) /* NOTREACHED */ } break; + case 'F': + foreground = 1; + break; case 'g': grace_period = atoi(optarg); if (!grace_period) { @@ -420,7 +424,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if (daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, debug_level > 0)) { err(1, "cannot fork"); /* NOTREACHED */ } @@ -842,7 +846,7 @@ void usage() { errx(1, "usage: rpc.lockd [-d ]" - " [-g ] [-h ] [-p ]"); + " [-F] [-g ] [-h ] [-p ]"); } /* Modified: stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 ============================================================================== --- stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:54:24 2019 (r355368) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2007 +.Dd November 21, 2019 .Dt RPC.LOCKD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d Ar debug_level +.Op Fl F .Op Fl g Ar grace period .Op Fl h Ar bindip .Op Fl p Ar port @@ -70,6 +71,17 @@ in the generation of one log line per protocol operati Higher debug levels can be specified, causing display of operation arguments and internal operations of the daemon. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl g The .Fl g Modified: stable/11/usr.sbin/rpc.statd/rpc.statd.8 ============================================================================== --- stable/11/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:54:24 2019 (r355368) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2007 +.Dd November 21, 2019 .Dt RPC.STATD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d +.Op Fl F .Op Fl h Ar bindip .Op Fl p Ar port .Sh DESCRIPTION @@ -71,6 +72,17 @@ These messages are logged with level LOG_DEBUG and facility LOG_DAEMON. Error conditions are logged irrespective of this option, using level LOG_ERR. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl h Ar bindip Specify specific IP addresses to bind to. This option may be specified multiple times. Modified: stable/11/usr.sbin/rpc.statd/statd.c ============================================================================== --- stable/11/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:54:24 2019 (r355368) @@ -86,15 +86,19 @@ main(int argc, char **argv) int ch, i, s; char *endptr, **hosts_bak; int have_v6 = 1; + int foreground = 0; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "dh:p:")) != -1) + while ((ch = getopt(argc, argv, "dFh:p:")) != -1) switch (ch) { case 'd': debug = 1; break; + case 'F': + foreground = 1; + break; case 'h': ++nhosts; hosts_bak = hosts; @@ -285,7 +289,11 @@ main(int argc, char **argv) /* Note that it is NOT sensible to run this program from inetd - the */ /* protocol assumes that it will run immediately at boot time. */ - daemon(0, 0); + if ((foreground == 0) && daemon(0, 0) < 0) { + err(1, "cannot fork"); + /* NOTREACHED */ + } + openlog("rpc.statd", 0, LOG_DAEMON); if (debug) syslog(LOG_INFO, "Starting - debug enabled"); else syslog(LOG_INFO, "Starting"); @@ -615,7 +623,7 @@ clearout_service(void) static void usage(void) { - fprintf(stderr, "usage: rpc.statd [-d] [-h ] [-p ]\n"); + fprintf(stderr, "usage: rpc.statd [-d] [-F] [-h ] [-p ]\n"); exit(1); } From owner-svn-src-stable@freebsd.org Tue Dec 3 22:57:11 2019 Return-Path: Delivered-To: svn-src-stable@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 8669C1C0D2F; Tue, 3 Dec 2019 22:57:11 +0000 (UTC) (envelope-from vangyzen@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 47SHRq31Kvz45Ph; Tue, 3 Dec 2019 22:57:11 +0000 (UTC) (envelope-from vangyzen@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 4763C1EE3D; Tue, 3 Dec 2019 22:57:11 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MvBMs010876; Tue, 3 Dec 2019 22:57:11 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MvBTH010875; Tue, 3 Dec 2019 22:57:11 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201912032257.xB3MvBTH010875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 3 Dec 2019 22:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355369 - stable/12/usr.bin/tip/tip X-SVN-Group: stable-12 X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: stable/12/usr.bin/tip/tip X-SVN-Commit-Revision: 355369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:57:11 -0000 Author: vangyzen Date: Tue Dec 3 22:57:10 2019 New Revision: 355369 URL: https://svnweb.freebsd.org/changeset/base/355369 Log: MFC r354624 tip/cu: check for EOF on input on the local side If cu reads an EOF on the input side, it goes into a tight loop sending a garbage byte to the remote. With this change, it exits gracefully, along with its child. Sponsored by: Dell EMC Isilon Modified: stable/12/usr.bin/tip/tip/tip.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/tip/tip/tip.c ============================================================================== --- stable/12/usr.bin/tip/tip/tip.c Tue Dec 3 22:54:24 2019 (r355368) +++ stable/12/usr.bin/tip/tip/tip.c Tue Dec 3 22:57:10 2019 (r355369) @@ -252,7 +252,6 @@ cucommon: tipin(); else tipout(); - /*NOTREACHED*/ exit(0); } @@ -402,11 +401,16 @@ tipin(void) } while (1) { - gch = getchar()&STRIP_PAR; - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; if ((gch == character(value(ESCAPE))) && bol) { if (!noesc) { - if (!(gch = escape())) + gch = escape(); + if (gch == EOF) + return; + if (gch == 0) continue; } } else if (!cumode && gch == character(value(RAISECHAR))) { @@ -420,7 +424,10 @@ tipin(void) printf("\r\n"); continue; } else if (!cumode && gch == character(value(FORCE))) - gch = getchar()&STRIP_PAR; + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; bol = any(gch, value(EOL)); if (boolean(value(RAISE)) && islower(gch)) gch = toupper(gch); @@ -444,8 +451,10 @@ escape(void) esctable_t *p; char c = character(value(ESCAPE)); - gch = (getchar()&STRIP_PAR); - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return (EOF); + gch = gch & STRIP_PAR; for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags&PRIV) && uid) From owner-svn-src-stable@freebsd.org Tue Dec 3 22:59:56 2019 Return-Path: Delivered-To: svn-src-stable@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 A0A091C0E0C; Tue, 3 Dec 2019 22:59:56 +0000 (UTC) (envelope-from vangyzen@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 47SHW03nYRz45ZV; Tue, 3 Dec 2019 22:59:56 +0000 (UTC) (envelope-from vangyzen@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 61F201EE3E; Tue, 3 Dec 2019 22:59:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MxuMx011042; Tue, 3 Dec 2019 22:59:56 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Mxu2D011041; Tue, 3 Dec 2019 22:59:56 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201912032259.xB3Mxu2D011041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 3 Dec 2019 22:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355370 - stable/11/usr.bin/tip/tip X-SVN-Group: stable-11 X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: stable/11/usr.bin/tip/tip X-SVN-Commit-Revision: 355370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:59:56 -0000 Author: vangyzen Date: Tue Dec 3 22:59:55 2019 New Revision: 355370 URL: https://svnweb.freebsd.org/changeset/base/355370 Log: MFC r354624 tip/cu: check for EOF on input on the local side If cu reads an EOF on the input side, it goes into a tight loop sending a garbage byte to the remote. With this change, it exits gracefully, along with its child. Sponsored by: Dell EMC Isilon Modified: stable/11/usr.bin/tip/tip/tip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/tip/tip/tip.c ============================================================================== --- stable/11/usr.bin/tip/tip/tip.c Tue Dec 3 22:57:10 2019 (r355369) +++ stable/11/usr.bin/tip/tip/tip.c Tue Dec 3 22:59:55 2019 (r355370) @@ -250,7 +250,6 @@ cucommon: tipin(); else tipout(); - /*NOTREACHED*/ exit(0); } @@ -400,11 +399,16 @@ tipin(void) } while (1) { - gch = getchar()&STRIP_PAR; - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; if ((gch == character(value(ESCAPE))) && bol) { if (!noesc) { - if (!(gch = escape())) + gch = escape(); + if (gch == EOF) + return; + if (gch == 0) continue; } } else if (!cumode && gch == character(value(RAISECHAR))) { @@ -418,7 +422,10 @@ tipin(void) printf("\r\n"); continue; } else if (!cumode && gch == character(value(FORCE))) - gch = getchar()&STRIP_PAR; + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; bol = any(gch, value(EOL)); if (boolean(value(RAISE)) && islower(gch)) gch = toupper(gch); @@ -442,8 +449,10 @@ escape(void) esctable_t *p; char c = character(value(ESCAPE)); - gch = (getchar()&STRIP_PAR); - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return (EOF); + gch = gch & STRIP_PAR; for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags&PRIV) && uid) From owner-svn-src-stable@freebsd.org Tue Dec 3 23:11:41 2019 Return-Path: Delivered-To: svn-src-stable@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 A57E91C1514; Tue, 3 Dec 2019 23:11:41 +0000 (UTC) (envelope-from wulf@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 47SHmY3rJ3z46kT; Tue, 3 Dec 2019 23:11:41 +0000 (UTC) (envelope-from wulf@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 670DB1F073; Tue, 3 Dec 2019 23:11:41 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3NBfCa017928; Tue, 3 Dec 2019 23:11:41 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3NBfLB017927; Tue, 3 Dec 2019 23:11:41 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201912032311.xB3NBfLB017927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Tue, 3 Dec 2019 23:11:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355372 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 355372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 23:11:41 -0000 Author: wulf Date: Tue Dec 3 23:11:40 2019 New Revision: 355372 URL: https://svnweb.freebsd.org/changeset/base/355372 Log: MFC r355065 - r355068: Linux epoll improvements. r355065: Linux epoll: Don't deregister file descriptor after EPOLLONESHOT is fired Linux epoll does not remove descriptor after one-shot event has been triggered. Set EV_DISPATCH kqueue flag rather then EV_ONESHOT to get the same behavior. Required by Linux Steam client. PR: 240590 Reported by: Alex S Reviewed by: emaste, imp Differential Revision: https://reviews.freebsd.org/D22513 r355066: Linux epoll: Check both read and write kqueue events existence in EPOLL_CTL_ADD Linux epoll EPOLL_CTL_ADD op handler should always check registration of both EVFILT_READ and EVFILT_WRITE kevents to deceide if supplied file descriptor fd is already registered with epoll instance. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D22515 r355067: Linux epoll: Register events with zero event mask Such an events are legal and should be interpreted as EPOLLERR | EPOLLHUP. Register a disabled kqueue event in that case as we do not support EPOLLHUP yet. Required by Linux Steam client. PR: 240590 Reported by: Alex S Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D22516 r355068: Linux epoll: Allow passing of any negative timeout value to epoll_wait Linux epoll allow passing of any negative timeout value to epoll_wait() to cause unbound blocking Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D22517 Modified: stable/12/sys/compat/linux/linux_event.c stable/12/sys/compat/linux/linux_event.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_event.c ============================================================================== --- stable/12/sys/compat/linux/linux_event.c Tue Dec 3 23:07:09 2019 (r355371) +++ stable/12/sys/compat/linux/linux_event.c Tue Dec 3 23:11:40 2019 (r355372) @@ -98,14 +98,16 @@ __attribute__((packed)) #define LINUX_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event)) static void epoll_fd_install(struct thread *td, int fd, epoll_udata_t udata); -static int epoll_to_kevent(struct thread *td, struct file *epfp, - int fd, struct epoll_event *l_event, int *kev_flags, - struct kevent *kevent, int *nkevents); +static int epoll_to_kevent(struct thread *td, int fd, + struct epoll_event *l_event, struct kevent *kevent, + int *nkevents); static void kevent_to_epoll(struct kevent *kevent, struct epoll_event *l_event); static int epoll_kev_copyout(void *arg, struct kevent *kevp, int count); static int epoll_kev_copyin(void *arg, struct kevent *kevp, int count); -static int epoll_delete_event(struct thread *td, struct file *epfp, - int fd, int filter); +static int epoll_register_kevent(struct thread *td, struct file *epfp, + int fd, int filter, unsigned int flags); +static int epoll_fd_registered(struct thread *td, struct file *epfp, + int fd); static int epoll_delete_all_events(struct thread *td, struct file *epfp, int fd); @@ -296,33 +298,38 @@ linux_epoll_create1(struct thread *td, struct linux_ep /* Structure converting function from epoll to kevent. */ static int -epoll_to_kevent(struct thread *td, struct file *epfp, - int fd, struct epoll_event *l_event, int *kev_flags, +epoll_to_kevent(struct thread *td, int fd, struct epoll_event *l_event, struct kevent *kevent, int *nkevents) { uint32_t levents = l_event->events; struct linux_pemuldata *pem; struct proc *p; + unsigned short kev_flags = EV_ADD | EV_ENABLE; /* flags related to how event is registered */ if ((levents & LINUX_EPOLLONESHOT) != 0) - *kev_flags |= EV_ONESHOT; + kev_flags |= EV_DISPATCH; if ((levents & LINUX_EPOLLET) != 0) - *kev_flags |= EV_CLEAR; + kev_flags |= EV_CLEAR; if ((levents & LINUX_EPOLLERR) != 0) - *kev_flags |= EV_ERROR; + kev_flags |= EV_ERROR; if ((levents & LINUX_EPOLLRDHUP) != 0) - *kev_flags |= EV_EOF; + kev_flags |= EV_EOF; /* flags related to what event is registered */ if ((levents & LINUX_EPOLL_EVRD) != 0) { - EV_SET(kevent++, fd, EVFILT_READ, *kev_flags, 0, 0, 0); + EV_SET(kevent++, fd, EVFILT_READ, kev_flags, 0, 0, 0); ++(*nkevents); } if ((levents & LINUX_EPOLL_EVWR) != 0) { - EV_SET(kevent++, fd, EVFILT_WRITE, *kev_flags, 0, 0, 0); + EV_SET(kevent++, fd, EVFILT_WRITE, kev_flags, 0, 0, 0); ++(*nkevents); } + /* zero event mask is legal */ + if ((levents & (LINUX_EPOLL_EVRD | LINUX_EPOLL_EVWR)) == 0) { + EV_SET(kevent++, fd, EVFILT_READ, EV_ADD|EV_DISABLE, 0, 0, 0); + ++(*nkevents); + } if ((levents & ~(LINUX_EPOLL_EVSUP)) != 0) { p = td->td_proc; @@ -451,7 +458,6 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ epoll_kev_copyin}; struct epoll_event le; cap_rights_t rights; - int kev_flags; int nchanges = 0; int error; @@ -484,9 +490,7 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ ciargs.changelist = kev; if (args->op != LINUX_EPOLL_CTL_DEL) { - kev_flags = EV_ADD | EV_ENABLE; - error = epoll_to_kevent(td, epfp, args->fd, &le, - &kev_flags, kev, &nchanges); + error = epoll_to_kevent(td, args->fd, &le, kev, &nchanges); if (error != 0) goto leave0; } @@ -499,18 +503,10 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ break; case LINUX_EPOLL_CTL_ADD: - /* - * kqueue_register() return ENOENT if event does not exists - * and the EV_ADD flag is not set. - */ - kev[0].flags &= ~EV_ADD; - error = kqfd_register(args->epfd, &kev[0], td, M_WAITOK); - if (error != ENOENT) { + if (epoll_fd_registered(td, epfp, args->fd)) { error = EEXIST; goto leave0; } - error = 0; - kev[0].flags |= EV_ADD; break; case LINUX_EPOLL_CTL_DEL: @@ -561,13 +557,13 @@ linux_epoll_wait_common(struct thread *td, int epfd, s return (error); if (epfp->f_type != DTYPE_KQUEUE) { error = EINVAL; - goto leave1; + goto leave; } if (uset != NULL) { error = kern_sigprocmask(td, SIG_SETMASK, uset, &omask, 0); if (error != 0) - goto leave1; + goto leave; td->td_pflags |= TDP_OLDMASK; /* * Make sure that ast() is called on return to @@ -585,11 +581,12 @@ linux_epoll_wait_common(struct thread *td, int epfd, s coargs.count = 0; coargs.error = 0; - if (timeout != -1) { - if (timeout < 0) { - error = EINVAL; - goto leave0; - } + /* + * Linux epoll_wait(2) man page states that timeout of -1 causes caller + * to block indefinitely. Real implementation does it if any negative + * timeout value is passed. + */ + if (timeout >= 0) { /* Convert from milliseconds to timespec. */ ts.tv_sec = timeout / 1000; ts.tv_nsec = (timeout % 1000) * 1000000; @@ -609,11 +606,10 @@ linux_epoll_wait_common(struct thread *td, int epfd, s if (error == 0) td->td_retval[0] = coargs.count; -leave0: if (uset != NULL) error = kern_sigprocmask(td, SIG_SETMASK, &omask, NULL, 0); -leave1: +leave: fdrop(epfp, td); return (error); } @@ -650,7 +646,8 @@ linux_epoll_pwait(struct thread *td, struct linux_epol } static int -epoll_delete_event(struct thread *td, struct file *epfp, int fd, int filter) +epoll_register_kevent(struct thread *td, struct file *epfp, int fd, int filter, + unsigned int flags) { struct epoll_copyin_args ciargs; struct kevent kev; @@ -659,18 +656,36 @@ epoll_delete_event(struct thread *td, struct file *epf epoll_kev_copyin}; ciargs.changelist = &kev; - EV_SET(&kev, fd, filter, EV_DELETE | EV_DISABLE, 0, 0, 0); + EV_SET(&kev, fd, filter, flags, 0, 0, 0); return (kern_kevent_fp(td, epfp, 1, 0, &k_ops, NULL)); } static int +epoll_fd_registered(struct thread *td, struct file *epfp, int fd) +{ + /* + * Set empty filter flags to avoid accidental modification of already + * registered events. In the case of event re-registration: + * 1. If event does not exists kevent() does nothing and returns ENOENT + * 2. If event does exists, it's enabled/disabled state is preserved + * but fflags, data and udata fields are overwritten. So we can not + * set socket lowats and store user's context pointer in udata. + */ + if (epoll_register_kevent(td, epfp, fd, EVFILT_READ, 0) != ENOENT || + epoll_register_kevent(td, epfp, fd, EVFILT_WRITE, 0) != ENOENT) + return (1); + + return (0); +} + +static int epoll_delete_all_events(struct thread *td, struct file *epfp, int fd) { int error1, error2; - error1 = epoll_delete_event(td, epfp, fd, EVFILT_READ); - error2 = epoll_delete_event(td, epfp, fd, EVFILT_WRITE); + error1 = epoll_register_kevent(td, epfp, fd, EVFILT_READ, EV_DELETE); + error2 = epoll_register_kevent(td, epfp, fd, EVFILT_WRITE, EV_DELETE); /* return 0 if at least one result positive */ return (error1 == 0 ? 0 : error2); Modified: stable/12/sys/compat/linux/linux_event.h ============================================================================== --- stable/12/sys/compat/linux/linux_event.h Tue Dec 3 23:07:09 2019 (r355371) +++ stable/12/sys/compat/linux/linux_event.h Tue Dec 3 23:11:40 2019 (r355372) @@ -45,10 +45,10 @@ #define LINUX_EPOLLONESHOT 1u<<30 #define LINUX_EPOLLET 1u<<31 -#define LINUX_EPOLL_EVRD (LINUX_EPOLLIN|LINUX_EPOLLRDNORM \ - |LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI) +#define LINUX_EPOLL_EVRD (LINUX_EPOLLIN|LINUX_EPOLLRDNORM) #define LINUX_EPOLL_EVWR (LINUX_EPOLLOUT|LINUX_EPOLLWRNORM) #define LINUX_EPOLL_EVSUP (LINUX_EPOLLET|LINUX_EPOLLONESHOT \ + |LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI \ |LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR|LINUX_EPOLLRDHUP) #define LINUX_EPOLL_CTL_ADD 1 From owner-svn-src-stable@freebsd.org Wed Dec 4 09:18:34 2019 Return-Path: Delivered-To: svn-src-stable@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 3F47F1CE870; Wed, 4 Dec 2019 09:18:34 +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 47SYDp0kGHz4cCw; Wed, 4 Dec 2019 09:18:34 +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 EBBC925D10; Wed, 4 Dec 2019 09:18:33 +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 xB49IXqF076901; Wed, 4 Dec 2019 09:18:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB49IWql076895; Wed, 4 Dec 2019 09:18:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912040918.xB49IWql076895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 4 Dec 2019 09:18:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355384 - in stable/12/sys/x86: include iommu x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/x86: include iommu x86 X-SVN-Commit-Revision: 355384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 09:18:34 -0000 Author: kib Date: Wed Dec 4 09:18:32 2019 New Revision: 355384 URL: https://svnweb.freebsd.org/changeset/base/355384 Log: MFC r355138: bus_dma_dmar_load_ident(9): load identity mapping into the map. Modified: stable/12/sys/x86/include/bus_dma.h stable/12/sys/x86/iommu/busdma_dmar.c stable/12/sys/x86/iommu/intel_ctx.c stable/12/sys/x86/iommu/intel_dmar.h stable/12/sys/x86/iommu/intel_gas.c stable/12/sys/x86/x86/busdma_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/include/bus_dma.h ============================================================================== --- stable/12/sys/x86/include/bus_dma.h Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/include/bus_dma.h Wed Dec 4 09:18:32 2019 (r355384) @@ -181,6 +181,8 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t #ifdef _KERNEL bool bus_dma_dmar_set_buswide(device_t dev); +int bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t start, vm_size_t length, int flags); #endif #endif /* !_X86_BUS_DMA_H_ */ Modified: stable/12/sys/x86/iommu/busdma_dmar.c ============================================================================== --- stable/12/sys/x86/iommu/busdma_dmar.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/busdma_dmar.c Wed Dec 4 09:18:32 2019 (r355384) @@ -950,3 +950,66 @@ dmar_fini_busdma(struct dmar_unit *unit) taskqueue_free(unit->delayed_taskqueue); unit->delayed_taskqueue = NULL; } + +int +bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1, + vm_paddr_t start, vm_size_t length, int flags) +{ + struct bus_dma_tag_common *tc; + struct bus_dma_tag_dmar *tag; + struct bus_dmamap_dmar *map; + struct dmar_ctx *ctx; + struct dmar_domain *domain; + struct dmar_map_entry *entry; + vm_page_t *ma; + vm_size_t i; + int error; + bool waitok; + + MPASS((start & PAGE_MASK) == 0); + MPASS((length & PAGE_MASK) == 0); + MPASS(length > 0); + MPASS(start + length >= start); + MPASS((flags & ~(BUS_DMA_NOWAIT | BUS_DMA_NOWRITE)) == 0); + + tc = (struct bus_dma_tag_common *)dmat; + if (tc->impl != &bus_dma_dmar_impl) + return (0); + + tag = (struct bus_dma_tag_dmar *)dmat; + ctx = tag->ctx; + domain = ctx->domain; + map = (struct bus_dmamap_dmar *)map1; + waitok = (flags & BUS_DMA_NOWAIT) != 0; + + entry = dmar_gas_alloc_entry(domain, waitok ? 0 : DMAR_PGF_WAITOK); + if (entry == NULL) + return (ENOMEM); + entry->start = start; + entry->end = start + length; + ma = malloc(sizeof(vm_page_t) * atop(length), M_TEMP, waitok ? + M_WAITOK : M_NOWAIT); + if (ma == NULL) { + dmar_gas_free_entry(domain, entry); + return (ENOMEM); + } + for (i = 0; i < atop(length); i++) { + ma[i] = vm_page_getfake(entry->start + PAGE_SIZE * i, + VM_MEMATTR_DEFAULT); + } + error = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | + ((flags & BUS_DMA_NOWRITE) ? 0 : DMAR_MAP_ENTRY_WRITE), + waitok ? DMAR_GM_CANWAIT : 0, ma); + if (error == 0) { + DMAR_DOMAIN_LOCK(domain); + TAILQ_INSERT_TAIL(&map->map_entries, entry, dmamap_link); + entry->flags |= DMAR_MAP_ENTRY_MAP; + DMAR_DOMAIN_UNLOCK(domain); + } else { + dmar_domain_unload_entry(entry, true); + } + for (i = 0; i < atop(length); i++) + vm_page_putfake(ma[i]); + free(ma, M_TEMP); + return (error); +} Modified: stable/12/sys/x86/iommu/intel_ctx.c ============================================================================== --- stable/12/sys/x86/iommu/intel_ctx.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_ctx.c Wed Dec 4 09:18:32 2019 (r355384) @@ -279,7 +279,7 @@ domain_init_rmrr(struct dmar_domain *domain, device_t } error1 = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | DMAR_MAP_ENTRY_WRITE, - DMAR_GM_CANWAIT, ma); + DMAR_GM_CANWAIT | DMAR_GM_RMRR, ma); /* * Non-failed RMRR entries are owned by context rb * tree. Get rid of the failed entry, but do not stop Modified: stable/12/sys/x86/iommu/intel_dmar.h ============================================================================== --- stable/12/sys/x86/iommu/intel_dmar.h Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_dmar.h Wed Dec 4 09:18:32 2019 (r355384) @@ -391,6 +391,7 @@ bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int #define DMAR_GM_CANWAIT 0x0001 #define DMAR_GM_CANSPLIT 0x0002 +#define DMAR_GM_RMRR 0x0004 #define DMAR_PGF_WAITOK 0x0001 #define DMAR_PGF_ZERO 0x0002 Modified: stable/12/sys/x86/iommu/intel_gas.c ============================================================================== --- stable/12/sys/x86/iommu/intel_gas.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_gas.c Wed Dec 4 09:18:32 2019 (r355384) @@ -543,13 +543,15 @@ dmar_gas_alloc_region(struct dmar_domain *domain, stru */ if (prev != NULL && prev->end > entry->start && (prev->flags & DMAR_MAP_ENTRY_PLACE) == 0) { - if ((prev->flags & DMAR_MAP_ENTRY_RMRR) == 0) + if ((flags & DMAR_GM_RMRR) == 0 || + (prev->flags & DMAR_MAP_ENTRY_RMRR) == 0) return (EBUSY); entry->start = prev->end; } if (next != NULL && next->start < entry->end && (next->flags & DMAR_MAP_ENTRY_PLACE) == 0) { - if ((next->flags & DMAR_MAP_ENTRY_RMRR) == 0) + if ((flags & DMAR_GM_RMRR) == 0 || + (next->flags & DMAR_MAP_ENTRY_RMRR) == 0) return (EBUSY); entry->end = next->start; } @@ -569,7 +571,8 @@ dmar_gas_alloc_region(struct dmar_domain *domain, stru found = dmar_gas_rb_insert(domain, entry); KASSERT(found, ("found RMRR dup %p start %jx end %jx", domain, (uintmax_t)entry->start, (uintmax_t)entry->end)); - entry->flags = DMAR_MAP_ENTRY_RMRR; + if ((flags & DMAR_GM_RMRR) != 0) + entry->flags = DMAR_MAP_ENTRY_RMRR; #ifdef INVARIANTS struct dmar_map_entry *ip, *in; @@ -689,7 +692,7 @@ dmar_gas_map_region(struct dmar_domain *domain, struct KASSERT(entry->flags == 0, ("used RMRR entry %p %p %x", domain, entry, entry->flags)); - KASSERT((flags & ~(DMAR_GM_CANWAIT)) == 0, + KASSERT((flags & ~(DMAR_GM_CANWAIT | DMAR_GM_RMRR)) == 0, ("invalid flags 0x%x", flags)); start = entry->start; Modified: stable/12/sys/x86/x86/busdma_machdep.c ============================================================================== --- stable/12/sys/x86/x86/busdma_machdep.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/x86/busdma_machdep.c Wed Dec 4 09:18:32 2019 (r355384) @@ -253,4 +253,11 @@ bus_dma_dmar_set_buswide(device_t dev) { return (false); } + +int +bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t start, vm_size_t length, int flags) +{ + return (0); +} #endif From owner-svn-src-stable@freebsd.org Wed Dec 4 09:21:00 2019 Return-Path: Delivered-To: svn-src-stable@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 BF4F51CEAD7; Wed, 4 Dec 2019 09:21:00 +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 47SYHc4k7gz4cTM; Wed, 4 Dec 2019 09:21:00 +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 86B5125D37; Wed, 4 Dec 2019 09:21:00 +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 xB49L001079339; Wed, 4 Dec 2019 09:21:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB49L0Mx079338; Wed, 4 Dec 2019 09:21:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912040921.xB49L0Mx079338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 4 Dec 2019 09:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355385 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 355385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 09:21:00 -0000 Author: kib Date: Wed Dec 4 09:21:00 2019 New Revision: 355385 URL: https://svnweb.freebsd.org/changeset/base/355385 Log: MFC r355146: Ease the life of PT_TO_SCE/PT_TO_SCX users when debuggee sleeps in sigsuspend(2)/sig{timed,}wait(2). Modified: stable/12/sys/kern/kern_sig.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sig.c ============================================================================== --- stable/12/sys/kern/kern_sig.c Wed Dec 4 09:18:32 2019 (r355384) +++ stable/12/sys/kern/kern_sig.c Wed Dec 4 09:21:00 2019 (r355385) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1252,11 +1253,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, int error, sig, timo, timevalid = 0; struct timespec rts, ets, ts; struct timeval tv; + bool traced; p = td->td_proc; error = 0; ets.tv_sec = 0; ets.tv_nsec = 0; + traced = false; if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { @@ -1309,6 +1312,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, timo = 0; } + if (traced) { + error = EINTR; + break; + } + error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); if (timeout != NULL) { @@ -1320,6 +1328,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, error = 0; } } + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR after wait was done. Only do this as last + * resort after rechecking for possible queued signals + * and expired timeouts. + */ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + traced = true; } new_block = saved_mask; @@ -1532,6 +1550,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) has_sig += postsig(sig); } mtx_unlock(&p->p_sigacts->ps_mtx); + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR. + */ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR; From owner-svn-src-stable@freebsd.org Wed Dec 4 09:24:37 2019 Return-Path: Delivered-To: svn-src-stable@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 8BB671CEC67; Wed, 4 Dec 2019 09:24:37 +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 47SYMn3GWFz4cts; Wed, 4 Dec 2019 09:24:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 536E125EC9; Wed, 4 Dec 2019 09:24:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB49ObHf083027; Wed, 4 Dec 2019 09:24:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB49ObiB083026; Wed, 4 Dec 2019 09:24:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912040924.xB49ObiB083026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 4 Dec 2019 09:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355386 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 355386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 09:24:37 -0000 Author: kib Date: Wed Dec 4 09:24:36 2019 New Revision: 355386 URL: https://svnweb.freebsd.org/changeset/base/355386 Log: MFC r355146: Ease the life of PT_TO_SCE/PT_TO_SCX users when debuggee sleeps in sigsuspend(2)/sig{timed,}wait(2). Modified: stable/11/sys/kern/kern_sig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sig.c ============================================================================== --- stable/11/sys/kern/kern_sig.c Wed Dec 4 09:21:00 2019 (r355385) +++ stable/11/sys/kern/kern_sig.c Wed Dec 4 09:24:36 2019 (r355386) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1253,11 +1254,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, int error, sig, timo, timevalid = 0; struct timespec rts, ets, ts; struct timeval tv; + bool traced; p = td->td_proc; error = 0; ets.tv_sec = 0; ets.tv_nsec = 0; + traced = false; if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { @@ -1312,6 +1315,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, timo = 0; } + if (traced) { + error = EINTR; + break; + } + error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); if (timeout != NULL) { @@ -1323,6 +1331,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, error = 0; } } + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR after wait was done. Only do this as last + * resort after rechecking for possible queued signals + * and expired timeouts. + */ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + traced = true; } new_block = saved_mask; @@ -1535,6 +1553,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) has_sig += postsig(sig); } mtx_unlock(&p->p_sigacts->ps_mtx); + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR. + */ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR; From owner-svn-src-stable@freebsd.org Wed Dec 4 13:28:18 2019 Return-Path: Delivered-To: svn-src-stable@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 2977D1BAB71; Wed, 4 Dec 2019 13:28:18 +0000 (UTC) (envelope-from loos@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 47Sfmy0P4Mz3LTX; Wed, 4 Dec 2019 13:28:18 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E50D2AFE; Wed, 4 Dec 2019 13:28:17 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4DSHLB025408; Wed, 4 Dec 2019 13:28:17 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4DSH7l025407; Wed, 4 Dec 2019 13:28:17 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912041328.xB4DSH7l025407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 4 Dec 2019 13:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355387 - stable/11/sys/dev/iicbus/twsi X-SVN-Group: stable-11 X-SVN-Commit-Author: loos X-SVN-Commit-Paths: stable/11/sys/dev/iicbus/twsi X-SVN-Commit-Revision: 355387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 13:28:18 -0000 Author: loos Date: Wed Dec 4 13:28:17 2019 New Revision: 355387 URL: https://svnweb.freebsd.org/changeset/base/355387 Log: MFC r320159: Add the ofw_bus_get_node() callback in mv_twsi, it is mandatory for the ofw_iicbus usage. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/dev/iicbus/twsi/mv_twsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/twsi/mv_twsi.c ============================================================================== --- stable/11/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 4 09:24:36 2019 (r355386) +++ stable/11/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 4 13:28:17 2019 (r355387) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +static phandle_t mv_twsi_get_node(device_t, device_t); static int mv_twsi_probe(device_t); static int mv_twsi_attach(device_t); @@ -105,7 +106,10 @@ static device_method_t mv_twsi_methods[] = { DEVMETHOD(device_probe, mv_twsi_probe), DEVMETHOD(device_attach, mv_twsi_attach), - { 0, 0 } + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, mv_twsi_get_node), + + DEVMETHOD_END }; DEFINE_CLASS_1(twsi, mv_twsi_driver, mv_twsi_methods, @@ -116,6 +120,14 @@ static devclass_t mv_twsi_devclass; DRIVER_MODULE(twsi, simplebus, mv_twsi_driver, mv_twsi_devclass, 0, 0); DRIVER_MODULE(iicbus, twsi, iicbus_driver, iicbus_devclass, 0, 0); MODULE_DEPEND(twsi, iicbus, 1, 1, 1); + +static phandle_t +mv_twsi_get_node(device_t bus, device_t dev) +{ + + /* Used by ofw_iicbus. */ + return (ofw_bus_get_node(bus)); +} static int mv_twsi_probe(device_t dev) From owner-svn-src-stable@freebsd.org Wed Dec 4 15:11:42 2019 Return-Path: Delivered-To: svn-src-stable@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 C27EE1C619A; Wed, 4 Dec 2019 15:11:42 +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 47Sj4G4pzQz3wsC; Wed, 4 Dec 2019 15:11:42 +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 888261F3D; Wed, 4 Dec 2019 15:11:42 +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 xB4FBggu087486; Wed, 4 Dec 2019 15:11:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4FBgS8087485; Wed, 4 Dec 2019 15:11:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912041511.xB4FBgS8087485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 4 Dec 2019 15:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355389 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 355389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 15:11:42 -0000 Author: mav Date: Wed Dec 4 15:11:42 2019 New Revision: 355389 URL: https://svnweb.freebsd.org/changeset/base/355389 Log: MFC r355074: Report XLAT0 register for completeness. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:04:06 2019 (r355388) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:11:42 2019 (r355389) @@ -2408,6 +2408,14 @@ intel_ntb_sysctl_init(struct ntb_softc *ntb) if (ntb->conn_type != NTB_CONN_B2B) return; + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01l", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETL, + sysctl_handle_register, "IU", "Outgoing XLAT0L register"); + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01u", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETU, + sysctl_handle_register, "IU", "Outgoing XLAT0U register"); SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat23", CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, NTB_REG_64 | ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off, From owner-svn-src-stable@freebsd.org Wed Dec 4 15:12:10 2019 Return-Path: Delivered-To: svn-src-stable@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 5C8B61C621D; Wed, 4 Dec 2019 15:12: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 47Sj4p1qbjz3x1p; Wed, 4 Dec 2019 15:12: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 224611F69; Wed, 4 Dec 2019 15:12: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 xB4FCAvn088499; Wed, 4 Dec 2019 15:12:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4FC9QF088498; Wed, 4 Dec 2019 15:12:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912041512.xB4FC9QF088498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 4 Dec 2019 15:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355390 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 355390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 15:12:10 -0000 Author: mav Date: Wed Dec 4 15:12:09 2019 New Revision: 355390 URL: https://svnweb.freebsd.org/changeset/base/355390 Log: MFC r355163: Make the code slightly more compact. There should be no functional change. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:11:42 2019 (r355389) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:12:09 2019 (r355390) @@ -781,37 +781,42 @@ bar_get_xlat_params(struct ntb_softc *ntb, enum ntb_ba static int intel_ntb_map_pci_bars(struct ntb_softc *ntb) { + struct ntb_pci_bar_info *bar; int rc; - ntb->bar_info[NTB_CONFIG_BAR].pci_resource_id = PCIR_BAR(0); - rc = map_mmr_bar(ntb, &ntb->bar_info[NTB_CONFIG_BAR]); + bar = &ntb->bar_info[NTB_CONFIG_BAR]; + bar->pci_resource_id = PCIR_BAR(0); + rc = map_mmr_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].pci_resource_id = PCIR_BAR(2); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_1]); + bar = &ntb->bar_info[NTB_B2B_BAR_1]; + bar->pci_resource_id = PCIR_BAR(2); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].psz_off = XEON_PBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].ssz_off = XEON_SBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off = XEON_PBAR2XLAT_OFFSET; + bar->psz_off = XEON_PBAR23SZ_OFFSET; + bar->ssz_off = XEON_SBAR23SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR2XLAT_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pci_resource_id = PCIR_BAR(4); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_2]); + bar = &ntb->bar_info[NTB_B2B_BAR_2]; + bar->pci_resource_id = PCIR_BAR(4); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_2].psz_off = XEON_PBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].ssz_off = XEON_SBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pbarxlat_off = XEON_PBAR4XLAT_OFFSET; + bar->psz_off = XEON_PBAR4SZ_OFFSET; + bar->ssz_off = XEON_SBAR4SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR4XLAT_OFFSET; if (!HAS_FEATURE(ntb, NTB_SPLIT_BAR)) goto out; - ntb->bar_info[NTB_B2B_BAR_3].pci_resource_id = PCIR_BAR(5); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_3]); - ntb->bar_info[NTB_B2B_BAR_3].psz_off = XEON_PBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].ssz_off = XEON_SBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].pbarxlat_off = XEON_PBAR5XLAT_OFFSET; + bar = &ntb->bar_info[NTB_B2B_BAR_3]; + bar->pci_resource_id = PCIR_BAR(5); + rc = map_memory_window_bar(ntb, bar); + bar->psz_off = XEON_PBAR5SZ_OFFSET; + bar->ssz_off = XEON_SBAR5SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR5XLAT_OFFSET; out: if (rc != 0) @@ -934,15 +939,14 @@ map_memory_window_bar(struct ntb_softc *ntb, struct nt static void intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) { - struct ntb_pci_bar_info *current_bar; + struct ntb_pci_bar_info *bar; int i; for (i = 0; i < NTB_MAX_BARS; i++) { - current_bar = &ntb->bar_info[i]; - if (current_bar->pci_resource != NULL) + bar = &ntb->bar_info[i]; + if (bar->pci_resource != NULL) bus_release_resource(ntb->device, SYS_RES_MEMORY, - current_bar->pci_resource_id, - current_bar->pci_resource); + bar->pci_resource_id, bar->pci_resource); } } From owner-svn-src-stable@freebsd.org Wed Dec 4 15:14:14 2019 Return-Path: Delivered-To: svn-src-stable@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 DC3FB1C65C9; Wed, 4 Dec 2019 15:14:14 +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 47Sj7B5WbPz3xHT; Wed, 4 Dec 2019 15:14:14 +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 A0CFE1F8A; Wed, 4 Dec 2019 15:14:14 +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 xB4FEEkv090272; Wed, 4 Dec 2019 15:14:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4FEEmu090271; Wed, 4 Dec 2019 15:14:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912041514.xB4FEEmu090271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 4 Dec 2019 15:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355391 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 355391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 15:14:14 -0000 Author: mav Date: Wed Dec 4 15:14:14 2019 New Revision: 355391 URL: https://svnweb.freebsd.org/changeset/base/355391 Log: MFC r355165: Make DMAR allow Intel NTB device to access its own BAR0. I have no good explanation why it happens, but I found that in B2B mode at least Xeon v4 NTB leaks accesses to its configuration memory at BAR0 originated from the link side to its host side. DMAR predictably blocks those, making access to remote scratchpad registers in B2B mode impossible. This change creates identity mapping in DMAR covering the BAR0 addresses, making the NTB work fine with DMAR enabled. It seems like allowing single 4KB range at 32KB offset may be enough, but I don't see a reason to be so specific. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:12:09 2019 (r355390) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:14:14 2019 (r355391) @@ -218,6 +218,9 @@ struct ntb_softc { struct ntb_pci_bar_info *peer_lapic_bar; struct callout peer_msix_work; + bus_dma_tag_t bar0_dma_tag; + bus_dmamap_t bar0_dma_map; + struct callout heartbeat_timer; struct callout lr_timer; @@ -790,6 +793,29 @@ intel_ntb_map_pci_bars(struct ntb_softc *ntb) if (rc != 0) goto out; + /* + * At least on Xeon v4 NTB device leaks to host some remote side + * BAR0 writes supposed to update scratchpad registers. I am not + * sure why it happens, but it may be related to the fact that + * on a link side BAR0 is 32KB, while on a host side it is 64KB. + * Without this hack DMAR blocks those accesses as not allowed. + */ + if (bus_dma_tag_create(bus_get_dma_tag(ntb->device), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + bar->size, 1, bar->size, 0, NULL, NULL, &ntb->bar0_dma_tag)) { + device_printf(ntb->device, "Unable to create BAR0 tag\n"); + return (ENOMEM); + } + if (bus_dmamap_create(ntb->bar0_dma_tag, 0, &ntb->bar0_dma_map)) { + device_printf(ntb->device, "Unable to create BAR0 map\n"); + return (ENOMEM); + } + if (bus_dma_dmar_load_ident(ntb->bar0_dma_tag, ntb->bar0_dma_map, + bar->pbase, bar->size, 0)) { + device_printf(ntb->device, "Unable to load BAR0 map\n"); + return (ENOMEM); + } + bar = &ntb->bar_info[NTB_B2B_BAR_1]; bar->pci_resource_id = PCIR_BAR(2); rc = map_memory_window_bar(ntb, bar); @@ -942,6 +968,12 @@ intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) struct ntb_pci_bar_info *bar; int i; + if (ntb->bar0_dma_map != NULL) { + bus_dmamap_unload(ntb->bar0_dma_tag, ntb->bar0_dma_map); + bus_dmamap_destroy(ntb->bar0_dma_tag, ntb->bar0_dma_map); + } + if (ntb->bar0_dma_tag != NULL) + bus_dma_tag_destroy(ntb->bar0_dma_tag); for (i = 0; i < NTB_MAX_BARS; i++) { bar = &ntb->bar_info[i]; if (bar->pci_resource != NULL) From owner-svn-src-stable@freebsd.org Wed Dec 4 17:45:35 2019 Return-Path: Delivered-To: svn-src-stable@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 063BE1A9BB0; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@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 47SmTp6J5qz48MF; Wed, 4 Dec 2019 17:45:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB72A3DA3; Wed, 4 Dec 2019 17:45:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4HjYXq081484; Wed, 4 Dec 2019 17:45:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4HjYba081482; Wed, 4 Dec 2019 17:45:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912041745.xB4HjYba081482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Dec 2019 17:45:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Commit-Revision: 355395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:45:35 -0000 Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from: https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/lib/msun/src/e_hypot.c ============================================================================== --- stable/12/lib/msun/src/e_hypot.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/12/lib/msun/src/e_hypot.c Wed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/12/lib/msun/src/e_hypotf.c ============================================================================== --- stable/12/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/12/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } From owner-svn-src-stable@freebsd.org Wed Dec 4 17:45:36 2019 Return-Path: Delivered-To: svn-src-stable@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 27B7E1A9BC0; Wed, 4 Dec 2019 17:45:36 +0000 (UTC) (envelope-from dim@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 47SmTr0HD6z48MN; Wed, 4 Dec 2019 17:45:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD9B53DA5; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4HjZqx081498; Wed, 4 Dec 2019 17:45:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4HjZ9O081496; Wed, 4 Dec 2019 17:45:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912041745.xB4HjZ9O081496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Dec 2019 17:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Commit-Revision: 355395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:45:36 -0000 Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from: https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/lib/msun/src/e_hypot.c ============================================================================== --- stable/10/lib/msun/src/e_hypot.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/10/lib/msun/src/e_hypot.c Wed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/10/lib/msun/src/e_hypotf.c ============================================================================== --- stable/10/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/10/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } From owner-svn-src-stable@freebsd.org Wed Dec 4 17:45:35 2019 Return-Path: Delivered-To: svn-src-stable@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 90F8D1A9BB4; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@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 47SmTq3GkKz48MG; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5376D3DA4; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4HjZAW081491; Wed, 4 Dec 2019 17:45:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4HjYb9081489; Wed, 4 Dec 2019 17:45:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912041745.xB4HjYb9081489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Dec 2019 17:45:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Commit-Revision: 355395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:45:35 -0000 Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from: https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/lib/msun/src/e_hypot.c ============================================================================== --- stable/11/lib/msun/src/e_hypot.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/11/lib/msun/src/e_hypot.c Wed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/11/lib/msun/src/e_hypotf.c ============================================================================== --- stable/11/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/11/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } From owner-svn-src-stable@freebsd.org Thu Dec 5 05:28:20 2019 Return-Path: Delivered-To: svn-src-stable@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 1041B1BB96E; Thu, 5 Dec 2019 05:28:20 +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 47T44g0m3Cz3JW9; Thu, 5 Dec 2019 05:28:18 +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 xB55SG3Y042438; Wed, 4 Dec 2019 21:28:16 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB55SG9C042437; Wed, 4 Dec 2019 21:28:16 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912050528.xB55SG9C042437@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355362 - in stable/12: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm In-Reply-To: <201912032249.xB3MnOWT004438@repo.freebsd.org> To: Ravi Pokala Date: Wed, 4 Dec 2019 21:28:16 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@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: 47T44g0m3Cz3JW9 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.55 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.40)[-0.397,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; NEURAL_SPAM_LONG(0.01)[0.012,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:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:28:20 -0000 > Author: rpokala > Date: Tue Dec 3 22:49:24 2019 > New Revision: 355362 > URL: https://svnweb.freebsd.org/changeset/base/355362 > > Log: > MFC r343583: > > Remove unecessary "All rights reserved" from files under my or Panasas's > copyright. > > When all member nations of the Buenos Aires Convention adopted the Berne > Convention, the phrase "All rights reserved" became unnecessary to assert > copyright. Remove it from files under my or Panasas's copyright. The files > related to jedec_dimm(4) also bear avg@'s copyright; he has approved this > change. Thank you! -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Thu Dec 5 14:50:47 2019 Return-Path: Delivered-To: svn-src-stable@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 287B11CB2B2; Thu, 5 Dec 2019 14:50:47 +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 47TJYg0JB2z4Gv3; Thu, 5 Dec 2019 14:50:47 +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 E2FFF1A77F; Thu, 5 Dec 2019 14:50:46 +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 xB5EokLT028395; Thu, 5 Dec 2019 14:50:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5Eokl2028393; Thu, 5 Dec 2019 14:50:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912051450.xB5Eokl2028393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 5 Dec 2019 14:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355417 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 355417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 14:50:47 -0000 Author: hselasky Date: Thu Dec 5 14:50:46 2019 New Revision: 355417 URL: https://svnweb.freebsd.org/changeset/base/355417 Log: MFC r355108 and r355170: Fix panic when loading kernel modules before root file system is mounted. Make sure the rootvnode is always NULL checked. Differential Revision: https://reviews.freebsd.org/D22545 PR: 241639 Sponsored by: Mellanox Technologies Modified: stable/12/sys/kern/kern_linker.c stable/12/sys/kern/subr_firmware.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_linker.c ============================================================================== --- stable/12/sys/kern/kern_linker.c Thu Dec 5 13:43:44 2019 (r355416) +++ stable/12/sys/kern/kern_linker.c Thu Dec 5 14:50:46 2019 (r355417) @@ -2061,14 +2061,18 @@ linker_load_module(const char *kldname, const char *mo */ KASSERT(verinfo == NULL, ("linker_load_module: verinfo" " is not NULL")); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); pathname = linker_search_kld(kldname); } else { if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); if (kldname != NULL) pathname = strdup(kldname, M_LINKER); - else if (rootvnode == NULL) - pathname = NULL; else /* * Need to find a KLD with required module Modified: stable/12/sys/kern/subr_firmware.c ============================================================================== --- stable/12/sys/kern/subr_firmware.c Thu Dec 5 13:43:44 2019 (r355416) +++ stable/12/sys/kern/subr_firmware.c Thu Dec 5 14:50:46 2019 (r355417) @@ -257,7 +257,6 @@ firmware_unregister(const char *imagename) static void loadimage(void *arg, int npending) { - struct thread *td = curthread; char *imagename = arg; struct priv_fw *fp; linker_file_t result; @@ -267,11 +266,6 @@ loadimage(void *arg, int npending) mtx_lock(&firmware_mtx); mtx_unlock(&firmware_mtx); - if (td->td_proc->p_fd->fd_rdir == NULL) { - printf("%s: root not mounted yet, no way to load image\n", - imagename); - goto done; - } error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n", From owner-svn-src-stable@freebsd.org Thu Dec 5 14:52:07 2019 Return-Path: Delivered-To: svn-src-stable@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 3AE891CB588; Thu, 5 Dec 2019 14:52:07 +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 47TJbC0v5Dz4H9K; Thu, 5 Dec 2019 14:52:07 +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 022AC1A911; Thu, 5 Dec 2019 14:52:07 +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 xB5Eq62v029227; Thu, 5 Dec 2019 14:52:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5Eq6CI029226; Thu, 5 Dec 2019 14:52:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912051452.xB5Eq6CI029226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 5 Dec 2019 14:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355418 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 355418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 14:52:07 -0000 Author: hselasky Date: Thu Dec 5 14:52:06 2019 New Revision: 355418 URL: https://svnweb.freebsd.org/changeset/base/355418 Log: MFC r355108 and r355170: Fix panic when loading kernel modules before root file system is mounted. Make sure the rootvnode is always NULL checked. Differential Revision: https://reviews.freebsd.org/D22545 PR: 241639 Sponsored by: Mellanox Technologies Modified: stable/11/sys/kern/kern_linker.c stable/11/sys/kern/subr_firmware.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_linker.c ============================================================================== --- stable/11/sys/kern/kern_linker.c Thu Dec 5 14:50:46 2019 (r355417) +++ stable/11/sys/kern/kern_linker.c Thu Dec 5 14:52:06 2019 (r355418) @@ -2022,14 +2022,18 @@ linker_load_module(const char *kldname, const char *mo */ KASSERT(verinfo == NULL, ("linker_load_module: verinfo" " is not NULL")); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); pathname = linker_search_kld(kldname); } else { if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); if (kldname != NULL) pathname = strdup(kldname, M_LINKER); - else if (rootvnode == NULL) - pathname = NULL; else /* * Need to find a KLD with required module Modified: stable/11/sys/kern/subr_firmware.c ============================================================================== --- stable/11/sys/kern/subr_firmware.c Thu Dec 5 14:50:46 2019 (r355417) +++ stable/11/sys/kern/subr_firmware.c Thu Dec 5 14:52:06 2019 (r355418) @@ -255,7 +255,6 @@ firmware_unregister(const char *imagename) static void loadimage(void *arg, int npending) { - struct thread *td = curthread; char *imagename = arg; struct priv_fw *fp; linker_file_t result; @@ -265,11 +264,6 @@ loadimage(void *arg, int npending) mtx_lock(&firmware_mtx); mtx_unlock(&firmware_mtx); - if (td->td_proc->p_fd->fd_rdir == NULL) { - printf("%s: root not mounted yet, no way to load image\n", - imagename); - goto done; - } error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n", From owner-svn-src-stable@freebsd.org Thu Dec 5 14:53:47 2019 Return-Path: Delivered-To: svn-src-stable@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 83AAB1CB6BB; Thu, 5 Dec 2019 14:53:47 +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 47TJd72vgCz4HTM; Thu, 5 Dec 2019 14:53:47 +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 2E6D31A943; Thu, 5 Dec 2019 14:53:47 +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 xB5Erlp1032240; Thu, 5 Dec 2019 14:53:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5ErkcH032239; Thu, 5 Dec 2019 14:53:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912051453.xB5ErkcH032239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 5 Dec 2019 14:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r355419 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 355419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 14:53:47 -0000 Author: hselasky Date: Thu Dec 5 14:53:46 2019 New Revision: 355419 URL: https://svnweb.freebsd.org/changeset/base/355419 Log: MFC r355108 and r355170: Fix panic when loading kernel modules before root file system is mounted. Make sure the rootvnode is always NULL checked. Differential Revision: https://reviews.freebsd.org/D22545 PR: 241639 Sponsored by: Mellanox Technologies Modified: stable/10/sys/kern/kern_linker.c stable/10/sys/kern/subr_firmware.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_linker.c ============================================================================== --- stable/10/sys/kern/kern_linker.c Thu Dec 5 14:52:06 2019 (r355418) +++ stable/10/sys/kern/kern_linker.c Thu Dec 5 14:53:46 2019 (r355419) @@ -2000,14 +2000,18 @@ linker_load_module(const char *kldname, const char *mo */ KASSERT(verinfo == NULL, ("linker_load_module: verinfo" " is not NULL")); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); pathname = linker_search_kld(kldname); } else { if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); if (kldname != NULL) pathname = strdup(kldname, M_LINKER); - else if (rootvnode == NULL) - pathname = NULL; else /* * Need to find a KLD with required module Modified: stable/10/sys/kern/subr_firmware.c ============================================================================== --- stable/10/sys/kern/subr_firmware.c Thu Dec 5 14:52:06 2019 (r355418) +++ stable/10/sys/kern/subr_firmware.c Thu Dec 5 14:53:46 2019 (r355419) @@ -255,7 +255,6 @@ firmware_unregister(const char *imagename) static void loadimage(void *arg, int npending) { - struct thread *td = curthread; char *imagename = arg; struct priv_fw *fp; linker_file_t result; @@ -265,11 +264,6 @@ loadimage(void *arg, int npending) mtx_lock(&firmware_mtx); mtx_unlock(&firmware_mtx); - if (td->td_proc->p_fd->fd_rdir == NULL) { - printf("%s: root not mounted yet, no way to load image\n", - imagename); - goto done; - } error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n", From owner-svn-src-stable@freebsd.org Fri Dec 6 00:24:32 2019 Return-Path: Delivered-To: svn-src-stable@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 997181B0DF1; Fri, 6 Dec 2019 00:24:32 +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 47TYHh3HxTz3Jgv; Fri, 6 Dec 2019 00:24:32 +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 55645210A0; Fri, 6 Dec 2019 00:24:32 +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 xB60OWEq071310; Fri, 6 Dec 2019 00:24:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB60OWo0071309; Fri, 6 Dec 2019 00:24:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060024.xB60OWo0071309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:24:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355432 - stable/12/usr.sbin/sesutil X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/usr.sbin/sesutil X-SVN-Commit-Revision: 355432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:24:32 -0000 Author: asomers Date: Fri Dec 6 00:24:31 2019 New Revision: 355432 URL: https://svnweb.freebsd.org/changeset/base/355432 Log: MFC r354664-r354666 r354664: sesutil: fix an out-of-bounds array access sesutil would allow the user to toggle an LED that was one past the maximum element. If he tried, ENCIOC_GETELMSTAT would return EINVAL. Reported by: Coverity Coverity CID: 1398940 Sponsored by: Axcient r354665: sesutil: fix some memory leaks Reported by: Coverity Coverity CID: 1331665 Sponsored by: Axcient r354666: sesutil: fix another memory leak Instead of calloc()ing (and forgetting to free) in a tight loop, just put this small array on the stack. Reported by: Coverity Coverity CID: 1331665 Sponsored by: Axcient Modified: stable/12/usr.sbin/sesutil/sesutil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/sesutil/sesutil.c ============================================================================== --- stable/12/usr.sbin/sesutil/sesutil.c Fri Dec 6 00:12:14 2019 (r355431) +++ stable/12/usr.sbin/sesutil/sesutil.c Fri Dec 6 00:24:31 2019 (r355432) @@ -242,35 +242,38 @@ sesled(int argc, char **argv, bool setfault) } if (ioctl(fd, ENCIOC_GETELMMAP, (caddr_t) objp) < 0) { + free(objp); close(fd); xo_err(EXIT_FAILURE, "ENCIOC_GETELMMAP"); } if (isses) { - if (sesid > nobj) { + if (sesid >= nobj) { + free(objp); close(fd); xo_errx(EXIT_FAILURE, "Requested SES ID does not exist"); } do_led(fd, sesid, objp[sesid].elm_type, onoff, setfault); ndisks++; + free(objp); close(fd); break; } for (j = 0; j < nobj; j++) { + const int devnames_size = 128; + char devnames[devnames_size]; + if (all) { do_led(fd, objp[j].elm_idx, objp[j].elm_type, onoff, setfault); continue; } memset(&objdn, 0, sizeof(objdn)); + memset(devnames, 0, devnames_size); objdn.elm_idx = objp[j].elm_idx; - objdn.elm_names_size = 128; - objdn.elm_devnames = calloc(128, sizeof(char)); - if (objdn.elm_devnames == NULL) { - close(fd); - xo_err(EXIT_FAILURE, "calloc()"); - } + objdn.elm_names_size = devnames_size; + objdn.elm_devnames = devnames; if (ioctl(fd, ENCIOC_GETELMDEVNAMES, (caddr_t) &objdn) <0) { continue; From owner-svn-src-stable@freebsd.org Fri Dec 6 00:27:17 2019 Return-Path: Delivered-To: svn-src-stable@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 73ED81B1276; Fri, 6 Dec 2019 00:27:17 +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 47TYLs2G9fz3K1v; Fri, 6 Dec 2019 00:27:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C27D210A1; Fri, 6 Dec 2019 00:27:17 +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 xB60RHW2071486; Fri, 6 Dec 2019 00:27:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB60RHSM071485; Fri, 6 Dec 2019 00:27:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060027.xB60RHSM071485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355433 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 355433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:27:17 -0000 Author: asomers Date: Fri Dec 6 00:27:16 2019 New Revision: 355433 URL: https://svnweb.freebsd.org/changeset/base/355433 Log: MFC r354812: Update the ses(4) man page This driver was largely rewritten in 2015 (svn r235911) but the man page was never updated to match. Reviewed by: trasz Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22339 Modified: stable/12/share/man/man4/ses.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ses.4 ============================================================================== --- stable/12/share/man/man4/ses.4 Fri Dec 6 00:24:31 2019 (r355432) +++ stable/12/share/man/man4/ses.4 Fri Dec 6 00:27:16 2019 (r355433) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 05, 2015 +.Dd November 12, 2019 .Dt SES 4 .Os .Sh NAME @@ -77,33 +77,47 @@ calls apply to .Nm devices. They are defined in the header file -.In cam/scsi/scsi_ses.h +.In cam/scsi/scsi_enc.h (\fIq.v.\fR). -.Bl -tag -width SESIOC_GETENCSTAT -.It Dv SESIOC_GETNOBJ +.Bl -tag -width ENCIOC_GETENCSTAT +.It Dv ENCIOC_GETNELM Used to find out how many .Nm -objects are driven by this particular device instance. -.It Dv SESIOC_GETOBJMAP -Read, from the kernel, an array of SES objects which contains -the object identifier, which subenclosure it is in, and the +elements are driven by this particular device instance. +.It Dv ENCIOC_GETELMMAP +Read, from the kernel, an array of SES elements which contains +the element identifier, which subenclosure it is in, and the .Nm -type of the object. -.It Dv SESIOC_GETENCSTAT +type of the element. +.It Dv ENCIOC_GETENCSTAT Get the overall enclosure status. -.It Dv SESIOC_SETENCSTAT +.It Dv ENCIOC_SETENCSTAT Set the overall enclosure status. -.It Dv SESIOC_GETOBJSTAT -Get the status of a particular object. -.It Dv SESIOC_SETOBJSTAT -Set the status of a particular object. -.It Dv SESIOC_GETTEXT -Get the associated help text for an object (not yet implemented). +.It Dv ENCIOC_GETELMSTAT +Get the status of a particular element. +.It Dv ENCIOC_SETELMSTAT +Set the status of a particular element. +.It Dv ENCIOC_GETTEXT +Get the associated help text for an element (not yet implemented). .Nm -devices often have descriptive text for an object which can tell +devices often have descriptive text for an element which can tell you things like location (e.g., "left power supply"). -.It Dv SESIOC_INIT +.It Dv ENCIOC_INIT Initialize the enclosure. +.It Dv ENCIOC_GETELMDESC +Get the element's descriptor string. +.It Dv ENCIOC_GETELMDEVNAMES +Get the device names, if any, associated with this element. +.It Dv ENCIOC_GETSTRING +Used to read the SES String In Diagnostic Page. +The contents of this page are device-specific. +.It Dv ENCIOC_SETSTRING +Used to set the SES String Out Diagnostic Page. +The contents of this page are device-specific. +.It Dv ENCIOC_GETENCNAME +Used to get the name of the enclosure. +.It Dv ENCIOC_GETENCID +Used to get the Enclosure Logical Identifier. .El .Sh EXAMPLE USAGE The files contained in @@ -128,9 +142,12 @@ parameters to the console. .Sh HISTORY The .Nm -driver was written for the +driver was originally written for the .Tn CAM .Tn SCSI -subsystem by Matthew Jacob. -This is a functional equivalent of a similar +subsystem by Matthew Jacob and first released in +.Fx 4.3 . +It was a functional equivalent of a similar driver available in Solaris, Release 7. +It was largely rewritten by Alexander Motin, Justin Gibbs, and Will Andrews for +.Fx 9.2 . From owner-svn-src-stable@freebsd.org Fri Dec 6 00:29:17 2019 Return-Path: Delivered-To: svn-src-stable@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 4B6D51B1366; Fri, 6 Dec 2019 00:29:17 +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 47TYP91FCPz3K8P; Fri, 6 Dec 2019 00:29:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09828210A2; Fri, 6 Dec 2019 00:29:17 +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 xB60TGvR071620; Fri, 6 Dec 2019 00:29:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB60TGoc071619; Fri, 6 Dec 2019 00:29:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060029.xB60TGoc071619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355434 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 355434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:29:17 -0000 Author: asomers Date: Fri Dec 6 00:29:16 2019 New Revision: 355434 URL: https://svnweb.freebsd.org/changeset/base/355434 Log: MFC r354779: Actually hook CAM_IO_STATS up to the build It's still disabled by default, but now it can be enabled with config(5) and it will be build in LINT. Reviewed by: imp Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22383 Modified: stable/12/sys/conf/NOTES stable/12/sys/conf/options Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/NOTES ============================================================================== --- stable/12/sys/conf/NOTES Fri Dec 6 00:27:16 2019 (r355433) +++ stable/12/sys/conf/NOTES Fri Dec 6 00:29:16 2019 (r355434) @@ -1356,6 +1356,7 @@ device ctl #CAM Target Layer # CAM_DEBUG_TARGET Limit debugging to the given target. # CAM_DEBUG_LUN Limit debugging to the given lun. # CAM_DEBUG_DELAY Delay in us after printing each debug line. +# CAM_IO_STATS Publish additional CAM device statics by sysctl # # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions @@ -1377,6 +1378,7 @@ options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS options SCSI_DELAY=5000 # Be pessimistic about Joe SCSI device options CAM_IOSCHED_DYNAMIC +options CAM_IO_STATS options CAM_TEST_FAILURE # Options for the CAM CDROM driver: Modified: stable/12/sys/conf/options ============================================================================== --- stable/12/sys/conf/options Fri Dec 6 00:27:16 2019 (r355433) +++ stable/12/sys/conf/options Fri Dec 6 00:29:16 2019 (r355434) @@ -346,6 +346,7 @@ CAM_DEBUG_LUN opt_cam.h CAM_DEBUG_FLAGS opt_cam.h CAM_BOOT_DELAY opt_cam.h CAM_IOSCHED_DYNAMIC opt_cam.h +CAM_IO_STATS opt_cam.h CAM_TEST_FAILURE opt_cam.h SCSI_DELAY opt_scsi.h SCSI_NO_SENSE_STRINGS opt_scsi.h From owner-svn-src-stable@freebsd.org Fri Dec 6 09:50:02 2019 Return-Path: Delivered-To: svn-src-stable@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 01E6E1C7818; Fri, 6 Dec 2019 09:50:02 +0000 (UTC) (envelope-from scottl@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 47Tnr96Cycz4FL3; Fri, 6 Dec 2019 09:50:01 +0000 (UTC) (envelope-from scottl@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 B8BC3274E7; Fri, 6 Dec 2019 09:50:01 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB69o1ej099893; Fri, 6 Dec 2019 09:50:01 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB69o1Oc099892; Fri, 6 Dec 2019 09:50:01 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912060950.xB69o1Oc099892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 6 Dec 2019 09:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355440 - stable/12/sys/amd64/vmm/intel X-SVN-Group: stable-12 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: stable/12/sys/amd64/vmm/intel X-SVN-Commit-Revision: 355440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 09:50:02 -0000 Author: scottl Date: Fri Dec 6 09:50:01 2019 New Revision: 355440 URL: https://svnweb.freebsd.org/changeset/base/355440 Log: MFC r349184. This fixing PCI passthrough via VT-d on modern chipsets with multiple translation units. PR: 229852 Submitted by: callum@mitchison.org Modified: stable/12/sys/amd64/vmm/intel/vtd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/vmm/intel/vtd.c ============================================================================== --- stable/12/sys/amd64/vmm/intel/vtd.c Fri Dec 6 03:48:35 2019 (r355439) +++ stable/12/sys/amd64/vmm/intel/vtd.c Fri Dec 6 09:50:01 2019 (r355440) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); * Architecture Spec, September 2008. */ +#define VTD_DRHD_INCLUDE_PCI_ALL(Flags) (((Flags) >> 0) & 0x1) + /* Section 10.4 "Register Descriptions" */ struct vtdmap { volatile uint32_t version; @@ -116,10 +118,11 @@ struct domain { static SLIST_HEAD(, domain) domhead; #define DRHD_MAX_UNITS 8 -static int drhd_num; -static struct vtdmap *vtdmaps[DRHD_MAX_UNITS]; -static int max_domains; -typedef int (*drhd_ident_func_t)(void); +static ACPI_DMAR_HARDWARE_UNIT *drhds[DRHD_MAX_UNITS]; +static int drhd_num; +static struct vtdmap *vtdmaps[DRHD_MAX_UNITS]; +static int max_domains; +typedef int (*drhd_ident_func_t)(void); static uint64_t root_table[PAGE_SIZE / sizeof(uint64_t)] __aligned(4096); static uint64_t ctx_tables[256][PAGE_SIZE / sizeof(uint64_t)] __aligned(4096); @@ -175,6 +178,69 @@ domain_id(void) return (id); } +static struct vtdmap * +vtd_device_scope(uint16_t rid) +{ + int i, remaining, pathremaining; + char *end, *pathend; + struct vtdmap *vtdmap; + ACPI_DMAR_HARDWARE_UNIT *drhd; + ACPI_DMAR_DEVICE_SCOPE *device_scope; + ACPI_DMAR_PCI_PATH *path; + + for (i = 0; i < drhd_num; i++) { + drhd = drhds[i]; + + if (VTD_DRHD_INCLUDE_PCI_ALL(drhd->Flags)) { + /* + * From Intel VT-d arch spec, version 3.0: + * If a DRHD structure with INCLUDE_PCI_ALL flag Set is reported + * for a Segment, it must be enumerated by BIOS after all other + * DRHD structures for the same Segment. + */ + vtdmap = vtdmaps[i]; + return(vtdmap); + } + + end = (char *)drhd + drhd->Header.Length; + remaining = drhd->Header.Length - sizeof(ACPI_DMAR_HARDWARE_UNIT); + while (remaining > sizeof(ACPI_DMAR_DEVICE_SCOPE)) { + device_scope = (ACPI_DMAR_DEVICE_SCOPE *)(end - remaining); + remaining -= device_scope->Length; + + switch (device_scope->EntryType){ + /* 0x01 and 0x02 are PCI device entries */ + case 0x01: + case 0x02: + break; + default: + continue; + } + + if (PCI_RID2BUS(rid) != device_scope->Bus) + continue; + + pathend = (char *)device_scope + device_scope->Length; + pathremaining = device_scope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE); + while (pathremaining >= sizeof(ACPI_DMAR_PCI_PATH)) { + path = (ACPI_DMAR_PCI_PATH *)(pathend - pathremaining); + pathremaining -= sizeof(ACPI_DMAR_PCI_PATH); + + if (PCI_RID2SLOT(rid) != path->Device) + continue; + if (PCI_RID2FUNC(rid) != path->Function) + continue; + + vtdmap = vtdmaps[i]; + return (vtdmap); + } + } + } + + /* No matching scope */ + return (NULL); +} + static void vtd_wbflush(struct vtdmap *vtdmap) { @@ -240,7 +306,7 @@ vtd_translation_disable(struct vtdmap *vtdmap) static int vtd_init(void) { - int i, units, remaining; + int i, units, remaining, tmp; struct vtdmap *vtdmap; vm_paddr_t ctx_paddr; char *end, envname[32]; @@ -291,8 +357,9 @@ vtd_init(void) break; drhd = (ACPI_DMAR_HARDWARE_UNIT *)hdr; - vtdmaps[units++] = (struct vtdmap *)PHYS_TO_DMAP(drhd->Address); - if (units >= DRHD_MAX_UNITS) + drhds[units] = drhd; + vtdmaps[units] = (struct vtdmap *)PHYS_TO_DMAP(drhd->Address); + if (++units >= DRHD_MAX_UNITS) break; remaining -= hdr->Length; } @@ -302,13 +369,19 @@ vtd_init(void) skip_dmar: drhd_num = units; - vtdmap = vtdmaps[0]; - if (VTD_CAP_CM(vtdmap->cap) != 0) - panic("vtd_init: invalid caching mode"); + max_domains = 64 * 1024; /* maximum valid value */ + for (i = 0; i < drhd_num; i++){ + vtdmap = vtdmaps[i]; - max_domains = vtd_max_domains(vtdmap); + if (VTD_CAP_CM(vtdmap->cap) != 0) + panic("vtd_init: invalid caching mode"); + /* take most compatible (minimum) value */ + if ((tmp = vtd_max_domains(vtdmap)) < max_domains) + max_domains = tmp; + } + /* * Set up the root-table to point to the context-entry tables */ @@ -373,7 +446,6 @@ vtd_add_device(void *arg, uint16_t rid) struct vtdmap *vtdmap; uint8_t bus; - vtdmap = vtdmaps[0]; bus = PCI_RID2BUS(rid); ctxp = ctx_tables[bus]; pt_paddr = vtophys(dom->ptp); @@ -385,6 +457,10 @@ vtd_add_device(void *arg, uint16_t rid) (uint16_t)(ctxp[idx + 1] >> 8)); } + if ((vtdmap = vtd_device_scope(rid)) == NULL) + panic("vtd_add_device: device %x is not in scope for " + "any DMA remapping unit", rid); + /* * Order is important. The 'present' bit is set only after all fields * of the context pointer are initialized. @@ -568,8 +644,6 @@ vtd_create_domain(vm_paddr_t maxaddr) if (drhd_num <= 0) panic("vtd_create_domain: no dma remapping hardware available"); - vtdmap = vtdmaps[0]; - /* * Calculate AGAW. * Section 3.4.2 "Adjusted Guest Address Width", Architecture Spec. @@ -594,7 +668,14 @@ vtd_create_domain(vm_paddr_t maxaddr) pt_levels = 2; sagaw = 30; addrwidth = 0; - tmp = VTD_CAP_SAGAW(vtdmap->cap); + + tmp = ~0; + for (i = 0; i < drhd_num; i++) { + vtdmap = vtdmaps[i]; + /* take most compatible value */ + tmp &= VTD_CAP_SAGAW(vtdmap->cap); + } + for (i = 0; i < 5; i++) { if ((tmp & (1 << i)) != 0 && sagaw >= agaw) break; @@ -606,8 +687,8 @@ vtd_create_domain(vm_paddr_t maxaddr) } if (i >= 5) { - panic("vtd_create_domain: SAGAW 0x%lx does not support AGAW %d", - VTD_CAP_SAGAW(vtdmap->cap), agaw); + panic("vtd_create_domain: SAGAW 0x%x does not support AGAW %d", + tmp, agaw); } dom = malloc(sizeof(struct domain), M_VTD, M_ZERO | M_WAITOK); @@ -634,7 +715,12 @@ vtd_create_domain(vm_paddr_t maxaddr) * There is not any code to deal with the demotion at the moment * so we disable superpage mappings altogether. */ - dom->spsmask = VTD_CAP_SPS(vtdmap->cap); + dom->spsmask = ~0; + for (i = 0; i < drhd_num; i++) { + vtdmap = vtdmaps[i]; + /* take most compatible value */ + dom->spsmask &= VTD_CAP_SPS(vtdmap->cap); + } #endif SLIST_INSERT_HEAD(&domhead, dom, next); From owner-svn-src-stable@freebsd.org Fri Dec 6 11:46:16 2019 Return-Path: Delivered-To: svn-src-stable@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 3F8091C97EB; Fri, 6 Dec 2019 11:46:16 +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 47TrQJ0pJyz4KsY; Fri, 6 Dec 2019 11:46:16 +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 F2FCEAFF; Fri, 6 Dec 2019 11:46: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 xB6BkFQh070108; Fri, 6 Dec 2019 11:46:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6BkF5F070105; Fri, 6 Dec 2019 11:46:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912061146.xB6BkF5F070105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 6 Dec 2019 11:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355442 - in stable/12/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Commit-Revision: 355442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 11:46:16 -0000 Author: kib Date: Fri Dec 6 11:46:15 2019 New Revision: 355442 URL: https://svnweb.freebsd.org/changeset/base/355442 Log: MFC r355211: Add a VN_OPEN_INVFS flag. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/12/sys/kern/vfs_vnops.c stable/12/sys/sys/vnode.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 09:50:29 2019 (r355441) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) @@ -5541,7 +5541,7 @@ vop_getextattr { flags = FREAD; NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, VN_OPEN_INVFS, 0, ap->a_cred, NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { @@ -5678,7 +5678,8 @@ vop_setextattr { flags = FFLAGS(O_WRONLY | O_CREAT); NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0600, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred, + NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { Modified: stable/12/sys/kern/vfs_vnops.c ============================================================================== --- stable/12/sys/kern/vfs_vnops.c Fri Dec 6 09:50:29 2019 (r355441) +++ stable/12/sys/kern/vfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) @@ -216,7 +216,8 @@ restart: ndp->ni_cnd.cn_flags |= AUDITVNODE1; if (vn_open_flags & VN_OPEN_NOCAPCHECK) ndp->ni_cnd.cn_flags |= NOCAPCHECK; - bwillwrite(); + if ((vn_open_flags & VN_OPEN_INVFS) == 0) + bwillwrite(); if ((error = namei(ndp)) != 0) return (error); if (ndp->ni_vp == NULL) { Modified: stable/12/sys/sys/vnode.h ============================================================================== --- stable/12/sys/sys/vnode.h Fri Dec 6 09:50:29 2019 (r355441) +++ stable/12/sys/sys/vnode.h Fri Dec 6 11:46:15 2019 (r355442) @@ -577,6 +577,7 @@ typedef void vop_getpages_iodone_t(void *, vm_page_t * #define VN_OPEN_NOAUDIT 0x00000001 #define VN_OPEN_NOCAPCHECK 0x00000002 #define VN_OPEN_NAMECACHE 0x00000004 +#define VN_OPEN_INVFS 0x00000008 /* * Public vnode manipulation functions. From owner-svn-src-stable@freebsd.org Fri Dec 6 11:48:23 2019 Return-Path: Delivered-To: svn-src-stable@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 E92411C9885; Fri, 6 Dec 2019 11:48:23 +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 47TrSl5y41z4L19; Fri, 6 Dec 2019 11:48:23 +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 957E1B01; Fri, 6 Dec 2019 11:48:23 +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 xB6BmNCI070252; Fri, 6 Dec 2019 11:48:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6BmMdH070249; Fri, 6 Dec 2019 11:48:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912061148.xB6BmMdH070249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 6 Dec 2019 11:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355443 - in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Commit-Revision: 355443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 11:48:24 -0000 Author: kib Date: Fri Dec 6 11:48:22 2019 New Revision: 355443 URL: https://svnweb.freebsd.org/changeset/base/355443 Log: MFC r355211: Add a VN_OPEN_INVFS flag. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/11/sys/kern/vfs_vnops.c stable/11/sys/sys/vnode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 11:48:22 2019 (r355443) @@ -5544,7 +5544,7 @@ vop_getextattr { flags = FREAD; NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, VN_OPEN_INVFS, 0, ap->a_cred, NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { @@ -5681,7 +5681,8 @@ vop_setextattr { flags = FFLAGS(O_WRONLY | O_CREAT); NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0600, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred, + NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { Modified: stable/11/sys/kern/vfs_vnops.c ============================================================================== --- stable/11/sys/kern/vfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) +++ stable/11/sys/kern/vfs_vnops.c Fri Dec 6 11:48:22 2019 (r355443) @@ -217,7 +217,8 @@ restart: ndp->ni_cnd.cn_flags |= AUDITVNODE1; if (vn_open_flags & VN_OPEN_NOCAPCHECK) ndp->ni_cnd.cn_flags |= NOCAPCHECK; - bwillwrite(); + if ((vn_open_flags & VN_OPEN_INVFS) == 0) + bwillwrite(); if ((error = namei(ndp)) != 0) return (error); if (ndp->ni_vp == NULL) { Modified: stable/11/sys/sys/vnode.h ============================================================================== --- stable/11/sys/sys/vnode.h Fri Dec 6 11:46:15 2019 (r355442) +++ stable/11/sys/sys/vnode.h Fri Dec 6 11:48:22 2019 (r355443) @@ -591,6 +591,7 @@ typedef void vop_getpages_iodone_t(void *, vm_page_t * #define VN_OPEN_NOAUDIT 0x00000001 #define VN_OPEN_NOCAPCHECK 0x00000002 #define VN_OPEN_NAMECACHE 0x00000004 +#define VN_OPEN_INVFS 0x00000008 /* * Public vnode manipulation functions. From owner-svn-src-stable@freebsd.org Fri Dec 6 15:01:37 2019 Return-Path: Delivered-To: svn-src-stable@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 D53481CE217; Fri, 6 Dec 2019 15:01:37 +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 47Twlj5KhFz4W7q; Fri, 6 Dec 2019 15:01:37 +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 9A8632D7A; Fri, 6 Dec 2019 15:01:37 +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 xB6F1bxt085158; Fri, 6 Dec 2019 15:01:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6F1bQD085156; Fri, 6 Dec 2019 15:01:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061501.xB6F1bQD085156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 15:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355445 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 15:01:37 -0000 Author: markj Date: Fri Dec 6 15:01:36 2019 New Revision: 355445 URL: https://svnweb.freebsd.org/changeset/base/355445 Log: MFC r355001: Fix locking in vm_reserv_reclaim_contig(). Modified: stable/12/sys/vm/vm_reserv.c stable/12/sys/vm/vm_reserv.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_reserv.c ============================================================================== --- stable/12/sys/vm/vm_reserv.c Fri Dec 6 12:55:39 2019 (r355444) +++ stable/12/sys/vm/vm_reserv.c Fri Dec 6 15:01:36 2019 (r355445) @@ -181,10 +181,11 @@ popmap_is_set(popmap_t popmap[], int i) * * A partially populated reservation can be broken and reclaimed at any time. * - * r - vm_reserv_lock + * c - constant after boot * d - vm_reserv_domain_lock * o - vm_reserv_object_lock - * c - constant after boot + * r - vm_reserv_lock + * s - vm_reserv_domain_scan_lock */ struct vm_reserv { struct mtx lock; /* reservation lock. */ @@ -200,6 +201,8 @@ struct vm_reserv { popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ }; +TAILQ_HEAD(vm_reserv_queue, vm_reserv); + #define vm_reserv_lockptr(rv) (&(rv)->lock) #define vm_reserv_assert_locked(rv) \ mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) @@ -238,18 +241,26 @@ static vm_reserv_t vm_reserv_array; * is the least recently changed, partially populated reservation. * * Access to this queue is synchronized by the per-domain reservation lock. + * Threads reclaiming free pages from the queue must hold the per-domain scan + * lock. */ struct vm_reserv_domain { - struct mtx lock; - TAILQ_HEAD(, vm_reserv) partpop; + struct mtx lock; + struct vm_reserv_queue partpop; /* (d) */ + struct vm_reserv marker; /* (d, s) scan marker/lock */ } __aligned(CACHE_LINE_SIZE); static struct vm_reserv_domain vm_rvd[MAXMEMDOM]; #define vm_reserv_domain_lockptr(d) (&vm_rvd[(d)].lock) +#define vm_reserv_domain_assert_locked(d) \ + mtx_assert(vm_reserv_domain_lockptr(d), MA_OWNED) #define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) #define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_scan_lock(d) mtx_lock(&vm_rvd[(d)].marker.lock) +#define vm_reserv_domain_scan_unlock(d) mtx_unlock(&vm_rvd[(d)].marker.lock) + static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); static counter_u64_t vm_reserv_broken = EARLY_COUNTER; @@ -350,6 +361,8 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) unused_pages = 0; vm_reserv_domain_lock(domain); TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { + if (rv == &vm_rvd[domain].marker) + continue; counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } @@ -1156,7 +1169,8 @@ vm_reserv_init(void) vm_paddr_t paddr; struct vm_phys_seg *seg; struct vm_reserv *rv; - int i, segind; + struct vm_reserv_domain *rvd; + int i, j, segind; /* * Initialize the reservation array. Specifically, initialize the @@ -1175,8 +1189,18 @@ vm_reserv_init(void) } } for (i = 0; i < MAXMEMDOM; i++) { - mtx_init(&vm_rvd[i].lock, "VM reserv domain", NULL, MTX_DEF); - TAILQ_INIT(&vm_rvd[i].partpop); + rvd = &vm_rvd[i]; + mtx_init(&rvd->lock, "vm reserv domain", NULL, MTX_DEF); + TAILQ_INIT(&rvd->partpop); + mtx_init(&rvd->marker.lock, "vm reserv marker", NULL, MTX_DEF); + + /* + * Fully populated reservations should never be present in the + * partially populated reservation queues. + */ + rvd->marker.popcnt = VM_LEVEL_0_NPAGES; + for (j = 0; j < NBPOPMAP; j++) + popmap_set(rvd->marker.popmap, j); } for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) @@ -1226,50 +1250,71 @@ vm_reserv_level_iffullpop(vm_page_t m) } /* - * Breaks the given partially populated reservation, releasing its free pages - * to the physical memory allocator. + * Remove a partially populated reservation from the queue. */ static void -vm_reserv_reclaim(vm_reserv_t rv) +vm_reserv_dequeue(vm_reserv_t rv) { + vm_reserv_domain_assert_locked(rv->domain); vm_reserv_assert_locked(rv); CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); - vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); - KASSERT(rv->domain < vm_ndomains, - ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", - rv, rv->domain)); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; - vm_reserv_domain_unlock(rv->domain); +} + +/* + * Breaks the given partially populated reservation, releasing its free pages + * to the physical memory allocator. + */ +static void +vm_reserv_reclaim(vm_reserv_t rv) +{ + + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); + if (rv->inpartpopq) { + vm_reserv_domain_lock(rv->domain); + vm_reserv_dequeue(rv); + vm_reserv_domain_unlock(rv->domain); + } vm_reserv_break(rv); counter_u64_add(vm_reserv_reclaimed, 1); } /* - * Breaks the reservation at the head of the partially populated reservation + * Breaks a reservation near the head of the partially populated reservation * queue, releasing its free pages to the physical memory allocator. Returns * TRUE if a reservation is broken and FALSE otherwise. */ -boolean_t +bool vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - while ((rv = TAILQ_FIRST(&vm_rvd[domain].partpop)) != NULL) { - vm_reserv_lock(rv); - if (rv != TAILQ_FIRST(&vm_rvd[domain].partpop)) { - vm_reserv_unlock(rv); - continue; + vm_reserv_domain_lock(domain); + TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { + /* + * A locked reservation is likely being updated or reclaimed, + * so just skip ahead. + */ + if (rv != &vm_rvd[domain].marker && vm_reserv_trylock(rv)) { + vm_reserv_dequeue(rv); + break; } + } + vm_reserv_domain_unlock(domain); + if (rv != NULL) { vm_reserv_reclaim(rv); vm_reserv_unlock(rv); - return (TRUE); + return (true); } - return (FALSE); + return (false); } /* @@ -1355,20 +1400,23 @@ vm_reserv_test_contig(vm_reserv_t rv, u_long npages, v * contiguous physical memory. If a satisfactory reservation is found, it is * broken. Returns true if a reservation is broken and false otherwise. */ -boolean_t +bool vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { + struct vm_reserv_queue *queue; vm_paddr_t pa, size; - vm_reserv_t rv, rvn; + vm_reserv_t marker, rv, rvn; if (npages > VM_LEVEL_0_NPAGES - 1) return (false); + marker = &vm_rvd[domain].marker; + queue = &vm_rvd[domain].partpop; size = npages << PAGE_SHIFT; + + vm_reserv_domain_scan_lock(domain); vm_reserv_domain_lock(domain); -again: - for (rv = TAILQ_FIRST(&vm_rvd[domain].partpop); rv != NULL; rv = rvn) { - rvn = TAILQ_NEXT(rv, partpopq); + TAILQ_FOREACH_SAFE(rv, queue, partpopq, rvn) { pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + VM_LEVEL_0_SIZE - size < low) { /* This entire reservation is too low; go to next. */ @@ -1378,29 +1426,35 @@ again: /* This entire reservation is too high; go to next. */ continue; } + if (vm_reserv_trylock(rv) == 0) { + TAILQ_INSERT_AFTER(queue, rv, marker, partpopq); vm_reserv_domain_unlock(domain); vm_reserv_lock(rv); - if (!rv->inpartpopq) { + if (!rv->inpartpopq || + TAILQ_NEXT(rv, partpopq) != marker) { + vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); - if (!rvn->inpartpopq) - goto again; + rvn = TAILQ_NEXT(marker, partpopq); + TAILQ_REMOVE(queue, marker, partpopq); continue; } - } else - vm_reserv_domain_unlock(domain); + vm_reserv_domain_lock(domain); + TAILQ_REMOVE(queue, marker, partpopq); + } + vm_reserv_domain_unlock(domain); if (vm_reserv_test_contig(rv, npages, low, high, alignment, boundary)) { + vm_reserv_domain_scan_unlock(domain); vm_reserv_reclaim(rv); vm_reserv_unlock(rv); return (true); } vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); - if (rvn != NULL && !rvn->inpartpopq) - goto again; } vm_reserv_domain_unlock(domain); + vm_reserv_domain_scan_unlock(domain); return (false); } Modified: stable/12/sys/vm/vm_reserv.h ============================================================================== --- stable/12/sys/vm/vm_reserv.h Fri Dec 6 12:55:39 2019 (r355444) +++ stable/12/sys/vm/vm_reserv.h Fri Dec 6 15:01:36 2019 (r355445) @@ -64,10 +64,10 @@ void vm_reserv_init(void); bool vm_reserv_is_page_free(vm_page_t m); int vm_reserv_level(vm_page_t m); int vm_reserv_level_iffullpop(vm_page_t m); -boolean_t vm_reserv_reclaim_contig(int domain, u_long npages, +bool vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); -boolean_t vm_reserv_reclaim_inactive(int domain); +bool vm_reserv_reclaim_inactive(int domain); void vm_reserv_rename(vm_page_t m, vm_object_t new_object, vm_object_t old_object, vm_pindex_t old_object_offset); int vm_reserv_size(int level); From owner-svn-src-stable@freebsd.org Fri Dec 6 17:58:28 2019 Return-Path: Delivered-To: svn-src-stable@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 7B7B21B1E5D; Fri, 6 Dec 2019 17:58:28 +0000 (UTC) (envelope-from brooks@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 47V0gm2Jx1z3C2L; Fri, 6 Dec 2019 17:58:28 +0000 (UTC) (envelope-from brooks@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 2E8A45072; Fri, 6 Dec 2019 17:58:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6HwRMP089105; Fri, 6 Dec 2019 17:58:27 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6HwRv6089104; Fri, 6 Dec 2019 17:58:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201912061758.xB6HwRv6089104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 6 Dec 2019 17:58:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355453 - stable/12/sys/dev/bwn X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/dev/bwn X-SVN-Commit-Revision: 355453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 17:58:28 -0000 Author: brooks Date: Fri Dec 6 17:58:27 2019 New Revision: 355453 URL: https://svnweb.freebsd.org/changeset/base/355453 Log: MFC r355139: Fix a logic bug when "mask" contains a ?: operator. Newer versions of clang warn that '&' evaluates before '?:'. Reviewed by: markj Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22573 Modified: stable/12/sys/dev/bwn/if_bwnvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/bwn/if_bwnvar.h ============================================================================== --- stable/12/sys/dev/bwn/if_bwnvar.h Fri Dec 6 16:53:42 2019 (r355452) +++ stable/12/sys/dev/bwn/if_bwnvar.h Fri Dec 6 17:58:27 2019 (r355453) @@ -129,7 +129,7 @@ struct bwn_mac; mac->mac_phy.phy_maskset(mac, offset, mask, 0); \ } else \ BWN_PHY_WRITE(mac, offset, \ - BWN_PHY_READ(mac, offset) & mask); \ + BWN_PHY_READ(mac, offset) & (mask)); \ } while (0) #define BWN_PHY_COPY(mac, dst, src) do { \ KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \ From owner-svn-src-stable@freebsd.org Fri Dec 6 18:15:28 2019 Return-Path: Delivered-To: svn-src-stable@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 1C48B1B28CD; Fri, 6 Dec 2019 18:15:28 +0000 (UTC) (envelope-from brooks@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 47V13M71gqz3D6K; Fri, 6 Dec 2019 18:15:27 +0000 (UTC) (envelope-from brooks@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 D441E541E; Fri, 6 Dec 2019 18:15:27 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6IFRgH000568; Fri, 6 Dec 2019 18:15:27 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IFRcI000567; Fri, 6 Dec 2019 18:15:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201912061815.xB6IFRcI000567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 6 Dec 2019 18:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355454 - stable/11/sys/dev/bwn X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sys/dev/bwn X-SVN-Commit-Revision: 355454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:15:28 -0000 Author: brooks Date: Fri Dec 6 18:15:27 2019 New Revision: 355454 URL: https://svnweb.freebsd.org/changeset/base/355454 Log: MFC r355139: Fix a logic bug when "mask" contains a ?: operator. Newer versions of clang warn that '&' evaluates before '?:'. Reviewed by: markj Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22573 Modified: stable/11/sys/dev/bwn/if_bwnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bwn/if_bwnvar.h ============================================================================== --- stable/11/sys/dev/bwn/if_bwnvar.h Fri Dec 6 17:58:27 2019 (r355453) +++ stable/11/sys/dev/bwn/if_bwnvar.h Fri Dec 6 18:15:27 2019 (r355454) @@ -125,7 +125,7 @@ struct bwn_mac; mac->mac_phy.phy_maskset(mac, offset, mask, 0); \ } else \ BWN_PHY_WRITE(mac, offset, \ - BWN_PHY_READ(mac, offset) & mask); \ + BWN_PHY_READ(mac, offset) & (mask)); \ } while (0) #define BWN_PHY_COPY(mac, dst, src) do { \ KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \ From owner-svn-src-stable@freebsd.org Fri Dec 6 18:26:39 2019 Return-Path: Delivered-To: svn-src-stable@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 5265B1B2B93; Fri, 6 Dec 2019 18:26:39 +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 47V1JH2BmVz3DZd; Fri, 6 Dec 2019 18:26:39 +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 2DE1B55EF; Fri, 6 Dec 2019 18:26:39 +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 xB6IQd2F006806; Fri, 6 Dec 2019 18:26:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IQZTf006786; Fri, 6 Dec 2019 18:26:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061826.xB6IQZTf006786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 18:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355455 - in stable/12: bin/dd sbin/dhclient sbin/md5 usr.bin/cmp usr.bin/diff usr.bin/diff3 usr.bin/elfdump usr.bin/indent usr.bin/jot usr.bin/ktrdump usr.bin/lam usr.bin/rwho usr.bin/... X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: bin/dd sbin/dhclient sbin/md5 usr.bin/cmp usr.bin/diff usr.bin/diff3 usr.bin/elfdump usr.bin/indent usr.bin/jot usr.bin/ktrdump usr.bin/lam usr.bin/rwho usr.bin/tee usr.bin/uniq usr.bin/... X-SVN-Commit-Revision: 355455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:26:39 -0000 Author: markj Date: Fri Dec 6 18:26:34 2019 New Revision: 355455 URL: https://svnweb.freebsd.org/changeset/base/355455 Log: MFC r340138 (by oshogbo): capsicum: use a new capsicum helpers in tools Modified: stable/12/bin/dd/dd.c stable/12/sbin/dhclient/bpf.c stable/12/sbin/dhclient/dhclient.c stable/12/sbin/md5/md5.c stable/12/usr.bin/cmp/cmp.c stable/12/usr.bin/diff/diffreg.c stable/12/usr.bin/diff3/diff3.c stable/12/usr.bin/elfdump/elfdump.c stable/12/usr.bin/indent/indent.c stable/12/usr.bin/jot/jot.c stable/12/usr.bin/ktrdump/ktrdump.c stable/12/usr.bin/lam/lam.c stable/12/usr.bin/rwho/rwho.c stable/12/usr.bin/tee/tee.c stable/12/usr.bin/uniq/uniq.c stable/12/usr.bin/units/units.c stable/12/usr.bin/write/write.c stable/12/usr.sbin/rwhod/rwhod.c Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/dd/dd.c ============================================================================== --- stable/12/bin/dd/dd.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/bin/dd/dd.c Fri Dec 6 18:26:34 2019 (r355455) @@ -157,7 +157,7 @@ setup(void) getfdtype(&in); cap_rights_init(&rights, CAP_READ, CAP_SEEK); - if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(in.fd, &rights) == -1) err(1, "unable to limit capability rights"); if (files_cnt > 1 && !(in.flags & ISTAPE)) @@ -188,10 +188,9 @@ setup(void) getfdtype(&out); - if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(out.fd, &rights) == -1) err(1, "unable to limit capability rights"); - if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1) err(1, "unable to limit capability rights"); if (in.fd != STDIN_FILENO && out.fd != STDIN_FILENO) { Modified: stable/12/sbin/dhclient/bpf.c ============================================================================== --- stable/12/sbin/dhclient/bpf.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/sbin/dhclient/bpf.c Fri Dec 6 18:26:34 2019 (r355455) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define BPF_FORMAT "/dev/bpf%d" /* @@ -164,7 +166,7 @@ if_register_send(struct interface_info *info) error("Cannot lock bpf"); cap_rights_init(&rights, CAP_WRITE); - if (cap_rights_limit(info->wfdesc, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(info->wfdesc, &rights) < 0) error("Can't limit bpf descriptor: %m"); /* @@ -270,9 +272,9 @@ if_register_receive(struct interface_info *info) error("Cannot lock bpf"); cap_rights_init(&rights, CAP_IOCTL, CAP_EVENT, CAP_READ); - if (cap_rights_limit(info->rfdesc, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(info->rfdesc, &rights) < 0) error("Can't limit bpf descriptor: %m"); - if (cap_ioctls_limit(info->rfdesc, cmds, 2) < 0 && errno != ENOSYS) + if (caph_ioctls_limit(info->rfdesc, cmds, 2) < 0) error("Can't limit ioctls for bpf descriptor: %m"); } Modified: stable/12/sbin/dhclient/dhclient.c ============================================================================== --- stable/12/sbin/dhclient/dhclient.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/sbin/dhclient/dhclient.c Fri Dec 6 18:26:34 2019 (r355455) @@ -512,7 +512,7 @@ main(int argc, char *argv[]) close(pipe_fd[0]); privfd = pipe_fd[1]; cap_rights_init(&rights, CAP_READ, CAP_WRITE); - if (cap_rights_limit(privfd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(privfd, &rights) < 0) error("can't limit private descriptor: %m"); if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1) @@ -526,7 +526,7 @@ main(int argc, char *argv[]) if (shutdown(routefd, SHUT_WR) < 0) error("can't shutdown route socket: %m"); cap_rights_init(&rights, CAP_EVENT, CAP_READ); - if (cap_rights_limit(routefd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(routefd, &rights) < 0) error("can't limit route socket: %m"); endpwent(); @@ -1928,12 +1928,10 @@ rewrite_client_leases(void) error("can't create %s: %m", path_dhclient_db); cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_FSYNC, CAP_FTRUNCATE, CAP_SEEK, CAP_WRITE); - if (cap_rights_limit(fileno(leaseFile), &rights) < 0 && - errno != ENOSYS) { + if (caph_rights_limit(fileno(leaseFile), &rights) < 0) { error("can't limit lease descriptor: %m"); } - if (cap_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0 && - errno != ENOSYS) { + if (caph_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0) { error("can't limit lease descriptor fcntls: %m"); } } else { @@ -2461,20 +2459,24 @@ go_daemon(void) cap_rights_init(&rights); - if (pidfile != NULL) + if (pidfile != NULL) { pidfile_write(pidfile); + if (caph_rights_limit(pidfile_fileno(pidfile), &rights) < 0) + error("can't limit pidfile descriptor: %m"); + } + if (nullfd != -1) { close(nullfd); nullfd = -1; } - if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, &rights) < 0) error("can't limit stdin: %m"); cap_rights_init(&rights, CAP_WRITE); - if (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDOUT_FILENO, &rights) < 0) error("can't limit stdout: %m"); - if (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDERR_FILENO, &rights) < 0) error("can't limit stderr: %m"); } Modified: stable/12/sbin/md5/md5.c ============================================================================== --- stable/12/sbin/md5/md5.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/sbin/md5/md5.c Fri Dec 6 18:26:34 2019 (r355455) @@ -242,8 +242,8 @@ main(int argc, char *argv[]) if (*(argv + 1) == NULL) { #ifdef HAVE_CAPSICUM cap_rights_init(&rights, CAP_READ); - if ((cap_rights_limit(fd, &rights) < 0 && - errno != ENOSYS) || caph_enter() < 0) + if (caph_rights_limit(fd, &rights) < 0 || + caph_enter() < 0) err(1, "capsicum"); #endif } Modified: stable/12/usr.bin/cmp/cmp.c ============================================================================== --- stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:26:34 2019 (r355455) @@ -163,22 +163,21 @@ main(int argc, char *argv[]) } cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_MMAP_R); - if (cap_rights_limit(fd1, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd1, &rights) < 0) err(ERR_EXIT, "unable to limit rights for %s", file1); - if (cap_rights_limit(fd2, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd2, &rights) < 0) err(ERR_EXIT, "unable to limit rights for %s", file2); /* Required for fdopen(3). */ fcntls = CAP_FCNTL_GETFL; - if (cap_fcntls_limit(fd1, fcntls) < 0 && errno != ENOSYS) + if (caph_fcntls_limit(fd1, fcntls) < 0) err(ERR_EXIT, "unable to limit fcntls for %s", file1); - if (cap_fcntls_limit(fd2, fcntls) < 0 && errno != ENOSYS) + if (caph_fcntls_limit(fd2, fcntls) < 0) err(ERR_EXIT, "unable to limit fcntls for %s", file2); if (!special) { cap_rights_init(&rights); - if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && - errno != ENOSYS) { + if (caph_rights_limit(STDIN_FILENO, &rights) < 0) { err(ERR_EXIT, "unable to limit stdio"); } } Modified: stable/12/usr.bin/diff/diffreg.c ============================================================================== --- stable/12/usr.bin/diff/diffreg.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/diff/diffreg.c Fri Dec 6 18:26:34 2019 (r355455) @@ -319,11 +319,9 @@ diffreg(char *file1, char *file2, int flags, int capsi if (capsicum) { cap_rights_init(&rights_ro, CAP_READ, CAP_FSTAT, CAP_SEEK); - if (cap_rights_limit(fileno(f1), &rights_ro) < 0 - && errno != ENOSYS) + if (caph_rights_limit(fileno(f1), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file1); - if (cap_rights_limit(fileno(f2), &rights_ro) < 0 && - errno != ENOSYS) + if (caph_rights_limit(fileno(f2), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file2); if (fileno(f1) == STDIN_FILENO || fileno(f2) == STDIN_FILENO) { /* stding has already been limited */ Modified: stable/12/usr.bin/diff3/diff3.c ============================================================================== --- stable/12/usr.bin/diff3/diff3.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/diff3/diff3.c Fri Dec 6 18:26:34 2019 (r355455) @@ -717,19 +717,19 @@ main(int argc, char **argv) fp[0] = fopen(file1, "r"); if (fp[0] == NULL) err(2, "Can't open %s", file1); - if (cap_rights_limit(fileno(fp[0]), &rights_ro) < 0) + if (caph_rights_limit(fileno(fp[0]), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file1); fp[1] = fopen(file2, "r"); if (fp[1] == NULL) err(2, "Can't open %s", file2); - if (cap_rights_limit(fileno(fp[1]), &rights_ro) < 0) + if (caph_rights_limit(fileno(fp[1]), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file2); fp[2] = fopen(file3, "r"); if (fp[2] == NULL) err(2, "Can't open %s", file3); - if (cap_rights_limit(fileno(fp[2]), &rights_ro) < 0) + if (caph_rights_limit(fileno(fp[2]), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file3); if (pipe(fd13)) Modified: stable/12/usr.bin/elfdump/elfdump.c ============================================================================== --- stable/12/usr.bin/elfdump/elfdump.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/elfdump/elfdump.c Fri Dec 6 18:26:34 2019 (r355455) @@ -557,7 +557,7 @@ main(int ac, char **av) if ((out = fopen(optarg, "w")) == NULL) err(1, "%s", optarg); cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); - if (cap_rights_limit(fileno(out), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(out), &rights) < 0) err(1, "unable to limit rights for %s", optarg); break; case '?': @@ -572,10 +572,10 @@ main(int ac, char **av) fstat(fd, &sb) < 0) err(1, "%s", *av); cap_rights_init(&rights, CAP_MMAP_R); - if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd, &rights) < 0) err(1, "unable to limit rights for %s", *av); cap_rights_init(&rights); - if ((cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) || + if (caph_rights_limit(STDIN_FILENO, &rights) < 0 || caph_limit_stdout() < 0 || caph_limit_stderr() < 0) { err(1, "unable to limit rights for stdio"); } Modified: stable/12/usr.bin/indent/indent.c ============================================================================== --- stable/12/usr.bin/indent/indent.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/indent/indent.c Fri Dec 6 18:26:34 2019 (r355455) @@ -245,10 +245,10 @@ main(int argc, char **argv) /* Restrict input/output descriptors and enter Capsicum sandbox. */ cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); - if (cap_rights_limit(fileno(output), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(output), &rights) < 0) err(EXIT_FAILURE, "unable to limit rights for %s", out_name); cap_rights_init(&rights, CAP_FSTAT, CAP_READ); - if (cap_rights_limit(fileno(input), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(input), &rights) < 0) err(EXIT_FAILURE, "unable to limit rights for %s", in_name); if (caph_enter() < 0) err(EXIT_FAILURE, "unable to enter capability mode"); Modified: stable/12/usr.bin/jot/jot.c ============================================================================== --- stable/12/usr.bin/jot/jot.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/jot/jot.c Fri Dec 6 18:26:34 2019 (r355455) @@ -114,7 +114,7 @@ main(int argc, char **argv) if (caph_limit_stdio() < 0) err(1, "unable to limit rights for stdio"); cap_rights_init(&rights); - if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, &rights) < 0) err(1, "unable to limit rights for stdin"); /* Modified: stable/12/usr.bin/ktrdump/ktrdump.c ============================================================================== --- stable/12/usr.bin/ktrdump/ktrdump.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/ktrdump/ktrdump.c Fri Dec 6 18:26:34 2019 (r355455) @@ -132,8 +132,7 @@ main(int ac, char **av) if ((in = open(optarg, O_RDONLY)) == -1) err(1, "%s", optarg); cap_rights_init(&rights, CAP_FSTAT, CAP_MMAP_R); - if (cap_rights_limit(in, &rights) < 0 && - errno != ENOSYS) + if (caph_rights_limit(in, &rights) < 0) err(1, "unable to limit rights for %s", optarg); break; Modified: stable/12/usr.bin/lam/lam.c ============================================================================== --- stable/12/usr.bin/lam/lam.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/lam/lam.c Fri Dec 6 18:26:34 2019 (r355455) @@ -136,8 +136,7 @@ getargs(char *av[]) else if ((ip->fp = fopen(p, "r")) == NULL) { err(1, "%s", p); } - if (cap_rights_limit(fileno(ip->fp), &rights_ro) < 0 - && errno != ENOSYS) + if (caph_rights_limit(fileno(ip->fp), &rights_ro) < 0) err(1, "unable to limit rights on: %s", p); ip->pad = P; if (!ip->sepstring) Modified: stable/12/usr.bin/rwho/rwho.c ============================================================================== --- stable/12/usr.bin/rwho/rwho.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/rwho/rwho.c Fri Dec 6 18:26:34 2019 (r355455) @@ -129,7 +129,7 @@ main(int argc, char *argv[]) dfd = dirfd(dirp); mp = myutmp; cap_rights_init(&rights, CAP_READ, CAP_LOOKUP); - if (cap_rights_limit(dfd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(dfd, &rights) < 0) err(1, "cap_rights_limit failed: %s", _PATH_RWHODIR); /* * Cache files required for time(3) and localtime(3) before entering @@ -147,7 +147,7 @@ main(int argc, char *argv[]) f = openat(dfd, dp->d_name, O_RDONLY); if (f < 0) continue; - if (cap_rights_limit(f, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(f, &rights) < 0) err(1, "cap_rights_limit failed: %s", dp->d_name); cc = read(f, (char *)&wd, sizeof(struct whod)); if (cc < WHDRSIZE) { Modified: stable/12/usr.bin/tee/tee.c ============================================================================== --- stable/12/usr.bin/tee/tee.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/tee/tee.c Fri Dec 6 18:26:34 2019 (r355455) @@ -147,7 +147,7 @@ add(int fd, const char *name) err(EXIT_FAILURE, "unable to limit stdout"); } else { cap_rights_init(&rights, CAP_WRITE, CAP_FSTAT); - if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd, &rights) < 0) err(EXIT_FAILURE, "unable to limit rights"); } Modified: stable/12/usr.bin/uniq/uniq.c ============================================================================== --- stable/12/usr.bin/uniq/uniq.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/uniq/uniq.c Fri Dec 6 18:26:34 2019 (r355455) @@ -143,14 +143,14 @@ main (int argc, char *argv[]) if (argc > 0 && strcmp(argv[0], "-") != 0) ifp = file(ifn = argv[0], "r"); cap_rights_init(&rights, CAP_FSTAT, CAP_READ); - if (cap_rights_limit(fileno(ifp), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(ifp), &rights) < 0) err(1, "unable to limit rights for %s", ifn); cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); if (argc > 1) ofp = file(argv[1], "w"); else cap_rights_set(&rights, CAP_IOCTL); - if (cap_rights_limit(fileno(ofp), &rights) < 0 && errno != ENOSYS) { + if (caph_rights_limit(fileno(ofp), &rights) < 0) { err(1, "unable to limit rights for %s", argc > 1 ? argv[1] : "stdout"); } @@ -159,8 +159,7 @@ main (int argc, char *argv[]) cmd = TIOCGETA; /* required by isatty(3) in printf(3) */ - if (cap_ioctls_limit(fileno(ofp), &cmd, 1) < 0 && - errno != ENOSYS) { + if (caph_ioctls_limit(fileno(ofp), &cmd, 1) < 0) { err(1, "unable to limit ioctls for %s", argc > 1 ? argv[1] : "stdout"); } Modified: stable/12/usr.bin/units/units.c ============================================================================== --- stable/12/usr.bin/units/units.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/units/units.c Fri Dec 6 18:26:34 2019 (r355455) @@ -156,8 +156,7 @@ readunits(const char *userfile) } } cap_rights_init(&unitfilerights, CAP_READ, CAP_FSTAT); - if (cap_rights_limit(fileno(unitfile), &unitfilerights) < 0 - && errno != ENOSYS) + if (caph_rights_limit(fileno(unitfile), &unitfilerights) < 0) err(1, "cap_rights_limit() failed"); while (!feof(unitfile)) { if (!fgets(line, sizeof(line), unitfile)) Modified: stable/12/usr.bin/write/write.c ============================================================================== --- stable/12/usr.bin/write/write.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/write/write.c Fri Dec 6 18:26:34 2019 (r355455) @@ -97,7 +97,7 @@ main(int argc, char **argv) err(1, "open(/dev)"); cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_LOOKUP, CAP_PWRITE); - if (cap_rights_limit(devfd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(devfd, &rights) < 0) err(1, "can't limit devfd rights"); /* @@ -106,15 +106,15 @@ main(int argc, char **argv) */ cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_READ, CAP_WRITE); - if ((cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) || - (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS) || - (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS) || - (cap_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) < 0 && errno != ENOSYS) || - (cap_ioctls_limit(STDOUT_FILENO, cmds, nitems(cmds)) < 0 && errno != ENOSYS) || - (cap_ioctls_limit(STDERR_FILENO, cmds, nitems(cmds)) < 0 && errno != ENOSYS) || - (cap_fcntls_limit(STDIN_FILENO, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) || - (cap_fcntls_limit(STDOUT_FILENO, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) || - (cap_fcntls_limit(STDERR_FILENO, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS)) + if (caph_rights_limit(STDIN_FILENO, &rights) < 0 || + caph_rights_limit(STDOUT_FILENO, &rights) < 0 || + caph_rights_limit(STDERR_FILENO, &rights) < 0 || + caph_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) < 0 || + caph_ioctls_limit(STDOUT_FILENO, cmds, nitems(cmds)) < 0 || + caph_ioctls_limit(STDERR_FILENO, cmds, nitems(cmds)) < 0 || + caph_fcntls_limit(STDIN_FILENO, CAP_FCNTL_GETFL) < 0 || + caph_fcntls_limit(STDOUT_FILENO, CAP_FCNTL_GETFL) < 0 || + caph_fcntls_limit(STDERR_FILENO, CAP_FCNTL_GETFL) < 0) err(1, "can't limit stdio rights"); caph_cache_catpages(); Modified: stable/12/usr.sbin/rwhod/rwhod.c ============================================================================== --- stable/12/usr.sbin/rwhod/rwhod.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.sbin/rwhod/rwhod.c Fri Dec 6 18:26:34 2019 (r355455) @@ -369,7 +369,7 @@ receiver_process(void) } cap_rights_init(&rights, CAP_CREATE, CAP_FSTAT, CAP_FTRUNCATE, CAP_LOOKUP, CAP_SEEK, CAP_WRITE); - if (cap_rights_limit(dirfd, &rights) < 0 && errno != ENOSYS) { + if (caph_rights_limit(dirfd, &rights) < 0) { syslog(LOG_WARNING, "cap_rights_limit: %m"); exit(1); } @@ -415,7 +415,7 @@ receiver_process(void) continue; } cap_rights_init(&rights, CAP_FSTAT, CAP_FTRUNCATE, CAP_WRITE); - if (cap_rights_limit(whod, &rights) < 0 && errno != ENOSYS) { + if (caph_rights_limit(whod, &rights) < 0) { syslog(LOG_WARNING, "cap_rights_limit: %m"); exit(1); } From owner-svn-src-stable@freebsd.org Fri Dec 6 18:27:51 2019 Return-Path: Delivered-To: svn-src-stable@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 8D65D1B2C40; Fri, 6 Dec 2019 18:27:51 +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 47V1Kg39j8z3Dhy; Fri, 6 Dec 2019 18:27:51 +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 5166E55F2; Fri, 6 Dec 2019 18:27:51 +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 xB6IRpfw006910; Fri, 6 Dec 2019 18:27:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IRoMB006907; Fri, 6 Dec 2019 18:27:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061827.xB6IRoMB006907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 18:27:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355456 - in stable/12/usr.bin/cmp: . tests X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/usr.bin/cmp: . tests X-SVN-Commit-Revision: 355456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:27:51 -0000 Author: markj Date: Fri Dec 6 18:27:50 2019 New Revision: 355456 URL: https://svnweb.freebsd.org/changeset/base/355456 Log: MFC r344551: Fix handling of rights on stdio streams, take two. PR: 234885 Modified: stable/12/usr.bin/cmp/cmp.c stable/12/usr.bin/cmp/regular.c stable/12/usr.bin/cmp/special.c stable/12/usr.bin/cmp/tests/cmp_test2.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/cmp/cmp.c ============================================================================== --- stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:27:50 2019 (r355456) @@ -45,7 +45,6 @@ static char sccsid[] = "@(#)cmp.c 8.3 (Berkeley) 4/2/9 __FBSDID("$FreeBSD$"); #include -#include #include #include @@ -80,8 +79,6 @@ main(int argc, char *argv[]) off_t skip1, skip2; int ch, fd1, fd2, oflag, special; const char *file1, *file2; - cap_rights_t rights; - uint32_t fcntls; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) @@ -116,14 +113,19 @@ main(int argc, char *argv[]) if (argc < 2 || argc > 4) usage(); + /* Don't limit rights on stdin since it may be one of the inputs. */ + if (caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | CAPH_IGNORE_EBADF)) + err(ERR_EXIT, "unable to limit rights on stdout"); + if (caph_limit_stream(STDERR_FILENO, CAPH_WRITE | CAPH_IGNORE_EBADF)) + err(ERR_EXIT, "unable to limit rights on stderr"); + /* Backward compatibility -- handle "-" meaning stdin. */ special = 0; if (strcmp(file1 = argv[0], "-") == 0) { special = 1; - fd1 = 0; + fd1 = STDIN_FILENO; file1 = "stdin"; - } - else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) { + } else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) { if (!sflag) err(ERR_EXIT, "%s", file1); else @@ -134,10 +136,9 @@ main(int argc, char *argv[]) errx(ERR_EXIT, "standard input may only be specified once"); special = 1; - fd2 = 0; + fd2 = STDIN_FILENO; file2 = "stdin"; - } - else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { + } else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { if (!sflag) err(ERR_EXIT, "%s", file2); else @@ -162,33 +163,8 @@ main(int argc, char *argv[]) exit(ERR_EXIT); } - cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_MMAP_R); - if (caph_rights_limit(fd1, &rights) < 0) - err(ERR_EXIT, "unable to limit rights for %s", file1); - if (caph_rights_limit(fd2, &rights) < 0) - err(ERR_EXIT, "unable to limit rights for %s", file2); - - /* Required for fdopen(3). */ - fcntls = CAP_FCNTL_GETFL; - if (caph_fcntls_limit(fd1, fcntls) < 0) - err(ERR_EXIT, "unable to limit fcntls for %s", file1); - if (caph_fcntls_limit(fd2, fcntls) < 0) - err(ERR_EXIT, "unable to limit fcntls for %s", file2); - - if (!special) { - cap_rights_init(&rights); - if (caph_rights_limit(STDIN_FILENO, &rights) < 0) { - err(ERR_EXIT, "unable to limit stdio"); - } - } - - if (caph_limit_stdout() == -1 || caph_limit_stderr() == -1) - err(ERR_EXIT, "unable to limit stdio"); - + /* FD rights are limited in c_special() and c_regular(). */ caph_cache_catpages(); - - if (caph_enter() < 0) - err(ERR_EXIT, "unable to enter capability mode"); if (!special) { if (fstat(fd1, &sb1)) { Modified: stable/12/usr.bin/cmp/regular.c ============================================================================== --- stable/12/usr.bin/cmp/regular.c Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/regular.c Fri Dec 6 18:27:50 2019 (r355456) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -61,12 +62,13 @@ void c_regular(int fd1, const char *file1, off_t skip1, off_t len1, int fd2, const char *file2, off_t skip2, off_t len2) { + struct sigaction act, oact; + cap_rights_t rights; u_char ch, *p1, *p2, *m1, *m2, *e1, *e2; off_t byte, length, line; - int dfound; off_t pagemask, off1, off2; size_t pagesize; - struct sigaction act, oact; + int dfound; if (skip1 > len1) eofmsg(file1); @@ -78,12 +80,6 @@ c_regular(int fd1, const char *file1, off_t skip1, off if (sflag && len1 != len2) exit(DIFF_EXIT); - sigemptyset(&act.sa_mask); - act.sa_flags = SA_NODEFER; - act.sa_handler = segv_handler; - if (sigaction(SIGSEGV, &act, &oact)) - err(ERR_EXIT, "sigaction()"); - pagesize = getpagesize(); pagemask = (off_t)pagesize - 1; off1 = ROUNDPAGE(skip1); @@ -101,6 +97,19 @@ c_regular(int fd1, const char *file1, off_t skip1, off c_special(fd1, file1, skip1, fd2, file2, skip2); return; } + + if (caph_rights_limit(fd1, cap_rights_init(&rights, CAP_MMAP_R)) < 0) + err(1, "unable to limit rights for %s", file1); + if (caph_rights_limit(fd2, cap_rights_init(&rights, CAP_MMAP_R)) < 0) + err(1, "unable to limit rights for %s", file2); + if (caph_enter() < 0) + err(ERR_EXIT, "unable to enter capability mode"); + + sigemptyset(&act.sa_mask); + act.sa_flags = SA_NODEFER; + act.sa_handler = segv_handler; + if (sigaction(SIGSEGV, &act, &oact)) + err(ERR_EXIT, "sigaction()"); dfound = 0; e1 = m1 + MMAP_CHUNK; Modified: stable/12/usr.bin/cmp/special.c ============================================================================== --- stable/12/usr.bin/cmp/special.c Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/special.c Fri Dec 6 18:27:50 2019 (r355456) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -54,6 +55,13 @@ c_special(int fd1, const char *file1, off_t skip1, off_t byte, line; FILE *fp1, *fp2; int dfound; + + if (caph_limit_stream(fd1, CAPH_READ) < 0) + err(ERR_EXIT, "caph_limit_stream(%s)", file1); + if (caph_limit_stream(fd2, CAPH_READ) < 0) + err(ERR_EXIT, "caph_limit_stream(%s)", file2); + if (caph_enter() < 0) + err(ERR_EXIT, "unable to enter capability mode"); if ((fp1 = fdopen(fd1, "r")) == NULL) err(ERR_EXIT, "%s", file1); Modified: stable/12/usr.bin/cmp/tests/cmp_test2.sh ============================================================================== --- stable/12/usr.bin/cmp/tests/cmp_test2.sh Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/tests/cmp_test2.sh Fri Dec 6 18:27:50 2019 (r355456) @@ -36,6 +36,8 @@ special_body() { atf_check -s exit:0 -o empty -e empty -x "cat a | cmp - a" atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp a -" atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp - a" + + atf_check -s exit:0 -o empty -e empty -x "cmp a a <&-" } atf_test_case symlink From owner-svn-src-stable@freebsd.org Fri Dec 6 18:51:17 2019 Return-Path: Delivered-To: svn-src-stable@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 9D3171B3472; Fri, 6 Dec 2019 18:51: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 47V1rj3hbJz3Fsk; Fri, 6 Dec 2019 18:51: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 486E259C1; Fri, 6 Dec 2019 18:51: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 xB6IpHve022423; Fri, 6 Dec 2019 18:51:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IpHIj022422; Fri, 6 Dec 2019 18:51:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061851.xB6IpHIj022422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 18:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355458 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:51:17 -0000 Author: markj Date: Fri Dec 6 18:51:16 2019 New Revision: 355458 URL: https://svnweb.freebsd.org/changeset/base/355458 Log: MFC r355003: Update the checks in vm_page_zone_import(). Modified: stable/12/sys/vm/vm_page.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Fri Dec 6 18:39:05 2019 (r355457) +++ stable/12/sys/vm/vm_page.c Fri Dec 6 18:51:16 2019 (r355458) @@ -1755,21 +1755,14 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi * Returns true if the number of free pages exceeds the minimum * for the request class and false otherwise. */ -int -vm_domain_allocate(struct vm_domain *vmd, int req, int npages) +static int +_vm_domain_allocate(struct vm_domain *vmd, int req_class, int npages) { u_int limit, old, new; - req = req & VM_ALLOC_CLASS_MASK; - - /* - * The page daemon is allowed to dig deeper into the free page list. - */ - if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) - req = VM_ALLOC_SYSTEM; - if (req == VM_ALLOC_INTERRUPT) + if (req_class == VM_ALLOC_INTERRUPT) limit = 0; - else if (req == VM_ALLOC_SYSTEM) + else if (req_class == VM_ALLOC_SYSTEM) limit = vmd->vmd_interrupt_free_min; else limit = vmd->vmd_free_reserved; @@ -1797,6 +1790,20 @@ vm_domain_allocate(struct vm_domain *vmd, int req, int return (1); } +int +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) +{ + int req_class; + + /* + * The page daemon is allowed to dig deeper into the free page list. + */ + req_class = req & VM_ALLOC_CLASS_MASK; + if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) + req_class = VM_ALLOC_SYSTEM; + return (_vm_domain_allocate(vmd, req_class, npages)); +} + vm_page_t vm_page_alloc_domain_after(vm_object_t object, vm_pindex_t pindex, int domain, int req, vm_page_t mpred) @@ -2244,8 +2251,13 @@ vm_page_zone_import(void *arg, void **store, int cnt, pgcache = arg; vmd = VM_DOMAIN(pgcache->domain); - /* Only import if we can bring in a full bucket. */ - if (cnt == 1 || !vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) + + /* + * The page daemon should avoid creating extra memory pressure since its + * main purpose is to replenish the store of free pages. + */ + if (vmd->vmd_severeset || curproc == pageproc || + !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); From owner-svn-src-stable@freebsd.org Fri Dec 6 21:20:33 2019 Return-Path: Delivered-To: svn-src-stable@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 109541B6B98; Fri, 6 Dec 2019 21:20:33 +0000 (UTC) (envelope-from gjb@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 47V58w6mM9z3QRW; Fri, 6 Dec 2019 21:20:32 +0000 (UTC) (envelope-from gjb@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 CC2BE74D1; Fri, 6 Dec 2019 21:20:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6LKWAS007460; Fri, 6 Dec 2019 21:20:32 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6LKWbN007459; Fri, 6 Dec 2019 21:20:32 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201912062120.xB6LKWbN007459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 6 Dec 2019 21:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355463 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 355463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 21:20:33 -0000 Author: gjb Date: Fri Dec 6 21:20:32 2019 New Revision: 355463 URL: https://svnweb.freebsd.org/changeset/base/355463 Log: Document the 11.3-RELEASE images in GCE do not work, and provide information regarding alternative solutions. PR: 242303 (related) Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Dec 6 20:21:07 2019 (r355462) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Dec 6 21:20:32 2019 (r355463) @@ -135,6 +135,30 @@ Late-Breaking News - No news. + + + [2019-12-06] An issue has been reported with the + &os; 11.3-RELEASE images on the Google Compute Engine + platform which causes virtual machines to fail to start + properly. + + While we intend to investigate how to handle similar + situations should they arise in the future, updated images + will not be provided as of this time. + + Users wanting to use &os; in Google Compute Engine are + advised to use 12.0-RELEASE or 12.1-RELEASE, or for those + who wish to track 11.X, the + freebsd-11-3-stable-amd64-v20190801 + snapshot from stable/11 has been + + reported to work correctly. + + More details can be found in PR + 242303. + + From owner-svn-src-stable@freebsd.org Sat Dec 7 00:51:38 2019 Return-Path: Delivered-To: svn-src-stable@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 4D1E81BE20D; Sat, 7 Dec 2019 00:51:38 +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 47V9rV144Yz4BSB; Sat, 7 Dec 2019 00:51:38 +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 DE7C29BAF; Sat, 7 Dec 2019 00:51:37 +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 xB70pbs6034778; Sat, 7 Dec 2019 00:51:37 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70pb7M034777; Sat, 7 Dec 2019 00:51:37 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070051.xB70pb7M034777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355477 - in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Commit-Revision: 355477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:51:38 -0000 Author: cy Date: Sat Dec 7 00:51:37 2019 New Revision: 355477 URL: https://svnweb.freebsd.org/changeset/base/355477 Log: MFC r355300: Fix a typo (upto --> up to) and reword to improve word flow. Modified: stable/11/contrib/ipfilter/man/ipf.5 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/ipfilter/man/ipf.5 Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/ipfilter/man/ipf.5 ============================================================================== --- stable/11/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:33:08 2019 (r355476) +++ stable/11/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:51:37 2019 (r355477) @@ -1191,7 +1191,7 @@ pass in log or-block first quick proto tcp from any \\ .fi .PP By default, IPFilter will only log the header portion of a packet received -on the network. A portion of the body of a packet, upto 128 bytes, can also +on the network. Up to 128 bytes of a packet's body can also be logged with the body keyword. ipmon(8) will display the contents of the portion of the body logged in hex. .PP From owner-svn-src-stable@freebsd.org Sat Dec 7 00:51:39 2019 Return-Path: Delivered-To: svn-src-stable@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 2CF761BE218; Sat, 7 Dec 2019 00:51:39 +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 47V9rV5ZtNz4BTQ; Sat, 7 Dec 2019 00:51:38 +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 3D6B79BB0; Sat, 7 Dec 2019 00:51:38 +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 xB70pc1V034806; Sat, 7 Dec 2019 00:51:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70pcag034798; Sat, 7 Dec 2019 00:51:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070051.xB70pcag034798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355477 - in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Commit-Revision: 355477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:51:39 -0000 Author: cy Date: Sat Dec 7 00:51:37 2019 New Revision: 355477 URL: https://svnweb.freebsd.org/changeset/base/355477 Log: MFC r355300: Fix a typo (upto --> up to) and reword to improve word flow. Modified: stable/12/contrib/ipfilter/man/ipf.5 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/man/ipf.5 Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/man/ipf.5 ============================================================================== --- stable/12/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:33:08 2019 (r355476) +++ stable/12/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:51:37 2019 (r355477) @@ -1191,7 +1191,7 @@ pass in log or-block first quick proto tcp from any \\ .fi .PP By default, IPFilter will only log the header portion of a packet received -on the network. A portion of the body of a packet, upto 128 bytes, can also +on the network. Up to 128 bytes of a packet's body can also be logged with the body keyword. ipmon(8) will display the contents of the portion of the body logged in hex. .PP From owner-svn-src-stable@freebsd.org Sat Dec 7 00:53:23 2019 Return-Path: Delivered-To: svn-src-stable@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 1B6241BE4DF; Sat, 7 Dec 2019 00:53:23 +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 47V9tV6yzsz4Bsl; Sat, 7 Dec 2019 00:53:22 +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 D362D9CF1; Sat, 7 Dec 2019 00:53:22 +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 xB70rMgD036481; Sat, 7 Dec 2019 00:53:22 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70rMFq036480; Sat, 7 Dec 2019 00:53:22 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070053.xB70rMFq036480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355478 - in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Commit-Revision: 355478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:53:23 -0000 Author: cy Date: Sat Dec 7 00:53:22 2019 New Revision: 355478 URL: https://svnweb.freebsd.org/changeset/base/355478 Log: MFC r355388: Chase r352304. The default rlimit memlock is no memory locking. Reported by: egypcio@ Modified: stable/11/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.sbin/ntp/doc/ntp.conf.5 ============================================================================== --- stable/11/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:51:37 2019 (r355477) +++ stable/11/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:53:22 2019 (r355478) @@ -2965,7 +2965,7 @@ Probably only available under Linux, this option may b when dropping root (the .Fl i option). -The default is 32 megabytes on non\-Linux machines, and \-1 under Linux. +The default is \-1. -1 means "do not lock the process into memory". 0 means "lock whatever memory the process wants into memory". .It Cm stacksize Ar N4kPages From owner-svn-src-stable@freebsd.org Sat Dec 7 00:53:23 2019 Return-Path: Delivered-To: svn-src-stable@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 6D5461BE4E4; Sat, 7 Dec 2019 00:53:23 +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 47V9tW2LSMz4Bsm; Sat, 7 Dec 2019 00:53:23 +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 3395E9CF2; Sat, 7 Dec 2019 00:53:23 +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 xB70rNgr036487; Sat, 7 Dec 2019 00:53:23 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70rNR1036486; Sat, 7 Dec 2019 00:53:23 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070053.xB70rNR1036486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:53:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355478 - in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Commit-Revision: 355478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:53:23 -0000 Author: cy Date: Sat Dec 7 00:53:22 2019 New Revision: 355478 URL: https://svnweb.freebsd.org/changeset/base/355478 Log: MFC r355388: Chase r352304. The default rlimit memlock is no memory locking. Reported by: egypcio@ Modified: stable/12/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/ntp/doc/ntp.conf.5 ============================================================================== --- stable/12/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:51:37 2019 (r355477) +++ stable/12/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:53:22 2019 (r355478) @@ -2965,7 +2965,7 @@ Probably only available under Linux, this option may b when dropping root (the .Fl i option). -The default is 32 megabytes on non\-Linux machines, and \-1 under Linux. +The default is \-1. -1 means "do not lock the process into memory". 0 means "lock whatever memory the process wants into memory". .It Cm stacksize Ar N4kPages From owner-svn-src-stable@freebsd.org Sat Dec 7 03:29:59 2019 Return-Path: Delivered-To: svn-src-stable@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 39F761C5C9F; Sat, 7 Dec 2019 03:29: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 47VFMB5QCGz4LSH; Sat, 7 Dec 2019 03:29:58 +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 9891AB9AA; Sat, 7 Dec 2019 03:29:58 +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 xB73TwRi026602; Sat, 7 Dec 2019 03:29:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB73Tw7h026601; Sat, 7 Dec 2019 03:29:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912070329.xB73Tw7h026601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 7 Dec 2019 03:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355480 - stable/12/libexec/rc X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/libexec/rc X-SVN-Commit-Revision: 355480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 03:29:59 -0000 Author: emaste Date: Sat Dec 7 03:29:58 2019 New Revision: 355480 URL: https://svnweb.freebsd.org/changeset/base/355480 Log: MFC r354446: rc.shutdown: print a newline before watchdog timeout message Previously the watchdog timeout message was appended to the last entry in the "Waiting for PIDS" list, resulting in a message like Waiting for PIDS: 31299 31296 90201 9020090 second watchdog timeout expired. Shutdown terminated. Print a newline to separate the watchdog timeout message. Also MFC 355476: rc.shutdown: kill shutdown process after logging message Move the kill -KILL $$ back to the pre-r354446 location at the end of the shutdown timeout handler. PR: 241072 Sponsored by: The FreeBSD Foundation Modified: stable/12/libexec/rc/rc.shutdown Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.shutdown ============================================================================== --- stable/12/libexec/rc/rc.shutdown Sat Dec 7 01:10:38 2019 (r355479) +++ stable/12/libexec/rc/rc.shutdown Sat Dec 7 03:29:58 2019 (r355480) @@ -72,6 +72,7 @@ if [ -n "$rcshutdown_timeout" ]; then _msg="$rcshutdown_timeout second watchdog" _msg="$_msg timeout expired. Shutdown terminated." logger -t rc.shutdown "$_msg" + echo echo "$_msg" date kill -KILL $$ >/dev/null 2>&1 From owner-svn-src-stable@freebsd.org Sat Dec 7 03:56:37 2019 Return-Path: Delivered-To: svn-src-stable@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 755DA1C6F32; Sat, 7 Dec 2019 03:56:37 +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 47VFxx279yz4MwB; Sat, 7 Dec 2019 03:56:37 +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 2CEE6C0B9; Sat, 7 Dec 2019 03:56:37 +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 xB73ubPj043787; Sat, 7 Dec 2019 03:56:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB73ubvP043786; Sat, 7 Dec 2019 03:56:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912070356.xB73ubvP043786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 7 Dec 2019 03:56:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355482 - stable/12/sbin/dhclient X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sbin/dhclient X-SVN-Commit-Revision: 355482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 03:56:37 -0000 Author: emaste Date: Sat Dec 7 03:56:36 2019 New Revision: 355482 URL: https://svnweb.freebsd.org/changeset/base/355482 Log: MFC r238022 (cem): dhclient: fix braino in previous bugfix r300174 The previous revision missed the exact same error in a copy paste block of the same code in another function. Fix the identical case, too. A DHCP client identifier is simply the hardware type (one byte) concatenated with the hardware address (some variable number of bytes, but at most 16). Limit the size of the temporary buffer to match and the rest of the calculations shake out correctly. PR: 238022 Reported by: Young Submitted by: Young Modified: stable/12/sbin/dhclient/dhclient.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/dhclient/dhclient.c ============================================================================== --- stable/12/sbin/dhclient/dhclient.c Sat Dec 7 03:34:03 2019 (r355481) +++ stable/12/sbin/dhclient/dhclient.c Sat Dec 7 03:56:36 2019 (r355482) @@ -1774,7 +1774,7 @@ make_request(struct interface_info *ip, struct client_ } /* set unique client identifier */ - char client_ident[sizeof(struct hardware)]; + char client_ident[sizeof(ip->hw_address.haddr) + 1]; if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) { int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ? ip->hw_address.hlen : sizeof(client_ident)-1; From owner-svn-src-stable@freebsd.org Sat Dec 7 09:33:29 2019 Return-Path: Delivered-To: svn-src-stable@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 7BD001CF005; Sat, 7 Dec 2019 09:33:29 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (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 47VPQc3NCMz4c8c; Sat, 7 Dec 2019 09:33:27 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (ezra.dcm1.omnilan.net [IPv6:2a00:e10:2800::a135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id xB79XI6g000341; Sat, 7 Dec 2019 10:33:18 +0100 (CET) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (s1.omnilan.de [217.91.127.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id A2C6D53E; Sat, 7 Dec 2019 10:33:18 +0100 (CET) Subject: Re: svn commit: r355482 - stable/12/sbin/dhclient To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201912070356.xB73ubvP043786@repo.freebsd.org> From: Harry Schmalzbauer Organization: OmniLAN Message-ID: Date: Sat, 7 Dec 2019 10:33:18 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201912070356.xB73ubvP043786@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]); Sat, 07 Dec 2019 10:33:18 +0100 (CET) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: ; Sender-helo: mh0.gentlemail.de; ) X-Rspamd-Queue-Id: 47VPQc3NCMz4c8c X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@omnilan.de designates 2a00:e10:2800::a130 as permitted sender) smtp.mailfrom=freebsd@omnilan.de X-Spamd-Result: default: False [-4.62 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,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]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[omnilan.de]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.32)[ip: (-9.19), ipnet: 2a00:e10:2800::/38(-4.56), asn: 61157(2.15), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:61157, ipnet:2a00:e10:2800::/38, country:DE]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 09:33:29 -0000 Am 07.12.2019 um 04:56 schrieb Ed Maste: > Author: emaste > Date: Sat Dec 7 03:56:36 2019 > New Revision: 355482 > URL: https://svnweb.freebsd.org/changeset/base/355482 > > Log: > MFC r238022 (cem): dhclient: fix braino in previous bugfix r300174 PR vs. SVN typo, cem's commit was r355204. Thanks, -harry From owner-svn-src-stable@freebsd.org Sat Dec 7 14:17:57 2019 Return-Path: Delivered-To: svn-src-stable@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 90D3D1D4183; Sat, 7 Dec 2019 14:17:57 +0000 (UTC) (envelope-from bcr@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 47VWks3Bs8z3Lp5; Sat, 7 Dec 2019 14:17:57 +0000 (UTC) (envelope-from bcr@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 4CDCF1B0C3; Sat, 7 Dec 2019 14:17:57 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7EHvrN010806; Sat, 7 Dec 2019 14:17:57 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7EHvoI010805; Sat, 7 Dec 2019 14:17:57 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201912071417.xB7EHvoI010805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sat, 7 Dec 2019 14:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355485 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 355485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 14:17:57 -0000 Author: bcr (doc committer) Date: Sat Dec 7 14:17:56 2019 New Revision: 355485 URL: https://svnweb.freebsd.org/changeset/base/355485 Log: MFC r355225: Capitalize some user-visible output messages in the bectl utility. No functional changes. Approved by: imp@ Differential Revision: https://reviews.freebsd.org/D22330 Modified: stable/12/sbin/bectl/bectl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl.c ============================================================================== --- stable/12/sbin/bectl/bectl.c Sat Dec 7 12:56:24 2019 (r355484) +++ stable/12/sbin/bectl/bectl.c Sat Dec 7 14:17:56 2019 (r355485) @@ -68,7 +68,7 @@ usage(bool explicit) fp = explicit ? stdout : stderr; fprintf(fp, "%s", - "usage:\tbectl {-h | -? | subcommand [args...]}\n" + "Usage:\tbectl {-h | -? | subcommand [args...]}\n" #if SOON "\tbectl add (path)*\n" #endif @@ -167,10 +167,10 @@ bectl_cmd_activate(int argc, char *argv[]) /* activate logic goes here */ if ((err = be_activate(be, argv[0], temp)) != 0) /* XXX TODO: more specific error msg based on err */ - printf("did not successfully activate boot environment %s\n", + printf("Did not successfully activate boot environment %s\n", argv[0]); else - printf("successfully activated boot environment %s\n", argv[0]); + printf("Successfully activated boot environment %s\n", argv[0]); if (temp) printf("for next boot\n"); @@ -250,14 +250,14 @@ bectl_cmd_create(int argc, char *argv[]) default: if (atpos != NULL) fprintf(stderr, - "failed to create a snapshot '%s' of '%s'\n", + "Failed to create a snapshot '%s' of '%s'\n", atpos, bootenv); else if (snapname == NULL) fprintf(stderr, - "failed to create bootenv %s\n", bootenv); + "Failed to create bootenv %s\n", bootenv); else fprintf(stderr, - "failed to create bootenv %s from snapshot %s\n", + "Failed to create bootenv %s from snapshot %s\n", bootenv, snapname); } @@ -424,12 +424,12 @@ bectl_cmd_mount(int argc, char *argv[]) switch (err) { case BE_ERR_SUCCESS: - printf("successfully mounted %s at %s\n", bootenv, result_loc); + printf("Successfully mounted %s at %s\n", bootenv, result_loc); break; default: fprintf(stderr, - (argc == 3) ? "failed to mount bootenv %s at %s\n" : - "failed to mount bootenv %s at temporary path %s\n", + (argc == 3) ? "Failed to mount bootenv %s at %s\n" : + "Failed to mount bootenv %s at temporary path %s\n", bootenv, mountpoint); } @@ -462,7 +462,7 @@ bectl_cmd_rename(int argc, char *argv[]) case BE_ERR_SUCCESS: break; default: - fprintf(stderr, "failed to rename bootenv %s to %s\n", + fprintf(stderr, "Failed to rename bootenv %s to %s\n", src, dest); } @@ -507,7 +507,7 @@ bectl_cmd_unmount(int argc, char *argv[]) case BE_ERR_SUCCESS: break; default: - fprintf(stderr, "failed to unmount bootenv %s\n", bootenv); + fprintf(stderr, "Failed to unmount bootenv %s\n", bootenv); } return (err); @@ -563,7 +563,7 @@ main(int argc, char *argv[]) return (usage(true)); if ((cmd = get_cmd_info(command)) == NULL) { - fprintf(stderr, "unknown command: %s\n", command); + fprintf(stderr, "Unknown command: %s\n", command); return (usage(false)); } From owner-svn-src-stable@freebsd.org Sat Dec 7 17:10:05 2019 Return-Path: Delivered-To: svn-src-stable@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 739431D727A; Sat, 7 Dec 2019 17:10:05 +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 47VbYT2lBmz3yWT; Sat, 7 Dec 2019 17:10:05 +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 3D7DD1CED0; Sat, 7 Dec 2019 17:10:05 +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 xB7HA5TV011185; Sat, 7 Dec 2019 17:10:05 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HA4ap011179; Sat, 7 Dec 2019 17:10:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071710.xB7HA4ap011179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355490 - in stable/12: share/man/man4 sys/dev/gpio sys/dev/ofw X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/gpio sys/dev/ofw X-SVN-Commit-Revision: 355490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:10:05 -0000 Author: ian Date: Sat Dec 7 17:10:03 2019 New Revision: 355490 URL: https://svnweb.freebsd.org/changeset/base/355490 Log: MFC r355214, r355239, r355274, r355276-r355277, r355295, r355298 r355214: Ignore "gpio-hog" nodes when instantiating ofw_gpiobus children. Also, in ofw_gpiobus_probe() return BUS_PROBE_DEFAULT rather than 0; we are not the only possible driver to handle this device, we're just slightly better than the base gpiobus (which probes at BUS_PROBE_GENERIC). In the time since this code was first written, the gpio controller bindings aquired the concept of a "hog" node which could be used to preset one or more gpio pins as input or output at a specified level. This change doesn't fully implement the hogging concept, it just filters out hog nodes when instantiating child devices by scanning for child nodes in the fdt data. The whole concept of having child nodes under the controller node is not supported by the standard bindings, and appears to be a freebsd extension, probably left over from the days when we had no support for cross-tree phandle references in the fdt data. r355239: Add an OFWBUS_PNP_INFO() macro for devices that hang directly off the root ofwbus. Also, apply some style(9) whitespace fixing to the SIMPLEBUS_PNP_INFO() macro (no functional change). r355274: Move most of the gpio_pin_* functions from ofw_gpiobus.c to gpiobus.c so that they can be used by drivers on non-FDT-configured systems. Only the functions related to acquiring pins by parsing FDT data remain in ofw_gpiobus. Also, add two new functions for acquiring gpio pins based on child device_t and index, or on the bus device_t and pin number. And finally, defer reserving pins for gpiobus children until they acquire the pin, rather than reserving them as soon as the child is added (before it's even known whether the child will attach). This will allow drivers configured with hints (or any other mechanism) to use the same code as drivers configured via FDT data. Until now, a hinted driver and an FDT driver had to be two completely different sets of code, because hinted drivers could only use gpiobus calls to manipulate pins, while fdt-configured drivers could not use that API (due to not always being children of the bus that owns the pins) and had to use the newer gpio_pin_xxxx() functions. Now drivers can be written in the more traditional form, where most of the code is shared and only the resource acquisition code at attachment time changes. r355276: Rewrite gpioiic(4) to use the gpio_pin_* API, and to conform to the modern FDT bindings document for gpio-i2c devices. Using the gpio_pin_* functions to acquire/release/manipulate gpio pins removes the constraint that both gpio pins must belong to the same gpio controller/bank, and that the gpioiic instance must be a child of gpiobus. Removing those constraints allows the driver to be fully compatible with the modern dts bindings for a gpio bitbanged i2c bus. For hinted attachment, the two gpio pins still must be on the same gpiobus, and the device instance must be a child of that bus. This preserves compatibility for existing installations that have use gpioiic(4) with hints. r355277: Fix leading whitespace (spaces->tabs) in comments; no functional change. r355295: Remove "all rights reserved" from copyright after getting a response from Luiz that he also was not intentionally asserting that right, it was already there when he added his name. r355298: Do not initialize the flags field in struct gpiobus_pin from the flags in struct gpio_pin. It turns out these two sets of flags are completely unrelated to each other. Also, update the comment for GPIO_ACTIVE_LOW to reflect the fact that it does get set, somewhat unobviously, by code that parses FDT data. The bits from the FDT cell containing flags are just copied to gpiobus_pin.flags, so there's never any obvious reference to the symbol GPIO_ACTIVE_LOW being stored into the flags field. Modified: stable/12/share/man/man4/gpioiic.4 stable/12/sys/dev/gpio/gpiobus.c stable/12/sys/dev/gpio/gpiobusvar.h stable/12/sys/dev/gpio/gpioiic.c stable/12/sys/dev/gpio/ofw_gpiobus.c stable/12/sys/dev/ofw/ofw_bus_subr.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/gpioiic.4 ============================================================================== --- stable/12/share/man/man4/gpioiic.4 Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/share/man/man4/gpioiic.4 Sat Dec 7 17:10:03 2019 (r355490) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 14, 2014 +.Dd December 1, 2019 .Dt GPIOIIC 4 .Os .Sh NAME @@ -37,38 +37,42 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device gpio" .Cd "device gpioiic" -.Cd "device iic" .Cd "device iicbb" .Cd "device iicbus" .Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +gpioiic_load="YES" +.Ed .Sh DESCRIPTION The .Nm driver provides an IIC bit-banging interface using two GPIO pins for the -SCL and SDA on the -.Nm gpiobus . +SCL and SDA lines on the bus. +.Pp .Nm -implements an open collector kind of output, as recommended by the standard, -when driving the pins on the -.Nm gpiobus , -i.e, they are never switched to the logical value of '1', -or they are '0' or simply open (Hi-Z/tri-state). -So the pullup resistors are required so -.Nm -can work. +simulates an open collector kind of output when managing the pins on the +bus, even on systems which don't directly support configuring gpio pins +in that mode. +The pins are never driven to the logical value of '1'. +They are driven to '0' or switched to input mode (Hi-Z/tri-state), and +an external pullup resistor pulls the line to the 1 state unless some +other device on the bus is driving it to 0. .Pp +.Sh HINTS CONFIGURATION On a .Xr device.hints 5 -based system, like -.Li MIPS , -these values are configurable for the +based system, such as MIPS, these values are configurable for .Nm : .Bl -tag -width ".Va hint.gpioiic.%d.atXXX" .It Va hint.gpioiic.%d.at The .Nm gpiobus you are attaching to. -Normally just gpiobus0. +Normally just gpiobus0 on systems with a single bank of gpio pins. .It Va hint.gpioiic.%d.pins This is a bitmask of the pins on the .Nm gpiobus @@ -78,6 +82,9 @@ To configure pin 0 and 7, use the bitmask of 0b10000001 and convert it to a hexadecimal value of 0x0081. Please note that this mask should only ever have two bits set (any other bits - i.e., pins - will be ignored). +Because +.Nm +must be a child of the gpiobus, both gpio pins must be part of that bus. .It Va hint.gpioiic.%d.scl Indicates which bit in the .Va hint.gpioiic.%d.pins @@ -91,35 +98,32 @@ should be used as the SDATA source. Optional, defaults to 1. .El -.Pp -On a +.Sh FDT CONFIGURATION +On an .Xr FDT 4 -based system, like -.Li ARM , -the DTS part for a +based system, such as ARM, the DTS node for .Nm gpioiic -device usually looks like: +conforms to the standard bindings document i2c/i2c-gpio.yaml. +The device node typically appears at the root of the device tree. +The following is an example of a +.Nm +node with one slave device +on the IIC bus: .Bd -literal -gpio: gpio { - - gpio-controller; - ... - +/ { gpioiic0 { - compatible = "gpioiic"; - /* - * Attach to GPIO pins 21 and 22. Set them - * initially as inputs. - */ - gpios = <&gpio 21 1 0 - &gpio 22 1 0>; - scl = <0>; /* GPIO pin 21 - optional */ - sda = <1>; /* GPIO pin 22 - optional */ + compatible = "i2c-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpioiic0>; + scl-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + sda-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>; + status = "okay"; - /* This is an example of a gpioiic child. */ - gpioiic-child0 { - compatible = "lm75"; - i2c-address = <0x4f>; + /* One slave device on the i2c bus. */ + rtc@51 { + compatible="nxp,pcf2127"; + reg = <0x51>; + status = "okay"; }; }; }; @@ -128,35 +132,19 @@ gpio: gpio { Where: .Bl -tag -width ".Va compatible" .It Va compatible -Should always be set to "gpioiic". -.It Va gpios -The -.Va gpios -property indicates which GPIO pins should be used for SCLOCK and SDATA -on the GPIO IIC bit-banging bus. -For more details about the -.Va gpios -property, please consult -.Pa /usr/src/sys/dts/bindings-gpio.txt . -.It Va scl -The -.Va scl -option indicates which bit in the -.Va gpios -should be used as the SCLOCK source. -Optional, defaults to 0. -.It Va sda -The -.Va sda -option indicates which bit in the -.Va gpios -should be used as the SDATA source. -Optional, defaults to 1. +Should be set to "i2c-gpio". +The deprecated string "gpioiic" is also accepted for backwards compatibility. +.It Va scl-gpios Va sda-gpios +These properties indicate which GPIO pins should be used for clock +and data on the GPIO IIC bit-banging bus. +There is no requirement that the two pins belong to the same gpio controller. +.It Va pinctrl-names pinctrl-0 +These properties may be required to configure the chosen pins as gpio +pins, unless the pins default to that state on your system. .El .Sh SEE ALSO .Xr fdt 4 , .Xr gpio 4 , -.Xr gpioled 4 , .Xr iic 4 , .Xr iicbb 4 , .Xr iicbus 4 Modified: stable/12/sys/dev/gpio/gpiobus.c ============================================================================== --- stable/12/sys/dev/gpio/gpiobus.c Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/gpiobus.c Sat Dec 7 17:10:03 2019 (r355490) @@ -78,6 +78,18 @@ static int gpiobus_pin_get(device_t, device_t, uint32_ static int gpiobus_pin_toggle(device_t, device_t, uint32_t); /* + * gpiobus_pin flags + * The flags in struct gpiobus_pin are not related to the flags used by the + * low-level controller driver in struct gpio_pin. Currently, only pins + * acquired via FDT data have gpiobus_pin.flags set, sourced from the flags in + * the FDT properties. In theory, these flags are defined per-platform. In + * practice they are always the flags from the dt-bindings/gpio/gpio.h file. + * The only one of those flags we currently support is for handling active-low + * pins, so we just define that flag here instead of including a GPL'd header. + */ +#define GPIO_ACTIVE_LOW 1 + +/* * XXX -> Move me to better place - gpio_subr.c? * Also, this function must be changed when interrupt configuration * data will be moved into struct resource. @@ -135,6 +147,114 @@ gpio_check_flags(uint32_t caps, uint32_t flags) return (0); } +int +gpio_pin_get_by_bus_pinnum(device_t busdev, uint32_t pinnum, gpio_pin_t *ppin) +{ + gpio_pin_t pin; + int err; + + err = gpiobus_acquire_pin(busdev, pinnum); + if (err != 0) + return (EBUSY); + + pin = malloc(sizeof(*pin), M_DEVBUF, M_WAITOK | M_ZERO); + + pin->dev = device_get_parent(busdev); + pin->pin = pinnum; + pin->flags = 0; + + *ppin = pin; + return (0); +} + +int +gpio_pin_get_by_child_index(device_t childdev, uint32_t idx, gpio_pin_t *ppin) +{ + struct gpiobus_ivar *devi; + + devi = GPIOBUS_IVAR(childdev); + if (idx >= devi->npins) + return (EINVAL); + + return (gpio_pin_get_by_bus_pinnum(device_get_parent(childdev), + devi->pins[idx], ppin)); +} + +int +gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps) +{ + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + return (GPIO_PIN_GETCAPS(pin->dev, pin->pin, caps)); +} + +int +gpio_pin_is_active(gpio_pin_t pin, bool *active) +{ + int rv; + uint32_t tmp; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + rv = GPIO_PIN_GET(pin->dev, pin->pin, &tmp); + if (rv != 0) { + return (rv); + } + + if (pin->flags & GPIO_ACTIVE_LOW) + *active = tmp == 0; + else + *active = tmp != 0; + return (0); +} + +void +gpio_pin_release(gpio_pin_t gpio) +{ + device_t busdev; + + if (gpio == NULL) + return; + + KASSERT(gpio->dev != NULL, ("GPIO pin device is NULL.")); + + busdev = GPIO_GET_BUS(gpio->dev); + if (busdev != NULL) + gpiobus_release_pin(busdev, gpio->pin); + + free(gpio, M_DEVBUF); +} + +int +gpio_pin_set_active(gpio_pin_t pin, bool active) +{ + int rv; + uint32_t tmp; + + if (pin->flags & GPIO_ACTIVE_LOW) + tmp = active ? 0 : 1; + else + tmp = active ? 1 : 0; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + rv = GPIO_PIN_SET(pin->dev, pin->pin, tmp); + return (rv); +} + +int +gpio_pin_setflags(gpio_pin_t pin, uint32_t flags) +{ + int rv; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + + rv = GPIO_PIN_SETFLAGS(pin->dev, pin->pin, flags); + return (rv); +} + static void gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen) { @@ -370,8 +490,6 @@ gpiobus_parse_pins(struct gpiobus_softc *sc, device_t devi->pins[npins++] = i; } - if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) - return (EINVAL); return (0); } @@ -425,8 +543,6 @@ gpiobus_parse_pin_list(struct gpiobus_softc *sc, devic p = endp + 1; } - if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) - return (EINVAL); return (0); } Modified: stable/12/sys/dev/gpio/gpiobusvar.h ============================================================================== --- stable/12/sys/dev/gpio/gpiobusvar.h Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/gpiobusvar.h Sat Dec 7 17:10:03 2019 (r355490) @@ -141,7 +141,7 @@ int ofw_gpiobus_parse_gpios(device_t, char *, struct g void ofw_gpiobus_register_provider(device_t); void ofw_gpiobus_unregister_provider(device_t); -/* Consumers interface. */ +/* Acquire a pin by parsing FDT data. */ int gpio_pin_get_by_ofw_name(device_t consumer, phandle_t node, char *name, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_idx(device_t consumer, phandle_t node, @@ -150,14 +150,29 @@ int gpio_pin_get_by_ofw_property(device_t consumer, ph char *name, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t node, char *name, int idx, gpio_pin_t *gpio); +#endif /* FDT */ + +/* Acquire a pin by bus and pin number. */ +int gpio_pin_get_by_bus_pinnum(device_t _bus, uint32_t _pinnum, gpio_pin_t *_gp); + +/* Acquire a pin by child and index (used by direct children of gpiobus). */ +int gpio_pin_get_by_child_index(device_t _child, uint32_t _idx, gpio_pin_t *_gp); + +/* Release a pin acquired via any gpio_pin_get_xxx() function. */ void gpio_pin_release(gpio_pin_t gpio); + +/* Work with gpio pins acquired using the functions above. */ int gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps); int gpio_pin_is_active(gpio_pin_t pin, bool *active); int gpio_pin_set_active(gpio_pin_t pin, bool active); int gpio_pin_setflags(gpio_pin_t pin, uint32_t flags); -#endif struct resource *gpio_alloc_intr_resource(device_t consumer_dev, int *rid, u_int alloc_flags, gpio_pin_t pin, uint32_t intr_mode); + +/* + * Functions shared between gpiobus and other bus classes that derive from it; + * these should not be called directly by other drivers. + */ int gpio_check_flags(uint32_t, uint32_t); device_t gpiobus_attach_bus(device_t); int gpiobus_detach_bus(device_t); Modified: stable/12/sys/dev/gpio/gpioiic.c ============================================================================== --- stable/12/sys/dev/gpio/gpioiic.c Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/gpioiic.c Sat Dec 7 17:10:03 2019 (r355490) @@ -1,9 +1,9 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2009 Oleksandr Tymoshenko * Copyright (c) 2010 Luiz Otavio O Souza - * All rights reserved. + * Copyright (c) 2019 Ian Lepore * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,14 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FDT -#include -#include -#endif - #include #include -#include #include "gpiobus_if.h" #include "iicbb_if.h" @@ -57,200 +51,281 @@ __FBSDID("$FreeBSD$"); struct gpioiic_softc { - device_t sc_dev; - device_t sc_busdev; - int scl_pin; - int sda_pin; + device_t dev; + gpio_pin_t sclpin; + gpio_pin_t sdapin; }; -static int gpioiic_probe(device_t); -static int gpioiic_attach(device_t); +#ifdef FDT -/* iicbb interface */ -static void gpioiic_reset_bus(device_t); -static void gpioiic_setsda(device_t, int); -static void gpioiic_setscl(device_t, int); -static int gpioiic_getsda(device_t); -static int gpioiic_getscl(device_t); -static int gpioiic_reset(device_t, u_char, u_char, u_char *); +#include +static struct ofw_compat_data compat_data[] = { + {"i2c-gpio", true}, /* Standard devicetree compat string */ + {"gpioiic", true}, /* Deprecated old freebsd compat string */ + {NULL, false} +}; +OFWBUS_PNP_INFO(compat_data); +SIMPLEBUS_PNP_INFO(compat_data); + +static phandle_t +gpioiic_get_node(device_t bus, device_t dev) +{ + + /* Share our fdt node with iicbus so it can find its child nodes. */ + return (ofw_bus_get_node(bus)); +} + static int -gpioiic_probe(device_t dev) +gpioiic_setup_fdt_pins(struct gpioiic_softc *sc) { - struct gpiobus_ivar *devi; + phandle_t node; + int err; -#ifdef FDT - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - if (!ofw_bus_is_compatible(dev, "gpioiic")) - return (ENXIO); -#endif - devi = GPIOBUS_IVAR(dev); - if (devi->npins < GPIOIIC_MIN_PINS) { - device_printf(dev, - "gpioiic needs at least %d GPIO pins (only %d given).\n", - GPIOIIC_MIN_PINS, devi->npins); - return (ENXIO); - } - device_set_desc(dev, "GPIO I2C bit-banging driver"); + node = ofw_bus_get_node(sc->dev); - return (BUS_PROBE_DEFAULT); + /* + * Historically, we used the first two array elements of the gpios + * property. The modern bindings specify separate scl-gpios and + * sda-gpios properties. We cope with whichever is present. + */ + if (OF_hasprop(node, "gpios")) { + if ((err = gpio_pin_get_by_ofw_idx(sc->dev, node, + GPIOIIC_SCL_DFLT, &sc->sclpin)) != 0) { + device_printf(sc->dev, "invalid gpios property\n"); + return (err); + } + if ((err = gpio_pin_get_by_ofw_idx(sc->dev, node, + GPIOIIC_SDA_DFLT, &sc->sdapin)) != 0) { + device_printf(sc->dev, "ivalid gpios property\n"); + return (err); + } + } else { + if ((err = gpio_pin_get_by_ofw_property(sc->dev, node, + "scl-gpios", &sc->sclpin)) != 0) { + device_printf(sc->dev, "missing scl-gpios property\n"); + return (err); + } + if ((err = gpio_pin_get_by_ofw_property(sc->dev, node, + "sda-gpios", &sc->sdapin)) != 0) { + device_printf(sc->dev, "missing sda-gpios property\n"); + return (err); + } + } + return (0); } +#endif /* FDT */ static int -gpioiic_attach(device_t dev) +gpioiic_setup_hinted_pins(struct gpioiic_softc *sc) { - device_t bitbang; -#ifdef FDT - phandle_t node; - pcell_t pin; -#endif - struct gpiobus_ivar *devi; - struct gpioiic_softc *sc; + device_t busdev; + const char *busname, *devname; + int err, numpins, sclnum, sdanum, unit; - sc = device_get_softc(dev); - sc->sc_dev = dev; - sc->sc_busdev = device_get_parent(dev); - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "scl", &sc->scl_pin)) - sc->scl_pin = GPIOIIC_SCL_DFLT; - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "sda", &sc->sda_pin)) - sc->sda_pin = GPIOIIC_SDA_DFLT; + devname = device_get_name(sc->dev); + unit = device_get_unit(sc->dev); + busdev = device_get_parent(sc->dev); + /* + * If there is not an "at" hint naming our actual parent, then we + * weren't instantiated as a child of gpiobus via hints, and we thus + * can't access ivars that only exist for such children. + */ + if (resource_string_value(devname, unit, "at", &busname) != 0 || + (strcmp(busname, device_get_nameunit(busdev)) != 0 && + strcmp(busname, device_get_name(busdev)) != 0)) { + return (ENOENT); + } + + /* Make sure there were hints for at least two pins. */ + numpins = gpiobus_get_npins(sc->dev); + if (numpins < GPIOIIC_MIN_PINS) { #ifdef FDT - if ((node = ofw_bus_get_node(dev)) == -1) - return (ENXIO); - if (OF_getencprop(node, "scl", &pin, sizeof(pin)) > 0) - sc->scl_pin = (int)pin; - if (OF_getencprop(node, "sda", &pin, sizeof(pin)) > 0) - sc->sda_pin = (int)pin; + /* + * Be silent when there are no hints on FDT systems; the FDT + * data will provide the pin config (we'll whine if it doesn't). + */ + if (numpins == 0) { + return (ENOENT); + } #endif + device_printf(sc->dev, + "invalid pins hint; it must contain at least %d pins\n", + GPIOIIC_MIN_PINS); + return (EINVAL); + } - if (sc->scl_pin < 0 || sc->scl_pin > 1) - sc->scl_pin = GPIOIIC_SCL_DFLT; - if (sc->sda_pin < 0 || sc->sda_pin > 1) - sc->sda_pin = GPIOIIC_SDA_DFLT; + /* + * Our parent bus has already parsed the pins hint and it will use that + * info when we call gpio_pin_get_by_child_index(). But we have to + * handle the scl/sda index hints that tell us which of the two pins is + * the clock and which is the data. They're optional, but if present + * they must be a valid index (0 <= index < numpins). + */ + if ((err = resource_int_value(devname, unit, "scl", &sclnum)) != 0) + sclnum = GPIOIIC_SCL_DFLT; + else if (sclnum < 0 || sclnum >= numpins) { + device_printf(sc->dev, "invalid scl hint %d\n", sclnum); + return (EINVAL); + } + if ((err = resource_int_value(devname, unit, "sda", &sdanum)) != 0) + sdanum = GPIOIIC_SDA_DFLT; + else if (sdanum < 0 || sdanum >= numpins) { + device_printf(sc->dev, "invalid sda hint %d\n", sdanum); + return (EINVAL); + } - devi = GPIOBUS_IVAR(dev); - device_printf(dev, "SCL pin: %d, SDA pin: %d\n", - devi->pins[sc->scl_pin], devi->pins[sc->sda_pin]); + /* Allocate gpiobus_pin structs for the pins we found above. */ + if ((err = gpio_pin_get_by_child_index(sc->dev, sclnum, + &sc->sclpin)) != 0) + return (err); + if ((err = gpio_pin_get_by_child_index(sc->dev, sdanum, + &sc->sdapin)) != 0) + return (err); - /* add generic bit-banging code */ - bitbang = device_add_child(dev, "iicbb", -1); - device_probe_and_attach(bitbang); - return (0); } -static int -gpioiic_detach(device_t dev) -{ - - bus_generic_detach(dev); - device_delete_children(dev); - return (0); -} - -/* - * Reset bus by setting SDA first and then SCL. - * Must always be called with gpio bus locked. - */ static void -gpioiic_reset_bus(device_t dev) +gpioiic_setsda(device_t dev, int val) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); + /* + * Some controllers cannot set an output value while a pin is in input + * mode; in that case we set the pin again after changing mode. + */ + err = gpio_pin_set_active(sc->sdapin, val); + gpio_pin_setflags(sc->sdapin, GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN); + if (err != 0) + gpio_pin_set_active(sc->sdapin, val); } static void -gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val) +gpioiic_setscl(device_t dev, int val) { - int err; + struct gpioiic_softc *sc = device_get_softc(dev); - if (val == 0) { - err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, - GPIO_PIN_OUTPUT); - - /* - * Some controllers cannot set output value while a pin is in - * input mode. - */ - if (err != 0) - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); - } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, - GPIO_PIN_INPUT); - } + gpio_pin_setflags(sc->sclpin, GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN); + gpio_pin_set_active(sc->sclpin, val); } -static void -gpioiic_setsda(device_t dev, int val) +static int +gpioiic_getscl(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + bool val; - gpioiic_setpin(sc, sc->sda_pin, val); + gpio_pin_setflags(sc->sclpin, GPIO_PIN_INPUT); + gpio_pin_is_active(sc->sclpin, &val); + return (val); } -static void -gpioiic_setscl(device_t dev, int val) +static int +gpioiic_getsda(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + bool val; - gpioiic_setpin(sc, sc->scl_pin, val); + gpio_pin_setflags(sc->sdapin, GPIO_PIN_INPUT); + gpio_pin_is_active(sc->sdapin, &val); + return (val); } static int -gpioiic_getpin(struct gpioiic_softc *sc, int pin) +gpioiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) { - unsigned int val; + struct gpioiic_softc *sc = device_get_softc(dev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, &val); - return ((int)val); + /* Stop driving the bus pins. */ + gpio_pin_setflags(sc->sdapin, GPIO_PIN_INPUT); + gpio_pin_setflags(sc->sclpin, GPIO_PIN_INPUT); + + /* Indicate that we have no slave address (master mode). */ + return (IIC_ENOADDR); } -static int -gpioiic_getscl(device_t dev) +static void +gpioiic_cleanup(struct gpioiic_softc *sc) { - struct gpioiic_softc *sc = device_get_softc(dev); - return (gpioiic_getpin(sc, sc->scl_pin)); + device_delete_children(sc->dev); + + if (sc->sclpin != NULL) + gpio_pin_release(sc->sclpin); + + if (sc->sdapin != NULL) + gpio_pin_release(sc->sdapin); } static int -gpioiic_getsda(device_t dev) +gpioiic_probe(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + int rv; - return (gpioiic_getpin(sc, sc->sda_pin)); + /* + * By default we only bid to attach if specifically added by our parent + * (usually via hint.gpioiic.#.at=busname). On FDT systems we bid as + * the default driver based on being configured in the FDT data. + */ + rv = BUS_PROBE_NOWILDCARD; + +#ifdef FDT + if (ofw_bus_status_okay(dev) && + ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rv = BUS_PROBE_DEFAULT; +#endif + + device_set_desc(dev, "GPIO I2C"); + + return (rv); } static int -gpioiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +gpioiic_attach(device_t dev) { - struct gpioiic_softc *sc; + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - sc = device_get_softc(dev); - gpioiic_reset_bus(sc->sc_dev); + sc->dev = dev; - return (IIC_ENOADDR); + /* Acquire our gpio pins. */ + err = gpioiic_setup_hinted_pins(sc); +#ifdef FDT + if (err != 0) + err = gpioiic_setup_fdt_pins(sc); +#endif + if (err != 0) { + device_printf(sc->dev, "no pins configured\n"); + gpioiic_cleanup(sc); + return (ENXIO); + } + + /* Say what we came up with for pin config. */ + device_printf(dev, "SCL pin: %s:%d, SDA pin: %s:%d\n", + device_get_nameunit(GPIO_GET_BUS(sc->sclpin->dev)), sc->sclpin->pin, + device_get_nameunit(GPIO_GET_BUS(sc->sdapin->dev)), sc->sdapin->pin); + + /* Add the bitbang driver as our only child; it will add iicbus. */ + device_add_child(sc->dev, "iicbb", -1); + return (bus_generic_attach(dev)); } -#ifdef FDT -static phandle_t -gpioiic_get_node(device_t bus, device_t dev) +static int +gpioiic_detach(device_t dev) { + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - /* We only have one child, the iicbb, which needs our own node. */ - return (ofw_bus_get_node(bus)); + if ((err = bus_generic_detach(dev)) != 0) + return (err); + + gpioiic_cleanup(sc); + + return (0); } -#endif static devclass_t gpioiic_devclass; @@ -282,6 +357,7 @@ static driver_t gpioiic_driver = { }; DRIVER_MODULE(gpioiic, gpiobus, gpioiic_driver, gpioiic_devclass, 0, 0); +DRIVER_MODULE(gpioiic, simplebus, gpioiic_driver, gpioiic_devclass, 0, 0); DRIVER_MODULE(iicbb, gpioiic, iicbb_driver, iicbb_devclass, 0, 0); MODULE_DEPEND(gpioiic, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); MODULE_DEPEND(gpioiic, gpiobus, 1, 1, 1); Modified: stable/12/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- stable/12/sys/dev/gpio/ofw_gpiobus.c Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/ofw_gpiobus.c Sat Dec 7 17:10:03 2019 (r355490) @@ -43,8 +43,6 @@ __FBSDID("$FreeBSD$"); #include "gpiobus_if.h" -#define GPIO_ACTIVE_LOW 1 - static struct ofw_gpiobus_devinfo *ofw_gpiobus_setup_devinfo(device_t, device_t, phandle_t); static void ofw_gpiobus_destroy_devinfo(device_t, struct ofw_gpiobus_devinfo *); @@ -140,82 +138,6 @@ gpio_pin_get_by_ofw_name(device_t consumer, phandle_t return (gpio_pin_get_by_ofw_idx(consumer, node, idx, pin)); } -void -gpio_pin_release(gpio_pin_t gpio) -{ - device_t busdev; - - if (gpio == NULL) - return; - - KASSERT(gpio->dev != NULL, ("invalid pin state")); - - busdev = GPIO_GET_BUS(gpio->dev); - if (busdev != NULL) - gpiobus_release_pin(busdev, gpio->pin); - - /* XXXX Unreserve pin. */ - free(gpio, M_DEVBUF); -} - -int -gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps) -{ - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - return (GPIO_PIN_GETCAPS(pin->dev, pin->pin, caps)); -} - -int -gpio_pin_is_active(gpio_pin_t pin, bool *active) -{ - int rv; - uint32_t tmp; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - rv = GPIO_PIN_GET(pin->dev, pin->pin, &tmp); - if (rv != 0) { - return (rv); - } - - if (pin->flags & GPIO_ACTIVE_LOW) - *active = tmp == 0; - else - *active = tmp != 0; - return (0); -} - -int -gpio_pin_set_active(gpio_pin_t pin, bool active) -{ - int rv; - uint32_t tmp; - - if (pin->flags & GPIO_ACTIVE_LOW) - tmp = active ? 0 : 1; - else - tmp = active ? 1 : 0; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - rv = GPIO_PIN_SET(pin->dev, pin->pin, tmp); - return (rv); -} - -int -gpio_pin_setflags(gpio_pin_t pin, uint32_t flags) -{ - int rv; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - - rv = GPIO_PIN_SETFLAGS(pin->dev, pin->pin, flags); - return (rv); -} - /* * OFW_GPIOBUS driver. */ @@ -492,7 +414,7 @@ ofw_gpiobus_probe(device_t dev) return (ENXIO); device_set_desc(dev, "OFW GPIO bus"); - return (0); + return (BUS_PROBE_DEFAULT); } static int @@ -511,6 +433,8 @@ ofw_gpiobus_attach(device_t dev) */ for (child = OF_child(ofw_bus_get_node(dev)); child != 0; child = OF_peer(child)) { + if (OF_hasprop(child, "gpio-hog")) + continue; if (!OF_hasprop(child, "gpios")) continue; if (ofw_gpiobus_add_fdt_child(dev, NULL, child) == NULL) Modified: stable/12/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- stable/12/sys/dev/ofw/ofw_bus_subr.h Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/ofw/ofw_bus_subr.h Sat Dec 7 17:10:03 2019 (r355490) @@ -69,7 +69,8 @@ struct intr_map_data_fdt { #define FDTCOMPAT_PNP_INFO(t, busname) \ MODULE_PNP_INFO(FDTCOMPAT_PNP_DESCR, busname, t, t, sizeof(t) / sizeof(t[0])); -#define SIMPLEBUS_PNP_INFO(t) FDTCOMPAT_PNP_INFO(t, simplebus) +#define OFWBUS_PNP_INFO(t) FDTCOMPAT_PNP_INFO(t, ofwbus) +#define SIMPLEBUS_PNP_INFO(t) FDTCOMPAT_PNP_INFO(t, simplebus) /* Generic implementation of ofw_bus_if.m methods and helper routines */ int ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *, phandle_t); From owner-svn-src-stable@freebsd.org Sat Dec 7 17:17:35 2019 Return-Path: Delivered-To: svn-src-stable@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 247D51D75F7; Sat, 7 Dec 2019 17:17:35 +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 47Vbk70907z40Qt; Sat, 7 Dec 2019 17:17:35 +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 D8A631D090; Sat, 7 Dec 2019 17:17:34 +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 xB7HHYPs017016; Sat, 7 Dec 2019 17:17:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HHY7D017013; Sat, 7 Dec 2019 17:17:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071717.xB7HHY7D017013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355492 - in stable/12/sys/arm/ti: . am335x X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12/sys/arm/ti: . am335x X-SVN-Commit-Revision: 355492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:17:35 -0000 Author: ian Date: Sat Dec 7 17:17:34 2019 New Revision: 355492 URL: https://svnweb.freebsd.org/changeset/base/355492 Log: MFC r352196, r352333, r352342, r353653 r352196: In am335x_dmtpps, use a spin mutex to interlock between PPS capture and PPS ioctl(2) handling. This allows doing the pps_event() work in the polling routine, instead of using a taskqueue task to do that work. Also, add PNPINFO, and switch to using make_dev_s() to create the cdev. Using a spin mutex and calling pps_event() from the polling function works around the situation which requires more than 2 sets of timecounter timehands in a single-core system to get reliable PPS capture. That problem would happen when a single-core system is idle in cpu_idle() then gets woken up with an event timer event which was scheduled to handle a hardclock tick. That processing path would end up calling tc_windup 3 or 4 times between when the tc polling function was called and when the taskqueue task would eventually run, and with only two sets of timehands, the th_generation count would always be too old to allow the captured PPS data to be used. r352333: Include , required to use spinlocks in this code. r352342: Make the ti_sysc device quiet. It's an internal utility pseudo-device that makes the upstream FDT data work right, so we don't need to see a couple dozen instances of it spam the dmesg at boot time unless it's a verbose boot. r353653: Update some comments; no functional changes. Some historical old comments in this driver indicate that the SD_CAPA register is write-once and after being set one time the values in it cannot be changed. That turns out not to be the case -- the values written to it survive a reset, but they can be rewritten/changed at any time. Modified: stable/12/sys/arm/ti/am335x/am335x_dmtpps.c stable/12/sys/arm/ti/ti_sdhci.c stable/12/sys/arm/ti/ti_sysc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/ti/am335x/am335x_dmtpps.c ============================================================================== --- stable/12/sys/arm/ti/am335x/am335x_dmtpps.c Sat Dec 7 17:14:33 2019 (r355491) +++ stable/12/sys/arm/ti/am335x/am335x_dmtpps.c Sat Dec 7 17:17:34 2019 (r355492) @@ -48,11 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -79,7 +79,6 @@ struct dmtpps_softc { uint32_t tclr; /* Cached TCLR register. */ struct timecounter tc; int pps_curmode; /* Edge mode now set in hw. */ - struct task pps_task; /* For pps_event handling. */ struct cdev * pps_cdev; struct pps_state pps_state; struct mtx pps_mtx; @@ -93,6 +92,7 @@ static struct ofw_compat_data compat_data[] = { {"ti,am335x-timer-1ms", 1}, {NULL, 0}, }; +SIMPLEBUS_PNP_INFO(compat_data); /* * A table relating pad names to the hardware timer number they can be mux'd to. @@ -285,48 +285,29 @@ dmtpps_poll(struct timecounter *tc) * populates it from the current DMT_TCRR register) with the latched * value from the TCAR1 register. * - * There is no locking here, by design. pps_capture() writes into an - * area of struct pps_state which is read only by pps_event(). The - * synchronization of access to that area is temporal rather than - * interlock based... we write in this routine and trigger the task that - * will read the data, so no simultaneous access can occur. - * * Note that we don't have the TCAR interrupt enabled, but the hardware * still provides the status bits in the "RAW" status register even when * they're masked from generating an irq. However, when clearing the * TCAR status to re-arm the capture for the next second, we have to * write to the IRQ status register, not the RAW register. Quirky. + * + * We do not need to hold a lock while capturing the pps data, because + * it is captured into an area of the pps_state struct which is read + * only by pps_event(). We do need to hold a lock while calling + * pps_event(), because it manipulates data which is also accessed from + * the ioctl(2) context by userland processes. */ if (DMTIMER_READ4(sc, DMT_IRQSTATUS_RAW) & DMT_IRQ_TCAR) { pps_capture(&sc->pps_state); sc->pps_state.capcount = DMTIMER_READ4(sc, DMT_TCAR1); DMTIMER_WRITE4(sc, DMT_IRQSTATUS, DMT_IRQ_TCAR); - taskqueue_enqueue(taskqueue_fast, &sc->pps_task); + + mtx_lock_spin(&sc->pps_mtx); + pps_event(&sc->pps_state, PPS_CAPTUREASSERT); + mtx_unlock_spin(&sc->pps_mtx); } } -static void -dmtpps_event(void *arg, int pending) -{ - struct dmtpps_softc *sc; - - sc = arg; - - /* This is the task function that gets enqueued by poll_pps. Once the - * time has been captured by the timecounter polling code which runs in - * primary interrupt context, the remaining (more expensive) work to - * process the event is done later in a threaded context. - * - * Here there is an interlock that protects the event data in struct - * pps_state. That data can be accessed at any time from userland via - * ioctl() calls so we must ensure that there is no read access to - * partially updated data while pps_event() does its work. - */ - mtx_lock(&sc->pps_mtx); - pps_event(&sc->pps_state, PPS_CAPTUREASSERT); - mtx_unlock(&sc->pps_mtx); -} - static int dmtpps_open(struct cdev *dev, int flags, int fmt, struct thread *td) @@ -374,9 +355,9 @@ dmtpps_ioctl(struct cdev *dev, u_long cmd, caddr_t dat sc = dev->si_drv1; /* Let the kernel do the heavy lifting for ioctl. */ - mtx_lock(&sc->pps_mtx); + mtx_lock_spin(&sc->pps_mtx); err = pps_ioctl(cmd, data, &sc->pps_state); - mtx_unlock(&sc->pps_mtx); + mtx_unlock_spin(&sc->pps_mtx); if (err != 0) return (err); @@ -436,6 +417,7 @@ static int dmtpps_attach(device_t dev) { struct dmtpps_softc *sc; + struct make_dev_args mda; clk_ident_t timer_id; int err, sysclk_freq; @@ -502,22 +484,27 @@ dmtpps_attach(device_t dev) * now, just say we can only capture assert events (the positive-going * edge of the pulse). */ - mtx_init(&sc->pps_mtx, "dmtpps", NULL, MTX_DEF); + mtx_init(&sc->pps_mtx, "dmtpps", NULL, MTX_SPIN); + sc->pps_state.flags = PPSFLAG_MTX_SPIN; sc->pps_state.ppscap = PPS_CAPTUREASSERT; sc->pps_state.driver_abi = PPS_ABI_VERSION; sc->pps_state.driver_mtx = &sc->pps_mtx; pps_init_abi(&sc->pps_state); - /* - * Init the task that does deferred pps_event() processing after - * the polling routine has captured a pps pulse time. - */ - TASK_INIT(&sc->pps_task, 0, dmtpps_event, sc); - /* Create the PPS cdev. */ - sc->pps_cdev = make_dev(&dmtpps_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - PPS_CDEV_NAME); - sc->pps_cdev->si_drv1 = sc; + make_dev_args_init(&mda); + mda.mda_flags = MAKEDEV_WAITOK; + mda.mda_devsw = &dmtpps_cdevsw; + mda.mda_cr = NULL; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_WHEEL; + mda.mda_mode = 0600; + mda.mda_unit = device_get_unit(dev); + mda.mda_si_drv1 = sc; + if ((err = make_dev_s(&mda, &sc->pps_cdev, PPS_CDEV_NAME)) != 0) { + device_printf(dev, "Failed to create cdev %s\n", PPS_CDEV_NAME); + return (err); + } if (bootverbose) device_printf(sc->dev, "Using %s for PPS device /dev/%s\n", Modified: stable/12/sys/arm/ti/ti_sdhci.c ============================================================================== --- stable/12/sys/arm/ti/ti_sdhci.c Sat Dec 7 17:14:33 2019 (r355491) +++ stable/12/sys/arm/ti/ti_sdhci.c Sat Dec 7 17:17:34 2019 (r355492) @@ -481,10 +481,10 @@ ti_sdhci_hw_init(device_t dev) /* * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those - * values in the CAPA register. The manual says that these values can - * only be set once, "before initialization" whatever that means, and - * that they survive a reset. So maybe doing this will be a no-op if - * u-boot has already initialized the hardware. + * values in the CAPA register. Empirical testing shows that the + * values in this register can be overwritten at any time, but the + * manual says that these values should only be set once, "before + * initialization" whatever that means, and that they survive a reset. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) @@ -528,8 +528,7 @@ ti_sdhci_attach(device_t dev) * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so - * that it can set the right values in the CAPA register, which can only - * be done once and never reset. + * that it can set the right values in the CAPA register. */ sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { Modified: stable/12/sys/arm/ti/ti_sysc.c ============================================================================== --- stable/12/sys/arm/ti/ti_sysc.c Sat Dec 7 17:14:33 2019 (r355491) +++ stable/12/sys/arm/ti/ti_sysc.c Sat Dec 7 17:17:34 2019 (r355492) @@ -71,6 +71,9 @@ ti_sysc_probe(device_t dev) return (ENXIO); device_set_desc(dev, "TI SYSC Interconnect"); + if (!bootverbose) + device_quiet(dev); + return (BUS_PROBE_DEFAULT); } From owner-svn-src-stable@freebsd.org Sat Dec 7 17:19:37 2019 Return-Path: Delivered-To: svn-src-stable@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 9BBE21D7674; Sat, 7 Dec 2019 17:19:37 +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 47VbmT3bgHz40YB; Sat, 7 Dec 2019 17:19:37 +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 5FA9F1D094; Sat, 7 Dec 2019 17:19:37 +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 xB7HJbxx017137; Sat, 7 Dec 2019 17:19:37 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HJb96017136; Sat, 7 Dec 2019 17:19:37 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071719.xB7HJb96017136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355493 - stable/12/usr.sbin/daemon X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/usr.sbin/daemon X-SVN-Commit-Revision: 355493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:19:37 -0000 Author: ian Date: Sat Dec 7 17:19:36 2019 New Revision: 355493 URL: https://svnweb.freebsd.org/changeset/base/355493 Log: MFC r353024-r353025 r353024: Clarify how the -f option for daemon(8) interacts with other options related to redirecting stdout and stderr. r353025: Bump .Dd for earlier update (should have been part of r353024). Modified: stable/12/usr.sbin/daemon/daemon.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/daemon/daemon.8 ============================================================================== --- stable/12/usr.sbin/daemon/daemon.8 Sat Dec 7 17:17:34 2019 (r355492) +++ stable/12/usr.sbin/daemon/daemon.8 Sat Dec 7 17:19:36 2019 (r355493) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2019 +.Dd October 2, 2019 .Dt DAEMON 8 .Os .Sh NAME @@ -63,6 +63,11 @@ Change the current working directory to the root .It Fl f Redirect standard input, standard output and standard error to .Pa /dev/null . +When this option is used together with any of the options related to file +or syslog output, the standard file descriptors are first redirected to +.Pa /dev/null , +then stdout and/or stderr is redirected to a file or to syslog as +specified by the other options. .It Fl S Enable syslog output. This is implicitly applied if other syslog parameters are provided. From owner-svn-src-stable@freebsd.org Sat Dec 7 17:24:08 2019 Return-Path: Delivered-To: svn-src-stable@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 648EB1D78B2; Sat, 7 Dec 2019 17:24:08 +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 47Vbsh22Dxz410Z; Sat, 7 Dec 2019 17:24:08 +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 28ED31D24A; Sat, 7 Dec 2019 17:24:08 +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 xB7HO8dT022620; Sat, 7 Dec 2019 17:24:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HO7J8022618; Sat, 7 Dec 2019 17:24:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071724.xB7HO7J8022618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355494 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 355494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:24:08 -0000 Author: ian Date: Sat Dec 7 17:24:07 2019 New Revision: 355494 URL: https://svnweb.freebsd.org/changeset/base/355494 Log: MFC r352338: Create a mechanism for encoding a system errno into the IIC_Exxxxx space. Errors are communicated between the i2c controller layer and upper layers (iicbus and slave device drivers) using a set of IIC_Exxxxxx constants which effectively define a private number space separate from (and having values that conflict with) the system errno number space. Sometimes it is necessary to report a plain old system error (especially EINTR) from the controller or bus layer and have that value make it back across the syscall interface intact. I initially considered replicating a few "crucial" errno values with similar names and new numbers, e.g., IIC_EINTR, IIC_ERESTART, etc. It seemed like that had the potential to grow over time until many of the errno names were duplicated into the IIC_Exxxxx space. So instead, this defines a mechanism to "encode" an errno into the IIC_Exxxx space by setting the high bit and putting the errno into the lower-order bits; a new errno2iic() function does this. The existing iic2errno() recognizes the encoded values and extracts the original errno out of the encoded value. An interesting wrinkle occurs with the pseudo-error values such as ERESTART -- they aleady have the high bit set, and turning it off would be the wrong thing to do. Instead, iic2errno() recognizes that lots of high bits are on (i.e., it's a negative number near to zero) and just returns that value as-is. Thus, existing drivers continue to work without needing any changes, and there is now a way to return errno values from the lower layers. The first use of that is in iicbus_poll() which does mtx_sleep() with the PCATCH flag, and needs to return the errno from that up the call chain. Differential Revision: https://reviews.freebsd.org/D20975 Modified: stable/12/sys/dev/iicbus/iiconf.c stable/12/sys/dev/iicbus/iiconf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:19:36 2019 (r355493) +++ stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:24:07 2019 (r355494) @@ -42,6 +42,18 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" /* + * Encode a system errno value into the IIC_Exxxxx space by setting the + * IIC_ERRNO marker bit, so that iic2errno() can turn it back into a plain + * system errno value later. This lets controller- and bus-layer code get + * important system errno values (such as EINTR/ERESTART) back to the caller. + */ +int +errno2iic(int errno) +{ + return ((errno == 0) ? 0 : errno | IIC_ERRNO); +} + +/* * Translate IIC_Exxxxx status values to vaguely-equivelent errno values. */ int @@ -59,7 +71,22 @@ iic2errno(int iic_status) case IIC_ENOTSUPP: return (EOPNOTSUPP); case IIC_ENOADDR: return (EADDRNOTAVAIL); case IIC_ERESOURCE: return (ENOMEM); - default: return (EIO); + default: + /* + * If the high bit is set, that means it's a system errno value + * that was encoded into the IIC_Exxxxxx space by setting the + * IIC_ERRNO marker bit. If lots of high-order bits are set, + * then it's one of the negative pseudo-errors such as ERESTART + * and we return it as-is. Otherwise it's a plain "small + * positive integer" errno, so just remove the IIC_ERRNO marker + * bit. If it's some unknown number without the high bit set, + * there isn't much we can do except call it an I/O error. + */ + if ((iic_status & IIC_ERRNO) == 0) + return (EIO); + if ((iic_status & 0xFFFF0000) != 0) + return (iic_status); + return (iic_status & ~IIC_ERRNO); } } @@ -97,7 +124,7 @@ iicbus_poll(struct iicbus_softc *sc, int how) return (IIC_EBUSBSY); } - return (error); + return (errno2iic(error)); } /* Modified: stable/12/sys/dev/iicbus/iiconf.h ============================================================================== --- stable/12/sys/dev/iicbus/iiconf.h Sat Dec 7 17:19:36 2019 (r355493) +++ stable/12/sys/dev/iicbus/iiconf.h Sat Dec 7 17:24:07 2019 (r355494) @@ -96,12 +96,14 @@ #define IIC_ENOTSUPP 0x8 /* request not supported */ #define IIC_ENOADDR 0x9 /* no address assigned to the interface */ #define IIC_ERESOURCE 0xa /* resources (memory, whatever) unavailable */ +#define IIC_ERRNO __INT_MIN /* marker bit: errno is in low-order bits */ /* * Note that all iicbus functions return IIC_Exxxxx status values, * except iic2errno() (obviously) and iicbus_started() (returns bool). */ extern int iic2errno(int); +extern int errno2iic(int); extern int iicbus_request_bus(device_t, device_t, int); extern int iicbus_release_bus(device_t, device_t); extern device_t iicbus_alloc_bus(device_t); From owner-svn-src-stable@freebsd.org Sat Dec 7 17:34:05 2019 Return-Path: Delivered-To: svn-src-stable@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 326191D7D85; Sat, 7 Dec 2019 17:34:05 +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 47Vc591N6jz41xp; Sat, 7 Dec 2019 17:34:05 +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 EC0CD1D420; Sat, 7 Dec 2019 17:34:04 +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 xB7HY40T029871; Sat, 7 Dec 2019 17:34:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HY4uQ029869; Sat, 7 Dec 2019 17:34:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071734.xB7HY4uQ029869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355496 - stable/12/sys/arm/include X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/arm/include X-SVN-Commit-Revision: 355496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:34:05 -0000 Author: ian Date: Sat Dec 7 17:34:04 2019 New Revision: 355496 URL: https://svnweb.freebsd.org/changeset/base/355496 Log: MFC r352938: Add 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm. This adds 8 and 16 bit versions of the cmpset and fcmpset functions. Macros are used to generate all the flavors from the same set of instructions; the macro expansion handles the couple minor differences between each size variation (generating ldrexb/ldrexh/ldrex for 8/16/32, etc). In addition to handling new sizes, the instruction sequences used for cmpset and fcmpset are rewritten to be a bit shorter/faster, and the new sequence will not return false when *dst==*old but the store-exclusive fails because of concurrent writers. Instead, it just loops like ldrex/strex sequences normally do until it gets a non-conflicted store. The manpage allows LL/SC architectures to bogusly return false, but there's no reason to actually do so, at least on arm. Reviewed by: cognet Modified: stable/12/sys/arm/include/atomic-v4.h stable/12/sys/arm/include/atomic-v6.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/include/atomic-v4.h ============================================================================== --- stable/12/sys/arm/include/atomic-v4.h Sat Dec 7 17:28:41 2019 (r355495) +++ stable/12/sys/arm/include/atomic-v4.h Sat Dec 7 17:34:04 2019 (r355496) @@ -113,6 +113,43 @@ atomic_clear_64(volatile uint64_t *address, uint64_t c } static __inline int +atomic_fcmpset_8(volatile uint8_t *p, volatile uint8_t *cmpval, volatile uint8_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + ret = *p; + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} +static __inline int +atomic_fcmpset_16(volatile uint16_t *p, volatile uint16_t *cmpval, volatile uint16_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + ret = *p; + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} + +static __inline int atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) { int ret; @@ -150,6 +187,40 @@ atomic_fcmpset_64(volatile u_int64_t *p, volatile u_in } static __inline int +atomic_cmpset_8(volatile uint8_t *p, volatile uint8_t cmpval, volatile uint8_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + if (*p == cmpval) { + *p = newval; + ret = 1; + } else { + ret = 0; + } + }); + return (ret); +} + +static __inline int +atomic_cmpset_16(volatile uint16_t *p, volatile uint16_t cmpval, volatile uint16_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + if (*p == cmpval) { + *p = newval; + ret = 1; + } else { + ret = 0; + } + }); + return (ret); +} + +static __inline int atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { int ret; @@ -450,6 +521,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v) #define atomic_fcmpset_rel_32 atomic_fcmpset_32 #define atomic_fcmpset_acq_32 atomic_fcmpset_32 #ifdef _KERNEL +#define atomic_fcmpset_rel_8 atomic_fcmpset_8 +#define atomic_fcmpset_acq_8 atomic_fcmpset_8 +#define atomic_fcmpset_rel_16 atomic_fcmpset_16 +#define atomic_fcmpset_acq_16 atomic_fcmpset_16 #define atomic_fcmpset_rel_64 atomic_fcmpset_64 #define atomic_fcmpset_acq_64 atomic_fcmpset_64 #endif @@ -458,6 +533,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v) #define atomic_cmpset_rel_32 atomic_cmpset_32 #define atomic_cmpset_acq_32 atomic_cmpset_32 #ifdef _KERNEL +#define atomic_cmpset_rel_8 atomic_cmpset_8 +#define atomic_cmpset_acq_8 atomic_cmpset_8 +#define atomic_cmpset_rel_16 atomic_cmpset_16 +#define atomic_cmpset_acq_16 atomic_cmpset_16 #define atomic_cmpset_rel_64 atomic_cmpset_64 #define atomic_cmpset_acq_64 atomic_cmpset_64 #endif Modified: stable/12/sys/arm/include/atomic-v6.h ============================================================================== --- stable/12/sys/arm/include/atomic-v6.h Sat Dec 7 17:28:41 2019 (r355495) +++ stable/12/sys/arm/include/atomic-v6.h Sat Dec 7 17:34:04 2019 (r355496) @@ -190,224 +190,380 @@ ATOMIC_ACQ_REL(clear, 32) ATOMIC_ACQ_REL(clear, 64) ATOMIC_ACQ_REL_LONG(clear) +#define ATOMIC_FCMPSET_CODE(RET, TYPE, SUF) \ + { \ + TYPE tmp; \ + \ + __asm __volatile( \ + "1: ldrex" SUF " %[tmp], [%[ptr]] \n" \ + " ldr %[ret], [%[oldv]] \n" \ + " teq %[tmp], %[ret] \n" \ + " ittee ne \n" \ + " str" SUF "ne %[tmp], [%[oldv]] \n" \ + " movne %[ret], #0 \n" \ + " strex" SUF "eq %[ret], %[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET), \ + [tmp] "=&r" (tmp) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + +#define ATOMIC_FCMPSET_CODE64(RET) \ + { \ + uint64_t cmp, tmp; \ + \ + __asm __volatile( \ + "1: ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" \ + " ldrd %Q[cmp], %R[cmp], [%[oldv]] \n" \ + " teq %Q[tmp], %Q[cmp] \n" \ + " it eq \n" \ + " teqeq %R[tmp], %R[cmp] \n" \ + " ittee ne \n" \ + " movne %[ret], #0 \n" \ + " strdne %[cmp], [%[oldv]] \n" \ + " strexdeq %[ret], %Q[newv], %R[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET), \ + [cmp] "=&r" (cmp), \ + [tmp] "=&r" (tmp) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + static __inline int -atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +atomic_fcmpset_8(volatile uint8_t *_ptr, uint8_t *_old, uint8_t _new) { - uint32_t tmp; - uint32_t _cmpval = *cmpval; int ret; - __asm __volatile( - " mov %0, #1 \n" - " ldrex %1, [%2] \n" - " cmp %1, %3 \n" - " it eq \n" - " strexeq %0, %4, [%2] \n" - : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) - : : "cc", "memory"); - *cmpval = tmp; - return (!ret); + ATOMIC_FCMPSET_CODE(ret, uint8_t, "b"); + return (ret); } static __inline int -atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +atomic_fcmpset_acq_8(volatile uint8_t *_ptr, uint8_t *_old, uint8_t _new) { - uint64_t tmp; - uint64_t _cmpval = *cmpval; int ret; - __asm __volatile( - "1: mov %[ret], #1 \n" - " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" - " teq %Q[tmp], %Q[_cmpval] \n" - " ite eq \n" - " teqeq %R[tmp], %R[_cmpval] \n" - " bne 2f \n" - " strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n" - "2: \n" - : [ret] "=&r" (ret), - [tmp] "=&r" (tmp) - : [ptr] "r" (p), - [_cmpval] "r" (_cmpval), - [newval] "r" (newval) - : "cc", "memory"); - *cmpval = tmp; - return (!ret); + ATOMIC_FCMPSET_CODE(ret, uint8_t, "b"); + dmb(); + return (ret); } static __inline int -atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval) +atomic_fcmpset_rel_8(volatile uint8_t *_ptr, uint8_t *_old, uint8_t _new) { + int ret; - return (atomic_fcmpset_32((volatile uint32_t *)p, - (uint32_t *)cmpval, newval)); + dmb(); + ATOMIC_FCMPSET_CODE(ret, uint8_t, "b"); + return (ret); } static __inline int -atomic_fcmpset_acq_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +atomic_fcmpset_16(volatile uint16_t *_ptr, uint16_t *_old, uint16_t _new) { int ret; - ret = atomic_fcmpset_64(p, cmpval, newval); + ATOMIC_FCMPSET_CODE(ret, uint16_t, "h"); + return (ret); +} + +static __inline int +atomic_fcmpset_acq_16(volatile uint16_t *_ptr, uint16_t *_old, uint16_t _new) +{ + int ret; + + ATOMIC_FCMPSET_CODE(ret, uint16_t, "h"); dmb(); return (ret); } static __inline int -atomic_fcmpset_acq_long(volatile u_long *p, u_long *cmpval, u_long newval) +atomic_fcmpset_rel_16(volatile uint16_t *_ptr, uint16_t *_old, uint16_t _new) { int ret; - ret = atomic_fcmpset_long(p, cmpval, newval); dmb(); + ATOMIC_FCMPSET_CODE(ret, uint16_t, "h"); return (ret); } static __inline int -atomic_fcmpset_acq_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +atomic_fcmpset_32(volatile uint32_t *_ptr, uint32_t *_old, uint32_t _new) { + int ret; + ATOMIC_FCMPSET_CODE(ret, uint32_t, ""); + return (ret); +} + +static __inline int +atomic_fcmpset_acq_32(volatile uint32_t *_ptr, uint32_t *_old, uint32_t _new) +{ int ret; - ret = atomic_fcmpset_32(p, cmpval, newval); + ATOMIC_FCMPSET_CODE(ret, uint32_t, ""); dmb(); return (ret); } static __inline int -atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +atomic_fcmpset_rel_32(volatile uint32_t *_ptr, uint32_t *_old, uint32_t _new) { + int ret; dmb(); - return (atomic_fcmpset_32(p, cmpval, newval)); + ATOMIC_FCMPSET_CODE(ret, uint32_t, ""); + return (ret); } static __inline int -atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +atomic_fcmpset_long(volatile long *_ptr, long *_old, long _new) { + int ret; + ATOMIC_FCMPSET_CODE(ret, long, ""); + return (ret); +} + +static __inline int +atomic_fcmpset_acq_long(volatile long *_ptr, long *_old, long _new) +{ + int ret; + + ATOMIC_FCMPSET_CODE(ret, long, ""); dmb(); - return (atomic_fcmpset_64(p, cmpval, newval)); + return (ret); } static __inline int -atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval) +atomic_fcmpset_rel_long(volatile long *_ptr, long *_old, long _new) { + int ret; dmb(); - return (atomic_fcmpset_long(p, cmpval, newval)); + ATOMIC_FCMPSET_CODE(ret, long, ""); + return (ret); } static __inline int -atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) +atomic_fcmpset_64(volatile uint64_t *_ptr, uint64_t *_old, uint64_t _new) { int ret; - __asm __volatile( - "1: ldrex %0, [%1] \n" - " cmp %0, %2 \n" - " itt ne \n" - " movne %0, #0 \n" - " bne 2f \n" - " strex %0, %3, [%1] \n" - " cmp %0, #0 \n" - " ite eq \n" - " moveq %0, #1 \n" - " bne 1b \n" - "2:" - : "=&r" (ret), "+r" (p), "+r" (cmpval), "+r" (newval) - : : "cc", "memory"); + ATOMIC_FCMPSET_CODE64(ret); return (ret); } static __inline int -atomic_cmpset_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +atomic_fcmpset_acq_64(volatile uint64_t *_ptr, uint64_t *_old, uint64_t _new) { - uint64_t tmp; - uint32_t ret; + int ret; - __asm __volatile( - "1: \n" - " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" - " teq %Q[tmp], %Q[cmpval] \n" - " itee eq \n" - " teqeq %R[tmp], %R[cmpval] \n" - " movne %[ret], #0 \n" - " bne 2f \n" - " strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n" - " teq %[ret], #0 \n" - " it ne \n" - " bne 1b \n" - " mov %[ret], #1 \n" - "2: \n" - : [ret] "=&r" (ret), - [tmp] "=&r" (tmp) - : [ptr] "r" (p), - [cmpval] "r" (cmpval), - [newval] "r" (newval) - : "cc", "memory"); + ATOMIC_FCMPSET_CODE64(ret); + dmb(); return (ret); } static __inline int -atomic_cmpset_long(volatile u_long *p, u_long cmpval, u_long newval) +atomic_fcmpset_rel_64(volatile uint64_t *_ptr, uint64_t *_old, uint64_t _new) { + int ret; - return (atomic_cmpset_32((volatile uint32_t *)p, cmpval, newval)); + dmb(); + ATOMIC_FCMPSET_CODE64(ret); + return (ret); } +#define ATOMIC_CMPSET_CODE(RET, SUF) \ + { \ + __asm __volatile( \ + "1: ldrex" SUF " %[ret], [%[ptr]] \n" \ + " teq %[ret], %[oldv] \n" \ + " itee ne \n" \ + " movne %[ret], #0 \n" \ + " strex" SUF "eq %[ret], %[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + +#define ATOMIC_CMPSET_CODE64(RET) \ + { \ + uint64_t tmp; \ + \ + __asm __volatile( \ + "1: ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" \ + " teq %Q[tmp], %Q[oldv] \n" \ + " it eq \n" \ + " teqeq %R[tmp], %R[oldv] \n" \ + " itee ne \n" \ + " movne %[ret], #0 \n" \ + " strexdeq %[ret], %Q[newv], %R[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET), \ + [tmp] "=&r" (tmp) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + static __inline int -atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) +atomic_cmpset_8(volatile uint8_t *_ptr, uint8_t _old, uint8_t _new) { int ret; - ret = atomic_cmpset_32(p, cmpval, newval); + ATOMIC_CMPSET_CODE(ret, "b"); + return (ret); +} + +static __inline int +atomic_cmpset_acq_8(volatile uint8_t *_ptr, uint8_t _old, uint8_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, "b"); dmb(); return (ret); } static __inline int -atomic_cmpset_acq_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +atomic_cmpset_rel_8(volatile uint8_t *_ptr, uint8_t _old, uint8_t _new) { int ret; - ret = atomic_cmpset_64(p, cmpval, newval); dmb(); + ATOMIC_CMPSET_CODE(ret, "b"); return (ret); } static __inline int -atomic_cmpset_acq_long(volatile u_long *p, u_long cmpval, u_long newval) +atomic_cmpset_16(volatile uint16_t *_ptr, uint16_t _old, uint16_t _new) { int ret; - ret = atomic_cmpset_long(p, cmpval, newval); + ATOMIC_CMPSET_CODE(ret, "h"); + return (ret); +} + +static __inline int +atomic_cmpset_acq_16(volatile uint16_t *_ptr, uint16_t _old, uint16_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, "h"); dmb(); return (ret); } static __inline int -atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) +atomic_cmpset_rel_16(volatile uint16_t *_ptr, uint16_t _old, uint16_t _new) { + int ret; dmb(); - return (atomic_cmpset_32(p, cmpval, newval)); + ATOMIC_CMPSET_CODE(ret, "h"); + return (ret); } static __inline int -atomic_cmpset_rel_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +atomic_cmpset_32(volatile uint32_t *_ptr, uint32_t _old, uint32_t _new) { + int ret; + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_acq_32(volatile uint32_t *_ptr, uint32_t _old, uint32_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, ""); dmb(); - return (atomic_cmpset_64(p, cmpval, newval)); + return (ret); } static __inline int -atomic_cmpset_rel_long(volatile u_long *p, u_long cmpval, u_long newval) +atomic_cmpset_rel_32(volatile uint32_t *_ptr, uint32_t _old, uint32_t _new) { + int ret; dmb(); - return (atomic_cmpset_long(p, cmpval, newval)); + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_long(volatile long *_ptr, long _old, long _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_acq_long(volatile long *_ptr, long _old, long _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, ""); + dmb(); + return (ret); +} + +static __inline int +atomic_cmpset_rel_long(volatile long *_ptr, long _old, long _new) +{ + int ret; + + dmb(); + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_64(volatile uint64_t *_ptr, uint64_t _old, uint64_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE64(ret); + return (ret); +} + +static __inline int +atomic_cmpset_acq_64(volatile uint64_t *_ptr, uint64_t _old, uint64_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE64(ret); + dmb(); + return (ret); +} + +static __inline int +atomic_cmpset_rel_64(volatile uint64_t *_ptr, uint64_t _old, uint64_t _new) +{ + int ret; + + dmb(); + ATOMIC_CMPSET_CODE64(ret); + return (ret); } static __inline uint32_t From owner-svn-src-stable@freebsd.org Sat Dec 7 17:44:22 2019 Return-Path: Delivered-To: svn-src-stable@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 7234E1C804F; Sat, 7 Dec 2019 17:44:22 +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 47VcK22NT6z42Pf; Sat, 7 Dec 2019 17:44:22 +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 1AB101D61F; Sat, 7 Dec 2019 17:44:22 +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 xB7HiLx0035737; Sat, 7 Dec 2019 17:44:21 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HiLrO035736; Sat, 7 Dec 2019 17:44:21 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071744.xB7HiLrO035736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:44:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355497 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 355497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:44:22 -0000 Author: ian Date: Sat Dec 7 17:44:21 2019 New Revision: 355497 URL: https://svnweb.freebsd.org/changeset/base/355497 Log: MFC r354973: Rewrite iicdev_writeto() to use a single buffer and a single iic_msg, rather than effectively doing scatter/gather IO with a pair of iic_msgs that direct the controller to do a single transfer with no bus STOP/START between the two buffers. It turns out we have multiple i2c hardware drivers that don't honor the NOSTOP and NOSTART flags; sometimes they just try to do the transfers anyway, creating confusing failures or leading to corrupted data. Modified: stable/12/sys/dev/iicbus/iiconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:34:04 2019 (r355496) +++ stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:44:21 2019 (r355497) @@ -540,25 +540,47 @@ iicdev_readfrom(device_t slavedev, uint8_t regaddr, vo int iicdev_writeto(device_t slavedev, uint8_t regaddr, void *buffer, uint16_t buflen, int waithow) { - struct iic_msg msgs[2]; - uint8_t slaveaddr; + struct iic_msg msg; + uint8_t local_buffer[32]; + uint8_t *bufptr; + size_t bufsize; + int error; /* - * Two transfers back to back with no stop or start between them; first - * we write the address then we write the data to that address, all in a - * single transfer from two scattered buffers. + * Ideally, we would do two transfers back to back with no stop or start + * between them using an array of 2 iic_msgs; first we'd write the + * address byte using the IIC_M_NOSTOP flag, then we write the data + * using IIC_M_NOSTART, all in a single transfer. Unfortunately, + * several i2c hardware drivers don't support that (perhaps because the + * hardware itself can't support it). So instead we gather the + * scattered bytes into a single buffer here before writing them using a + * single iic_msg. This function is typically used to write a few bytes + * at a time, so we try to use a small local buffer on the stack, but + * fall back to allocating a temporary buffer when necessary. */ - slaveaddr = iicbus_get_addr(slavedev); - msgs[0].slave = slaveaddr; - msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; - msgs[0].len = 1; - msgs[0].buf = ®addr; + bufsize = buflen + 1; + if (bufsize <= sizeof(local_buffer)) { + bufptr = local_buffer; + } else { + bufptr = malloc(bufsize, M_DEVBUF, + (waithow & IIC_WAIT) ? M_WAITOK : M_NOWAIT); + if (bufptr == NULL) + return (errno2iic(ENOMEM)); + } - msgs[1].slave = slaveaddr; - msgs[1].flags = IIC_M_WR | IIC_M_NOSTART; - msgs[1].len = buflen; - msgs[1].buf = buffer; + bufptr[0] = regaddr; + memcpy(&bufptr[1], buffer, buflen); - return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); + msg.slave = iicbus_get_addr(slavedev); + msg.flags = IIC_M_WR; + msg.len = bufsize; + msg.buf = bufptr; + + error = iicbus_transfer_excl(slavedev, &msg, 1, waithow); + + if (bufptr != local_buffer) + free(bufptr, M_DEVBUF); + + return (error); } From owner-svn-src-stable@freebsd.org Sat Dec 7 17:46:33 2019 Return-Path: Delivered-To: svn-src-stable@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 12DFE1C8200; Sat, 7 Dec 2019 17:46:33 +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 47VcMX6kjlz42d6; Sat, 7 Dec 2019 17:46:32 +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 CAC961D623; Sat, 7 Dec 2019 17:46:32 +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 xB7HkWWb035880; Sat, 7 Dec 2019 17:46:32 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HkW7t035879; Sat, 7 Dec 2019 17:46:32 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071746.xB7HkW7t035879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355498 - stable/12/sys/arm/freescale/imx X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/arm/freescale/imx X-SVN-Commit-Revision: 355498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:46:33 -0000 Author: ian Date: Sat Dec 7 17:46:32 2019 New Revision: 355498 URL: https://svnweb.freebsd.org/changeset/base/355498 Log: MFC r355193: Implement the ofw_bus_get_node method in the imx_gpio driver so that ofw_gpiobus can find its fdt metadata and instantiate child devices. Modified: stable/12/sys/arm/freescale/imx/imx_gpio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- stable/12/sys/arm/freescale/imx/imx_gpio.c Sat Dec 7 17:44:21 2019 (r355497) +++ stable/12/sys/arm/freescale/imx/imx_gpio.c Sat Dec 7 17:46:32 2019 (r355498) @@ -865,6 +865,15 @@ imx51_gpio_detach(device_t dev) return(0); } +static phandle_t +imx51_gpio_get_node(device_t bus, device_t dev) +{ + /* + * Share controller node with gpiobus device + */ + return ofw_bus_get_node(bus); +} + static device_method_t imx51_gpio_methods[] = { DEVMETHOD(device_probe, imx51_gpio_probe), DEVMETHOD(device_attach, imx51_gpio_attach), @@ -881,6 +890,9 @@ static device_method_t imx51_gpio_methods[] = { DEVMETHOD(pic_post_ithread, gpio_pic_post_ithread), DEVMETHOD(pic_pre_ithread, gpio_pic_pre_ithread), #endif + + /* OFW methods */ + DEVMETHOD(ofw_bus_get_node, imx51_gpio_get_node), /* GPIO protocol */ DEVMETHOD(gpio_get_bus, imx51_gpio_get_bus), From owner-svn-src-stable@freebsd.org Sat Dec 7 19:02:11 2019 Return-Path: Delivered-To: svn-src-stable@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 A50E01CA12C; Sat, 7 Dec 2019 19:02:11 +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 47Vf2q4k6Lz46wS; Sat, 7 Dec 2019 19:02:11 +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 869301E497; Sat, 7 Dec 2019 19:02:11 +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 xB7J2BbX083962; Sat, 7 Dec 2019 19:02:11 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7J29qo083948; Sat, 7 Dec 2019 19:02:09 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912071902.xB7J29qo083948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 7 Dec 2019 19:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355503 - in stable/12: contrib/less usr.bin/less X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/less usr.bin/less X-SVN-Commit-Revision: 355503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 19:02:11 -0000 Author: delphij Date: Sat Dec 7 19:02:09 2019 New Revision: 355503 URL: https://svnweb.freebsd.org/changeset/base/355503 Log: MFC r349549: MFV r349535: less v551. Relnotes: yes Modified: stable/12/contrib/less/LICENSE stable/12/contrib/less/NEWS stable/12/contrib/less/README stable/12/contrib/less/brac.c stable/12/contrib/less/ch.c stable/12/contrib/less/charset.c stable/12/contrib/less/charset.h stable/12/contrib/less/cmd.h stable/12/contrib/less/cmdbuf.c stable/12/contrib/less/command.c stable/12/contrib/less/compose.uni stable/12/contrib/less/cvt.c stable/12/contrib/less/decode.c stable/12/contrib/less/edit.c stable/12/contrib/less/filename.c stable/12/contrib/less/fmt.uni stable/12/contrib/less/forwback.c stable/12/contrib/less/funcs.h stable/12/contrib/less/help.c stable/12/contrib/less/ifile.c stable/12/contrib/less/input.c stable/12/contrib/less/jump.c stable/12/contrib/less/less.h stable/12/contrib/less/less.hlp stable/12/contrib/less/less.nro stable/12/contrib/less/lessecho.c stable/12/contrib/less/lessecho.nro stable/12/contrib/less/lesskey.c stable/12/contrib/less/lesskey.h stable/12/contrib/less/lesskey.nro stable/12/contrib/less/lglob.h stable/12/contrib/less/line.c stable/12/contrib/less/linenum.c stable/12/contrib/less/lsystem.c stable/12/contrib/less/main.c stable/12/contrib/less/mark.c stable/12/contrib/less/mkutable stable/12/contrib/less/optfunc.c stable/12/contrib/less/option.c stable/12/contrib/less/option.h stable/12/contrib/less/opttbl.c stable/12/contrib/less/os.c stable/12/contrib/less/output.c stable/12/contrib/less/pattern.c stable/12/contrib/less/pattern.h stable/12/contrib/less/pckeys.h stable/12/contrib/less/position.c stable/12/contrib/less/position.h stable/12/contrib/less/prompt.c stable/12/contrib/less/screen.c stable/12/contrib/less/scrsize.c stable/12/contrib/less/search.c stable/12/contrib/less/signal.c stable/12/contrib/less/tags.c stable/12/contrib/less/ttyin.c stable/12/contrib/less/ubin.uni stable/12/contrib/less/version.c stable/12/contrib/less/wide.uni stable/12/usr.bin/less/defines.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/less/LICENSE ============================================================================== --- stable/12/contrib/less/LICENSE Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/LICENSE Sat Dec 7 19:02:09 2019 (r355503) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2016 Mark Nudelman +Copyright (C) 1984-2018 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: stable/12/contrib/less/NEWS ============================================================================== --- stable/12/contrib/less/NEWS Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/NEWS Sat Dec 7 19:02:09 2019 (r355503) @@ -11,6 +11,38 @@ ====================================================================== + Major changes between "less" versions 530 and 551 + +* Add --mouse option. + +* Add --wheel-lines option. + +* Add --no-histdups option. + +* Add --save-marks option. + +* Support PCRE2 regular expression library. + +* Redraw screen on SIGWINCH even if screen size doesn't change. + +* Shell-escape filenames in history so they can be used again. + +* Ring bell if user enters invalid long option name. + +* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode. + +* Windows: use wide-char string to set console title. + +* Don't count lines in initial screen if using -X with -F. + +* Support mingw build system. + +* Fix bug in v command on empty file. + +* Fix bug in v command when filename contains shell metacharacters. + +====================================================================== + Major changes between "less" versions 487 and 530 * Don't output terminal init sequence if using -F and file fits on one screen. Modified: stable/12/contrib/less/README ============================================================================== --- stable/12/contrib/less/README Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/README Sat Dec 7 19:02:09 2019 (r355503) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 530 + Less, version 551 - This is the distribution of less, version 530, released 05 Dec 2017. + This is the distribution of less, version 551, released 11 Jun 2019. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -56,6 +56,7 @@ INSTALLATION (Unix systems only): finds a regular expression library automatically. Other values are: gnu Use the GNU regex library. pcre Use the PCRE library. + pcre2 Use the PCRE2 library. posix Use the POSIX-compatible regcomp. regcmp Use the regcmp library. re_comp Use the re_comp library. @@ -63,6 +64,7 @@ INSTALLATION (Unix systems only): regcomp-local Use Henry Spencer's V8-compatible regcomp (source is supplied with less). none No regular expressions, only simple string matching. + --with-secure Builds a "secure" version of less, with some features disabled to prevent users from viewing other files, accessing shell Modified: stable/12/contrib/less/brac.c ============================================================================== --- stable/12/contrib/less/brac.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/brac.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/ch.c ============================================================================== --- stable/12/contrib/less/ch.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/ch.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,7 +144,7 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get() +ch_get(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -392,7 +392,7 @@ ch_ungetchar(c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile() +end_logfile(VOID_PARAM) { static int tried = FALSE; @@ -417,7 +417,7 @@ end_logfile() * Write all the existing buffered data to the log file. */ public void -sync_logfile() +sync_logfile(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -515,7 +515,7 @@ ch_seek(pos) * Seek to the end of the file. */ public int -ch_end_seek() +ch_end_seek(VOID_PARAM) { POSITION len; @@ -542,7 +542,7 @@ ch_end_seek() * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek() +ch_end_buffer_seek(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -570,7 +570,7 @@ ch_end_buffer_seek() * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek() +ch_beg_seek(VOID_PARAM) { struct bufnode *bn; struct bufnode *firstbn; @@ -602,7 +602,7 @@ ch_beg_seek() * Return the length of the file, if known. */ public POSITION -ch_length() +ch_length(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -619,7 +619,7 @@ ch_length() * Return the current position in the file. */ public POSITION -ch_tell() +ch_tell(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -630,7 +630,7 @@ ch_tell() * Get the current char and post-increment the read pointer. */ public int -ch_forw_get() +ch_forw_get(VOID_PARAM) { int c; @@ -653,7 +653,7 @@ ch_forw_get() * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get() +ch_back_get(VOID_PARAM) { if (thisfile == NULL) return (EOI); @@ -693,7 +693,7 @@ ch_setbufspace(bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush() +ch_flush(VOID_PARAM) { struct bufnode *bn; @@ -760,7 +760,7 @@ ch_flush() * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf() +ch_addbuf(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -785,7 +785,7 @@ ch_addbuf() * */ static void -init_hashtbl() +init_hashtbl(VOID_PARAM) { int h; @@ -800,7 +800,7 @@ init_hashtbl() * Delete all buffers for this file. */ static void -ch_delbufs() +ch_delbufs(VOID_PARAM) { struct bufnode *bn; @@ -840,7 +840,7 @@ seekable(f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof() +ch_set_eof(VOID_PARAM) { ch_fsize = ch_fpos; } @@ -890,7 +890,7 @@ ch_init(f, flags) * Close a filestate. */ public void -ch_close() +ch_close(VOID_PARAM) { int keepstate = FALSE; @@ -933,7 +933,7 @@ ch_close() * Return ch_flags for the current file. */ public int -ch_getflags() +ch_getflags(VOID_PARAM) { if (thisfile == NULL) return (0); Modified: stable/12/contrib/less/charset.c ============================================================================== --- stable/12/contrib/less/charset.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/charset.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -245,7 +245,7 @@ icharset(name, no_error) * Define a charset, given a locale name. */ static void -ilocale() +ilocale(VOID_PARAM) { int c; @@ -315,7 +315,7 @@ setfmt(s, fmtvarptr, attrptr, default_fmt) * */ static void -set_charset() +set_charset(VOID_PARAM) { char *s; @@ -338,7 +338,7 @@ set_charset() * LESSCHARSET is not defined: try LESSCHARDEF. */ s = lgetenv("LESSCHARDEF"); - if (s != NULL && *s != '\0') + if (!isnullenv(s)) { ichardef(s); return; @@ -395,7 +395,7 @@ set_charset() * Initialize charset data structures. */ public void -init_charset() +init_charset(VOID_PARAM) { char *s; Modified: stable/12/contrib/less/charset.h ============================================================================== --- stable/12/contrib/less/charset.h Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/charset.h Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/cmd.h ============================================================================== --- stable/12/contrib/less/cmd.h Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/cmd.h Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -71,6 +71,13 @@ #define A_RRSHIFT 59 #define A_CLRMARK 62 #define A_SETMARKBOT 63 +#define A_X11MOUSE_IN 64 +#define A_X11MOUSE_IGNORE 65 +#define A_F_MOUSE 66 +#define A_B_MOUSE 67 +/* Note "X116" refers to extended (1006) X11 mouse reporting. */ +#define A_X116MOUSE_IN 68 +#define A_X116MOUSE_IGNORE 69 #define A_INVALID 100 #define A_NOACTION 101 Modified: stable/12/contrib/less/cmdbuf.c ============================================================================== --- stable/12/contrib/less/cmdbuf.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/cmdbuf.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -22,6 +22,8 @@ extern int sc_width; extern int utf_mode; +extern int no_hist_dups; +extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ static int cmd_col; /* Current column of the cursor */ @@ -58,6 +60,7 @@ public char closequote = '"'; #define HISTFILE_FIRST_LINE ".less-history-file:" #define HISTFILE_SEARCH_SECTION ".search" #define HISTFILE_SHELL_SECTION ".shell" +#define HISTFILE_MARK_SECTION ".mark" /* * A mlist structure represents a command history. @@ -114,7 +117,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset() +cmd_reset(VOID_PARAM) { cp = cmdbuf; *cp = '\0'; @@ -129,7 +132,7 @@ cmd_reset() * Clear command line. */ public void -clear_cmd() +clear_cmd(VOID_PARAM) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -169,7 +172,7 @@ cmd_putstr(s) * How many characters are in the command buffer? */ public int -len_cmdbuf() +len_cmdbuf(VOID_PARAM) { char *s = cmdbuf; char *endline = s + strlen(s); @@ -302,7 +305,7 @@ cmd_repaint(old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home() +cmd_home(VOID_PARAM) { while (cmd_col > prompt_col) { @@ -321,7 +324,7 @@ cmd_home() * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift() +cmd_lshift(VOID_PARAM) { char *s; char *save_cp; @@ -359,7 +362,7 @@ cmd_lshift() * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift() +cmd_rshift(VOID_PARAM) { char *s; char *save_cp; @@ -389,7 +392,7 @@ cmd_rshift() * Move cursor right one character. */ static int -cmd_right() +cmd_right(VOID_PARAM) { char *pr; char *ncp; @@ -424,7 +427,7 @@ cmd_right() * Move cursor left one character. */ static int -cmd_left() +cmd_left(VOID_PARAM) { char *ncp; int width = 0; @@ -492,7 +495,7 @@ cmd_ichar(cs, clen) * Delete the char to the left of the cursor. */ static int -cmd_erase() +cmd_erase(VOID_PARAM) { char *s; int clen; @@ -541,7 +544,7 @@ cmd_erase() * Delete the char under the cursor. */ static int -cmd_delete() +cmd_delete(VOID_PARAM) { if (*cp == '\0') { @@ -560,7 +563,7 @@ cmd_delete() * Delete the "word" to the left of the cursor. */ static int -cmd_werase() +cmd_werase(VOID_PARAM) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -586,7 +589,7 @@ cmd_werase() * Delete the "word" under the cursor. */ static int -cmd_wdelete() +cmd_wdelete(VOID_PARAM) { if (*cp == ' ') { @@ -612,7 +615,7 @@ cmd_wdelete() * Delete all chars in the command buffer. */ static int -cmd_kill() +cmd_kill(VOID_PARAM) { if (cmdbuf[0] == '\0') { @@ -702,6 +705,7 @@ cmd_updown(action) s = ml->string; if (s == NULL) s = ""; + cmd_offset = 0; cmd_home(); clear_eol(); strcpy(cmdbuf, s); @@ -719,6 +723,31 @@ cmd_updown(action) #endif /* + * + */ + static void +ml_link(mlist, ml) + struct mlist *mlist; + struct mlist *ml; +{ + ml->next = mlist; + ml->prev = mlist->prev; + mlist->prev->next = ml; + mlist->prev = ml; +} + +/* + * + */ + static void +ml_unlink(ml) + struct mlist *ml; +{ + ml->prev->next = ml->next; + ml->next->prev = ml->prev; +} + +/* * Add a string to an mlist. */ public void @@ -736,6 +765,21 @@ cmd_addhist(mlist, cmd, modified) if (strlen(cmd) == 0) return; + if (no_hist_dups) + { + struct mlist *next = NULL; + for (ml = mlist->next; ml->string != NULL; ml = next) + { + next = ml->next; + if (strcmp(ml->string, cmd) == 0) + { + ml_unlink(ml); + free(ml->string); + free(ml); + } + } + } + /* * Save the command unless it's a duplicate of the * last command in the history. @@ -750,10 +794,7 @@ cmd_addhist(mlist, cmd, modified) ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); ml->string = save(cmd); ml->modified = modified; - ml->next = mlist; - ml->prev = mlist->prev; - mlist->prev->next = ml; - mlist->prev = ml; + ml_link(mlist, ml); } /* * Point to the cmd just after the just-accepted command. @@ -768,13 +809,13 @@ cmd_addhist(mlist, cmd, modified) * Add it to the currently selected history list. */ public void -cmd_accept() +cmd_accept(VOID_PARAM) { #if CMD_HISTORY /* * Nothing to do if there is no currently selected history list. */ - if (curr_mlist == NULL) + if (curr_mlist == NULL || curr_mlist == ml_examine) return; cmd_addhist(curr_mlist, cmdbuf, 1); curr_mlist->modified = 1; @@ -799,7 +840,7 @@ cmd_edit(c) #if TAB_COMPLETE_FILENAME #define not_in_completion() in_completion = 0 #else -#define not_in_completion() +#define not_in_completion(VOID_PARAM) #endif /* @@ -934,7 +975,7 @@ cmd_istr(str) * cursor at the end of the word. */ static char * -delimit_word() +delimit_word(VOID_PARAM) { char *word; #if SPACES_IN_FILENAMES @@ -1021,7 +1062,7 @@ delimit_word() * which start with that word, and set tk_text to that list. */ static void -init_compl() +init_compl(VOID_PARAM) { char *word; char c; @@ -1148,9 +1189,9 @@ cmd_complete(action) tk_trial = next_compl(action, tk_trial); } - /* - * Remove the original word, or the previous trial completion. - */ + /* + * Remove the original word, or the previous trial completion. + */ while (cp > tk_ipoint) (void) cmd_erase(); @@ -1323,7 +1364,7 @@ cmd_int(frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf() +get_cmdbuf(VOID_PARAM) { return (cmdbuf); } @@ -1333,7 +1374,7 @@ get_cmdbuf() * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern() +cmd_lastpattern(VOID_PARAM) { if (curr_mlist == NULL) return (NULL); @@ -1358,7 +1399,7 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name() +histfile_name(VOID_PARAM) { char *home; char *name; @@ -1366,7 +1407,7 @@ histfile_name() /* See if filename is explicitly specified by $LESSHISTFILE. */ name = lgetenv("LESSHISTFILE"); - if (name != NULL && *name != '\0') + if (!isnullenv(name)) { if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0) /* $LESSHISTFILE == "-" means don't use a history file. */ @@ -1380,11 +1421,11 @@ histfile_name() /* Otherwise, file is in $HOME. */ home = lgetenv("HOME"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) { #if OS2 home = lgetenv("INIT"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) #endif return (NULL); } @@ -1447,6 +1488,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) ml = NULL; skip = NULL; #endif + } else if (strcmp(line, HISTFILE_MARK_SECTION) == 0) + { + ml = NULL; } else if (*line == '"') { if (ml != NULL) @@ -1456,6 +1500,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) else (*action)(uparam, ml, line+1); } + } else if (*line == 'm') + { + (*action)(uparam, NULL, line); } } fclose(f); @@ -1475,9 +1522,10 @@ read_cmdhist(action, uparam, skip_search, skip_shell) static void addhist_init(void *uparam, struct mlist *ml, char *string) { - if (ml == NULL || string == NULL) - return; - cmd_addhist(ml, string, 0); + if (ml != NULL) + cmd_addhist(ml, string, 0); + else if (string != NULL) + restore_mark(string); } #endif /* CMD_HISTORY */ @@ -1485,7 +1533,7 @@ addhist_init(void *uparam, struct mlist *ml, char *str * Initialize history from a .lesshist file. */ public void -init_cmdhist() +init_cmdhist(VOID_PARAM) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1558,7 +1606,7 @@ copy_hist(void *uparam, struct mlist *ml, char *string { struct save_ctx *ctx = (struct save_ctx *) uparam; - if (ml != ctx->mlist) { + if (ml != NULL && ml != ctx->mlist) { /* We're changing mlists. */ if (ctx->mlist) /* Append any new entries to the end of the current mlist. */ @@ -1567,13 +1615,9 @@ copy_hist(void *uparam, struct mlist *ml, char *string ctx->mlist = ml; write_mlist_header(ctx->mlist, ctx->fout); } - if (string != NULL) + + if (string == NULL) /* End of file */ { - /* Copy the entry. */ - fprintf(ctx->fout, "\"%s\n", string); - } - if (ml == NULL) /* End of file */ - { /* Write any sections that were not in the original file. */ if (mlist_search.modified) { @@ -1587,7 +1631,12 @@ copy_hist(void *uparam, struct mlist *ml, char *string write_mlist(&mlist_shell, ctx->fout); } #endif + } else if (ml != NULL) + { + /* Copy mlist entry. */ + fprintf(ctx->fout, "\"%s\n", string); } + /* Skip marks */ } #endif /* CMD_HISTORY */ @@ -1616,7 +1665,7 @@ make_file_private(f) * Does the history file need to be updated? */ static int -histfile_modified() +histfile_modified(VOID_PARAM) { if (mlist_search.modified) return 1; @@ -1624,6 +1673,10 @@ histfile_modified() if (mlist_shell.modified) return 1; #endif +#if CMD_HISTORY + if (marks_modified) + return 1; +#endif return 0; } @@ -1631,7 +1684,7 @@ histfile_modified() * Update the .lesshst file. */ public void -save_cmdhist() +save_cmdhist(VOID_PARAM) { #if CMD_HISTORY char *histname; @@ -1665,7 +1718,8 @@ save_cmdhist() fprintf(fout, "%s\n", HISTFILE_FIRST_LINE); ctx.fout = fout; ctx.mlist = NULL; - read_cmdhist(copy_hist, &ctx, skip_search, skip_shell); + read_cmdhist(©_hist, &ctx, skip_search, skip_shell); + save_marks(fout, HISTFILE_MARK_SECTION); fclose(fout); #if MSDOS_COMPILER==WIN32C /* Modified: stable/12/contrib/less/command.c ============================================================================== --- stable/12/contrib/less/command.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/command.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -49,6 +49,7 @@ extern struct scrpos initial_scrpos; extern IFILE curr_ifile; extern void *ml_search; extern void *ml_examine; +extern int wheel_lines; #if SHELL_ESCAPE || PIPEC extern void *ml_shell; #endif @@ -60,6 +61,9 @@ extern int screen_trashed; /* The screen has been over extern int shift_count; extern int oldbot; extern int forw_prompt; +#if MSDOS_COMPILER==WIN32C +extern int utf_mode; +#endif #if SHELL_ESCAPE static char *shellcmd = NULL; /* For holding last shell command for "!!" */ @@ -94,14 +98,39 @@ static void multi_search(); * updating the screen. */ static void -cmd_exec() +cmd_exec(VOID_PARAM) { - clear_attn(); + clear_attn(); clear_bot(); flush(); } /* + * Indicate we are reading a multi-character command. + */ + static void +set_mca(action) + int action; +{ + mca = action; + deinit_mouse(); /* we don't want mouse events while entering a cmd */ + clear_bot(); + clear_cmd(); +} + +/* + * Indicate we are not reading a multi-character command. + */ + static void +clear_mca(VOID_PARAM) +{ + if (mca == 0) + return; + mca = 0; + init_mouse(); +} + +/* * Set up the display to start a new multi-character command. */ static void @@ -111,15 +140,13 @@ start_mca(action, prompt, mlist, cmdflags) void *mlist; int cmdflags; { - mca = action; - clear_bot(); - clear_cmd(); + set_mca(action); cmd_putstr(prompt); set_mlist(mlist, cmdflags); } public int -in_mca() +in_mca(VOID_PARAM) { return (mca != 0 && mca != A_PREFIX); } @@ -128,21 +155,18 @@ in_mca() * Set up the display to start a new search command. */ static void -mca_search() +mca_search(VOID_PARAM) { #if HILITE_SEARCH if (search_type & SRCH_FILTER) - mca = A_FILTER; + set_mca(A_FILTER); else #endif if (search_type & SRCH_FORW) - mca = A_F_SEARCH; + set_mca(A_F_SEARCH); else - mca = A_B_SEARCH; + set_mca(A_B_SEARCH); - clear_bot(); - clear_cmd(); - if (search_type & SRCH_NO_MATCH) cmd_putstr("Non-match "); if (search_type & SRCH_FIRST_FILE) @@ -171,7 +195,7 @@ mca_search() * Set up the display to start a new toggle-option command. */ static void -mca_opt_toggle() +mca_opt_toggle(VOID_PARAM) { int no_prompt; int flag; @@ -181,9 +205,7 @@ mca_opt_toggle() flag = (optflag & ~OPT_NO_PROMPT); dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; - mca = A_OPT_TOGGLE; - clear_bot(); - clear_cmd(); + set_mca(A_OPT_TOGGLE); cmd_putstr(dash); if (optgetname) cmd_putstr(dash); @@ -206,7 +228,7 @@ mca_opt_toggle() * Execute a multicharacter command. */ static void -exec_mca() +exec_mca(VOID_PARAM) { char *cbuf; @@ -373,6 +395,7 @@ mca_opt_nonfirst_char(c) { char *p; char *oname; + int err; if (curropt != NULL) { @@ -392,7 +415,8 @@ mca_opt_nonfirst_char(c) return (MCA_DONE); p = get_cmdbuf(); opt_lower = ASCII_IS_LOWER(p[0]); - curropt = findopt_name(&p, &oname, NULL); + err = 0; + curropt = findopt_name(&p, &oname, &err); if (curropt != NULL) { /* @@ -410,6 +434,9 @@ mca_opt_nonfirst_char(c) if (cmd_char(c) != CC_OK) return (MCA_DONE); } + } else if (err != OPT_AMBIG) + { + bell(); } return (MCA_MORE); } @@ -461,6 +488,7 @@ mca_opt_char(c) error("There is no %s option", &parg); return (MCA_DONE); } + opt_lower = ASCII_IS_LOWER(c); } /* * If the option which was entered does not take a @@ -470,7 +498,7 @@ mca_opt_char(c) if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || !opt_has_param(curropt)) { - toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag); + toggle_option(curropt, opt_lower, "", optflag); return (MCA_DONE); } /* @@ -577,7 +605,7 @@ mca_char(c) * as a normal command character. */ number = cmd_int(&fraction); - mca = 0; + clear_mca(); cmd_accept(); return (NO_MCA); } @@ -644,7 +672,7 @@ mca_char(c) * Discard any buffered file data. */ static void -clear_buffers() +clear_buffers(VOID_PARAM) { if (!(ch_getflags() & CH_CANSEEK)) return; @@ -659,7 +687,7 @@ clear_buffers() * Make sure the screen is displayed. */ static void -make_display() +make_display(VOID_PARAM) { /* * If nothing is displayed yet, display starting from initial_scrpos. @@ -699,7 +727,7 @@ make_display() * Display the appropriate prompt. */ static void -prompt() +prompt(VOID_PARAM) { constant char *p; @@ -739,8 +767,14 @@ prompt() * In Win32, display the file name in the window title. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Dec 7 19:05:51 2019 Return-Path: Delivered-To: svn-src-stable@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 679881CA2FE; Sat, 7 Dec 2019 19:05:51 +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 47Vf732qpfz4784; Sat, 7 Dec 2019 19:05:51 +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 257361E4B7; Sat, 7 Dec 2019 19:05:51 +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 xB7J5plb084184; Sat, 7 Dec 2019 19:05:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7J5ntu084172; Sat, 7 Dec 2019 19:05:49 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912071905.xB7J5ntu084172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 7 Dec 2019 19:05:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355504 - in stable/11: contrib/less usr.bin/less X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: contrib/less usr.bin/less X-SVN-Commit-Revision: 355504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 19:05:51 -0000 Author: delphij Date: Sat Dec 7 19:05:48 2019 New Revision: 355504 URL: https://svnweb.freebsd.org/changeset/base/355504 Log: MFC r349549: MFV r349535: less v551. Relnotes: yes Modified: stable/11/contrib/less/LICENSE stable/11/contrib/less/NEWS stable/11/contrib/less/README stable/11/contrib/less/brac.c stable/11/contrib/less/ch.c stable/11/contrib/less/charset.c stable/11/contrib/less/charset.h stable/11/contrib/less/cmd.h stable/11/contrib/less/cmdbuf.c stable/11/contrib/less/command.c stable/11/contrib/less/compose.uni stable/11/contrib/less/cvt.c stable/11/contrib/less/decode.c stable/11/contrib/less/edit.c stable/11/contrib/less/filename.c stable/11/contrib/less/fmt.uni stable/11/contrib/less/forwback.c stable/11/contrib/less/funcs.h stable/11/contrib/less/help.c stable/11/contrib/less/ifile.c stable/11/contrib/less/input.c stable/11/contrib/less/jump.c stable/11/contrib/less/less.h stable/11/contrib/less/less.hlp stable/11/contrib/less/less.nro stable/11/contrib/less/lessecho.c stable/11/contrib/less/lessecho.nro stable/11/contrib/less/lesskey.c stable/11/contrib/less/lesskey.h stable/11/contrib/less/lesskey.nro stable/11/contrib/less/lglob.h stable/11/contrib/less/line.c stable/11/contrib/less/linenum.c stable/11/contrib/less/lsystem.c stable/11/contrib/less/main.c stable/11/contrib/less/mark.c stable/11/contrib/less/mkutable stable/11/contrib/less/optfunc.c stable/11/contrib/less/option.c stable/11/contrib/less/option.h stable/11/contrib/less/opttbl.c stable/11/contrib/less/os.c stable/11/contrib/less/output.c stable/11/contrib/less/pattern.c stable/11/contrib/less/pattern.h stable/11/contrib/less/pckeys.h stable/11/contrib/less/position.c stable/11/contrib/less/position.h stable/11/contrib/less/prompt.c stable/11/contrib/less/screen.c stable/11/contrib/less/scrsize.c stable/11/contrib/less/search.c stable/11/contrib/less/signal.c stable/11/contrib/less/tags.c stable/11/contrib/less/ttyin.c stable/11/contrib/less/ubin.uni stable/11/contrib/less/version.c stable/11/contrib/less/wide.uni stable/11/usr.bin/less/defines.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/less/LICENSE ============================================================================== --- stable/11/contrib/less/LICENSE Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/LICENSE Sat Dec 7 19:05:48 2019 (r355504) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2016 Mark Nudelman +Copyright (C) 1984-2018 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: stable/11/contrib/less/NEWS ============================================================================== --- stable/11/contrib/less/NEWS Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/NEWS Sat Dec 7 19:05:48 2019 (r355504) @@ -11,6 +11,38 @@ ====================================================================== + Major changes between "less" versions 530 and 551 + +* Add --mouse option. + +* Add --wheel-lines option. + +* Add --no-histdups option. + +* Add --save-marks option. + +* Support PCRE2 regular expression library. + +* Redraw screen on SIGWINCH even if screen size doesn't change. + +* Shell-escape filenames in history so they can be used again. + +* Ring bell if user enters invalid long option name. + +* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode. + +* Windows: use wide-char string to set console title. + +* Don't count lines in initial screen if using -X with -F. + +* Support mingw build system. + +* Fix bug in v command on empty file. + +* Fix bug in v command when filename contains shell metacharacters. + +====================================================================== + Major changes between "less" versions 487 and 530 * Don't output terminal init sequence if using -F and file fits on one screen. Modified: stable/11/contrib/less/README ============================================================================== --- stable/11/contrib/less/README Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/README Sat Dec 7 19:05:48 2019 (r355504) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 530 + Less, version 551 - This is the distribution of less, version 530, released 05 Dec 2017. + This is the distribution of less, version 551, released 11 Jun 2019. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -56,6 +56,7 @@ INSTALLATION (Unix systems only): finds a regular expression library automatically. Other values are: gnu Use the GNU regex library. pcre Use the PCRE library. + pcre2 Use the PCRE2 library. posix Use the POSIX-compatible regcomp. regcmp Use the regcmp library. re_comp Use the re_comp library. @@ -63,6 +64,7 @@ INSTALLATION (Unix systems only): regcomp-local Use Henry Spencer's V8-compatible regcomp (source is supplied with less). none No regular expressions, only simple string matching. + --with-secure Builds a "secure" version of less, with some features disabled to prevent users from viewing other files, accessing shell Modified: stable/11/contrib/less/brac.c ============================================================================== --- stable/11/contrib/less/brac.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/brac.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/ch.c ============================================================================== --- stable/11/contrib/less/ch.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/ch.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,7 +144,7 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get() +ch_get(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -392,7 +392,7 @@ ch_ungetchar(c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile() +end_logfile(VOID_PARAM) { static int tried = FALSE; @@ -417,7 +417,7 @@ end_logfile() * Write all the existing buffered data to the log file. */ public void -sync_logfile() +sync_logfile(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -515,7 +515,7 @@ ch_seek(pos) * Seek to the end of the file. */ public int -ch_end_seek() +ch_end_seek(VOID_PARAM) { POSITION len; @@ -542,7 +542,7 @@ ch_end_seek() * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek() +ch_end_buffer_seek(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -570,7 +570,7 @@ ch_end_buffer_seek() * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek() +ch_beg_seek(VOID_PARAM) { struct bufnode *bn; struct bufnode *firstbn; @@ -602,7 +602,7 @@ ch_beg_seek() * Return the length of the file, if known. */ public POSITION -ch_length() +ch_length(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -619,7 +619,7 @@ ch_length() * Return the current position in the file. */ public POSITION -ch_tell() +ch_tell(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -630,7 +630,7 @@ ch_tell() * Get the current char and post-increment the read pointer. */ public int -ch_forw_get() +ch_forw_get(VOID_PARAM) { int c; @@ -653,7 +653,7 @@ ch_forw_get() * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get() +ch_back_get(VOID_PARAM) { if (thisfile == NULL) return (EOI); @@ -693,7 +693,7 @@ ch_setbufspace(bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush() +ch_flush(VOID_PARAM) { struct bufnode *bn; @@ -760,7 +760,7 @@ ch_flush() * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf() +ch_addbuf(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -785,7 +785,7 @@ ch_addbuf() * */ static void -init_hashtbl() +init_hashtbl(VOID_PARAM) { int h; @@ -800,7 +800,7 @@ init_hashtbl() * Delete all buffers for this file. */ static void -ch_delbufs() +ch_delbufs(VOID_PARAM) { struct bufnode *bn; @@ -840,7 +840,7 @@ seekable(f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof() +ch_set_eof(VOID_PARAM) { ch_fsize = ch_fpos; } @@ -890,7 +890,7 @@ ch_init(f, flags) * Close a filestate. */ public void -ch_close() +ch_close(VOID_PARAM) { int keepstate = FALSE; @@ -933,7 +933,7 @@ ch_close() * Return ch_flags for the current file. */ public int -ch_getflags() +ch_getflags(VOID_PARAM) { if (thisfile == NULL) return (0); Modified: stable/11/contrib/less/charset.c ============================================================================== --- stable/11/contrib/less/charset.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/charset.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -245,7 +245,7 @@ icharset(name, no_error) * Define a charset, given a locale name. */ static void -ilocale() +ilocale(VOID_PARAM) { int c; @@ -315,7 +315,7 @@ setfmt(s, fmtvarptr, attrptr, default_fmt) * */ static void -set_charset() +set_charset(VOID_PARAM) { char *s; @@ -338,7 +338,7 @@ set_charset() * LESSCHARSET is not defined: try LESSCHARDEF. */ s = lgetenv("LESSCHARDEF"); - if (s != NULL && *s != '\0') + if (!isnullenv(s)) { ichardef(s); return; @@ -395,7 +395,7 @@ set_charset() * Initialize charset data structures. */ public void -init_charset() +init_charset(VOID_PARAM) { char *s; Modified: stable/11/contrib/less/charset.h ============================================================================== --- stable/11/contrib/less/charset.h Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/charset.h Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/cmd.h ============================================================================== --- stable/11/contrib/less/cmd.h Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/cmd.h Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -71,6 +71,13 @@ #define A_RRSHIFT 59 #define A_CLRMARK 62 #define A_SETMARKBOT 63 +#define A_X11MOUSE_IN 64 +#define A_X11MOUSE_IGNORE 65 +#define A_F_MOUSE 66 +#define A_B_MOUSE 67 +/* Note "X116" refers to extended (1006) X11 mouse reporting. */ +#define A_X116MOUSE_IN 68 +#define A_X116MOUSE_IGNORE 69 #define A_INVALID 100 #define A_NOACTION 101 Modified: stable/11/contrib/less/cmdbuf.c ============================================================================== --- stable/11/contrib/less/cmdbuf.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/cmdbuf.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -22,6 +22,8 @@ extern int sc_width; extern int utf_mode; +extern int no_hist_dups; +extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ static int cmd_col; /* Current column of the cursor */ @@ -58,6 +60,7 @@ public char closequote = '"'; #define HISTFILE_FIRST_LINE ".less-history-file:" #define HISTFILE_SEARCH_SECTION ".search" #define HISTFILE_SHELL_SECTION ".shell" +#define HISTFILE_MARK_SECTION ".mark" /* * A mlist structure represents a command history. @@ -114,7 +117,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset() +cmd_reset(VOID_PARAM) { cp = cmdbuf; *cp = '\0'; @@ -129,7 +132,7 @@ cmd_reset() * Clear command line. */ public void -clear_cmd() +clear_cmd(VOID_PARAM) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -169,7 +172,7 @@ cmd_putstr(s) * How many characters are in the command buffer? */ public int -len_cmdbuf() +len_cmdbuf(VOID_PARAM) { char *s = cmdbuf; char *endline = s + strlen(s); @@ -302,7 +305,7 @@ cmd_repaint(old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home() +cmd_home(VOID_PARAM) { while (cmd_col > prompt_col) { @@ -321,7 +324,7 @@ cmd_home() * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift() +cmd_lshift(VOID_PARAM) { char *s; char *save_cp; @@ -359,7 +362,7 @@ cmd_lshift() * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift() +cmd_rshift(VOID_PARAM) { char *s; char *save_cp; @@ -389,7 +392,7 @@ cmd_rshift() * Move cursor right one character. */ static int -cmd_right() +cmd_right(VOID_PARAM) { char *pr; char *ncp; @@ -424,7 +427,7 @@ cmd_right() * Move cursor left one character. */ static int -cmd_left() +cmd_left(VOID_PARAM) { char *ncp; int width = 0; @@ -492,7 +495,7 @@ cmd_ichar(cs, clen) * Delete the char to the left of the cursor. */ static int -cmd_erase() +cmd_erase(VOID_PARAM) { char *s; int clen; @@ -541,7 +544,7 @@ cmd_erase() * Delete the char under the cursor. */ static int -cmd_delete() +cmd_delete(VOID_PARAM) { if (*cp == '\0') { @@ -560,7 +563,7 @@ cmd_delete() * Delete the "word" to the left of the cursor. */ static int -cmd_werase() +cmd_werase(VOID_PARAM) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -586,7 +589,7 @@ cmd_werase() * Delete the "word" under the cursor. */ static int -cmd_wdelete() +cmd_wdelete(VOID_PARAM) { if (*cp == ' ') { @@ -612,7 +615,7 @@ cmd_wdelete() * Delete all chars in the command buffer. */ static int -cmd_kill() +cmd_kill(VOID_PARAM) { if (cmdbuf[0] == '\0') { @@ -702,6 +705,7 @@ cmd_updown(action) s = ml->string; if (s == NULL) s = ""; + cmd_offset = 0; cmd_home(); clear_eol(); strcpy(cmdbuf, s); @@ -719,6 +723,31 @@ cmd_updown(action) #endif /* + * + */ + static void +ml_link(mlist, ml) + struct mlist *mlist; + struct mlist *ml; +{ + ml->next = mlist; + ml->prev = mlist->prev; + mlist->prev->next = ml; + mlist->prev = ml; +} + +/* + * + */ + static void +ml_unlink(ml) + struct mlist *ml; +{ + ml->prev->next = ml->next; + ml->next->prev = ml->prev; +} + +/* * Add a string to an mlist. */ public void @@ -736,6 +765,21 @@ cmd_addhist(mlist, cmd, modified) if (strlen(cmd) == 0) return; + if (no_hist_dups) + { + struct mlist *next = NULL; + for (ml = mlist->next; ml->string != NULL; ml = next) + { + next = ml->next; + if (strcmp(ml->string, cmd) == 0) + { + ml_unlink(ml); + free(ml->string); + free(ml); + } + } + } + /* * Save the command unless it's a duplicate of the * last command in the history. @@ -750,10 +794,7 @@ cmd_addhist(mlist, cmd, modified) ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); ml->string = save(cmd); ml->modified = modified; - ml->next = mlist; - ml->prev = mlist->prev; - mlist->prev->next = ml; - mlist->prev = ml; + ml_link(mlist, ml); } /* * Point to the cmd just after the just-accepted command. @@ -768,13 +809,13 @@ cmd_addhist(mlist, cmd, modified) * Add it to the currently selected history list. */ public void -cmd_accept() +cmd_accept(VOID_PARAM) { #if CMD_HISTORY /* * Nothing to do if there is no currently selected history list. */ - if (curr_mlist == NULL) + if (curr_mlist == NULL || curr_mlist == ml_examine) return; cmd_addhist(curr_mlist, cmdbuf, 1); curr_mlist->modified = 1; @@ -799,7 +840,7 @@ cmd_edit(c) #if TAB_COMPLETE_FILENAME #define not_in_completion() in_completion = 0 #else -#define not_in_completion() +#define not_in_completion(VOID_PARAM) #endif /* @@ -934,7 +975,7 @@ cmd_istr(str) * cursor at the end of the word. */ static char * -delimit_word() +delimit_word(VOID_PARAM) { char *word; #if SPACES_IN_FILENAMES @@ -1021,7 +1062,7 @@ delimit_word() * which start with that word, and set tk_text to that list. */ static void -init_compl() +init_compl(VOID_PARAM) { char *word; char c; @@ -1148,9 +1189,9 @@ cmd_complete(action) tk_trial = next_compl(action, tk_trial); } - /* - * Remove the original word, or the previous trial completion. - */ + /* + * Remove the original word, or the previous trial completion. + */ while (cp > tk_ipoint) (void) cmd_erase(); @@ -1323,7 +1364,7 @@ cmd_int(frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf() +get_cmdbuf(VOID_PARAM) { return (cmdbuf); } @@ -1333,7 +1374,7 @@ get_cmdbuf() * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern() +cmd_lastpattern(VOID_PARAM) { if (curr_mlist == NULL) return (NULL); @@ -1358,7 +1399,7 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name() +histfile_name(VOID_PARAM) { char *home; char *name; @@ -1366,7 +1407,7 @@ histfile_name() /* See if filename is explicitly specified by $LESSHISTFILE. */ name = lgetenv("LESSHISTFILE"); - if (name != NULL && *name != '\0') + if (!isnullenv(name)) { if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0) /* $LESSHISTFILE == "-" means don't use a history file. */ @@ -1380,11 +1421,11 @@ histfile_name() /* Otherwise, file is in $HOME. */ home = lgetenv("HOME"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) { #if OS2 home = lgetenv("INIT"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) #endif return (NULL); } @@ -1447,6 +1488,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) ml = NULL; skip = NULL; #endif + } else if (strcmp(line, HISTFILE_MARK_SECTION) == 0) + { + ml = NULL; } else if (*line == '"') { if (ml != NULL) @@ -1456,6 +1500,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) else (*action)(uparam, ml, line+1); } + } else if (*line == 'm') + { + (*action)(uparam, NULL, line); } } fclose(f); @@ -1475,9 +1522,10 @@ read_cmdhist(action, uparam, skip_search, skip_shell) static void addhist_init(void *uparam, struct mlist *ml, char *string) { - if (ml == NULL || string == NULL) - return; - cmd_addhist(ml, string, 0); + if (ml != NULL) + cmd_addhist(ml, string, 0); + else if (string != NULL) + restore_mark(string); } #endif /* CMD_HISTORY */ @@ -1485,7 +1533,7 @@ addhist_init(void *uparam, struct mlist *ml, char *str * Initialize history from a .lesshist file. */ public void -init_cmdhist() +init_cmdhist(VOID_PARAM) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1558,7 +1606,7 @@ copy_hist(void *uparam, struct mlist *ml, char *string { struct save_ctx *ctx = (struct save_ctx *) uparam; - if (ml != ctx->mlist) { + if (ml != NULL && ml != ctx->mlist) { /* We're changing mlists. */ if (ctx->mlist) /* Append any new entries to the end of the current mlist. */ @@ -1567,13 +1615,9 @@ copy_hist(void *uparam, struct mlist *ml, char *string ctx->mlist = ml; write_mlist_header(ctx->mlist, ctx->fout); } - if (string != NULL) + + if (string == NULL) /* End of file */ { - /* Copy the entry. */ - fprintf(ctx->fout, "\"%s\n", string); - } - if (ml == NULL) /* End of file */ - { /* Write any sections that were not in the original file. */ if (mlist_search.modified) { @@ -1587,7 +1631,12 @@ copy_hist(void *uparam, struct mlist *ml, char *string write_mlist(&mlist_shell, ctx->fout); } #endif + } else if (ml != NULL) + { + /* Copy mlist entry. */ + fprintf(ctx->fout, "\"%s\n", string); } + /* Skip marks */ } #endif /* CMD_HISTORY */ @@ -1616,7 +1665,7 @@ make_file_private(f) * Does the history file need to be updated? */ static int -histfile_modified() +histfile_modified(VOID_PARAM) { if (mlist_search.modified) return 1; @@ -1624,6 +1673,10 @@ histfile_modified() if (mlist_shell.modified) return 1; #endif +#if CMD_HISTORY + if (marks_modified) + return 1; +#endif return 0; } @@ -1631,7 +1684,7 @@ histfile_modified() * Update the .lesshst file. */ public void -save_cmdhist() +save_cmdhist(VOID_PARAM) { #if CMD_HISTORY char *histname; @@ -1665,7 +1718,8 @@ save_cmdhist() fprintf(fout, "%s\n", HISTFILE_FIRST_LINE); ctx.fout = fout; ctx.mlist = NULL; - read_cmdhist(copy_hist, &ctx, skip_search, skip_shell); + read_cmdhist(©_hist, &ctx, skip_search, skip_shell); + save_marks(fout, HISTFILE_MARK_SECTION); fclose(fout); #if MSDOS_COMPILER==WIN32C /* Modified: stable/11/contrib/less/command.c ============================================================================== --- stable/11/contrib/less/command.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/command.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -49,6 +49,7 @@ extern struct scrpos initial_scrpos; extern IFILE curr_ifile; extern void *ml_search; extern void *ml_examine; +extern int wheel_lines; #if SHELL_ESCAPE || PIPEC extern void *ml_shell; #endif @@ -60,6 +61,9 @@ extern int screen_trashed; /* The screen has been over extern int shift_count; extern int oldbot; extern int forw_prompt; +#if MSDOS_COMPILER==WIN32C +extern int utf_mode; +#endif #if SHELL_ESCAPE static char *shellcmd = NULL; /* For holding last shell command for "!!" */ @@ -94,14 +98,39 @@ static void multi_search(); * updating the screen. */ static void -cmd_exec() +cmd_exec(VOID_PARAM) { - clear_attn(); + clear_attn(); clear_bot(); flush(); } /* + * Indicate we are reading a multi-character command. + */ + static void +set_mca(action) + int action; +{ + mca = action; + deinit_mouse(); /* we don't want mouse events while entering a cmd */ + clear_bot(); + clear_cmd(); +} + +/* + * Indicate we are not reading a multi-character command. + */ + static void +clear_mca(VOID_PARAM) +{ + if (mca == 0) + return; + mca = 0; + init_mouse(); +} + +/* * Set up the display to start a new multi-character command. */ static void @@ -111,15 +140,13 @@ start_mca(action, prompt, mlist, cmdflags) void *mlist; int cmdflags; { - mca = action; - clear_bot(); - clear_cmd(); + set_mca(action); cmd_putstr(prompt); set_mlist(mlist, cmdflags); } public int -in_mca() +in_mca(VOID_PARAM) { return (mca != 0 && mca != A_PREFIX); } @@ -128,21 +155,18 @@ in_mca() * Set up the display to start a new search command. */ static void -mca_search() +mca_search(VOID_PARAM) { #if HILITE_SEARCH if (search_type & SRCH_FILTER) - mca = A_FILTER; + set_mca(A_FILTER); else #endif if (search_type & SRCH_FORW) - mca = A_F_SEARCH; + set_mca(A_F_SEARCH); else - mca = A_B_SEARCH; + set_mca(A_B_SEARCH); - clear_bot(); - clear_cmd(); - if (search_type & SRCH_NO_MATCH) cmd_putstr("Non-match "); if (search_type & SRCH_FIRST_FILE) @@ -171,7 +195,7 @@ mca_search() * Set up the display to start a new toggle-option command. */ static void -mca_opt_toggle() +mca_opt_toggle(VOID_PARAM) { int no_prompt; int flag; @@ -181,9 +205,7 @@ mca_opt_toggle() flag = (optflag & ~OPT_NO_PROMPT); dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; - mca = A_OPT_TOGGLE; - clear_bot(); - clear_cmd(); + set_mca(A_OPT_TOGGLE); cmd_putstr(dash); if (optgetname) cmd_putstr(dash); @@ -206,7 +228,7 @@ mca_opt_toggle() * Execute a multicharacter command. */ static void -exec_mca() +exec_mca(VOID_PARAM) { char *cbuf; @@ -373,6 +395,7 @@ mca_opt_nonfirst_char(c) { char *p; char *oname; + int err; if (curropt != NULL) { @@ -392,7 +415,8 @@ mca_opt_nonfirst_char(c) return (MCA_DONE); p = get_cmdbuf(); opt_lower = ASCII_IS_LOWER(p[0]); - curropt = findopt_name(&p, &oname, NULL); + err = 0; + curropt = findopt_name(&p, &oname, &err); if (curropt != NULL) { /* @@ -410,6 +434,9 @@ mca_opt_nonfirst_char(c) if (cmd_char(c) != CC_OK) return (MCA_DONE); } + } else if (err != OPT_AMBIG) + { + bell(); } return (MCA_MORE); } @@ -461,6 +488,7 @@ mca_opt_char(c) error("There is no %s option", &parg); return (MCA_DONE); } + opt_lower = ASCII_IS_LOWER(c); } /* * If the option which was entered does not take a @@ -470,7 +498,7 @@ mca_opt_char(c) if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || !opt_has_param(curropt)) { - toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag); + toggle_option(curropt, opt_lower, "", optflag); return (MCA_DONE); } /* @@ -577,7 +605,7 @@ mca_char(c) * as a normal command character. */ number = cmd_int(&fraction); - mca = 0; + clear_mca(); cmd_accept(); return (NO_MCA); } @@ -644,7 +672,7 @@ mca_char(c) * Discard any buffered file data. */ static void -clear_buffers() +clear_buffers(VOID_PARAM) { if (!(ch_getflags() & CH_CANSEEK)) return; @@ -659,7 +687,7 @@ clear_buffers() * Make sure the screen is displayed. */ static void -make_display() +make_display(VOID_PARAM) { /* * If nothing is displayed yet, display starting from initial_scrpos. @@ -699,7 +727,7 @@ make_display() * Display the appropriate prompt. */ static void -prompt() +prompt(VOID_PARAM) { constant char *p; @@ -739,8 +767,14 @@ prompt() * In Win32, display the file name in the window title. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***