From owner-svn-src-head@freebsd.org Sun Dec 22 00:12:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B1B31E08B4; Sun, 22 Dec 2019 00:12:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47gNGH2JHBz3JM4; Sun, 22 Dec 2019 00:12:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48D811F32F; Sun, 22 Dec 2019 00:12:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBM0CNl2050505; Sun, 22 Dec 2019 00:12:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM0CNE8050504; Sun, 22 Dec 2019 00:12:23 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912220012.xBM0CNE8050504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 22 Dec 2019 00:12:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355992 - head/usr.bin/nfsstat X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.bin/nfsstat X-SVN-Commit-Revision: 355992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 00:12:23 -0000 Author: rmacklem Date: Sun Dec 22 00:12:22 2019 New Revision: 355992 URL: https://svnweb.freebsd.org/changeset/base/355992 Log: Update nfsstat to list the NFSv4.2 procedures and operations. r355677 added NFSv4.2 support to the NFS client and server. It also updated the nfsstats structure to keep counts for the new procedures (client) and operations (server) added for NFSv4.2. This patch updates the "-E" option of nfsstat so that it lists counts for these new procedures and operations. Modified: head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Sat Dec 21 22:32:24 2019 (r355991) +++ head/usr.bin/nfsstat/nfsstat.c Sun Dec 22 00:12:22 2019 (r355992) @@ -772,6 +772,31 @@ exp_intpr(int clientOnly, int serverOnly, int nfs41) (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATELAYGET]); xo_close_container("nfsv41"); + + xo_open_container("nfsv42"); + + xo_emit("{T:IOAdvise/%13.13s}{T:Allocate/%13.13s}" + "{T:Copy/%13.13s}{T:Seek/%13.13s}" + "{T:SeekDataS/%13.13s}{T:GetExtattr/%13.13s}\n"); + xo_emit("{:ioadvise/%13ju}{:allocate/%13ju}" + "{:copy/%13ju}{:seek/%13ju}" + "{:seekdatas/%13ju}{:getextattr/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_IOADVISE], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ALLOCATE], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COPY], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SEEK], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SEEKDS], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETEXTATTR]); + + xo_emit("{T:SetExtattr/%13.13s}{T:RmExtattr/%13.13s}" + "{T:ListExtattr/%13.13s}\n"); + xo_emit("{:setextattr/%13ju}{:rmextattr/%13ju}" + "{:listextattr/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETEXTATTR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMEXTATTR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LISTEXTATTR]); + + xo_close_container("nfsv42"); } xo_close_container("operations"); @@ -993,6 +1018,48 @@ exp_intpr(int clientOnly, int serverOnly, int nfs41) (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RECLAIMCOMPL]); xo_close_container("nfsv41"); + + xo_open_container("nfsv42"); + + xo_emit("{T:Allocate/%13.13s}{T:Copy/%13.13s}" + "{T:CopyNotify/%13.13s}{T:Deallocate/%13.13s}" + "{T:IOAdvise/%13.13s}{T:LayoutError/%13.13s}\n"); + xo_emit("{:allocate/%13ju}{:copy/%13ju}" + "{:copynotify/%13ju}{:deallocate/%13ju}" + "{:ioadvise/%13ju}{:layouterror/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_ALLOCATE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COPY], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COPYNOTIFY], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_DEALLOCATE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_IOADVISE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LAYOUTERROR]); + + xo_emit("{T:LayoutStats/%13.13s}{T:OffloadCncl/%13.13s}" + "{T:OffloadStat/%13.13s}{T:ReadPlus/%13.13s}" + "{T:Seek/%13.13s}{T:WriteSame/%13.13s}\n"); + xo_emit("{:layoutstats/%13ju}{:offloadcncl/%13ju}" + "{:offloadstat/%13ju}{:readplus/%13ju}" + "{:seek/%13ju}{:writesame/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LAYOUTSTATS], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OFFLOADCANCEL], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OFFLOADSTATUS], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READPLUS], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SEEK], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITESAME]); + + xo_emit("{T:Clone/%13.13s}{T:GetExtattr/%13.13s}" + "{T:SetExtattr/%13.13s}{T:ListExtattr/%13.13s}" + "{T:RmExtattr/%13.13s}\n"); + xo_emit("{:clone/%13ju}{:getextattr/%13ju}" + "{:setextattr/%13ju}{:listextattr/%13ju}" + "{:rmextattr/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CLONE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETXATTR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETXATTR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LISTXATTRS], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_REMOVEXATTR]); + + xo_close_container("nfsv42"); } xo_close_container("operations"); From owner-svn-src-head@freebsd.org Sun Dec 22 00:36:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEF4A1E0ED0; Sun, 22 Dec 2019 00:36:22 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47gNny4fSpz3KSq; Sun, 22 Dec 2019 00:36:22 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AF0F1F6CC; Sun, 22 Dec 2019 00:36:22 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBM0aMP5062950; Sun, 22 Dec 2019 00:36:22 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM0aM6n062949; Sun, 22 Dec 2019 00:36:22 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912220036.xBM0aM6n062949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 22 Dec 2019 00:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355993 - head/usr.bin/nfsstat X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.bin/nfsstat X-SVN-Commit-Revision: 355993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 00:36:22 -0000 Author: rmacklem Date: Sun Dec 22 00:36:22 2019 New Revision: 355993 URL: https://svnweb.freebsd.org/changeset/base/355993 Log: Update the nfsstat man page to reflect r355992. r355992 added listing of NFSv4.2 procedure and operation counts. This patch updates the nfsstat.1 man page to reflect that change. This is a content change. Modified: head/usr.bin/nfsstat/nfsstat.1 Modified: head/usr.bin/nfsstat/nfsstat.1 ============================================================================== --- head/usr.bin/nfsstat/nfsstat.1 Sun Dec 22 00:12:22 2019 (r355992) +++ head/usr.bin/nfsstat/nfsstat.1 Sun Dec 22 00:36:22 2019 (r355993) @@ -28,7 +28,7 @@ .\" From: @(#)nfsstat.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd October 1, 2018 +.Dd December 21, 2019 .Dt NFSSTAT 1 .Os .Sh NAME @@ -86,8 +86,8 @@ server for NFSv4. .It Fl E Similar to .Fl e -except that the statistics include NFSv4.1 and the numbers aren't clipped -at one billion. +except that the statistics include NFSv4.1 and NFSv4.2 and the numbers aren't +clipped at one billion. Only one of .Fl e or From owner-svn-src-head@freebsd.org Sun Dec 22 01:22:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D8B71E247B; Sun, 22 Dec 2019 01:22:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47gPqc1n6zz3Mlt; Sun, 22 Dec 2019 01:22:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 384C91FFDD; Sun, 22 Dec 2019 01:22:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBM1Mqv0092514; Sun, 22 Dec 2019 01:22:52 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM1MqHk092513; Sun, 22 Dec 2019 01:22:52 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201912220122.xBM1MqHk092513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 22 Dec 2019 01:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355995 - head/sbin/hastd X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/hastd X-SVN-Commit-Revision: 355995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 01:22:52 -0000 Author: mckusick Date: Sun Dec 22 01:22:51 2019 New Revision: 355995 URL: https://svnweb.freebsd.org/changeset/base/355995 Log: Fix typo in hastd.8 manual page. Reported by: Steve Kargl MFC after: 3 days Modified: head/sbin/hastd/hastd.8 Modified: head/sbin/hastd/hastd.8 ============================================================================== --- head/sbin/hastd/hastd.8 Sun Dec 22 00:46:07 2019 (r355994) +++ head/sbin/hastd/hastd.8 Sun Dec 22 01:22:51 2019 (r355995) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 8, 2016 +.Dd December 21, 2019 .Dt HASTD 8 .Os .Sh NAME @@ -44,7 +44,7 @@ The daemon is responsible for managing highly available GEOM providers. .Pp .Nm -allows the transpaent storage of data on two physically separated machines +allows the transparent storage of data on two physically separated machines connected over a TCP/IP network. Only one machine (cluster node) can actively use storage provided by .Nm . From owner-svn-src-head@freebsd.org Sun Dec 22 03:19:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B3841E64C0; Sun, 22 Dec 2019 03:19:18 +0000 (UTC) (envelope-from cem@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 47gSPy2b44z3y9y; Sun, 22 Dec 2019 03:19:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 53F032150A; Sun, 22 Dec 2019 03:19:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBM3JIrV058407; Sun, 22 Dec 2019 03:19:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM3JHPu058403; Sun, 22 Dec 2019 03:19:17 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912220319.xBM3JHPu058403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 22 Dec 2019 03:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355996 - in head/usr.sbin/fstyp: . tests X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/usr.sbin/fstyp: . tests X-SVN-Commit-Revision: 355996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 03:19:18 -0000 Author: cem Date: Sun Dec 22 03:19:17 2019 New Revision: 355996 URL: https://svnweb.freebsd.org/changeset/base/355996 Log: fstyp(8): Show exFAT volume labels with -l flag exfat is fundamentally the same design as fat32. The superblock differs marginally, and there are some additional optional features irrelevant to fstype(8); the structure of dirents has changed slightly to enable, among other things, larger files; the directory entries are no longer DOS 8.3 ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE. (As a result, this change uses iconv to convert a found exfat volume label to the user's locale.) Locating the volume label is identical to FAT32: locate the root directory and walk through dirents until you find a volume label. Like FAT32, follow the FAT chain between root directory clusters as necessary. PR: 242225 Reported by: Victor Sudakov Modified: head/usr.sbin/fstyp/exfat.c head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/fstyp.h head/usr.sbin/fstyp/tests/fstyp_test.sh Modified: head/usr.sbin/fstyp/exfat.c ============================================================================== --- head/usr.sbin/fstyp/exfat.c Sun Dec 22 01:22:51 2019 (r355995) +++ head/usr.sbin/fstyp/exfat.c Sun Dec 22 03:19:17 2019 (r355996) @@ -27,6 +27,14 @@ #include __FBSDID("$FreeBSD$"); +#include +#include + +#include +#include +#include +#include +#include #include #include #include @@ -34,6 +42,10 @@ __FBSDID("$FreeBSD$"); #include "fstyp.h" +/* + * https://docs.microsoft.com/en-us/windows/win32/fileio/exfat-specification + */ + struct exfat_vbr { char ev_jmp[3]; char ev_fsname[8]; @@ -55,19 +67,300 @@ struct exfat_vbr { uint8_t ev_percent_used; } __packed; +struct exfat_dirent { + uint8_t xde_type; +#define XDE_TYPE_INUSE_MASK 0x80 /* 1=in use */ +#define XDE_TYPE_INUSE_SHIFT 7 +#define XDE_TYPE_CATEGORY_MASK 0x40 /* 0=primary */ +#define XDE_TYPE_CATEGORY_SHIFT 6 +#define XDE_TYPE_IMPORTNC_MASK 0x20 /* 0=critical */ +#define XDE_TYPE_IMPORTNC_SHIFT 5 +#define XDE_TYPE_CODE_MASK 0x1f +/* InUse=0, ..., TypeCode=0: EOD. */ +#define XDE_TYPE_EOD 0x00 +#define XDE_TYPE_ALLOC_BITMAP (XDE_TYPE_INUSE_MASK | 0x01) +#define XDE_TYPE_UPCASE_TABLE (XDE_TYPE_INUSE_MASK | 0x02) +#define XDE_TYPE_VOL_LABEL (XDE_TYPE_INUSE_MASK | 0x03) +#define XDE_TYPE_FILE (XDE_TYPE_INUSE_MASK | 0x05) +#define XDE_TYPE_VOL_GUID (XDE_TYPE_INUSE_MASK | XDE_TYPE_IMPORTNC_MASK) +#define XDE_TYPE_STREAM_EXT (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK) +#define XDE_TYPE_FILE_NAME (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK | 0x01) +#define XDE_TYPE_VENDOR (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK | XDE_TYPE_IMPORTNC_MASK) +#define XDE_TYPE_VENDOR_ALLOC (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK | XDE_TYPE_IMPORTNC_MASK | 0x01) + union { + uint8_t xde_generic_[19]; + struct exde_primary { + /* + * Count of "secondary" dirents following this one. + * + * A single logical entity may be composed of a + * sequence of several dirents, starting with a primary + * one; the rest are secondary dirents. + */ + uint8_t xde_secondary_count_; + uint16_t xde_set_chksum_; + uint16_t xde_prim_flags_; + uint8_t xde_prim_generic_[14]; + } __packed xde_primary_; + struct exde_secondary { + uint8_t xde_sec_flags_; + uint8_t xde_sec_generic_[18]; + } __packed xde_secondary_; + } u; + uint32_t xde_first_cluster; + uint64_t xde_data_len; +} __packed; +#define xde_generic u.xde_generic_ +#define xde_secondary_count u.xde_primary_.xde_secondary_count +#define xde_set_chksum u.xde_primary_.xde_set_chksum_ +#define xde_prim_flags u.xde_primary_.xde_prim_flags_ +#define xde_sec_flags u.xde_secondary_.xde_sec_flags_ +_Static_assert(sizeof(struct exfat_dirent) == 32, "spec"); + +struct exfat_de_label { + uint8_t xdel_type; /* XDE_TYPE_VOL_LABEL */ + uint8_t xdel_char_cnt; /* Length of UCS-2 label */ + uint16_t xdel_vol_lbl[11]; + uint8_t xdel_reserved[8]; +} __packed; +_Static_assert(sizeof(struct exfat_de_label) == 32, "spec"); + +#define MAIN_BOOT_REGION_SECT 0 +#define BACKUP_BOOT_REGION_SECT 12 + +#define SUBREGION_CHKSUM_SECT 11 + +#define FIRST_CLUSTER 2 +#define BAD_BLOCK_SENTINEL 0xfffffff7u +#define END_CLUSTER_SENTINEL 0xffffffffu + +static inline void * +read_sectn(FILE *fp, off_t sect, unsigned count, unsigned bytespersec) +{ + return (read_buf(fp, sect * bytespersec, bytespersec * count)); +} + +static inline void * +read_sect(FILE *fp, off_t sect, unsigned bytespersec) +{ + return (read_sectn(fp, sect, 1, bytespersec)); +} + +/* + * Compute the byte-by-byte multi-sector checksum of the given boot region + * (MAIN or BACKUP), for a given bytespersec (typically 512 or 4096). + * + * Endian-safe; result is host endian. + */ +static int +exfat_compute_boot_chksum(FILE *fp, unsigned region, unsigned bytespersec, + uint32_t *result) +{ + unsigned char *sector; + unsigned n, sect; + uint32_t checksum; + + checksum = 0; + for (sect = 0; sect < 11; sect++) { + sector = read_sect(fp, region + sect, bytespersec); + if (sector == NULL) + return (ENXIO); + for (n = 0; n < bytespersec; n++) { + if (sect == 0) { + switch (n) { + case 106: + case 107: + case 112: + continue; + } + } + checksum = ((checksum & 1) ? 0x80000000u : 0u) + + (checksum >> 1) + (uint32_t)sector[n]; + } + free(sector); + } + + *result = checksum; + return (0); +} + +static void +convert_label(const uint16_t *ucs2label /* LE */, unsigned ucs2len, char + *label_out, size_t label_sz) +{ + const char *label; + char *label_out_orig; + iconv_t cd; + size_t srcleft, rc; + + /* Currently hardcoded in fstyp.c as 256 or so. */ + assert(label_sz > 1); + + if (ucs2len == 0) { + /* + * Kind of seems bogus, but the spec allows an empty label + * entry with the same meaning as no label. + */ + return; + } + + if (ucs2len > 11) { + warnx("exfat: Bogus volume label length: %u", ucs2len); + return; + } + + /* dstname="" means convert to the current locale. */ + cd = iconv_open("", EXFAT_ENC); + if (cd == (iconv_t)-1) { + warn("exfat: Could not open iconv"); + return; + } + + label_out_orig = label_out; + + /* Dummy up the byte pointer and byte length iconv's API wants. */ + label = (const void *)ucs2label; + srcleft = ucs2len * sizeof(*ucs2label); + + rc = iconv(cd, __DECONST(char **, &label), &srcleft, &label_out, + &label_sz); + if (rc == (size_t)-1) { + warn("exfat: iconv()"); + *label_out_orig = '\0'; + } else { + /* NUL-terminate result (iconv advances label_out). */ + if (label_sz == 0) + label_out--; + *label_out = '\0'; + } + + iconv_close(cd); +} + +/* + * Using the FAT table, look up the next cluster in this chain. + */ +static uint32_t +exfat_fat_next(FILE *fp, const struct exfat_vbr *ev, unsigned BPS, + uint32_t cluster) +{ + uint32_t fat_offset_sect, clsect, clsectoff; + uint32_t *fatsect, nextclust; + + fat_offset_sect = le32toh(ev->ev_fat_offset); + clsect = fat_offset_sect + (cluster / (BPS / sizeof(cluster))); + clsectoff = (cluster % (BPS / sizeof(cluster))); + + /* XXX This is pretty wasteful without a block cache for the FAT. */ + fatsect = read_sect(fp, clsect, BPS); + nextclust = le32toh(fatsect[clsectoff]); + free(fatsect); + + return (nextclust); +} + +static void +exfat_find_label(FILE *fp, const struct exfat_vbr *ev, unsigned BPS, + char *label_out, size_t label_sz) +{ + uint32_t rootdir_cluster, sects_per_clust, cluster_offset_sect; + off_t rootdir_sect; + struct exfat_dirent *declust, *it; + + cluster_offset_sect = le32toh(ev->ev_cluster_offset); + rootdir_cluster = le32toh(ev->ev_rootdir_cluster); + sects_per_clust = (1u << ev->ev_log_sect_per_clust); + + if (rootdir_cluster < FIRST_CLUSTER) { + warnx("%s: invalid rootdir cluster %u < %d", __func__, + rootdir_cluster, FIRST_CLUSTER); + return; + } + + + for (; rootdir_cluster != END_CLUSTER_SENTINEL; + rootdir_cluster = exfat_fat_next(fp, ev, BPS, rootdir_cluster)) { + if (rootdir_cluster == BAD_BLOCK_SENTINEL) { + warnx("%s: Bogus bad block in root directory chain", + __func__); + return; + } + + rootdir_sect = (rootdir_cluster - FIRST_CLUSTER) * + sects_per_clust + cluster_offset_sect; + declust = read_sectn(fp, rootdir_sect, sects_per_clust, BPS); + for (it = declust; + it < declust + (sects_per_clust * BPS / sizeof(*it)); it++) { + bool eod = false; + + /* + * Simplistic directory traversal; doesn't do any + * validation of "MUST" requirements in spec. + */ + switch (it->xde_type) { + case XDE_TYPE_EOD: + eod = true; + break; + case XDE_TYPE_VOL_LABEL: { + struct exfat_de_label *lde = (void*)it; + convert_label(lde->xdel_vol_lbl, + lde->xdel_char_cnt, label_out, label_sz); + free(declust); + return; + } + } + + if (eod) + break; + } + free(declust); + } +} + int fstyp_exfat(FILE *fp, char *label, size_t size) { struct exfat_vbr *ev; + uint32_t *cksect; + unsigned bytespersec; + uint32_t chksum; + int error; + cksect = NULL; ev = (struct exfat_vbr *)read_buf(fp, 0, 512); if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT ", 8) != 0) goto fail; + if (ev->ev_log_bytes_per_sect < 9 || ev->ev_log_bytes_per_sect > 12) { + warnx("exfat: Invalid BytesPerSectorShift"); + goto done; + } + + bytespersec = (1u << ev->ev_log_bytes_per_sect); + + error = exfat_compute_boot_chksum(fp, MAIN_BOOT_REGION_SECT, + bytespersec, &chksum); + if (error != 0) + goto done; + + cksect = read_sect(fp, MAIN_BOOT_REGION_SECT + SUBREGION_CHKSUM_SECT, + bytespersec); + /* - * Reading the volume label requires walking the root directory to look - * for a special label file. Left as an exercise for the reader. + * Technically the entire sector should be full of repeating 4-byte + * checksum pattern, but we only verify the first. */ + if (chksum != le32toh(cksect[0])) { + warnx("exfat: Found checksum 0x%08x != computed 0x%08x", + le32toh(cksect[0]), chksum); + goto done; + } + + if (show_label) + exfat_find_label(fp, ev, bytespersec, label, size); + +done: + free(cksect); free(ev); return (0); Modified: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- head/usr.sbin/fstyp/fstyp.c Sun Dec 22 01:22:51 2019 (r355995) +++ head/usr.sbin/fstyp/fstyp.c Sun Dec 22 03:19:17 2019 (r355996) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -50,24 +52,27 @@ __FBSDID("$FreeBSD$"); #define LABEL_LEN 256 +bool show_label = false; + typedef int (*fstyp_function)(FILE *, char *, size_t); static struct { const char *name; fstyp_function function; bool unmountable; + char *precache_encoding; } fstypes[] = { - { "cd9660", &fstyp_cd9660, false }, - { "exfat", &fstyp_exfat, false }, - { "ext2fs", &fstyp_ext2fs, false }, - { "geli", &fstyp_geli, true }, - { "msdosfs", &fstyp_msdosfs, false }, - { "ntfs", &fstyp_ntfs, false }, - { "ufs", &fstyp_ufs, false }, + { "cd9660", &fstyp_cd9660, false, NULL }, + { "exfat", &fstyp_exfat, false, EXFAT_ENC }, + { "ext2fs", &fstyp_ext2fs, false, NULL }, + { "geli", &fstyp_geli, true, NULL }, + { "msdosfs", &fstyp_msdosfs, false, NULL }, + { "ntfs", &fstyp_ntfs, false, NULL }, + { "ufs", &fstyp_ufs, false, NULL }, #ifdef HAVE_ZFS - { "zfs", &fstyp_zfs, true }, + { "zfs", &fstyp_zfs, true, NULL }, #endif - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; void * @@ -159,7 +164,7 @@ int main(int argc, char **argv) { int ch, error, i, nbytes; - bool ignore_type = false, show_label = false, show_unmountable = false; + bool ignore_type = false, show_unmountable = false; char label[LABEL_LEN + 1], strvised[LABEL_LEN * 4 + 1]; char *path; FILE *fp; @@ -187,6 +192,26 @@ main(int argc, char **argv) usage(); path = argv[0]; + + if (setlocale(LC_CTYPE, "") == NULL) + err(1, "setlocale"); + caph_cache_catpages(); + + /* Cache iconv conversion data before entering capability mode. */ + if (show_label) { + for (i = 0; i < nitems(fstypes); i++) { + iconv_t cd; + + if (fstypes[i].precache_encoding == NULL) + continue; + cd = iconv_open("", fstypes[i].precache_encoding); + if (cd == (iconv_t)-1) + err(1, "%s: iconv_open %s", fstypes[i].name, + fstypes[i].precache_encoding); + /* Iconv keeps a small cache of unused encodings. */ + iconv_close(cd); + } + } fp = fopen(path, "r"); if (fp == NULL) Modified: head/usr.sbin/fstyp/fstyp.h ============================================================================== --- head/usr.sbin/fstyp/fstyp.h Sun Dec 22 01:22:51 2019 (r355995) +++ head/usr.sbin/fstyp/fstyp.h Sun Dec 22 03:19:17 2019 (r355996) @@ -32,7 +32,14 @@ #ifndef FSTYP_H #define FSTYP_H +#include + #define MIN(a,b) (((a)<(b))?(a):(b)) + +/* The spec doesn't seem to permit UTF-16 surrogates; definitely LE. */ +#define EXFAT_ENC "UCS-2LE" + +extern bool show_label; /* -l flag */ void *read_buf(FILE *fp, off_t off, size_t len); char *checked_strdup(const char *s); Modified: head/usr.sbin/fstyp/tests/fstyp_test.sh ============================================================================== --- head/usr.sbin/fstyp/tests/fstyp_test.sh Sun Dec 22 01:22:51 2019 (r355995) +++ head/usr.sbin/fstyp/tests/fstyp_test.sh Sun Dec 22 03:19:17 2019 (r355996) @@ -68,6 +68,15 @@ exfat_body() { atf_check -s exit:0 -o inline:"exfat\n" fstyp -u exfat.img } +atf_test_case exfat_label +exfat_label_head() { + atf_set "descr" "fstyp(8) can read exFAT labels" +} +exfat_label_body() { + bzcat $(atf_get_srcdir)/dfr-01-xfat.img.bz2 > exfat.img + atf_check -s exit:0 -o inline:"exfat exFat\n" fstyp -u -l exfat.img +} + atf_test_case empty empty_head() { atf_set "descr" "fstyp(8) should fail on an empty file" @@ -253,6 +262,7 @@ atf_init_test_cases() { atf_add_test_case dir atf_add_test_case empty atf_add_test_case exfat + atf_add_test_case exfat_label atf_add_test_case ext2 atf_add_test_case ext3 atf_add_test_case ext4 From owner-svn-src-head@freebsd.org Sun Dec 22 04:21:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF9CF1E7752; Sun, 22 Dec 2019 04:21:16 +0000 (UTC) (envelope-from jeff@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 47gTnS4SmCz41Nv; Sun, 22 Dec 2019 04:21:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9494B21FEE; Sun, 22 Dec 2019 04:21:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBM4LGOR095082; Sun, 22 Dec 2019 04:21:16 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM4LGQB095081; Sun, 22 Dec 2019 04:21:16 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912220421.xBM4LGQB095081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 22 Dec 2019 04:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355997 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 04:21:16 -0000 Author: jeff Date: Sun Dec 22 04:21:16 2019 New Revision: 355997 URL: https://svnweb.freebsd.org/changeset/base/355997 Log: Move vm_fault busy logic into its own function for clarity and re-use by later changes. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D22820 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Dec 22 03:19:17 2019 (r355996) +++ head/sys/vm/vm_fault.c Sun Dec 22 04:21:16 2019 (r355997) @@ -684,6 +684,41 @@ vm_fault_lock_vnode(struct faultstate *fs) return (KERN_RESOURCE_SHORTAGE); } +/* + * Wait/Retry if the page is busy. We have to do this if the page is + * either exclusive or shared busy because the vm_pager may be using + * read busy for pageouts (and even pageins if it is the vnode pager), + * and we could end up trying to pagein and pageout the same page + * simultaneously. + * + * We can theoretically allow the busy case on a read fault if the page + * is marked valid, but since such pages are typically already pmap'd, + * putting that special case in might be more effort then it is worth. + * We cannot under any circumstances mess around with a shared busied + * page except, perhaps, to pmap it. + */ +static void +vm_fault_busy_sleep(struct faultstate *fs) +{ + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_aflag_set(fs->m, PGA_REFERENCED); + if (fs->object != fs->first_object) { + fault_page_release(&fs->first_m); + vm_object_pip_wakeup(fs->first_object); + } + vm_object_pip_wakeup(fs->object); + unlock_map(fs); + if (fs->m == vm_page_lookup(fs->object, fs->pindex)) + vm_page_sleep_if_busy(fs->m, "vmpfw"); + VM_OBJECT_WUNLOCK(fs->object); + VM_CNT_INC(v_intrans); + vm_object_deallocate(fs->first_object); +} + int vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, vm_page_t *m_hold) @@ -822,42 +857,8 @@ RetryFault_oom: */ fs.m = vm_page_lookup(fs.object, fs.pindex); if (fs.m != NULL) { - /* - * Wait/Retry if the page is busy. We have to do this - * if the page is either exclusive or shared busy - * because the vm_pager may be using read busy for - * pageouts (and even pageins if it is the vnode - * pager), and we could end up trying to pagein and - * pageout the same page simultaneously. - * - * We can theoretically allow the busy case on a read - * fault if the page is marked valid, but since such - * pages are typically already pmap'd, putting that - * special case in might be more effort then it is - * worth. We cannot under any circumstances mess - * around with a shared busied page except, perhaps, - * to pmap it. - */ if (vm_page_tryxbusy(fs.m) == 0) { - /* - * Reference the page before unlocking and - * sleeping so that the page daemon is less - * likely to reclaim it. - */ - vm_page_aflag_set(fs.m, PGA_REFERENCED); - if (fs.object != fs.first_object) { - fault_page_release(&fs.first_m); - vm_object_pip_wakeup(fs.first_object); - } - unlock_map(&fs); - vm_object_pip_wakeup(fs.object); - if (fs.m == vm_page_lookup(fs.object, - fs.pindex)) { - vm_page_sleep_if_busy(fs.m, "vmpfw"); - } - VM_OBJECT_WUNLOCK(fs.object); - VM_CNT_INC(v_intrans); - vm_object_deallocate(fs.first_object); + vm_fault_busy_sleep(&fs); goto RetryFault; } From owner-svn-src-head@freebsd.org Sun Dec 22 05:44:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BC591C901D; Sun, 22 Dec 2019 05:44:30 +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 47gWdV3hBWz448F; Sun, 22 Dec 2019 05:44:30 +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 799A422FC5; Sun, 22 Dec 2019 05:44:30 +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 xBM5iUxN045477; Sun, 22 Dec 2019 05:44:30 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM5iTPl045474; Sun, 22 Dec 2019 05:44:29 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912220544.xBM5iTPl045474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 22 Dec 2019 05:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356000 - in head/sbin: fsck fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head/sbin: fsck fsck_ffs X-SVN-Commit-Revision: 356000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 05:44:30 -0000 Author: delphij Date: Sun Dec 22 05:44:29 2019 New Revision: 356000 URL: https://svnweb.freebsd.org/changeset/base/356000 Log: Remove unused includes. MFC after: 2 weeks Modified: head/sbin/fsck/fsck.c head/sbin/fsck/fsutil.c head/sbin/fsck_ffs/utilities.c Modified: head/sbin/fsck/fsck.c ============================================================================== --- head/sbin/fsck/fsck.c Sun Dec 22 05:43:13 2019 (r355999) +++ head/sbin/fsck/fsck.c Sun Dec 22 05:44:29 2019 (r356000) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sbin/fsck/fsutil.c ============================================================================== --- head/sbin/fsck/fsutil.c Sun Dec 22 05:43:13 2019 (r355999) +++ head/sbin/fsck/fsutil.c Sun Dec 22 05:44:29 2019 (r356000) @@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include #include Modified: head/sbin/fsck_ffs/utilities.c ============================================================================== --- head/sbin/fsck_ffs/utilities.c Sun Dec 22 05:43:13 2019 (r355999) +++ head/sbin/fsck_ffs/utilities.c Sun Dec 22 05:44:29 2019 (r356000) @@ -45,15 +45,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include -#include #include #include #include -#include -#include #include "fsck.h" From owner-svn-src-head@freebsd.org Sun Dec 22 06:25:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE2661CA057; Sun, 22 Dec 2019 06:25:21 +0000 (UTC) (envelope-from cem@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 47gXXd5zXRz45mK; Sun, 22 Dec 2019 06:25:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C3AFE236E0; Sun, 22 Dec 2019 06:25:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBM6PLkR069189; Sun, 22 Dec 2019 06:25:21 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM6PLME069187; Sun, 22 Dec 2019 06:25:21 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912220625.xBM6PLME069187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 22 Dec 2019 06:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356001 - in head/sys: conf dev/vmgenc X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: conf dev/vmgenc X-SVN-Commit-Revision: 356001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 06:25:22 -0000 Author: cem Date: Sun Dec 22 06:25:20 2019 New Revision: 356001 URL: https://svnweb.freebsd.org/changeset/base/356001 Log: Add vmgenc(4) driver for ACPI VM generation counter The VM generation counter is a 128-bit value exposed by the BIOS via ACPI. The value changes to another unique identifier whenever a VM is duplicated. Additionally, ACPI provides notification events when such events occur. The driver decodes the pointer to the UUID, exports the value to userspace via OPAQUE sysctl blob, and forwards the ACPI notifications in the form of an EVENTHANDLER invocation as well as userspace devctl events. See design paper: https://go.microsoft.com/fwlink/p/?LinkID=260709 Added: head/sys/dev/vmgenc/ head/sys/dev/vmgenc/vmgenc_acpi.c (contents, props changed) head/sys/dev/vmgenc/vmgenc_acpi.h (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Dec 22 05:44:29 2019 (r356000) +++ head/sys/conf/files Sun Dec 22 06:25:20 2019 (r356001) @@ -3398,6 +3398,7 @@ dev/virtio/scsi/virtio_scsi.c optional virtio_scsi dev/virtio/random/virtio_random.c optional virtio_random dev/virtio/console/virtio_console.c optional virtio_console dev/vkbd/vkbd.c optional vkbd +dev/vmgenc/vmgenc_acpi.c optional acpi dev/vr/if_vr.c optional vr pci dev/vt/colors/vt_termcolors.c optional vt dev/vt/font/vt_font_default.c optional vt Added: head/sys/dev/vmgenc/vmgenc_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/vmgenc/vmgenc_acpi.c Sun Dec 22 06:25:20 2019 (r356001) @@ -0,0 +1,240 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Conrad Meyer . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * VM Generation Counter driver + * + * See, e.g., the "Virtual Machine Generation ID" white paper: + * https://go.microsoft.com/fwlink/p/?LinkID=260709 , and perhaps also: + * https://docs.microsoft.com/en-us/windows/win32/hyperv_v2/virtual-machine-generation-identifier , + * https://azure.microsoft.com/en-us/blog/accessing-and-using-azure-vm-unique-id/ + * + * Microsoft introduced the concept in 2013 or so and seems to have + * successfully driven it to a consensus standard among hypervisors, not just + * HyperV/Azure: + * - QEMU: https://bugzilla.redhat.com/show_bug.cgi?id=1118834 + * - VMware/ESXi: https://kb.vmware.com/s/article/2032586 + * - Xen: https://github.com/xenserver/xen-4.5/blob/master/tools/firmware/hvmloader/acpi/dsdt.asl#L456 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifndef ACPI_NOTIFY_STATUS_CHANGED +#define ACPI_NOTIFY_STATUS_CHANGED 0x80 +#endif + +#define GUID_BYTES 16 + +static const char *vmgenc_ids[] = { + "VM_GEN_COUNTER", + NULL +}; +#if 0 +MODULE_PNP_INFO("Z:_CID", acpi, vmgenc, vmgenc_ids, nitems(vmgenc_ids) - 1); +#endif + +struct vmgenc_softc { + volatile void *vmg_pguid; + uint8_t vmg_cache_guid[GUID_BYTES]; +}; + +static void +vmgenc_status_changed(void *context) +{ + uint8_t guid[GUID_BYTES]; + struct vmgenc_softc *sc; + device_t dev; + + dev = context; + sc = device_get_softc(dev); + + /* Check for spurious notify events. */ + memcpy(guid, __DEVOLATILE(void *, sc->vmg_pguid), sizeof(guid)); + if (memcmp(guid, sc->vmg_cache_guid, GUID_BYTES) == 0) + return; /* No change. */ + + /* Update cache. */ + memcpy(sc->vmg_cache_guid, guid, GUID_BYTES); + + EVENTHANDLER_INVOKE(acpi_vmgenc_event); + acpi_UserNotify("VMGenerationCounter", acpi_get_handle(dev), 0); +} + +static void +vmgenc_notify(ACPI_HANDLE h, UINT32 notify, void *context) +{ + device_t dev; + + dev = context; + switch (notify) { + case ACPI_NOTIFY_STATUS_CHANGED: + /* + * We're possibly in GPE / interrupt context, kick the event up + * to a taskqueue. + */ + AcpiOsExecute(OSL_NOTIFY_HANDLER, vmgenc_status_changed, dev); + break; + default: + device_printf(dev, "unknown notify %#x\n", notify); + break; + } +} + +static int +vmgenc_probe(device_t dev) +{ + int rv; + + if (acpi_disabled("vmgenc")) + return (ENXIO); + rv = ACPI_ID_PROBE(device_get_parent(dev), dev, + __DECONST(char **, vmgenc_ids), NULL); + if (rv <= 0) + device_set_desc(dev, "VM Generation Counter"); + return (rv); +} + +static const char * +vmgenc_acpi_getname(ACPI_HANDLE handle, char data[static 256]) +{ + ACPI_BUFFER buf; + + buf.Length = 256; + buf.Pointer = data; + + if (ACPI_SUCCESS(AcpiGetName(handle, ACPI_FULL_PATHNAME, &buf))) + return (data); + return ("(unknown)"); +} + +static int +acpi_GetPackedUINT64(device_t dev, ACPI_HANDLE handle, char *path, + uint64_t *out) +{ + char hpath[256]; + ACPI_STATUS status; + ACPI_BUFFER buf; + ACPI_OBJECT param[3]; + + buf.Pointer = param; + buf.Length = sizeof(param); + status = AcpiEvaluateObject(handle, path, NULL, &buf); + if (!ACPI_SUCCESS(status)) { + device_printf(dev, "%s(%s::%s()): %s\n", __func__, + vmgenc_acpi_getname(handle, hpath), path, + AcpiFormatException(status)); + return (ENXIO); + } + if (param[0].Type != ACPI_TYPE_PACKAGE) { + device_printf(dev, "%s(%s::%s()): Wrong type %#x\n", __func__, + vmgenc_acpi_getname(handle, hpath), path, + param[0].Type); + return (ENXIO); + } + if (param[0].Package.Count != 2) { + device_printf(dev, "%s(%s::%s()): Wrong number of results %u\n", + __func__, vmgenc_acpi_getname(handle, hpath), path, + param[0].Package.Count); + return (ENXIO); + } + if (param[0].Package.Elements[0].Type != ACPI_TYPE_INTEGER || + param[0].Package.Elements[1].Type != ACPI_TYPE_INTEGER) { + device_printf(dev, "%s(%s::%s()): Wrong type results %#x, %#x\n", + __func__, vmgenc_acpi_getname(handle, hpath), path, + param[0].Package.Elements[0].Type, + param[0].Package.Elements[1].Type); + return (ENXIO); + } + + *out = (param[0].Package.Elements[0].Integer.Value & UINT32_MAX) | + ((uint64_t)param[0].Package.Elements[1].Integer.Value << 32); + if (*out == 0) + return (ENXIO); + return (0); + +} + +static int +vmgenc_attach(device_t dev) +{ + struct vmgenc_softc *sc; + uint64_t guid_physaddr; + ACPI_HANDLE h; + int error; + + h = acpi_get_handle(dev); + sc = device_get_softc(dev); + + error = acpi_GetPackedUINT64(dev, h, "ADDR", &guid_physaddr); + if (error != 0) + return (error); + + SYSCTL_ADD_OPAQUE(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "guid", + CTLFLAG_RD, sc->vmg_cache_guid, GUID_BYTES, "", + "latest cached VM generation counter (128-bit UUID)"); + + sc->vmg_pguid = AcpiOsMapMemory(guid_physaddr, GUID_BYTES); + memcpy(sc->vmg_cache_guid, __DEVOLATILE(void *, sc->vmg_pguid), + sizeof(sc->vmg_cache_guid)); + + AcpiInstallNotifyHandler(h, ACPI_DEVICE_NOTIFY, vmgenc_notify, dev); + return (0); +} + +static device_method_t vmgenc_methods[] = { + DEVMETHOD(device_probe, vmgenc_probe), + DEVMETHOD(device_attach, vmgenc_attach), + DEVMETHOD_END +}; + +static driver_t vmgenc_driver = { + "vmgenc", + vmgenc_methods, + sizeof(struct vmgenc_softc), +}; + +static devclass_t vmgenc_devclass; +DRIVER_MODULE(vmgenc, acpi, vmgenc_driver, vmgenc_devclass, NULL, NULL); +MODULE_DEPEND(vmgenc, acpi, 1, 1, 1); Added: head/sys/dev/vmgenc/vmgenc_acpi.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/vmgenc/vmgenc_acpi.h Sun Dec 22 06:25:20 2019 (r356001) @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Conrad Meyer . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#include + +/* + * VM Generation Counter driver + * + * This driver has two functions: first, it provides a system event (both in + * the kernel EVENTHANDLER framework as well as a userspace devctl event) + * whenever a VM has been (HyperV doc, for example): + * - Snapped and the snapshot is executing + * - Recovered from backup + * - Failed over in a HA setup + * - Imported, copied, or cloned + * - And unspecified if VM configuration changes might cause a changed + * generation counter + * + * Second, it can read the current VM generation counter, a 128-bit GUID. + */ +typedef void (*vmgenc_handler)(void *); +EVENTHANDLER_DECLARE(acpi_vmgenc_event, vmgenc_handler); From owner-svn-src-head@freebsd.org Sun Dec 22 06:56:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD2381CAB22; Sun, 22 Dec 2019 06:56:46 +0000 (UTC) (envelope-from jeff@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 47gYDt5nv1z477Y; Sun, 22 Dec 2019 06:56:46 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C1F8323C4E; Sun, 22 Dec 2019 06:56:46 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBM6ukxI086625; Sun, 22 Dec 2019 06:56:46 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBM6uimo086612; Sun, 22 Dec 2019 06:56:44 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912220656.xBM6uimo086612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 22 Dec 2019 06:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356002 - in head/sys: compat/linuxkpi/common/src dev/drm2/ttm dev/netmap dev/xen/gntdev dev/xen/privcmd vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/src dev/drm2/ttm dev/netmap dev/xen/gntdev dev/xen/privcmd vm X-SVN-Commit-Revision: 356002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 06:56:46 -0000 Author: jeff Date: Sun Dec 22 06:56:44 2019 New Revision: 356002 URL: https://svnweb.freebsd.org/changeset/base/356002 Log: Make page busy state deterministic on free. Pages must be xbusy when removed from objects including calls to free. Pages must not be xbusy when freed and not on an object. Strengthen assertions to match these expectations. In practice very little code had to change busy handling to meet these rules but we can now make stronger guarantees to busy holders and avoid conditionally dropping busy in free. Refine vm_page_remove() and vm_page_replace() semantics now that we have stronger guarantees about busy state. This removes redundant and potentially problematic code that has proliferated. Discussed with: markj Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22822 Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/dev/drm2/ttm/ttm_bo_vm.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/xen/gntdev/gntdev.c head/sys/dev/xen/privcmd/privcmd.c head/sys/vm/device_pager.c head/sys/vm/sg_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_kern.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Sun Dec 22 06:56:44 2019 (r356002) @@ -508,10 +508,7 @@ linux_cdev_pager_fault(vm_object_t vm_obj, vm_ooffset_ page = vm_page_getfake(paddr, vm_obj->memattr); VM_OBJECT_WLOCK(vm_obj); - vm_page_replace_checked(page, vm_obj, - (*mres)->pindex, *mres); - - vm_page_free(*mres); + vm_page_replace(page, vm_obj, (*mres)->pindex, *mres); *mres = page; } vm_page_valid(page); Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Sun Dec 22 06:56:44 2019 (r356002) @@ -237,6 +237,7 @@ reserve: goto retry; } m1 = vm_page_lookup(vm_obj, OFF_TO_IDX(offset)); + /* XXX This looks like it should just be vm_page_replace? */ if (m1 == NULL) { if (vm_page_insert(m, vm_obj, OFF_TO_IDX(offset))) { vm_page_xunbusy(m); @@ -255,6 +256,7 @@ reserve: vm_page_valid(m); if (*mres != NULL) { KASSERT(*mres != m, ("losing %p %p", *mres, m)); + vm_page_xunbusy(*mres); vm_page_free(*mres); } *mres = m; Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/dev/netmap/netmap_freebsd.c Sun Dec 22 06:56:44 2019 (r356002) @@ -1022,12 +1022,10 @@ netmap_dev_pager_fault(vm_object_t object, vm_ooffset_ vm_paddr_t paddr; vm_page_t page; vm_memattr_t memattr; - vm_pindex_t pidx; nm_prdis("object %p offset %jd prot %d mres %p", object, (intmax_t)offset, prot, mres); memattr = object->memattr; - pidx = OFF_TO_IDX(offset); paddr = netmap_mem_ofstophys(na->nm_mem, offset); if (paddr == 0) return VM_PAGER_FAIL; @@ -1052,9 +1050,8 @@ netmap_dev_pager_fault(vm_object_t object, vm_ooffset_ VM_OBJECT_WUNLOCK(object); page = vm_page_getfake(paddr, memattr); VM_OBJECT_WLOCK(object); - vm_page_free(*mres); + vm_page_replace(page, object, (*mres)->pindex, *mres); *mres = page; - vm_page_insert(page, object, pidx); } vm_page_valid(page); return (VM_PAGER_OK); Modified: head/sys/dev/xen/gntdev/gntdev.c ============================================================================== --- head/sys/dev/xen/gntdev/gntdev.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/dev/xen/gntdev/gntdev.c Sun Dec 22 06:56:44 2019 (r356002) @@ -806,7 +806,7 @@ gntdev_gmap_pg_fault(vm_object_t object, vm_ooffset_t { struct gntdev_gmap *gmap = object->handle; vm_pindex_t pidx, ridx; - vm_page_t page, oldm; + vm_page_t page; vm_ooffset_t relative_offset; if (gmap->map == NULL) @@ -829,15 +829,12 @@ gntdev_gmap_pg_fault(vm_object_t object, vm_ooffset_t KASSERT(vm_page_wired(page), ("page %p is not wired", page)); KASSERT(!vm_page_busied(page), ("page %p is busy", page)); - if (*mres != NULL) { - oldm = *mres; - vm_page_free(oldm); - *mres = NULL; - } - vm_page_busy_acquire(page, 0); vm_page_valid(page); - vm_page_insert(page, object, pidx); + if (*mres != NULL) + vm_page_replace(page, object, pidx, *mres); + else + vm_page_insert(page, object, pidx); *mres = page; return (VM_PAGER_OK); } Modified: head/sys/dev/xen/privcmd/privcmd.c ============================================================================== --- head/sys/dev/xen/privcmd/privcmd.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/dev/xen/privcmd/privcmd.c Sun Dec 22 06:56:44 2019 (r356002) @@ -154,7 +154,7 @@ privcmd_pg_fault(vm_object_t object, vm_ooffset_t offs { struct privcmd_map *map = object->handle; vm_pindex_t pidx; - vm_page_t page, oldm; + vm_page_t page; if (map->mapped != true) return (VM_PAGER_FAIL); @@ -172,15 +172,13 @@ privcmd_pg_fault(vm_object_t object, vm_ooffset_t offs KASSERT(vm_page_wired(page), ("page %p not wired", page)); KASSERT(!vm_page_busied(page), ("page %p is busy", page)); - if (*mres != NULL) { - oldm = *mres; - vm_page_free(oldm); - *mres = NULL; - } - vm_page_busy_acquire(page, 0); vm_page_valid(page); - vm_page_insert(page, object, pidx); + + if (*mres != NULL) + vm_page_replace(page, object, pidx, *mres); + else + vm_page_insert(page, object, pidx); *mres = page; return (VM_PAGER_OK); } Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/vm/device_pager.c Sun Dec 22 06:56:44 2019 (r356002) @@ -236,7 +236,6 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m)); pmap_remove_all(m); (void)vm_page_remove(m); - vm_page_xunbusy(m); } else if (object->type == OBJT_DEVICE) dev_pager_free_page(object, m); } @@ -271,8 +270,12 @@ dev_pager_dealloc(vm_object_t object) * Free up our fake pages. */ while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) - != NULL) + != NULL) { + if (vm_page_busy_acquire(m, VM_ALLOC_WAITFAIL) == 0) + continue; + dev_pager_free_page(object, m); + } } object->handle = NULL; object->type = OBJT_DEAD; @@ -391,8 +394,7 @@ old_dev_pager_fault(vm_object_t object, vm_ooffset_t o */ page = vm_page_getfake(paddr, memattr); VM_OBJECT_WLOCK(object); - vm_page_replace_checked(page, object, (*mres)->pindex, *mres); - vm_page_free(*mres); + vm_page_replace(page, object, (*mres)->pindex, *mres); *mres = page; } vm_page_valid(page); Modified: head/sys/vm/sg_pager.c ============================================================================== --- head/sys/vm/sg_pager.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/vm/sg_pager.c Sun Dec 22 06:56:44 2019 (r356002) @@ -129,6 +129,8 @@ sg_pager_dealloc(vm_object_t object) * Free up our fake pages. */ while ((m = TAILQ_FIRST(&object->un_pager.sgp.sgp_pglist)) != 0) { + if (vm_page_busy_acquire(m, VM_ALLOC_WAITFAIL) == 0) + continue; TAILQ_REMOVE(&object->un_pager.sgp.sgp_pglist, m, plinks.q); vm_page_putfake(m); } @@ -193,10 +195,7 @@ sg_pager_getpages(vm_object_t object, vm_page_t *m, in page = vm_page_getfake(paddr, memattr); VM_OBJECT_WLOCK(object); TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, plinks.q); - vm_page_replace_checked(page, object, offset, m[0]); - vm_page_lock(m[0]); - vm_page_free(m[0]); - vm_page_unlock(m[0]); + vm_page_replace(page, object, offset, m[0]); m[0] = page; vm_page_valid(page); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/vm/vm_fault.c Sun Dec 22 06:56:44 2019 (r356002) @@ -180,8 +180,6 @@ fault_page_free(vm_page_t *mp) VM_OBJECT_ASSERT_WLOCKED(m->object); if (!vm_page_wired(m)) vm_page_free(m); - else - vm_page_xunbusy(m); *mp = NULL; } } @@ -1229,10 +1227,14 @@ readrest: */ fs.object == fs.first_object->backing_object) { - (void)vm_page_remove(fs.m); - vm_page_replace_checked(fs.m, fs.first_object, + /* + * Remove but keep xbusy for replace. fs.m is + * moved into fs.first_object and left busy + * while fs.first_m is conditionally freed. + */ + vm_page_remove_xbusy(fs.m); + vm_page_replace(fs.m, fs.first_object, fs.first_pindex, fs.first_m); - vm_page_free(fs.first_m); vm_page_dirty(fs.m); #if VM_NRESERVLEVEL > 0 /* Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/vm/vm_kern.c Sun Dec 22 06:56:44 2019 (r356002) @@ -586,6 +586,7 @@ _kmem_unback(vm_object_t object, vm_offset_t addr, vm_ #endif for (; offset < end; offset += PAGE_SIZE, m = next) { next = vm_page_next(m); + vm_page_busy_acquire(m, 0); vm_page_unwire_noq(m); vm_page_free(m); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/vm/vm_object.c Sun Dec 22 06:56:44 2019 (r356002) @@ -1484,8 +1484,6 @@ retry: if (vm_page_none_valid(m)) { if (vm_page_remove(m)) vm_page_free(m); - else - vm_page_xunbusy(m); continue; } @@ -1675,8 +1673,6 @@ vm_object_collapse_scan(vm_object_t object, int op) ("freeing mapped page %p", p)); if (vm_page_remove(p)) vm_page_free(p); - else - vm_page_xunbusy(p); continue; } @@ -1708,8 +1704,6 @@ vm_object_collapse_scan(vm_object_t object, int op) */ if (vm_page_remove(pp)) vm_page_free(pp); - else - vm_page_xunbusy(pp); pp = NULL; } @@ -1728,8 +1722,6 @@ vm_object_collapse_scan(vm_object_t object, int op) ("freeing mapped page %p", p)); if (vm_page_remove(p)) vm_page_free(p); - else - vm_page_xunbusy(p); if (pp != NULL) vm_page_xunbusy(pp); continue; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/vm/vm_page.c Sun Dec 22 06:56:44 2019 (r356002) @@ -181,6 +181,8 @@ static void _vm_page_busy_sleep(vm_object_t obj, vm_pa static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_dequeue_complete(vm_page_t m); static void vm_page_enqueue(vm_page_t m, uint8_t queue); +static bool vm_page_free_prep(vm_page_t m); +static void vm_page_free_toq(vm_page_t m); static void vm_page_init(void *dummy); static int vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex, vm_page_t mpred); @@ -1290,8 +1292,7 @@ vm_page_putfake(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) != 0, ("managed %p", m)); KASSERT((m->flags & PG_FICTITIOUS) != 0, ("vm_page_putfake: bad page %p", m)); - if (vm_page_xbusied(m)) - vm_page_xunbusy(m); + vm_page_xunbusy(m); uma_zfree(fakepg_zone, m); } @@ -1579,6 +1580,7 @@ vm_page_object_remove(vm_page_t m) vm_object_t object; vm_page_t mrem; + vm_page_assert_xbusied(m); object = m->object; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((m->ref_count & VPRC_OBJREF) != 0, @@ -1615,12 +1617,32 @@ vm_page_object_remove(vm_page_t m) * invalidate any backing storage. Returns true if the object's reference * was the last reference to the page, and false otherwise. * - * The object must be locked. + * The object must be locked and the page must be exclusively busied. + * The exclusive busy will be released on return. If this is not the + * final ref and the caller does not hold a wire reference it may not + * continue to access the page. */ bool vm_page_remove(vm_page_t m) { + bool dropped; + dropped = vm_page_remove_xbusy(m); + vm_page_xunbusy(m); + + return (dropped); +} + +/* + * vm_page_remove_xbusy + * + * Removes the page but leaves the xbusy held. Returns true if this + * removed the final ref and false otherwise. + */ +bool +vm_page_remove_xbusy(vm_page_t m) +{ + vm_page_object_remove(m); m->object = NULL; return (vm_page_drop(m, VPRC_OBJREF) == VPRC_OBJREF); @@ -1704,13 +1726,24 @@ vm_page_prev(vm_page_t m) /* * Uses the page mnew as a replacement for an existing page at index * pindex which must be already present in the object. + * + * Both pages must be exclusively busied on enter. The old page is + * unbusied on exit. + * + * A return value of true means mold is now free. If this is not the + * final ref and the caller does not hold a wire reference it may not + * continue to access the page. */ -vm_page_t -vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex) +static bool +vm_page_replace_hold(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex, + vm_page_t mold) { - vm_page_t mold; + vm_page_t mret; + bool dropped; VM_OBJECT_ASSERT_WLOCKED(object); + vm_page_assert_xbusied(mnew); + vm_page_assert_xbusied(mold); KASSERT(mnew->object == NULL && (mnew->ref_count & VPRC_OBJREF) == 0, ("vm_page_replace: page %p already in object", mnew)); @@ -1723,7 +1756,9 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm mnew->object = object; mnew->pindex = pindex; atomic_set_int(&mnew->ref_count, VPRC_OBJREF); - mold = vm_radix_replace(&object->rtree, mnew); + mret = vm_radix_replace(&object->rtree, mnew); + KASSERT(mret == mold, + ("invalid page replacement, mold=%p, mret=%p", mold, mret)); KASSERT((mold->oflags & VPO_UNMANAGED) == (mnew->oflags & VPO_UNMANAGED), ("vm_page_replace: mismatched VPO_UNMANAGED")); @@ -1731,10 +1766,7 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm /* Keep the resident page list in sorted order. */ TAILQ_INSERT_AFTER(&object->memq, mold, mnew, listq); TAILQ_REMOVE(&object->memq, mold, listq); - mold->object = NULL; - atomic_clear_int(&mold->ref_count, VPRC_OBJREF); - vm_page_xunbusy(mold); /* * The object's resident_page_count does not change because we have @@ -1743,9 +1775,21 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm */ if (pmap_page_is_write_mapped(mnew)) vm_object_set_writeable_dirty(object); - return (mold); + dropped = vm_page_drop(mold, VPRC_OBJREF) == VPRC_OBJREF; + vm_page_xunbusy(mold); + + return (dropped); } +void +vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex, + vm_page_t mold) +{ + + if (vm_page_replace_hold(mnew, object, pindex, mold)) + vm_page_free(mold); +} + /* * vm_page_rename: * @@ -2761,9 +2805,9 @@ retry: m_new->dirty = m->dirty; m->flags &= ~PG_ZERO; vm_page_dequeue(m); - vm_page_replace_checked(m_new, object, - m->pindex, m); - if (vm_page_free_prep(m)) + if (vm_page_replace_hold(m_new, object, + m->pindex, m) && + vm_page_free_prep(m)) SLIST_INSERT_HEAD(&free, m, plinks.s.ss); @@ -3644,7 +3688,7 @@ vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t n * The object must be locked. The page must be locked if it is * managed. */ -bool +static bool vm_page_free_prep(vm_page_t m) { @@ -3654,6 +3698,9 @@ vm_page_free_prep(vm_page_t m) */ atomic_thread_fence_acq(); + if (vm_page_sbusied(m)) + panic("vm_page_free_prep: freeing shared busy page %p", m); + #if defined(DIAGNOSTIC) && defined(PHYS_TO_DMAP) if (PMAP_HAS_DMAP && (m->flags & PG_ZERO) != 0) { uint64_t *p; @@ -3675,9 +3722,6 @@ vm_page_free_prep(vm_page_t m) } VM_CNT_INC(v_tfree); - if (vm_page_sbusied(m)) - panic("vm_page_free_prep: freeing shared busy page %p", m); - if (m->object != NULL) { KASSERT(((m->oflags & VPO_UNMANAGED) != 0) == ((m->object->flags & OBJ_UNMANAGED) != 0), @@ -3695,10 +3739,11 @@ vm_page_free_prep(vm_page_t m) m, m->ref_count)); m->object = NULL; m->ref_count -= VPRC_OBJREF; + vm_page_xunbusy(m); } if (vm_page_xbusied(m)) - vm_page_xunbusy(m); + panic("vm_page_free_prep: freeing exclusive busy page %p", m); /* * If fictitious remove object association and @@ -3754,7 +3799,7 @@ vm_page_free_prep(vm_page_t m) * The object must be locked. The page must be locked if it is * managed. */ -void +static void vm_page_free_toq(vm_page_t m) { struct vm_domain *vmd; @@ -4099,19 +4144,15 @@ vm_page_release(vm_page_t m, int flags) if (object == NULL) break; /* Depends on type-stability. */ - if (vm_page_busied(m) || !VM_OBJECT_TRYWLOCK(object)) { - object = NULL; + if (vm_page_busied(m) || !VM_OBJECT_TRYWLOCK(object)) break; + if (object == m->object) { + vm_page_release_locked(m, flags); + VM_OBJECT_WUNLOCK(object); + return; } - if (object == m->object) - break; VM_OBJECT_WUNLOCK(object); } - if (__predict_true(object != NULL)) { - vm_page_release_locked(m, flags); - VM_OBJECT_WUNLOCK(object); - return; - } } /* @@ -4158,7 +4199,7 @@ vm_page_release_locked(vm_page_t m, int flags) if (vm_page_unwire_noq(m)) { if ((flags & VPR_TRYFREE) != 0 && (m->object->ref_count == 0 || !pmap_page_is_mapped(m)) && - m->dirty == 0 && !vm_page_busied(m)) { + m->dirty == 0 && vm_page_tryxbusy(m)) { vm_page_free(m); } else { vm_page_lock(m); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sun Dec 22 06:25:20 2019 (r356001) +++ head/sys/vm/vm_page.h Sun Dec 22 06:56:44 2019 (r356002) @@ -622,7 +622,6 @@ void vm_page_deactivate_noreuse(vm_page_t); void vm_page_dequeue(vm_page_t m); void vm_page_dequeue_deferred(vm_page_t m); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); -bool vm_page_free_prep(vm_page_t m); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); @@ -646,9 +645,10 @@ void vm_page_reference(vm_page_t m); void vm_page_release(vm_page_t m, int flags); void vm_page_release_locked(vm_page_t m, int flags); bool vm_page_remove(vm_page_t); +bool vm_page_remove_xbusy(vm_page_t); int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t); -vm_page_t vm_page_replace(vm_page_t mnew, vm_object_t object, - vm_pindex_t pindex); +void vm_page_replace(vm_page_t mnew, vm_object_t object, + vm_pindex_t pindex, vm_page_t mold); void vm_page_requeue(vm_page_t m); int vm_page_sbusied(vm_page_t m); vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start, @@ -681,7 +681,6 @@ int vm_page_is_valid(vm_page_t, int, int); void vm_page_test_dirty(vm_page_t); vm_page_bits_t vm_page_bits(int base, int size); void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid); -void vm_page_free_toq(vm_page_t m); void vm_page_free_pages_toq(struct spglist *free, bool update_wire_count); void vm_page_dirty_KBI(vm_page_t m); @@ -900,21 +899,6 @@ vm_page_undirty(vm_page_t m) VM_PAGE_OBJECT_BUSY_ASSERT(m); m->dirty = 0; -} - -static inline void -vm_page_replace_checked(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex, - vm_page_t mold) -{ - vm_page_t mret; - - mret = vm_page_replace(mnew, object, pindex); - KASSERT(mret == mold, - ("invalid page replacement, mold=%p, mret=%p", mold, mret)); - - /* Unused if !INVARIANTS. */ - (void)mold; - (void)mret; } /* From owner-svn-src-head@freebsd.org Sun Dec 22 11:50:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65CB31D1064; Sun, 22 Dec 2019 11:50:50 +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 47ggmB2W11z4Jlr; Sun, 22 Dec 2019 11:50:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50DF926FB6; Sun, 22 Dec 2019 11:50:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBMBoogV058280; Sun, 22 Dec 2019 11:50:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBMBojq8058252; Sun, 22 Dec 2019 11:50:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912221150.xBMBojq8058252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Dec 2019 11:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356004 - in head: . contrib/llvm-project/clang/include/clang/CodeGen contrib/llvm-project/clang/lib/Basic/Targets contrib/llvm-project/clang/lib/CodeGen contrib/llvm-project/clang/lib/... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: . contrib/llvm-project/clang/include/clang/CodeGen contrib/llvm-project/clang/lib/Basic/Targets contrib/llvm-project/clang/lib/CodeGen contrib/llvm-project/clang/lib/Driver/ToolChains contrib... X-SVN-Commit-Revision: 356004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 11:50:50 -0000 Author: dim Date: Sun Dec 22 11:50:44 2019 New Revision: 356004 URL: https://svnweb.freebsd.org/changeset/base/356004 Log: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp 9.0.1 final release c1a0a213378a458fbea1a5c77b315c7dce08fd05. Release notes for llvm, clang, lld and libc++ 9.0.1 will become available here: https://releases.llvm.org/9.0.1/docs/ReleaseNotes.html https://releases.llvm.org/9.0.1/tools/clang/docs/ReleaseNotes.html https://releases.llvm.org/9.0.1/tools/lld/docs/ReleaseNotes.html https://releases.llvm.org/9.0.1/projects/libcxx/docs/ReleaseNotes.html PR: 240629 MFC after: 1 month Added: head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp - copied unchanged from r355987, vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h - copied unchanged from r355987, vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h Modified: head/ObsoleteFiles.inc head/UPDATING head/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h head/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp head/contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp head/contrib/llvm-project/clang/lib/CodeGen/MicrosoftCXXABI.cpp head/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/ARM.cpp head/contrib/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp head/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp head/contrib/llvm-project/clang/lib/Sema/SemaType.cpp head/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c head/contrib/llvm-project/lld/COFF/Driver.cpp head/contrib/llvm-project/lld/ELF/Symbols.h head/contrib/llvm-project/lld/docs/ReleaseNotes.rst head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp head/contrib/llvm-project/lldb/source/Symbol/Symtab.cpp head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFunction.h head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h head/contrib/llvm-project/llvm/include/llvm/CodeGen/StackProtector.h head/contrib/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h head/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/GVN.h head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h head/contrib/llvm-project/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp head/contrib/llvm-project/llvm/lib/CodeGen/MachineFunction.cpp head/contrib/llvm-project/llvm/lib/CodeGen/MachineInstr.cpp head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp head/contrib/llvm-project/llvm/lib/CodeGen/StackProtector.cpp head/contrib/llvm-project/llvm/lib/Object/ELFObjectFile.cpp head/contrib/llvm-project/llvm/lib/Support/ARMTargetParser.cpp head/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp head/contrib/llvm-project/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp head/contrib/llvm-project/llvm/lib/Target/ARM/ARM.td head/contrib/llvm-project/llvm/lib/Target/ARM/ARMPredicates.td head/contrib/llvm-project/llvm/lib/Target/ARM/ARMSubtarget.h head/contrib/llvm-project/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp head/contrib/llvm-project/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp head/contrib/llvm-project/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp head/contrib/llvm-project/llvm/lib/Target/PowerPC/P9InstrResources.td head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstr64Bit.td head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.td head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVRegisterInfo.h head/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td head/contrib/llvm-project/llvm/lib/Target/X86/X86FrameLowering.cpp head/contrib/llvm-project/llvm/lib/Target/X86/X86FrameLowering.h head/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp head/contrib/llvm-project/llvm/lib/Target/X86/X86MachineFunctionInfo.h head/contrib/llvm-project/llvm/lib/Target/X86/X86RegisterInfo.cpp head/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp head/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp head/contrib/llvm-project/llvm/lib/Transforms/Scalar/GVN.cpp head/contrib/llvm-project/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp head/contrib/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp head/contrib/llvm-project/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp head/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td head/contrib/llvm-project/llvm/tools/llvm-objcopy/StripOpts.td head/contrib/llvm-project/llvm/tools/opt/opt.cpp head/etc/mtree/BSD.debug.dist head/etc/mtree/BSD.usr.dist head/lib/clang/freebsd_cc_version.h head/lib/clang/headers/Makefile head/lib/clang/include/VCSVersion.inc head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/clang/Config/config.h head/lib/clang/include/lld/Common/Version.inc head/lib/clang/include/llvm/Config/config.h head/lib/clang/include/llvm/Config/llvm-config.h head/lib/clang/include/llvm/Support/VCSRevision.h head/lib/libclang_rt/Makefile.inc head/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: head/contrib/llvm-project/ (props changed) head/contrib/llvm-project/clang/ (props changed) head/contrib/llvm-project/compiler-rt/ (props changed) head/contrib/llvm-project/lld/ (props changed) head/contrib/llvm-project/lldb/ (props changed) head/contrib/llvm-project/llvm/ (props changed) Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Dec 22 08:22:02 2019 (r356003) +++ head/ObsoleteFiles.inc Sun Dec 22 11:50:44 2019 (r356004) @@ -36,6 +36,242 @@ # xargs -n1 | sort | uniq -d; # done +# 20191222: new clang import which bumps version from 9.0.0 to 9.0.1. +OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/algorithm +OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/complex +OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/new +OLD_DIRS+=usr/lib/clang/9.0.0/include/cuda_wrappers +OLD_FILES+=usr/lib/clang/9.0.0/include/openmp_wrappers/__clang_openmp_math.h +OLD_FILES+=usr/lib/clang/9.0.0/include/openmp_wrappers/__clang_openmp_math_declares.h +OLD_FILES+=usr/lib/clang/9.0.0/include/openmp_wrappers/cmath +OLD_FILES+=usr/lib/clang/9.0.0/include/openmp_wrappers/math.h +OLD_DIRS+=usr/lib/clang/9.0.0/include/openmp_wrappers +OLD_FILES+=usr/lib/clang/9.0.0/include/ppc_wrappers/emmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/ppc_wrappers/mm_malloc.h +OLD_FILES+=usr/lib/clang/9.0.0/include/ppc_wrappers/mmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/ppc_wrappers/xmmintrin.h +OLD_DIRS+=usr/lib/clang/9.0.0/include/ppc_wrappers +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/allocator_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/asan_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/common_interface_defs.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/coverage_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/dfsan_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/hwasan_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/linux_syscall_hooks.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/lsan_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/msan_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/netbsd_syscall_hooks.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/scudo_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/tsan_interface.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sanitizer/tsan_interface_atomic.h +OLD_DIRS+=usr/lib/clang/9.0.0/include/sanitizer +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_builtin_vars.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_cmath.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_complex_builtins.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_intrinsics.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_libdevice_declares.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_math_forward_declares.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__stddef_max_align_t.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__wmmintrin_aes.h +OLD_FILES+=usr/lib/clang/9.0.0/include/__wmmintrin_pclmul.h +OLD_FILES+=usr/lib/clang/9.0.0/include/adxintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/altivec.h +OLD_FILES+=usr/lib/clang/9.0.0/include/ammintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/arm64intr.h +OLD_FILES+=usr/lib/clang/9.0.0/include/arm_acle.h +OLD_FILES+=usr/lib/clang/9.0.0/include/arm_fp16.h +OLD_FILES+=usr/lib/clang/9.0.0/include/arm_neon.h +OLD_FILES+=usr/lib/clang/9.0.0/include/armintr.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx2intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512bf16intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512bitalgintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512bwintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512cdintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512dqintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512erintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512fintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512ifmaintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512ifmavlintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512pfintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vbmi2intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vbmiintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vbmivlintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlbf16intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlbitalgintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlbwintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlcdintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vldqintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlvbmi2intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlvnniintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vlvp2intersectintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vnniintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vp2intersectintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vpopcntdqintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avx512vpopcntdqvlintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/avxintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/bmi2intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/bmiintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/cetintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/cldemoteintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/clflushoptintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/clwbintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/clzerointrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/cpuid.h +OLD_FILES+=usr/lib/clang/9.0.0/include/emmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/enqcmdintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/f16cintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/fma4intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/fmaintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/fxsrintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/gfniintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/htmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/htmxlintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/ia32intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/immintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/invpcidintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/lwpintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/lzcntintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/mm3dnow.h +OLD_FILES+=usr/lib/clang/9.0.0/include/mm_malloc.h +OLD_FILES+=usr/lib/clang/9.0.0/include/mmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/module.modulemap +OLD_FILES+=usr/lib/clang/9.0.0/include/movdirintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/msa.h +OLD_FILES+=usr/lib/clang/9.0.0/include/mwaitxintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/nmmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/opencl-c-base.h +OLD_FILES+=usr/lib/clang/9.0.0/include/opencl-c.h +OLD_FILES+=usr/lib/clang/9.0.0/include/pconfigintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/pkuintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/pmmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/popcntintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/prfchwintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/ptwriteintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/rdseedintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/rtmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/s390intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/sgxintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/shaintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/smmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/tbmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/tmmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/vadefs.h +OLD_FILES+=usr/lib/clang/9.0.0/include/vaesintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/vecintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/vpclmulqdqintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/waitpkgintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/wbnoinvdintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/wmmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/x86intrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/xmmintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/xopintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/xsavecintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/xsaveintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/xsaveoptintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/xsavesintrin.h +OLD_FILES+=usr/lib/clang/9.0.0/include/xtestintrin.h +OLD_DIRS+=usr/lib/clang/9.0.0/include +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-aarch64.so +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-arm.so +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-armhf.so +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-i386.so +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-preinit-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-preinit-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-preinit-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-preinit-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-preinit-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan-x86_64.so +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan_cxx-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan_cxx-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan_cxx-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan_cxx-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.asan_cxx-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi_diag-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi_diag-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi_diag-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi_diag-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.cfi_diag-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.dd-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.dd-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.fuzzer-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.fuzzer-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.fuzzer_no_main-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.fuzzer_no_main-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.msan-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.msan-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.msan_cxx-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.msan_cxx-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-powerpc.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-powerpc64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.safestack-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.safestack-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.safestack-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats_client-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats_client-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats_client-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats_client-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.stats_client-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.tsan-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.tsan-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.tsan_cxx-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.tsan_cxx-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_minimal-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_minimal-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_minimal-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_minimal-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_minimal-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-basic-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-basic-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-basic-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-basic-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-fdr-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-fdr-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-fdr-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-fdr-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-profiling-aarch64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-profiling-arm.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-profiling-armhf.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-profiling-x86_64.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-x86_64.a +OLD_DIRS+=usr/lib/clang/9.0.0/lib/freebsd +OLD_DIRS+=usr/lib/clang/9.0.0/lib +OLD_DIRS+=usr/lib/clang/9.0.0 # 20191214: Removal of sranddev(3) OLD_FILES+=usr/share/man/man3/sranddev.3.gz # 20191213: remove timeout(9) Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Dec 22 08:22:02 2019 (r356003) +++ head/UPDATING Sun Dec 22 11:50:44 2019 (r356004) @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191222: + Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have + been upgraded to 9.0.1. Please see the 20141231 entry below for + information about prerequisites and upgrading, if you are not already + using clang 3.5.0 or higher. + 20191212: r355677 has modified the internal interface used between the NFS modules in the kernel. As such, they must all be upgraded Modified: head/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h ============================================================================== --- head/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h Sun Dec 22 11:50:44 2019 (r356004) @@ -109,14 +109,12 @@ class ABIArgInfo { (private) UnpaddedCoerceAndExpandType = T; } - ABIArgInfo(Kind K) - : TheKind(K), PaddingInReg(false), InReg(false) { - } - public: - ABIArgInfo() + ABIArgInfo(Kind K = Direct) : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0), - TheKind(Direct), PaddingInReg(false), InReg(false) {} + TheKind(K), PaddingInReg(false), InAllocaSRet(false), + IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false), + InReg(false), CanBeFlattened(false), SignExt(false) {} static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0, llvm::Type *Padding = nullptr, Modified: head/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -427,10 +427,11 @@ bool ARMTargetInfo::handleTargetFeatures(std::vectorgetType()); + auto *PTy = llvm::PointerType::get( + VarTy, getContext().getTargetAddressSpace(VD->getType())); + if (PTy != Addr.getType()) + Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy); } else { // Should we be using the alignment of the constant pointer we emitted? CharUnits Alignment = Modified: head/contrib/llvm-project/clang/lib/CodeGen/MicrosoftCXXABI.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/CodeGen/MicrosoftCXXABI.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/clang/lib/CodeGen/MicrosoftCXXABI.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -617,6 +617,9 @@ class MicrosoftCXXABI : public CGCXXABI { (private) llvm::Function *EmitVirtualMemPtrThunk(const CXXMethodDecl *MD, const MethodVFTableLocation &ML); + llvm::Constant *EmitMemberDataPointer(const CXXRecordDecl *RD, + CharUnits offset); + public: llvm::Type *ConvertMemberPointerType(const MemberPointerType *MPT) override; @@ -2700,7 +2703,11 @@ MicrosoftCXXABI::EmitFullMemberPointer(llvm::Constant llvm::Constant * MicrosoftCXXABI::EmitMemberDataPointer(const MemberPointerType *MPT, CharUnits offset) { - const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl(); + return EmitMemberDataPointer(MPT->getMostRecentCXXRecordDecl(), offset); +} + +llvm::Constant *MicrosoftCXXABI::EmitMemberDataPointer(const CXXRecordDecl *RD, + CharUnits offset) { if (RD->getMSInheritanceModel() == MSInheritanceAttr::Keyword_virtual_inheritance) offset -= getContext().getOffsetOfBaseWithVBPtr(RD); @@ -2724,8 +2731,17 @@ llvm::Constant *MicrosoftCXXABI::EmitMemberPointer(con if (const CXXMethodDecl *MD = dyn_cast(MPD)) { C = EmitMemberFunctionPointer(MD); } else { + // For a pointer to data member, start off with the offset of the field in + // the class in which it was declared, and convert from there if necessary. + // For indirect field decls, get the outermost anonymous field and use the + // parent class. CharUnits FieldOffset = Ctx.toCharUnitsFromBits(Ctx.getFieldOffset(MPD)); - C = EmitMemberDataPointer(DstTy, FieldOffset); + const FieldDecl *FD = dyn_cast(MPD); + if (!FD) + FD = cast(*cast(MPD)->chain_begin()); + const CXXRecordDecl *RD = cast(FD->getParent()); + RD = RD->getMostRecentNonInjectedDecl(); + C = EmitMemberDataPointer(RD, FieldOffset); } if (!MemberPointerPath.empty()) { Modified: head/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/ARM.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/ARM.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/ARM.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -460,7 +460,7 @@ fp16_fml_fallthrough: // now just be explicit and disable all known dependent features // as well. for (std::string Feature : { - "vfp2", "vfp2sp", + "vfp2", "vfp2sp", "vfp2d16", "vfp2d16sp", "vfp3", "vfp3sp", "vfp3d16", "vfp3d16sp", "vfp4", "vfp4sp", "vfp4d16", "vfp4d16sp", "fp-armv8", "fp-armv8sp", "fp-armv8d16", "fp-armv8d16sp", Modified: head/contrib/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -658,11 +658,11 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &D if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include"); - if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { - SmallString<128> P(D.ResourceDir); - llvm::sys::path::append(P, "include"); - addSystemInclude(DriverArgs, CC1Args, P); - } + SmallString<128> ResourceDirInclude(D.ResourceDir); + llvm::sys::path::append(ResourceDirInclude, "include"); + if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && + (!getTriple().isMusl() || DriverArgs.hasArg(options::OPT_nostdlibinc))) + addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude); if (DriverArgs.hasArg(options::OPT_nostdlibinc)) return; @@ -860,6 +860,9 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &D addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); + + if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && getTriple().isMusl()) + addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude); } static std::string DetectLibcxxIncludePath(llvm::vfs::FileSystem &vfs, Modified: head/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -3475,7 +3475,12 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedD } } - if (OldQTypeForComparison == NewQType) + // If the function types are compatible, merge the declarations. Ignore the + // exception specifier because it was already checked above in + // CheckEquivalentExceptionSpec, and we don't want follow-on diagnostics + // about incompatible types under -fms-compatibility. + if (Context.hasSameFunctionTypeIgnoringExceptionSpec(OldQTypeForComparison, + NewQType)) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); // If the types are imprecise (due to dependent constructs in friends or Modified: head/contrib/llvm-project/clang/lib/Sema/SemaType.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/Sema/SemaType.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/clang/lib/Sema/SemaType.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -6325,7 +6325,8 @@ namespace { Pointer, BlockPointer, Reference, - MemberPointer + MemberPointer, + MacroQualified, }; QualType Original; @@ -6356,6 +6357,9 @@ namespace { } else if (isa(Ty)) { T = cast(Ty)->getEquivalentType(); Stack.push_back(Attributed); + } else if (isa(Ty)) { + T = cast(Ty)->getUnderlyingType(); + Stack.push_back(MacroQualified); } else { const Type *DTy = Ty->getUnqualifiedDesugaredType(); if (Ty == DTy) { @@ -6411,6 +6415,9 @@ namespace { QualType New = wrap(C, cast(Old)->getInnerType(), I); return C.getParenType(New); } + + case MacroQualified: + return wrap(C, cast(Old)->getUnderlyingType(), I); case Pointer: { QualType New = wrap(C, cast(Old)->getPointeeType(), I); Modified: head/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c ============================================================================== --- head/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c Sun Dec 22 11:50:44 2019 (r356004) @@ -189,8 +189,9 @@ COMPILER_RT_VISIBILITY FILE *lprofOpenFileEx(const cha f = fdopen(fd, "r+b"); #elif defined(_WIN32) // FIXME: Use the wide variants to handle Unicode filenames. - HANDLE h = CreateFileA(ProfileName, GENERIC_READ | GENERIC_WRITE, 0, 0, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + HANDLE h = CreateFileA(ProfileName, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, 0); if (h == INVALID_HANDLE_VALUE) return NULL; @@ -199,6 +200,10 @@ COMPILER_RT_VISIBILITY FILE *lprofOpenFileEx(const cha CloseHandle(h); return NULL; } + + if (lprofLockFd(fd) != 0) + PROF_WARN("Data may be corrupted during profile merging : %s\n", + "Fail to obtain file lock due to system limit."); f = _fdopen(fd, "r+b"); if (f == 0) { Modified: head/contrib/llvm-project/lld/COFF/Driver.cpp ============================================================================== --- head/contrib/llvm-project/lld/COFF/Driver.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/lld/COFF/Driver.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -1138,7 +1138,7 @@ void LinkerDriver::link(ArrayRef argsArr } } - if (!args.hasArg(OPT_INPUT)) { + if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) { if (args.hasArg(OPT_deffile)) config->noEntry = true; else @@ -1626,7 +1626,7 @@ void LinkerDriver::link(ArrayRef argsArr } // Handle generation of import library from a def file. - if (!args.hasArg(OPT_INPUT)) { + if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) { fixupExports(); createImportLibrary(/*asLib=*/true); return; @@ -1672,8 +1672,8 @@ void LinkerDriver::link(ArrayRef argsArr // Set default image name if neither /out or /def set it. if (config->outputFile.empty()) { - config->outputFile = - getOutputPath((*args.filtered(OPT_INPUT).begin())->getValue()); + config->outputFile = getOutputPath( + (*args.filtered(OPT_INPUT, OPT_wholearchive_file).begin())->getValue()); } // Fail early if an output file is not writable. Modified: head/contrib/llvm-project/lld/ELF/Symbols.h ============================================================================== --- head/contrib/llvm-project/lld/ELF/Symbols.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/lld/ELF/Symbols.h Sun Dec 22 11:50:44 2019 (r356004) @@ -108,27 +108,27 @@ class Symbol { (public) // Symbol visibility. This is the computed minimum visibility of all // observed non-DSO symbols. - unsigned visibility : 2; + uint8_t visibility : 2; // True if the symbol was used for linking and thus need to be added to the // output file's symbol table. This is true for all symbols except for // unreferenced DSO symbols, lazy (archive) symbols, and bitcode symbols that // are unreferenced except by other bitcode objects. - unsigned isUsedInRegularObj : 1; + uint8_t isUsedInRegularObj : 1; // If this flag is true and the symbol has protected or default visibility, it // will appear in .dynsym. This flag is set by interposable DSO symbols in // executables, by most symbols in DSOs and executables built with // --export-dynamic, and by dynamic lists. - unsigned exportDynamic : 1; + uint8_t exportDynamic : 1; // False if LTO shouldn't inline whatever this symbol points to. If a symbol // is overwritten after LTO, LTO shouldn't inline the symbol because it // doesn't know the final contents of the symbol. - unsigned canInline : 1; + uint8_t canInline : 1; // True if this symbol is specified by --trace-symbol option. - unsigned traced : 1; + uint8_t traced : 1; inline void replace(const Symbol &New); @@ -236,28 +236,28 @@ class Symbol { (public) public: // True the symbol should point to its PLT entry. // For SharedSymbol only. - unsigned needsPltAddr : 1; + uint8_t needsPltAddr : 1; // True if this symbol is in the Iplt sub-section of the Plt and the Igot // sub-section of the .got.plt or .got. - unsigned isInIplt : 1; + uint8_t isInIplt : 1; // True if this symbol needs a GOT entry and its GOT entry is actually in // Igot. This will be true only for certain non-preemptible ifuncs. - unsigned gotInIgot : 1; + uint8_t gotInIgot : 1; // True if this symbol is preemptible at load time. - unsigned isPreemptible : 1; + uint8_t isPreemptible : 1; // True if an undefined or shared symbol is used from a live section. - unsigned used : 1; + uint8_t used : 1; // True if a call to this symbol needs to be followed by a restore of the // PPC64 toc pointer. - unsigned needsTocRestore : 1; + uint8_t needsTocRestore : 1; // True if this symbol is defined by a linker script. - unsigned scriptDefined : 1; + uint8_t scriptDefined : 1; // The partition whose dynamic symbol table contains this symbol's definition. uint8_t partition = 1; Modified: head/contrib/llvm-project/lld/docs/ReleaseNotes.rst ============================================================================== --- head/contrib/llvm-project/lld/docs/ReleaseNotes.rst Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/lld/docs/ReleaseNotes.rst Sun Dec 22 11:50:44 2019 (r356004) @@ -153,7 +153,7 @@ COFF Improvements * Having more than two ``/natvis:`` now works correctly; it used to not work for larger binaries before. - (`r327895 `_) + (`r359515 `_) * Undefined symbols are now printed only in demangled form. Pass ``/demangle:no`` to see raw symbol names instead. Copied: head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp (from r355987, vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp Sun Dec 22 11:50:44 2019 (r356004, copy of r355987, vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp) @@ -0,0 +1,88 @@ +#include "PythonReadline.h" + +#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE + +#include + +#include + +// Simple implementation of the Python readline module using libedit. +// In the event that libedit is excluded from the build, this turns +// back into a null implementation that blocks the module from pulling +// in the GNU readline shared lib, which causes linkage confusion when +// both readline and libedit's readline compatibility symbols collide. +// +// Currently it only installs a PyOS_ReadlineFunctionPointer, without +// implementing any of the readline module methods. This is meant to +// work around LLVM pr18841 to avoid seg faults in the stock Python +// readline.so linked against GNU readline. +// +// Bug on the cpython side: https://bugs.python.org/issue38634 + +PyDoc_STRVAR(moduleDocumentation, + "Simple readline module implementation based on libedit."); + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef readline_module = { + PyModuleDef_HEAD_INIT, // m_base + "lldb_editline", // m_name + moduleDocumentation, // m_doc + -1, // m_size + nullptr, // m_methods + nullptr, // m_reload + nullptr, // m_traverse + nullptr, // m_clear + nullptr, // m_free +}; +#else +static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}}; +#endif + +static char * +#if PY_MAJOR_VERSION >= 3 +simple_readline(FILE *stdin, FILE *stdout, const char *prompt) +#else +simple_readline(FILE *stdin, FILE *stdout, char *prompt) +#endif +{ + rl_instream = stdin; + rl_outstream = stdout; + char *line = readline(prompt); + if (!line) { +#if PY_MAJOR_VERSION >= 3 + char *ret = (char *)PyMem_RawMalloc(1); +#else + char *ret = (char *)PyMem_Malloc(1); +#endif + if (ret != NULL) + *ret = '\0'; + return ret; + } + if (*line) + add_history(line); + int n = strlen(line); +#if PY_MAJOR_VERSION >= 3 + char *ret = (char *)PyMem_RawMalloc(n + 2); +#else + char *ret = (char *)PyMem_Malloc(n + 2); +#endif + if (ret) { + strncpy(ret, line, n); + free(line); + ret[n] = '\n'; + ret[n + 1] = '\0'; + } + return ret; +} + +PyMODINIT_FUNC initlldb_readline(void) { + PyOS_ReadlineFunctionPointer = simple_readline; + +#if PY_MAJOR_VERSION >= 3 + return PyModule_Create(&readline_module); +#else + Py_InitModule4("readline", moduleMethods, moduleDocumentation, + static_cast(NULL), PYTHON_API_VERSION); +#endif +} +#endif Copied: head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h (from r355987, vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h Sun Dec 22 11:50:44 2019 (r356004, copy of r355987, vendor/llvm-project/release-9.x/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h) @@ -0,0 +1,26 @@ +//===-- PythonReadline.h ----------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H +#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H + +#if !defined(LLDB_DISABLE_LIBEDIT) && defined(__linux__) +// NOTE: Since Python may define some pre-processor definitions which affect the +// standard headers on some systems, you must include Python.h before any +// standard headers are included. +#include "Python.h" + +// no need to hack into Python's readline module if libedit isn't used. +// +#define LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE 1 + +extern "C" PyMODINIT_FUNC initlldb_readline(void); + +#endif + +#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H Modified: head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp ============================================================================== --- head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -17,6 +17,7 @@ #include "PythonDataObjects.h" #include "PythonExceptionState.h" +#include "PythonReadline.h" #include "ScriptInterpreterPythonImpl.h" #include "lldb/API/SBFrame.h" @@ -206,6 +207,22 @@ struct InitializePythonRAII { (public) m_stdin_tty_state.Save(STDIN_FILENO, false); InitializePythonHome(); + +#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE + // Python's readline is incompatible with libedit being linked into lldb. + // Provide a patched version local to the embedded interpreter. + bool ReadlinePatched = false; + for (auto *p = PyImport_Inittab; p->name != NULL; p++) { + if (strcmp(p->name, "readline") == 0) { + p->initfunc = initlldb_readline; + break; + } + } + if (!ReadlinePatched) { + PyImport_AppendInittab("readline", initlldb_readline); + ReadlinePatched = true; + } +#endif // Register _lldb as a built-in module. PyImport_AppendInittab("_lldb", LLDBSwigPyInit); Modified: head/contrib/llvm-project/lldb/source/Symbol/Symtab.cpp ============================================================================== --- head/contrib/llvm-project/lldb/source/Symbol/Symtab.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/lldb/source/Symbol/Symtab.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -896,14 +896,8 @@ void Symtab::InitAddressIndexes() { for (size_t i = 0; i < num_entries; i++) { FileRangeToIndexMap::Entry *entry = m_file_addr_to_index.GetMutableEntryAtIndex(i); - if (entry->GetByteSize() > 0) - continue; - addr_t curr_base_addr = entry->GetRangeBase(); - // Symbols with non-zero size will show after zero-sized symbols on the - // same address. So do not set size of a non-last zero-sized symbol. - if (i == num_entries - 1 || - m_file_addr_to_index.GetMutableEntryAtIndex(i + 1) - ->GetRangeBase() != curr_base_addr) { + if (entry->GetByteSize() == 0) { + addr_t curr_base_addr = entry->GetRangeBase(); const RangeVector::Entry *containing_section = section_ranges.FindEntryThatContains(curr_base_addr); Modified: head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFunction.h ============================================================================== --- head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFunction.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFunction.h Sun Dec 22 11:50:44 2019 (r356004) @@ -792,6 +792,10 @@ class MachineFunction { (public) MCSymbol *PreInstrSymbol = nullptr, MCSymbol *PostInstrSymbol = nullptr); + MachineInstr::ExtraInfo *createMIExtraInfoWithMarker( + ArrayRef MMOs, MCSymbol *PreInstrSymbol, + MCSymbol *PostInstrSymbol, MDNode *HeapAllocMarker); + /// Allocate a string and populate it with the given external symbol name. const char *createExternalSymbolName(StringRef Name); Modified: head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h ============================================================================== --- head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h Sun Dec 22 11:50:44 2019 (r356004) @@ -137,19 +137,23 @@ class MachineInstr (private) /// This has to be defined eagerly due to the implementation constraints of /// `PointerSumType` where it is used. class ExtraInfo final - : TrailingObjects { + : TrailingObjects { public: static ExtraInfo *create(BumpPtrAllocator &Allocator, ArrayRef MMOs, MCSymbol *PreInstrSymbol = nullptr, - MCSymbol *PostInstrSymbol = nullptr) { + MCSymbol *PostInstrSymbol = nullptr, + MDNode *HeapAllocMarker = nullptr) { bool HasPreInstrSymbol = PreInstrSymbol != nullptr; bool HasPostInstrSymbol = PostInstrSymbol != nullptr; + bool HasHeapAllocMarker = HeapAllocMarker != nullptr; auto *Result = new (Allocator.Allocate( - totalSizeToAlloc( - MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol), + totalSizeToAlloc( + MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol, + HasHeapAllocMarker), alignof(ExtraInfo))) - ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol); + ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol, + HasHeapAllocMarker); // Copy the actual data into the trailing objects. std::copy(MMOs.begin(), MMOs.end(), @@ -160,6 +164,8 @@ class MachineInstr (private) if (HasPostInstrSymbol) Result->getTrailingObjects()[HasPreInstrSymbol] = PostInstrSymbol; + if (HasHeapAllocMarker) + Result->getTrailingObjects()[0] = HeapAllocMarker; return Result; } @@ -178,6 +184,10 @@ class MachineInstr (private) : nullptr; } + MDNode *getHeapAllocMarker() const { + return HasHeapAllocMarker ? getTrailingObjects()[0] : nullptr; + } + private: friend TrailingObjects; @@ -189,6 +199,7 @@ class MachineInstr (private) const int NumMMOs; const bool HasPreInstrSymbol; const bool HasPostInstrSymbol; + const bool HasHeapAllocMarker; // Implement the `TrailingObjects` internal API. size_t numTrailingObjects(OverloadToken) const { @@ -197,12 +208,17 @@ class MachineInstr (private) size_t numTrailingObjects(OverloadToken) const { return HasPreInstrSymbol + HasPostInstrSymbol; } + size_t numTrailingObjects(OverloadToken) const { + return HasHeapAllocMarker; + } // Just a boring constructor to allow us to initialize the sizes. Always use // the `create` routine above. - ExtraInfo(int NumMMOs, bool HasPreInstrSymbol, bool HasPostInstrSymbol) + ExtraInfo(int NumMMOs, bool HasPreInstrSymbol, bool HasPostInstrSymbol, + bool HasHeapAllocMarker) : NumMMOs(NumMMOs), HasPreInstrSymbol(HasPreInstrSymbol), - HasPostInstrSymbol(HasPostInstrSymbol) {} + HasPostInstrSymbol(HasPostInstrSymbol), + HasHeapAllocMarker(HasHeapAllocMarker) {} }; /// Enumeration of the kinds of inline extra info available. It is important @@ -577,6 +593,16 @@ class MachineInstr (private) return nullptr; } + /// Helper to extract a heap alloc marker if one has been added. + MDNode *getHeapAllocMarker() const { + if (!Info) + return nullptr; + if (ExtraInfo *EI = Info.get()) + return EI->getHeapAllocMarker(); + + return nullptr; + } + /// API for querying MachineInstr properties. They are the same as MCInstrDesc /// queries but they are bundle aware. @@ -1578,6 +1604,12 @@ class MachineInstr (private) /// replace ours with it. void cloneInstrSymbols(MachineFunction &MF, const MachineInstr &MI); + /// Set a marker on instructions that denotes where we should create and emit + /// heap alloc site labels. This waits until after instruction selection and + /// optimizations to create the label, so it should still work if the + /// instruction is removed or duplicated. + void setHeapAllocMarker(MachineFunction &MF, MDNode *MD); + /// Return the MIFlags which represent both MachineInstrs. This /// should be used when merging two MachineInstrs into one. This routine does /// not modify the MIFlags of this MachineInstr. @@ -1632,6 +1664,12 @@ class MachineInstr (private) const TargetRegisterClass *getRegClassConstraintEffectForVRegImpl( unsigned OpIdx, unsigned Reg, const TargetRegisterClass *CurRC, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const; + + /// Stores extra instruction information inline or allocates as ExtraInfo + /// based on the number of pointers. + void setExtraInfo(MachineFunction &MF, ArrayRef MMOs, + MCSymbol *PreInstrSymbol, MCSymbol *PostInstrSymbol, + MDNode *HeapAllocMarker); }; /// Special DenseMapInfo traits to compare MachineInstr* by *value* of the Modified: head/contrib/llvm-project/llvm/include/llvm/CodeGen/StackProtector.h ============================================================================== --- head/contrib/llvm-project/llvm/include/llvm/CodeGen/StackProtector.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/include/llvm/CodeGen/StackProtector.h Sun Dec 22 11:50:44 2019 (r356004) @@ -89,7 +89,8 @@ class StackProtector : public FunctionPass { (private) bool InStruct = false) const; /// Check whether a stack allocation has its address taken. - bool HasAddressTaken(const Instruction *AI); + bool HasAddressTaken(const Instruction *AI, + SmallPtrSetImpl &VisitedPHIs); /// RequiresStackProtector - Check whether or not this function needs a /// stack protector based upon the stack protector level. Modified: head/contrib/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h ============================================================================== --- head/contrib/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h Sun Dec 22 11:50:44 2019 (r356004) @@ -16,6 +16,8 @@ #include "llvm/Demangle/DemangleConfig.h" #include "llvm/Demangle/StringView.h" #include +#include +#include namespace llvm { namespace itanium_demangle { Modified: head/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/GVN.h ============================================================================== --- head/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/GVN.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/GVN.h Sun Dec 22 11:50:44 2019 (r356004) @@ -120,6 +120,8 @@ class GVN : public PassInfoMixin { (public) uint32_t lookupOrAddCall(CallInst *C); uint32_t phiTranslateImpl(const BasicBlock *BB, const BasicBlock *PhiBlock, uint32_t Num, GVN &Gvn); + bool areCallValsEqual(uint32_t Num, uint32_t NewNum, const BasicBlock *Pred, + const BasicBlock *PhiBlock, GVN &Gvn); std::pair assignExpNewValueNum(Expression &exp); bool areAllValsInBB(uint32_t num, const BasicBlock *BB, GVN &Gvn); Modified: head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -1127,15 +1127,9 @@ void CodeViewDebug::emitDebugInfoForFunction(const Fun } for (auto HeapAllocSite : FI.HeapAllocSites) { - MCSymbol *BeginLabel = std::get<0>(HeapAllocSite); - MCSymbol *EndLabel = std::get<1>(HeapAllocSite); - - // The labels might not be defined if the instruction was replaced - // somewhere in the codegen pipeline. - if (!BeginLabel->isDefined() || !EndLabel->isDefined()) - continue; - - DIType *DITy = std::get<2>(HeapAllocSite); + const MCSymbol *BeginLabel = std::get<0>(HeapAllocSite); + const MCSymbol *EndLabel = std::get<1>(HeapAllocSite); + const DIType *DITy = std::get<2>(HeapAllocSite); MCSymbol *HeapAllocEnd = beginSymbolRecord(SymbolKind::S_HEAPALLOCSITE); OS.AddComment("Call site offset"); OS.EmitCOFFSecRel32(BeginLabel, /*Offset=*/0); @@ -1454,6 +1448,16 @@ void CodeViewDebug::beginFunctionImpl(const MachineFun DebugLoc FnStartDL = PrologEndLoc.getFnDebugLoc(); maybeRecordLocation(FnStartDL, MF); } + + // Find heap alloc sites and emit labels around them. + for (const auto &MBB : *MF) { + for (const auto &MI : MBB) { + if (MI.getHeapAllocMarker()) { + requestLabelBeforeInsn(&MI); + requestLabelAfterInsn(&MI); + } + } + } } static bool shouldEmitUdt(const DIType *T) { @@ -2888,8 +2892,18 @@ void CodeViewDebug::endFunctionImpl(const MachineFunct return; } + // Find heap alloc sites and add to list. + for (const auto &MBB : *MF) { + for (const auto &MI : MBB) { + if (MDNode *MD = MI.getHeapAllocMarker()) { + CurFn->HeapAllocSites.push_back(std::make_tuple(getLabelBeforeInsn(&MI), + getLabelAfterInsn(&MI), + dyn_cast(MD))); + } + } + } + CurFn->Annotations = MF->getCodeViewAnnotations(); - CurFn->HeapAllocSites = MF->getCodeViewHeapAllocSites(); CurFn->End = Asm->getFunctionEnd(); Modified: head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h ============================================================================== --- head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h Sun Dec 22 11:50:44 2019 (r356004) @@ -148,7 +148,8 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public D SmallVector ChildBlocks; std::vector> Annotations; - std::vector> HeapAllocSites; + std::vector> + HeapAllocSites; const MCSymbol *Begin = nullptr; const MCSymbol *End = nullptr; Modified: head/contrib/llvm-project/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp Sun Dec 22 08:22:02 2019 (r356003) +++ head/contrib/llvm-project/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp Sun Dec 22 11:50:44 2019 (r356004) @@ -588,8 +588,8 @@ void IRTranslator::emitSwitchCase(SwitchCG::CaseBlock Register CondRHS = getOrCreateVReg(*CB.CmpRHS); Cond = MIB.buildICmp(CB.PredInfo.Pred, i1Ty, CondLHS, CondRHS).getReg(0); } else { - assert(CB.PredInfo.Pred == CmpInst::ICMP_ULE && - "Can only handle ULE ranges"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Dec 22 11:58:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8F6E1D1391; Sun, 22 Dec 2019 11:58:45 +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 47ggxK5SW5z4KM3; Sun, 22 Dec 2019 11:58:45 +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 B6CF627186; Sun, 22 Dec 2019 11:58:45 +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 xBMBwjKH062881; Sun, 22 Dec 2019 11:58:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBMBwi3e062875; Sun, 22 Dec 2019 11:58:44 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912221158.xBMBwi3e062875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Dec 2019 11:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356005 - in head/contrib/llvm-project/libcxx/include: . ext X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm-project/libcxx/include: . ext X-SVN-Commit-Revision: 356005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 11:58:45 -0000 Author: dim Date: Sun Dec 22 11:58:44 2019 New Revision: 356005 URL: https://svnweb.freebsd.org/changeset/base/356005 Log: Merge commit f97936fab from llvm git (by Eric Fiselier): [libc++] Cleanup and enable multiple warnings. Too many warnings are being disabled too quickly. Warnings are important to keeping libc++ correct. This patch re-enables two warnings: -Wconstant-evaluated and -Wdeprecated-copy. In future, all warnings disabled for the test suite should require an attached bug. The bug should state the plan for re-enabling that warning, or a strong case why it should remain disabled. This should fix a number of new g++ 9 warnings. Requested by: rlibby MFC after: 3 days Modified: head/contrib/llvm-project/libcxx/include/__bit_reference head/contrib/llvm-project/libcxx/include/__hash_table head/contrib/llvm-project/libcxx/include/__tree head/contrib/llvm-project/libcxx/include/ext/hash_map head/contrib/llvm-project/libcxx/include/random head/contrib/llvm-project/libcxx/include/valarray Modified: head/contrib/llvm-project/libcxx/include/__bit_reference ============================================================================== --- head/contrib/llvm-project/libcxx/include/__bit_reference Sun Dec 22 11:50:44 2019 (r356004) +++ head/contrib/llvm-project/libcxx/include/__bit_reference Sun Dec 22 11:58:44 2019 (r356005) @@ -1108,8 +1108,12 @@ class __bit_iterator (public) #endif {} + // avoid re-declaring a copy constructor for the non-const version. + using __type_for_copy_to_const = + _If<_IsConst, __bit_iterator<_Cp, false>, struct __private_nat>; + _LIBCPP_INLINE_VISIBILITY - __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT + __bit_iterator(const __type_for_copy_to_const& __it) _NOEXCEPT : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT Modified: head/contrib/llvm-project/libcxx/include/__hash_table ============================================================================== --- head/contrib/llvm-project/libcxx/include/__hash_table Sun Dec 22 11:50:44 2019 (r356004) +++ head/contrib/llvm-project/libcxx/include/__hash_table Sun Dec 22 11:58:44 2019 (r356005) @@ -825,10 +825,12 @@ class __hash_node_destructor (private) allocator_type& __na_; - __hash_node_destructor& operator=(const __hash_node_destructor&); - public: bool __value_constructed; + + __hash_node_destructor(__hash_node_destructor const&) = default; + __hash_node_destructor& operator=(const __hash_node_destructor&) = delete; + _LIBCPP_INLINE_VISIBILITY explicit __hash_node_destructor(allocator_type& __na, Modified: head/contrib/llvm-project/libcxx/include/__tree ============================================================================== --- head/contrib/llvm-project/libcxx/include/__tree Sun Dec 22 11:50:44 2019 (r356004) +++ head/contrib/llvm-project/libcxx/include/__tree Sun Dec 22 11:58:44 2019 (r356005) @@ -775,10 +775,13 @@ class __tree_node_destructor (private) typedef __tree_node_types _NodeTypes; allocator_type& __na_; - __tree_node_destructor& operator=(const __tree_node_destructor&); public: bool __value_constructed; + + + __tree_node_destructor(const __tree_node_destructor &) = default; + __tree_node_destructor& operator=(const __tree_node_destructor&) = delete; _LIBCPP_INLINE_VISIBILITY explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT Modified: head/contrib/llvm-project/libcxx/include/ext/hash_map ============================================================================== --- head/contrib/llvm-project/libcxx/include/ext/hash_map Sun Dec 22 11:50:44 2019 (r356004) +++ head/contrib/llvm-project/libcxx/include/ext/hash_map Sun Dec 22 11:58:44 2019 (r356005) @@ -315,11 +315,12 @@ class __hash_map_node_destructor (private) allocator_type& __na_; - __hash_map_node_destructor& operator=(const __hash_map_node_destructor&); - public: bool __first_constructed; bool __second_constructed; + + __hash_map_node_destructor(__hash_map_node_destructor const&) = default; + __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete; _LIBCPP_INLINE_VISIBILITY explicit __hash_map_node_destructor(allocator_type& __na) Modified: head/contrib/llvm-project/libcxx/include/random ============================================================================== --- head/contrib/llvm-project/libcxx/include/random Sun Dec 22 11:50:44 2019 (r356004) +++ head/contrib/llvm-project/libcxx/include/random Sun Dec 22 11:58:44 2019 (r356005) @@ -6105,6 +6105,7 @@ class _LIBCPP_TEMPLATE_VIS piecewise_constant_distribu template param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); + param_type(param_type const&) = default; param_type & operator=(const param_type& __rhs); _LIBCPP_INLINE_VISIBILITY @@ -6428,6 +6429,7 @@ class _LIBCPP_TEMPLATE_VIS piecewise_linear_distributi template param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); + param_type(param_type const&) = default; param_type & operator=(const param_type& __rhs); _LIBCPP_INLINE_VISIBILITY Modified: head/contrib/llvm-project/libcxx/include/valarray ============================================================================== --- head/contrib/llvm-project/libcxx/include/valarray Sun Dec 22 11:50:44 2019 (r356004) +++ head/contrib/llvm-project/libcxx/include/valarray Sun Dec 22 11:58:44 2019 (r356005) @@ -1256,6 +1256,8 @@ class _LIBCPP_TEMPLATE_VIS slice_array (public) _LIBCPP_INLINE_VISIBILITY operator>>=(const _Expr& __v) const; + slice_array(slice_array const&) = default; + _LIBCPP_INLINE_VISIBILITY const slice_array& operator=(const slice_array& __sa) const; @@ -1505,11 +1507,6 @@ class _LIBCPP_TYPE_VIS gslice (public) #endif // _LIBCPP_CXX03_LANG -// gslice(const gslice&) = default; -// gslice(gslice&&) = default; -// gslice& operator=(const gslice&) = default; -// gslice& operator=(gslice&&) = default; - _LIBCPP_INLINE_VISIBILITY size_t start() const {return __1d_.size() ? __1d_[0] : 0;} @@ -1645,10 +1642,7 @@ class _LIBCPP_TEMPLATE_VIS gslice_array (public) _LIBCPP_INLINE_VISIBILITY void operator=(const value_type& __x) const; -// gslice_array(const gslice_array&) = default; -// gslice_array(gslice_array&&) = default; -// gslice_array& operator=(const gslice_array&) = default; -// gslice_array& operator=(gslice_array&&) = default; + gslice_array(const gslice_array&) = default; private: gslice_array(const gslice& __gs, const valarray& __v) @@ -1977,17 +1971,14 @@ class _LIBCPP_TEMPLATE_VIS mask_array (public) _LIBCPP_INLINE_VISIBILITY operator>>=(const _Expr& __v) const; + mask_array(const mask_array&) = default; + _LIBCPP_INLINE_VISIBILITY const mask_array& operator=(const mask_array& __ma) const; _LIBCPP_INLINE_VISIBILITY void operator=(const value_type& __x) const; -// mask_array(const mask_array&) = default; -// mask_array(mask_array&&) = default; -// mask_array& operator=(const mask_array&) = default; -// mask_array& operator=(mask_array&&) = default; - private: _LIBCPP_INLINE_VISIBILITY mask_array(const valarray& __vb, const valarray& __v) @@ -2336,16 +2327,13 @@ class _LIBCPP_TEMPLATE_VIS indirect_array (public) _LIBCPP_INLINE_VISIBILITY operator>>=(const _Expr& __v) const; + indirect_array(const indirect_array&) = default; + _LIBCPP_INLINE_VISIBILITY const indirect_array& operator=(const indirect_array& __ia) const; _LIBCPP_INLINE_VISIBILITY void operator=(const value_type& __x) const; - -// indirect_array(const indirect_array&) = default; -// indirect_array(indirect_array&&) = default; -// indirect_array& operator=(const indirect_array&) = default; -// indirect_array& operator=(indirect_array&&) = default; private: _LIBCPP_INLINE_VISIBILITY From owner-svn-src-head@freebsd.org Sun Dec 22 20:35:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD9721DC3C2; Sun, 22 Dec 2019 20:35:50 +0000 (UTC) (envelope-from jeff@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 47gvPy5YnNz3L4g; Sun, 22 Dec 2019 20:35:50 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B9BD050FD; Sun, 22 Dec 2019 20:35:50 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBMKZo0H077640; Sun, 22 Dec 2019 20:35:50 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBMKZoXu077639; Sun, 22 Dec 2019 20:35:50 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912222035.xBMKZoXu077639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 22 Dec 2019 20:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356026 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356026 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 20:35:50 -0000 Author: jeff Date: Sun Dec 22 20:35:50 2019 New Revision: 356026 URL: https://svnweb.freebsd.org/changeset/base/356026 Log: Fix a bug introduced in r356002. Prior versions of this patchset had vm_page_remove() rather than !vm_page_wired() as the condition for free. When this changed back to wired the busy lock was leaked. Reported by: pho Reviewed by: markj Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Dec 22 20:34:15 2019 (r356025) +++ head/sys/vm/vm_fault.c Sun Dec 22 20:35:50 2019 (r356026) @@ -180,6 +180,8 @@ fault_page_free(vm_page_t *mp) VM_OBJECT_ASSERT_WLOCKED(m->object); if (!vm_page_wired(m)) vm_page_free(m); + else + vm_page_xunbusy(m); *mp = NULL; } } From owner-svn-src-head@freebsd.org Sun Dec 22 21:53:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01F671DE5FD; Sun, 22 Dec 2019 21:53:06 +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 47gx756HWBz3QJl; Sun, 22 Dec 2019 21:53:05 +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 D2E706071; Sun, 22 Dec 2019 21:53:05 +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 xBMLr5VR025721; Sun, 22 Dec 2019 21:53:05 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBMLr5ok025720; Sun, 22 Dec 2019 21:53:05 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912222153.xBMLr5ok025720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 22 Dec 2019 21:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356028 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 21:53:06 -0000 Author: dougm Date: Sun Dec 22 21:53:05 2019 New Revision: 356028 URL: https://svnweb.freebsd.org/changeset/base/356028 Log: Fix typo using RB_INITIALIZER. The macro RB_INITIALIZER ignores its argument, but is documented to require "&head" as argument to initialize "head". So using "_vm_phys_fictitious_tree" as the argument to initialize "vm_phys_fictitious_tree" is an inconsequential error, corrected here. Discussed with: alc Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sun Dec 22 20:36:57 2019 (r356027) +++ head/sys/vm/vm_phys.c Sun Dec 22 21:53:05 2019 (r356028) @@ -88,7 +88,7 @@ static int vm_phys_fictitious_cmp(struct vm_phys_ficti struct vm_phys_fictitious_seg *); RB_HEAD(fict_tree, vm_phys_fictitious_seg) vm_phys_fictitious_tree = - RB_INITIALIZER(_vm_phys_fictitious_tree); + RB_INITIALIZER(&vm_phys_fictitious_tree); struct vm_phys_fictitious_seg { RB_ENTRY(vm_phys_fictitious_seg) node; From owner-svn-src-head@freebsd.org Sun Dec 22 21:56:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7895D1DE7A9; Sun, 22 Dec 2019 21:56:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47gxCN2d0hz3Qdt; Sun, 22 Dec 2019 21:56:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54E236081; Sun, 22 Dec 2019 21:56:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBMLumN7026230; Sun, 22 Dec 2019 21:56:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBMLulk4026226; Sun, 22 Dec 2019 21:56:47 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912222156.xBMLulk4026226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 22 Dec 2019 21:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356029 - in head: sbin/ifconfig share/man/man4 sys/net X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: sbin/ifconfig share/man/man4 sys/net X-SVN-Commit-Revision: 356029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 21:56:48 -0000 Author: markj Date: Sun Dec 22 21:56:47 2019 New Revision: 356029 URL: https://svnweb.freebsd.org/changeset/base/356029 Log: lagg: Clean up handling of the rr_limit option. - Don't allow an unprivileged user to set the stride. [1] - Only set the stride under the softc lock. - Rename the internal fields to accurately reflect their use. Keep ro_bkt to avoid changing the user API. - Simplify the implementation. The port index is just sc_seq / stride. - Document rr_limit in ifconfig.8. Reported by: Ilja Van Sprundel [1] MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22857 Modified: head/sbin/ifconfig/ifconfig.8 head/share/man/man4/lagg.4 head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Sun Dec 22 21:53:05 2019 (r356028) +++ head/sbin/ifconfig/ifconfig.8 Sun Dec 22 21:56:47 2019 (r356029) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd August 26, 2019 +.Dd December 17, 2019 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2567,6 +2567,9 @@ means .Dq enabled . .It Cm -lacp_strict Disable lacp strict compliance on the interface. +.It Cm rr_limit Ar number +Configure a stride for an interface in round-robin mode. +The default stride is 1. .El .Pp The following parameters apply to IP tunnel interfaces, Modified: head/share/man/man4/lagg.4 ============================================================================== --- head/share/man/man4/lagg.4 Sun Dec 22 21:53:05 2019 (r356028) +++ head/share/man/man4/lagg.4 Sun Dec 22 21:56:47 2019 (r356029) @@ -166,7 +166,7 @@ Gigabit Ethernet interfaces: .Pp Create a link aggregation using ROUNDROBIN with two .Xr bge 4 -Gigabit Ethernet interfaces and set the limit of 500 packets +Gigabit Ethernet interfaces and set a stride of 500 packets per interface: .Bd -literal -offset indent # ifconfig bge0 up Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Sun Dec 22 21:53:05 2019 (r356028) +++ head/sys/net/if_lagg.c Sun Dec 22 21:56:47 2019 (r356029) @@ -1245,23 +1245,38 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) ro->ro_active += LAGG_PORTACTIVE(lp); } - ro->ro_bkt = sc->sc_bkt; + ro->ro_bkt = sc->sc_stride; ro->ro_flapping = sc->sc_flapping; ro->ro_flowid_shift = sc->flowid_shift; LAGG_XUNLOCK(sc); break; case SIOCSLAGGOPTS: - if (sc->sc_proto == LAGG_PROTO_ROUNDROBIN) { - if (ro->ro_bkt == 0) - sc->sc_bkt = 1; // Minimum 1 packet per iface. - else - sc->sc_bkt = ro->ro_bkt; - } error = priv_check(td, PRIV_NET_LAGG); if (error) break; - if (ro->ro_opts == 0) + + /* + * The stride option was added without defining a corresponding + * LAGG_OPT flag, so we must handle it before processing any + * remaining options. + */ + LAGG_XLOCK(sc); + if (ro->ro_bkt != 0) { + if (sc->sc_proto != LAGG_PROTO_ROUNDROBIN) { + LAGG_XUNLOCK(sc); + error = EINVAL; + break; + } + sc->sc_stride = ro->ro_bkt; + } else { + sc->sc_stride = 0; + } + + if (ro->ro_opts == 0) { + LAGG_XUNLOCK(sc); break; + } + /* * Set options. LACP options are stored in sc->sc_psc, * not in sc_opts. @@ -1292,8 +1307,6 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data break; } - LAGG_XLOCK(sc); - if (valid == 0 || (lacp == 1 && sc->sc_proto != LAGG_PROTO_LACP)) { /* Invalid combination of options specified. */ @@ -2033,7 +2046,6 @@ static void lagg_rr_attach(struct lagg_softc *sc) { sc->sc_seq = 0; - sc->sc_bkt_count = sc->sc_bkt; } static int @@ -2042,17 +2054,9 @@ lagg_rr_start(struct lagg_softc *sc, struct mbuf *m) struct lagg_port *lp; uint32_t p; - if (sc->sc_bkt_count == 0 && sc->sc_bkt > 0) - sc->sc_bkt_count = sc->sc_bkt; - - if (sc->sc_bkt > 0) { - atomic_subtract_int(&sc->sc_bkt_count, 1); - if (atomic_cmpset_int(&sc->sc_bkt_count, 0, sc->sc_bkt)) - p = atomic_fetchadd_32(&sc->sc_seq, 1); - else - p = sc->sc_seq; - } else - p = atomic_fetchadd_32(&sc->sc_seq, 1); + p = atomic_fetchadd_32(&sc->sc_seq, 1); + if (sc->sc_stride > 0) + p /= sc->sc_stride; p %= sc->sc_count; lp = CK_SLIST_FIRST(&sc->sc_ports); Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Sun Dec 22 21:53:05 2019 (r356028) +++ head/sys/net/if_lagg.h Sun Dec 22 21:56:47 2019 (r356029) @@ -153,7 +153,7 @@ struct lagg_reqopts { u_int ro_active; /* active port count */ u_int ro_flapping; /* number of flapping */ int ro_flowid_shift; /* shift the flowid */ - uint32_t ro_bkt; /* packet bucket for roundrobin */ + uint32_t ro_bkt; /* stride for RR */ }; #define SIOCGLAGGOPTS _IOWR('i', 152, struct lagg_reqopts) @@ -216,6 +216,7 @@ struct lagg_softc { struct ifmedia sc_media; /* media config */ void *sc_psc; /* protocol data */ uint32_t sc_seq; /* sequence counter */ + uint32_t sc_stride; /* stride for RR */ uint32_t sc_flags; int sc_destroying; /* destroying lagg */ @@ -227,8 +228,6 @@ struct lagg_softc { struct callout sc_callout; u_int sc_opts; int flowid_shift; /* shift the flowid */ - uint32_t sc_bkt; /* packates bucket for roundrobin */ - uint32_t sc_bkt_count; /* packates bucket count for roundrobin */ struct lagg_counters detached_counters; /* detached ports sum */ }; From owner-svn-src-head@freebsd.org Sun Dec 22 22:10:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 799941DEC3E; Sun, 22 Dec 2019 22:10:21 +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 47gxW12g2kz3RLV; Sun, 22 Dec 2019 22:10:21 +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 569DE6292; Sun, 22 Dec 2019 22:10:21 +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 xBMMALrb032558; Sun, 22 Dec 2019 22:10:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBMMALeD032557; Sun, 22 Dec 2019 22:10:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912222210.xBMMALeD032557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 22 Dec 2019 22:10:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356030 - head/sys/modules/uart X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/modules/uart X-SVN-Commit-Revision: 356030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 22:10:21 -0000 Author: markj Date: Sun Dec 22 22:10:20 2019 New Revision: 356030 URL: https://svnweb.freebsd.org/changeset/base/356030 Log: Compile uart_cpu_acpi.c, added in r348195, into uart.ko. PR: 242771 MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Sun Dec 22 21:56:47 2019 (r356029) +++ head/sys/modules/uart/Makefile Sun Dec 22 22:10:20 2019 (r356030) @@ -5,6 +5,7 @@ .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "i386" uart_bus_acpi=uart_bus_acpi.c +uart_cpu_acpi=uart_cpu_acpi.c .endif .if ${MACHINE_CPUARCH} == "sparc64" @@ -34,7 +35,7 @@ uart_dev_mu=uart_dev_mu.c KMOD= uart SRCS= ${uart_bus_acpi} ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \ uart_bus_pci.c uart_bus_puc.c uart_bus_scc.c \ - uart_core.c ${uart_cpu_machine} uart_dbg.c \ + uart_core.c ${uart_cpu_acpi} ${uart_cpu_machine} uart_dbg.c \ ${uart_dev_mvebu} uart_dev_ns8250.c ${uart_dev_mu} \ uart_dev_quicc.c uart_dev_sab82532.c uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c From owner-svn-src-head@freebsd.org Sun Dec 22 22:33:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BEA51DF2DE; Sun, 22 Dec 2019 22:33:23 +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 47gy1Z6zBcz3xcN; Sun, 22 Dec 2019 22:33: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 EAABB67D6; Sun, 22 Dec 2019 22:33: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 xBMMXMvd050001; Sun, 22 Dec 2019 22:33:22 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBMMXMqu050000; Sun, 22 Dec 2019 22:33:22 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912222233.xBMMXMqu050000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 22 Dec 2019 22:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356031 - head/stand/i386/gptboot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/stand/i386/gptboot X-SVN-Commit-Revision: 356031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 22:33:23 -0000 Author: ian Date: Sun Dec 22 22:33:22 2019 New Revision: 356031 URL: https://svnweb.freebsd.org/changeset/base/356031 Log: In gptboot, don't assume a partition number is a single digit, 1-9. GPT partitions can have 128 partitions, so parse contiguous digits and then validate that the number is between 1-128 inclusive. I'm not sure 128 is a hard limit in the GPT standard, but it's the common number in use, and it's a better upper limit than 9. Modified: head/stand/i386/gptboot/gptboot.c Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Sun Dec 22 22:10:20 2019 (r356030) +++ head/stand/i386/gptboot/gptboot.c Sun Dec 22 22:33:22 2019 (r356031) @@ -574,10 +574,12 @@ parse_cmds(char *cmdstr, int *dskupdated) if (arg[1] != 'p' || gdsk.dsk.unit > 9) return (-1); arg += 2; - gdsk.dsk.part = *arg - '0'; - if (gdsk.dsk.part < 1 || gdsk.dsk.part > 9) + j = 0; + while (*arg >= '0' && *arg <= '9') + j = j * 10 + *arg++ - '0'; + gdsk.dsk.part = j; + if (gdsk.dsk.part < 1 || gdsk.dsk.part > 128) return (-1); - arg++; if (arg[0] != ')') return (-1); arg++; From owner-svn-src-head@freebsd.org Mon Dec 23 02:41:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 948C21E26B5; Mon, 23 Dec 2019 02:41:14 +0000 (UTC) (envelope-from cem@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 47h3WZ3TvSz460x; Mon, 23 Dec 2019 02:41:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 72E6D9210; Mon, 23 Dec 2019 02:41:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBN2fEcC092406; Mon, 23 Dec 2019 02:41:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBN2fDte091985; Mon, 23 Dec 2019 02:41:13 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912230241.xBN2fDte091985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 23 Dec 2019 02:41:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356032 - head/usr.sbin/fstyp X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.sbin/fstyp X-SVN-Commit-Revision: 356032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 02:41:14 -0000 Author: cem Date: Mon Dec 23 02:41:13 2019 New Revision: 356032 URL: https://svnweb.freebsd.org/changeset/base/356032 Log: fstyp(8): Use iconv(3) to convert NTFS vol labels correctly Rather than hackily extracting only the ASCII subset of UTF-16LE, go ahead and convert the label to the user's locale correctly. Modified: head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/fstyp.h head/usr.sbin/fstyp/ntfs.c Modified: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- head/usr.sbin/fstyp/fstyp.c Sun Dec 22 22:33:22 2019 (r356031) +++ head/usr.sbin/fstyp/fstyp.c Mon Dec 23 02:41:13 2019 (r356032) @@ -67,7 +67,7 @@ static struct { { "ext2fs", &fstyp_ext2fs, false, NULL }, { "geli", &fstyp_geli, true, NULL }, { "msdosfs", &fstyp_msdosfs, false, NULL }, - { "ntfs", &fstyp_ntfs, false, NULL }, + { "ntfs", &fstyp_ntfs, false, NTFS_ENC }, { "ufs", &fstyp_ufs, false, NULL }, #ifdef HAVE_ZFS { "zfs", &fstyp_zfs, true, NULL }, Modified: head/usr.sbin/fstyp/fstyp.h ============================================================================== --- head/usr.sbin/fstyp/fstyp.h Sun Dec 22 22:33:22 2019 (r356031) +++ head/usr.sbin/fstyp/fstyp.h Mon Dec 23 02:41:13 2019 (r356032) @@ -38,6 +38,11 @@ /* The spec doesn't seem to permit UTF-16 surrogates; definitely LE. */ #define EXFAT_ENC "UCS-2LE" +/* + * NTFS itself is agnostic to encoding; it just stores 255 u16 wchars. In + * practice, UTF-16 seems expected for NTFS. (Maybe also for exFAT.) + */ +#define NTFS_ENC "UTF-16LE" extern bool show_label; /* -l flag */ Modified: head/usr.sbin/fstyp/ntfs.c ============================================================================== --- head/usr.sbin/fstyp/ntfs.c Sun Dec 22 22:33:22 2019 (r356031) +++ head/usr.sbin/fstyp/ntfs.c Mon Dec 23 02:41:13 2019 (r356032) @@ -31,6 +31,8 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include #include #include @@ -92,6 +94,38 @@ struct ntfs_bootfile { uint32_t bf_volsn; } __packed; +static void +convert_label(const void *label /* LE */, size_t labellen, char *label_out, + size_t label_sz) +{ + char *label_out_orig; + iconv_t cd; + size_t rc; + + /* dstname="" means convert to the current locale. */ + cd = iconv_open("", NTFS_ENC); + if (cd == (iconv_t)-1) { + warn("ntfs: Could not open iconv"); + return; + } + + label_out_orig = label_out; + + rc = iconv(cd, __DECONST(char **, &label), &labellen, &label_out, + &label_sz); + if (rc == (size_t)-1) { + warn("ntfs: iconv()"); + *label_out_orig = '\0'; + } else { + /* NUL-terminate result (iconv advances label_out). */ + if (label_sz == 0) + label_out--; + *label_out = '\0'; + } + + iconv_close(cd); +} + int fstyp_ntfs(FILE *fp, char *label, size_t size) { @@ -101,14 +135,15 @@ fstyp_ntfs(FILE *fp, char *label, size_t size) off_t voloff; char *filerecp, *ap; int8_t mftrecsz; - char vnchar; - int recsize, j; + int recsize; filerecp = NULL; bf = (struct ntfs_bootfile *)read_buf(fp, 0, 512); if (bf == NULL || strncmp(bf->bf_sysid, "NTFS ", 8) != 0) goto fail; + if (!show_label) + goto ok; mftrecsz = bf->bf_mftrecsz; recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz); @@ -127,29 +162,15 @@ fstyp_ntfs(FILE *fp, char *label, size_t size) for (ap = filerecp + fr->fr_attroff; atr = (struct ntfs_attr *)ap, (int)atr->a_type != -1; ap += atr->reclen) { - if (atr->a_type == NTFS_A_VOLUMENAME) { - if(atr->a_datalen >= size *2){ - goto fail; - } - /* - *UNICODE to ASCII. - * Should we need to use iconv(9)? - */ - for (j = 0; j < atr->a_datalen; j++) { - vnchar = *(ap + atr->a_dataoff + j); - if (j & 1) { - if (vnchar) { - goto fail; - } - } else { - label[j / 2] = vnchar; - } - } - label[j / 2] = 0; - break; - } + if (atr->a_type != NTFS_A_VOLUMENAME) + continue; + + convert_label(ap + atr->a_dataoff, + atr->a_datalen, label, size); + break; } +ok: free(bf); free(filerecp); From owner-svn-src-head@freebsd.org Mon Dec 23 05:43:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73D261E62DA; Mon, 23 Dec 2019 05:43:02 +0000 (UTC) (envelope-from cem@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 47h7YL2BtVz4GP3; Mon, 23 Dec 2019 05:43:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 46B49B423; Mon, 23 Dec 2019 05:43:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBN5h2kP003870; Mon, 23 Dec 2019 05:43:02 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBN5h1iO003866; Mon, 23 Dec 2019 05:43:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912230543.xBN5h1iO003866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 23 Dec 2019 05:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356033 - head/usr.sbin/fstyp X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.sbin/fstyp X-SVN-Commit-Revision: 356033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 05:43:02 -0000 Author: cem Date: Mon Dec 23 05:43:01 2019 New Revision: 356033 URL: https://svnweb.freebsd.org/changeset/base/356033 Log: fstyp(8): Detect HFS+ / HFSX volumes Added: head/usr.sbin/fstyp/hfsplus.c (contents, props changed) Modified: head/usr.sbin/fstyp/Makefile head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/fstyp.h Modified: head/usr.sbin/fstyp/Makefile ============================================================================== --- head/usr.sbin/fstyp/Makefile Mon Dec 23 02:41:13 2019 (r356032) +++ head/usr.sbin/fstyp/Makefile Mon Dec 23 05:43:01 2019 (r356033) @@ -3,7 +3,7 @@ .include PROG= fstyp -SRCS= cd9660.c exfat.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c +SRCS= cd9660.c exfat.c ext2fs.c fstyp.c geli.c hfsplus.c msdosfs.c ntfs.c ufs.c .if ${MK_ZFS} != "no" SRCS += zfs.c Modified: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- head/usr.sbin/fstyp/fstyp.c Mon Dec 23 02:41:13 2019 (r356032) +++ head/usr.sbin/fstyp/fstyp.c Mon Dec 23 05:43:01 2019 (r356033) @@ -66,6 +66,7 @@ static struct { { "exfat", &fstyp_exfat, false, EXFAT_ENC }, { "ext2fs", &fstyp_ext2fs, false, NULL }, { "geli", &fstyp_geli, true, NULL }, + { "hfs+", &fstyp_hfsp, false, NULL }, { "msdosfs", &fstyp_msdosfs, false, NULL }, { "ntfs", &fstyp_ntfs, false, NTFS_ENC }, { "ufs", &fstyp_ufs, false, NULL }, Modified: head/usr.sbin/fstyp/fstyp.h ============================================================================== --- head/usr.sbin/fstyp/fstyp.h Mon Dec 23 02:41:13 2019 (r356032) +++ head/usr.sbin/fstyp/fstyp.h Mon Dec 23 05:43:01 2019 (r356033) @@ -54,6 +54,7 @@ int fstyp_cd9660(FILE *fp, char *label, size_t size); int fstyp_exfat(FILE *fp, char *label, size_t size); int fstyp_ext2fs(FILE *fp, char *label, size_t size); int fstyp_geli(FILE *fp, char *label, size_t size); +int fstyp_hfsp(FILE *fp, char *label, size_t size); int fstyp_msdosfs(FILE *fp, char *label, size_t size); int fstyp_ntfs(FILE *fp, char *label, size_t size); int fstyp_ufs(FILE *fp, char *label, size_t size); Added: head/usr.sbin/fstyp/hfsplus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/hfsplus.c Mon Dec 23 05:43:01 2019 (r356033) @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2019 Conrad Meyer . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fstyp.h" + +/* + * https://developer.apple.com/library/archive/technotes/tn/tn1150.html + */ + +#define VOL_HDR_OFF 1024 + +typedef uint32_t hfsp_cat_nodeid; + +typedef struct hfsp_ext_desc { + uint32_t ex_startBlock; + uint32_t ex_blockCount; +} hfsp_ext_desc; + +typedef struct hfsp_fork_data { + uint64_t fd_logicalSz; + uint32_t fd_clumpSz; + uint32_t fd_totalBlocks; + hfsp_ext_desc fd_extents[8]; +} hfsp_fork_data; + +struct hfsp_vol_hdr { + char hp_signature[2]; + uint16_t hp_version; + uint32_t hp_attributes; + uint32_t hp_lastMounted; + uint32_t hp_journalInfoBlock; + + /* Creation / etc dates. */ + uint32_t hp_create; + uint32_t hp_modify; + uint32_t hp_backup; + uint32_t hp_checked; + + /* Stats */ + uint32_t hp_files; + uint32_t hp_folders; + + /* Parameters */ + uint32_t hp_blockSize; + uint32_t hp_totalBlocks; + uint32_t hp_freeBlocks; + + uint32_t hp_nextAlloc; + uint32_t hp_rsrcClumpSz; + uint32_t hp_dataClumpSz; + + hfsp_cat_nodeid hp_nextCatID; + + uint32_t hp_writeCount; + uint64_t hp_encodingsBM; + + uint32_t hp_finderInfo[8]; + + hfsp_fork_data hp_allocationFile; + hfsp_fork_data hp_extentsFile; + hfsp_fork_data hp_catalogFile; + hfsp_fork_data hp_attributesFile; + hfsp_fork_data hp_startupFile; +}; +_Static_assert(sizeof(struct hfsp_vol_hdr) == 512, ""); + +int +fstyp_hfsp(FILE *fp, char *label, size_t size) +{ + struct hfsp_vol_hdr *hdr; + int retval; + + retval = 1; + hdr = read_buf(fp, VOL_HDR_OFF, sizeof(*hdr)); + if (hdr == NULL) + goto fail; + + if ((strncmp(hdr->hp_signature, "H+", 2) != 0 || hdr->hp_version != 4) + && + (strncmp(hdr->hp_signature, "HX", 2) != 0 || hdr->hp_version != 5)) + goto fail; + + /* This is an HFS+ volume. */ + retval = 0; + + /* No label support yet. */ + +fail: + free(hdr); + return (retval); +} From owner-svn-src-head@freebsd.org Mon Dec 23 05:43:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A63281E642A; Mon, 23 Dec 2019 05:43:19 +0000 (UTC) (envelope-from cem@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 47h7Yg3h18z4GXw; Mon, 23 Dec 2019 05:43:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7634DB425; Mon, 23 Dec 2019 05:43:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBN5hJHp003931; Mon, 23 Dec 2019 05:43:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBN5hIQa003927; Mon, 23 Dec 2019 05:43:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912230543.xBN5hIQa003927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 23 Dec 2019 05:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356034 - head/usr.sbin/fstyp X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.sbin/fstyp X-SVN-Commit-Revision: 356034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 05:43:19 -0000 Author: cem Date: Mon Dec 23 05:43:18 2019 New Revision: 356034 URL: https://svnweb.freebsd.org/changeset/base/356034 Log: fstyp(8): Detect APFS containers APFS NXSBs are more like slices (or zvols?) than individual filesystem, but go ahead and detect them nicely as well. Added: head/usr.sbin/fstyp/apfs.c (contents, props changed) Modified: head/usr.sbin/fstyp/Makefile head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/fstyp.h Modified: head/usr.sbin/fstyp/Makefile ============================================================================== --- head/usr.sbin/fstyp/Makefile Mon Dec 23 05:43:01 2019 (r356033) +++ head/usr.sbin/fstyp/Makefile Mon Dec 23 05:43:18 2019 (r356034) @@ -3,7 +3,7 @@ .include PROG= fstyp -SRCS= cd9660.c exfat.c ext2fs.c fstyp.c geli.c hfsplus.c msdosfs.c ntfs.c ufs.c +SRCS= apfs.c cd9660.c exfat.c ext2fs.c fstyp.c geli.c hfsplus.c msdosfs.c ntfs.c ufs.c .if ${MK_ZFS} != "no" SRCS += zfs.c Added: head/usr.sbin/fstyp/apfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/apfs.c Mon Dec 23 05:43:18 2019 (r356034) @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2019 Conrad Meyer . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fstyp.h" + +/* + * This really detects the container format, which might be best supported by + * geom_part or a special GEOM class. + * + * https://developer.apple.com/support/downloads/Apple-File-System-Reference.pdf + */ + +#define NX_CKSUM_SZ 8 + +typedef uint64_t nx_oid_t; + +typedef uint64_t nx_xid_t; + +struct nx_obj { + uint8_t o_cksum[NX_CKSUM_SZ]; /* Fletcher 64 */ + nx_oid_t o_oid; + nx_xid_t o_xid; + uint32_t o_type; + uint32_t o_subtype; +}; + +/* nx_obj::o_oid */ +#define OID_NX_SUPERBLOCK 1 + +/* nx_obj::o_type: */ +#define OBJECT_TYPE_MASK 0x0000ffff +#define OBJECT_TYPE_NX_SUPERBLOCK 0x00000001 +#define OBJECT_TYPE_FLAGS_MASK 0xffff0000 +#define OBJ_STORAGETYPE_MASK 0xc0000000 +#define OBJECT_TYPE_FLAGS_DEFINED_MASK 0xf8000000 +#define OBJ_STORAGE_VIRTUAL 0x00000000 +#define OBJ_STORAGE_EPHEMERAL 0x80000000 +#define OBJ_STORAGE_PHYSICAL 0x40000000 +#define OBJ_NOHEADER 0x20000000 +#define OBJ_ENCRYPTED 0x10000000 +#define OBJ_NONPERSISTENT 0x08000000 + +struct nx_superblock { + struct nx_obj nx_o; + char nx_magic[4]; + /* ... other stuff that doesn't matter */ +}; + +int +fstyp_apfs(FILE *fp, char *label, size_t size) +{ + struct nx_superblock *csb; + int retval; + + retval = 1; + csb = read_buf(fp, 0, sizeof(*csb)); + if (csb == NULL) + goto fail; + + /* Ideally, checksum the SB here. */ + if (strncmp(csb->nx_magic, "NXSB", 4) != 0 || + csb->nx_o.o_oid != OID_NX_SUPERBLOCK || + (csb->nx_o.o_type & OBJECT_TYPE_MASK) != OBJECT_TYPE_NX_SUPERBLOCK) + goto fail; + + retval = 0; + + /* No label support yet. */ + +fail: + free(csb); + return (retval); +} Modified: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- head/usr.sbin/fstyp/fstyp.c Mon Dec 23 05:43:01 2019 (r356033) +++ head/usr.sbin/fstyp/fstyp.c Mon Dec 23 05:43:18 2019 (r356034) @@ -62,6 +62,7 @@ static struct { bool unmountable; char *precache_encoding; } fstypes[] = { + { "apfs", &fstyp_apfs, true, NULL }, { "cd9660", &fstyp_cd9660, false, NULL }, { "exfat", &fstyp_exfat, false, EXFAT_ENC }, { "ext2fs", &fstyp_ext2fs, false, NULL }, Modified: head/usr.sbin/fstyp/fstyp.h ============================================================================== --- head/usr.sbin/fstyp/fstyp.h Mon Dec 23 05:43:01 2019 (r356033) +++ head/usr.sbin/fstyp/fstyp.h Mon Dec 23 05:43:18 2019 (r356034) @@ -50,6 +50,7 @@ void *read_buf(FILE *fp, off_t off, size_t len); char *checked_strdup(const char *s); void rtrim(char *label, size_t size); +int fstyp_apfs(FILE *fp, char *label, size_t size); int fstyp_cd9660(FILE *fp, char *label, size_t size); int fstyp_exfat(FILE *fp, char *label, size_t size); int fstyp_ext2fs(FILE *fp, char *label, size_t size); From owner-svn-src-head@freebsd.org Mon Dec 23 08:12:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFC941E925E for ; Mon, 23 Dec 2019 08:12:04 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-zteg10011401.me.com (pv50p00im-zteg10011401.me.com [17.58.6.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47hBsJ2DPzz4Mf3 for ; Mon, 23 Dec 2019 08:12:04 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-zteg10011401.me.com (Postfix) with ESMTPSA id 2414490071E; Mon, 23 Dec 2019 08:12:00 +0000 (UTC) From: Toomas Soome Message-Id: Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: svn commit: r356031 - head/stand/i386/gptboot Date: Mon, 23 Dec 2019 10:11:58 +0200 In-Reply-To: <201912222233.xBMMXMqu050000@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Ian Lepore References: <201912222233.xBMMXMqu050000@repo.freebsd.org> X-Mailer: Apple Mail (2.3608.40.2.2.4) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-12-23_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1912230071 X-Rspamd-Queue-Id: 47hBsJ2DPzz4Mf3 X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; FREEMAIL_FROM(0.00)[me.com]; MV_CASE(0.50)[]; URI_COUNT_ODD(1.00)[3]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; RECEIVED_SPAMHAUS_PBL(0.00)[148.52.235.80.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; RCVD_IN_DNSWL_LOW(-0.10)[41.6.58.17.list.dnswl.org : 127.0.5.1]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[me.com]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.00)[ip: (-3.94), ipnet: 17.58.0.0/20(-1.88), asn: 714(-2.18), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[me.com.dwl.dnswl.org : 127.0.5.1]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 08:12:05 -0000 The only limit set by specification is: A minimum of 16,384 bytes of space must be reserved for the GPT = Partition Entry Array. =46rom this size and array entry size we do get 128, but specification = does not limit the max number. rgds, toomas > On 23. Dec 2019, at 00:33, Ian Lepore wrote: >=20 > Author: ian > Date: Sun Dec 22 22:33:22 2019 > New Revision: 356031 > URL: https://svnweb.freebsd.org/changeset/base/356031 >=20 > Log: > In gptboot, don't assume a partition number is a single digit, 1-9. = GPT > partitions can have 128 partitions, so parse contiguous digits and = then > validate that the number is between 1-128 inclusive. >=20 > I'm not sure 128 is a hard limit in the GPT standard, but it's the = common > number in use, and it's a better upper limit than 9. >=20 > Modified: > head/stand/i386/gptboot/gptboot.c >=20 > Modified: head/stand/i386/gptboot/gptboot.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/stand/i386/gptboot/gptboot.c Sun Dec 22 22:10:20 2019 = (r356030) > +++ head/stand/i386/gptboot/gptboot.c Sun Dec 22 22:33:22 2019 = (r356031) > @@ -574,10 +574,12 @@ parse_cmds(char *cmdstr, int *dskupdated) > if (arg[1] !=3D 'p' || gdsk.dsk.unit > = 9) > return (-1); > arg +=3D 2; > - gdsk.dsk.part =3D *arg - '0'; > - if (gdsk.dsk.part < 1 || gdsk.dsk.part > = 9) > + j =3D 0; > + while (*arg >=3D '0' && *arg <=3D '9') > + j =3D j * 10 + *arg++ - '0'; > + gdsk.dsk.part =3D j; > + if (gdsk.dsk.part < 1 || gdsk.dsk.part > = 128) > return (-1); > - arg++; > if (arg[0] !=3D ')') > return (-1); > arg++; From owner-svn-src-head@freebsd.org Mon Dec 23 09:22:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F16E61EAB53; Mon, 23 Dec 2019 09:22:36 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47hDQg2gRCz4QgH; Mon, 23 Dec 2019 09:22:34 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 60A30B20B2A; Mon, 23 Dec 2019 12:22:30 +0300 (MSK) Received: from sas1-5ebd8269dbc4.qloud-c.yandex.net (sas1-5ebd8269dbc4.qloud-c.yandex.net [2a02:6b8:c14:3611:0:640:5ebd:8269]) by mxback18j.mail.yandex.net (mxback/Yandex) with ESMTP id ubpqFeqCGh-MUOKTgDL; Mon, 23 Dec 2019 12:22:30 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1577092950; bh=3C+d7p/zLF4f9IwmUXqZuHWRR/9u8tsvO814vnryVCE=; h=In-Reply-To:From:To:Subject:Cc:Date:References:Message-ID; b=aQokPCrUvSieL23y7aFLK+QALu8Nbr2P18YTr9w640YyBTBMtd6SuSWmg5L3Gw/qz HT3qEzt9MlplwgpNWL9/OA6wnSsnIrn3OsWqK2aoUrLPYhrHYt8PEloi/aUDx5mJqO 84LkAEiFbu0AGmxe8nGXnyv1Ce93NVWO8QuLbp7Q= Received: by sas1-5ebd8269dbc4.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id Pqv2nbio6W-MTWOMkLv; Mon, 23 Dec 2019 12:22:29 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Subject: Re: svn commit: r343631 - in head: . sbin sbin/pfilctl share/man/man9 sys/contrib/ipfilter/netinet sys/net sys/netinet sys/netinet6 sys/netpfil/ipfw sys/netpfil/pf To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201901312301.x0VN13lM097213@repo.freebsd.org> <20191220221415.GU2706@FreeBSD.org> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Autocrypt: addr=bu7cher@yandex.ru; prefer-encrypt=mutual; keydata= mQENBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB AAG0JUFuZHJleSBWLiBFbHN1a292IDxidTdjaGVyQHlhbmRleC5ydT6JATgEEwECACIFAkwB F1kCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEAHF6gQQyKF6qmYIAI6ekfm1VA4T vqankI1ISE6ku4jV7UlpIQlEbE7/8n3Zd6teJ+pGOQhN5qk8QE7utdPdbktAzi+x7LIJVzUw 4TywZLXGrkP7VKYkfg6oyCGyzITghefQeJtr2TN4hYCkzPWpylkue8MtmqfZv/6royqwTbN+ +E09FQNvTgRUYJYTeQ1qOsxNRycwvw3dr2rOfuxShbzaHBB1pBIjGrMg8fC5pd65ACH5zuFV A0CoTNGMDrEZSfBkTW604UUHFFXeCoC3dwDZRKOWJ3GmMXns65Ai5YkA63BSHEE1Qle3VBhd cG1w0CB5FBV3pB27UVnf0jEbysrDqW4qN7XMRFSWNAy5AQ0ETAEXWQEIAJ2p6l9LBoqdH/0J PEFDY2t2gTvAuzz+8zs3R03dFuHcNbOwjvWCG0aOmVpAzkRa8egn5JB4sZaFUtKPYJEQ1Iu+ LUBwgvtXf4vWpzC67zs2dDuiW4LamH5p6xkTD61aHR7mCB3bg2TUjrDWn2Jt44cvoYxj3dz4 S49U1rc9ZPgD5axCNv45j72tggWlZvpefThP7xT1OlNTUqye2gAwQravXpZkl5JG4eOqJVIU X316iE3qso0iXRUtO7OseBf0PiVmk+wCahdreHOeOxK5jMhYkPKVn7z1sZiB7W2H2TojbmcK HZC22sz7Z/H36Lhg1+/RCnGzdEcjGc8oFHXHCxUAEQEAAYkBHwQYAQIACQUCTAEXWQIbDAAK CRABxeoEEMihegkYCAC3ivGYNe2taNm/4Nx5GPdzuaAJGKWksV+w9mo7dQvU+NmI2az5w8vw 98OmX7G0OV9snxMW+6cyNqBrVFTu33VVNzz9pnqNCHxGvj5dL5ltP160JV2zw2bUwJBYsgYQ WfyJJIM7l3gv5ZS3DGqaGIm9gOK1ANxfrR5PgPzvI9VxDhlr2juEVMZYAqPLEJe+SSxbwLoz BcFCNdDAyXcaAzXsx/E02YWm1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i Message-ID: Date: Mon, 23 Dec 2019 12:20:58 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191220221415.GU2706@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7OFBiQOAjyGo7WWEmRVjawecomRia8O3D" X-Rspamd-Queue-Id: 47hDQg2gRCz4QgH X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yandex.ru header.s=mail header.b=aQokPCrU; dmarc=pass (policy=none) header.from=yandex.ru; spf=pass (mx1.freebsd.org: domain of bu7cher@yandex.ru designates 2a02:6b8:0:801:2::108 as permitted sender) smtp.mailfrom=bu7cher@yandex.ru X-Spamd-Result: default: False [-6.20 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yandex.ru]; R_SPF_ALLOW(-0.20)[+ip6:2a02:6b8:0::/52]; HAS_ATTACHMENT(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[yandex.ru:+]; DMARC_POLICY_ALLOW(-0.50)[yandex.ru,none]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[8.0.1.0.0.0.0.0.0.0.0.0.2.0.0.0.1.0.8.0.0.0.0.0.8.b.6.0.2.0.a.2.list.dnswl.org : 127.0.5.1]; ASN(0.00)[asn:13238, ipnet:2a02:6b8::/32, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[yandex.ru:s=mail]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain]; IP_SCORE(0.00)[ip: (-9.22), ipnet: 2a02:6b8::/32(-4.71), asn: 13238(-3.79), country: RU(0.01)]; FREEMAIL_ENVFROM(0.00)[yandex.ru]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[yandex.ru.dwl.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 09:22:37 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7OFBiQOAjyGo7WWEmRVjawecomRia8O3D Content-Type: multipart/mixed; boundary="GDqUXJVC026hZAx5O9EdaTS588kuhLamF"; protected-headers="v1" From: "Andrey V. Elsukov" To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r343631 - in head: . sbin sbin/pfilctl share/man/man9 sys/contrib/ipfilter/netinet sys/net sys/netinet sys/netinet6 sys/netpfil/ipfw sys/netpfil/pf References: <201901312301.x0VN13lM097213@repo.freebsd.org> <20191220221415.GU2706@FreeBSD.org> In-Reply-To: <20191220221415.GU2706@FreeBSD.org> --GDqUXJVC026hZAx5O9EdaTS588kuhLamF Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 21.12.2019 01:14, Gleb Smirnoff wrote: > A> > Another future feature is possiblity to create pfil heads, that = provide > A> > not an mbuf pointer but just a memory pointer with length. That = would > A> > allow filtering at very early stages of a packet lifecycle, e.g.= when > A> > packet has just been received by a NIC and no mbuf was yet alloc= ated. > A> It seems that this commit has changed the error code returned from > A> ip[6]_output() when a packet is blocked. Previously it was EACCES, b= ut > A> now it became EPERM. Was it intentional? >=20 > I don't think that was intentional. Can you please review this patch? LGTM, thanks! --=20 WBR, Andrey V. Elsukov --GDqUXJVC026hZAx5O9EdaTS588kuhLamF-- --7OFBiQOAjyGo7WWEmRVjawecomRia8O3D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAl4AhvoACgkQAcXqBBDI oXpHIQgArYozNTmPp9GDP3bQnt5Z3KkWad+6pYkG+jUG/II86zX89lmvCTc2wRCh i4npymF/JzpLRhuQak/fWlRK5SdVgq1yLIZva0SGaBCo/jAaXs3f4NjlpzLh/zE8 NfQiZO5E4XgbG05fvGlrU3EAClKf0v5k6S9a3ueSueMZsU4Ly/LM2aPlLktxxtN4 KZdEqc5w/ajYG3sH5xbXuEyOtF0zvS4wfO4HI+GDT2/FsNYMPg+VY0mIeTIsCy+G OQqZ4WE7OlaFNUq6EJrbEvE74zQNjH7VTij+ua7upunmcShtxHED1fAiGIc/lMGw Tj9BVUZiq91PuO9Vpcohr3zAxOxN4A== =5rZp -----END PGP SIGNATURE----- --7OFBiQOAjyGo7WWEmRVjawecomRia8O3D-- From owner-svn-src-head@freebsd.org Mon Dec 23 20:15:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CAB61CF6A5; Mon, 23 Dec 2019 20:15:20 +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 47hVvr0Lmlz417t; Mon, 23 Dec 2019 20:15:20 +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 074991D069; Mon, 23 Dec 2019 20:15:20 +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 xBNKFJf5020143; Mon, 23 Dec 2019 20:15:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNKFJTR020142; Mon, 23 Dec 2019 20:15:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912232015.xBNKFJTR020142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 23 Dec 2019 20:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356038 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356038 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 20:15:20 -0000 Author: kib Date: Mon Dec 23 20:15:19 2019 New Revision: 356038 URL: https://svnweb.freebsd.org/changeset/base/356038 Log: Do not use waitable allocation of pbuf when creating cluster for write. Previously just ensuring that we do not sleep when clustering for md(4) vnode was enough. Now, with the switch of the pbuf allocator to uma and completely broken per-subsystem pbuf limits, it might cause unbounded sleep even for non-md(4) vnodes. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22899 Modified: head/sys/kern/vfs_cluster.c Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Mon Dec 23 16:34:39 2019 (r356037) +++ head/sys/kern/vfs_cluster.c Mon Dec 23 20:15:19 2019 (r356038) @@ -865,8 +865,7 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t st (tbp->b_bcount != tbp->b_bufsize) || (tbp->b_bcount != size) || (len == 1) || - ((bp = uma_zalloc(cluster_pbuf_zone, - (vp->v_vflag & VV_MD) != 0 ? M_NOWAIT : M_WAITOK)) == NULL)) { + ((bp = uma_zalloc(cluster_pbuf_zone, M_NOWAIT)) == NULL)) { totalwritten += tbp->b_bufsize; bawrite(tbp); ++start_lbn; From owner-svn-src-head@freebsd.org Mon Dec 23 20:18:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E48811CF75A; Mon, 23 Dec 2019 20:18:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47hVz25jWpz41JF; Mon, 23 Dec 2019 20:18:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE65E1D07F; Mon, 23 Dec 2019 20:18:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBNKI6ht020303; Mon, 23 Dec 2019 20:18:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNKI6hi020301; Mon, 23 Dec 2019 20:18:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912232018.xBNKI6hi020301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 23 Dec 2019 20:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356039 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 356039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 20:18:07 -0000 Author: kib Date: Mon Dec 23 20:18:05 2019 New Revision: 356039 URL: https://svnweb.freebsd.org/changeset/base/356039 Log: Fix undefined behavior: left-shifting into the sign bit. Reviewed by: dim, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22898 Modified: head/sys/sys/_sigset.h head/sys/sys/bitset.h Modified: head/sys/sys/_sigset.h ============================================================================== --- head/sys/sys/_sigset.h Mon Dec 23 20:15:19 2019 (r356038) +++ head/sys/sys/_sigset.h Mon Dec 23 20:18:05 2019 (r356039) @@ -47,7 +47,7 @@ #define _SIG_MAXSIG 128 #define _SIG_IDX(sig) ((sig) - 1) #define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) -#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31)) +#define _SIG_BIT(sig) (1U << (_SIG_IDX(sig) & 31)) #define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) typedef struct __sigset { Modified: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Mon Dec 23 20:15:19 2019 (r356038) +++ head/sys/sys/bitset.h Mon Dec 23 20:18:05 2019 (r356039) @@ -41,7 +41,7 @@ #define __constexpr_cond(expr) (__builtin_constant_p((expr)) && (expr)) #define __bitset_mask(_s, n) \ - (1L << (__constexpr_cond(__bitset_words((_s)) == 1) ? \ + (1UL << (__constexpr_cond(__bitset_words((_s)) == 1) ? \ (__size_t)(n) : ((n) % _BITSET_BITS))) #define __bitset_word(_s, n) \ From owner-svn-src-head@freebsd.org Mon Dec 23 20:23:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E6431CFAB5; Mon, 23 Dec 2019 20:23:04 +0000 (UTC) (envelope-from cem@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 47hW4m0s65z41vW; Mon, 23 Dec 2019 20:23:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 189D81D226; Mon, 23 Dec 2019 20:23:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBNKN3Mm026129; Mon, 23 Dec 2019 20:23:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNKN33Y026124; Mon, 23 Dec 2019 20:23:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912232023.xBNKN33Y026124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 23 Dec 2019 20:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356041 - head/usr.sbin/fstyp X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.sbin/fstyp X-SVN-Commit-Revision: 356041 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 20:23:04 -0000 Author: cem Date: Mon Dec 23 20:23:02 2019 New Revision: 356041 URL: https://svnweb.freebsd.org/changeset/base/356041 Log: fstyp(8): Fix WITHOUT_ICONV build Reported by: olivier Modified: head/usr.sbin/fstyp/Makefile head/usr.sbin/fstyp/apfs.c head/usr.sbin/fstyp/exfat.c head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/hfsplus.c head/usr.sbin/fstyp/ntfs.c Modified: head/usr.sbin/fstyp/Makefile ============================================================================== --- head/usr.sbin/fstyp/Makefile Mon Dec 23 20:19:23 2019 (r356040) +++ head/usr.sbin/fstyp/Makefile Mon Dec 23 20:23:02 2019 (r356041) @@ -13,6 +13,10 @@ MAN= fstyp.8 WARNS?= 2 +.if ${MK_ICONV} == "yes" +CFLAGS+= -DWITH_ICONV +.endif + .include .if ${TARGET_ENDIANNESS} == 1234 Modified: head/usr.sbin/fstyp/apfs.c ============================================================================== --- head/usr.sbin/fstyp/apfs.c Mon Dec 23 20:19:23 2019 (r356040) +++ head/usr.sbin/fstyp/apfs.c Mon Dec 23 20:23:02 2019 (r356041) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/usr.sbin/fstyp/exfat.c ============================================================================== --- head/usr.sbin/fstyp/exfat.c Mon Dec 23 20:19:23 2019 (r356040) +++ head/usr.sbin/fstyp/exfat.c Mon Dec 23 20:23:02 2019 (r356041) @@ -33,7 +33,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef WITH_ICONV #include +#endif #include #include #include @@ -184,6 +186,7 @@ exfat_compute_boot_chksum(FILE *fp, unsigned region, u return (0); } +#ifdef WITH_ICONV static void convert_label(const uint16_t *ucs2label /* LE */, unsigned ucs2len, char *label_out, size_t label_sz) @@ -316,6 +319,7 @@ exfat_find_label(FILE *fp, const struct exfat_vbr *ev, free(declust); } } +#endif /* WITH_ICONV */ int fstyp_exfat(FILE *fp, char *label, size_t size) @@ -356,8 +360,10 @@ fstyp_exfat(FILE *fp, char *label, size_t size) goto done; } +#ifdef WITH_ICONV if (show_label) exfat_find_label(fp, ev, bytespersec, label, size); +#endif done: free(cksect); Modified: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- head/usr.sbin/fstyp/fstyp.c Mon Dec 23 20:19:23 2019 (r356040) +++ head/usr.sbin/fstyp/fstyp.c Mon Dec 23 20:23:02 2019 (r356041) @@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef WITH_ICONV #include +#endif #include #include #include @@ -199,6 +201,7 @@ main(int argc, char **argv) err(1, "setlocale"); caph_cache_catpages(); +#ifdef WITH_ICONV /* Cache iconv conversion data before entering capability mode. */ if (show_label) { for (i = 0; i < nitems(fstypes); i++) { @@ -214,6 +217,7 @@ main(int argc, char **argv) iconv_close(cd); } } +#endif fp = fopen(path, "r"); if (fp == NULL) Modified: head/usr.sbin/fstyp/hfsplus.c ============================================================================== --- head/usr.sbin/fstyp/hfsplus.c Mon Dec 23 20:19:23 2019 (r356040) +++ head/usr.sbin/fstyp/hfsplus.c Mon Dec 23 20:23:02 2019 (r356041) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/usr.sbin/fstyp/ntfs.c ============================================================================== --- head/usr.sbin/fstyp/ntfs.c Mon Dec 23 20:19:23 2019 (r356040) +++ head/usr.sbin/fstyp/ntfs.c Mon Dec 23 20:23:02 2019 (r356041) @@ -32,7 +32,9 @@ __FBSDID("$FreeBSD$"); #include +#ifdef WITH_ICONV #include +#endif #include #include #include @@ -94,6 +96,7 @@ struct ntfs_bootfile { uint32_t bf_volsn; } __packed; +#ifdef WITH_ICONV static void convert_label(const void *label /* LE */, size_t labellen, char *label_out, size_t label_sz) @@ -125,6 +128,7 @@ convert_label(const void *label /* LE */, size_t label iconv_close(cd); } +#endif int fstyp_ntfs(FILE *fp, char *label, size_t size) @@ -142,6 +146,7 @@ fstyp_ntfs(FILE *fp, char *label, size_t size) bf = (struct ntfs_bootfile *)read_buf(fp, 0, 512); if (bf == NULL || strncmp(bf->bf_sysid, "NTFS ", 8) != 0) goto fail; +#ifdef WITH_ICONV if (!show_label) goto ok; @@ -171,6 +176,7 @@ fstyp_ntfs(FILE *fp, char *label, size_t size) } ok: +#endif /* WITH_ICONV */ free(bf); free(filerecp); From owner-svn-src-head@freebsd.org Mon Dec 23 20:41:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 495271D0043; Mon, 23 Dec 2019 20:41:56 +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 47hWVX1GsPz42pZ; Mon, 23 Dec 2019 20:41:56 +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 0C5CE1D592; Mon, 23 Dec 2019 20:41:56 +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 xBNKfttJ038447; Mon, 23 Dec 2019 20:41:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNKft9X038446; Mon, 23 Dec 2019 20:41:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912232041.xBNKft9X038446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 23 Dec 2019 20:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356042 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 356042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 20:41:56 -0000 Author: mav Date: Mon Dec 23 20:41:55 2019 New Revision: 356042 URL: https://svnweb.freebsd.org/changeset/base/356042 Log: Make pass(4) handle misaligned buffers of MAXPHYS size. Since we are already using malloc()+copyin()/copyout() for smaller data blocks, and since new asynchronous API does it always, I see no reason to keep this ugly artificial size/alignment limitation in old API. Tape applications suffer enough from the MAXPHYS limitations by itself, and additional alignment requirement, often halving effectively usable block size, does not help. It would be good to use unmapped I/O here instead, but it require some HBA drivers polishing first to support non-BIO unmapped buffers. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Mon Dec 23 20:23:02 2019 (r356041) +++ head/sys/cam/cam_periph.c Mon Dec 23 20:41:55 2019 (r356042) @@ -786,6 +786,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma u_int8_t **data_ptrs[CAM_PERIPH_MAXMAPS]; u_int32_t lengths[CAM_PERIPH_MAXMAPS]; u_int32_t dirs[CAM_PERIPH_MAXMAPS]; + bool misaligned[CAM_PERIPH_MAXMAPS]; bzero(mapinfo, sizeof(*mapinfo)); if (maxmap == 0) @@ -897,6 +898,12 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma * have to unmap any previously mapped buffers. */ for (i = 0; i < numbufs; i++) { + if (lengths[i] > maxmap) { + printf("cam_periph_mapmem: attempt to map %lu bytes, " + "which is greater than %lu\n", + (long)(lengths[i]), (u_long)maxmap); + return (E2BIG); + } /* * The userland data pointer passed in may not be page @@ -906,15 +913,8 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma * whatever extra space is necessary to make it to the page * boundary. */ - if ((lengths[i] + - (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK)) > maxmap){ - printf("cam_periph_mapmem: attempt to map %lu bytes, " - "which is greater than %lu\n", - (long)(lengths[i] + - (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK)), - (u_long)maxmap); - return(E2BIG); - } + misaligned[i] = (lengths[i] + + (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK) > MAXPHYS); } /* @@ -938,7 +938,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma * small allocations malloc is backed by UMA, and so much * cheaper on SMP systems. */ - if (lengths[i] <= periph_mapmem_thresh && + if ((lengths[i] <= periph_mapmem_thresh || misaligned[i]) && ccb->ccb_h.func_code != XPT_MMC_IO) { *data_ptrs[i] = malloc(lengths[i], M_CAMPERIPH, M_WAITOK); From owner-svn-src-head@freebsd.org Mon Dec 23 21:14:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3466D1D0753; Mon, 23 Dec 2019 21:14:21 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47hXCx0bcSz43ry; Mon, 23 Dec 2019 21:14:21 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 03452B28B; Mon, 23 Dec 2019 21:14:21 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f170.google.com with SMTP id w127so14545840qkb.11; Mon, 23 Dec 2019 13:14:20 -0800 (PST) X-Gm-Message-State: APjAAAVcVrB2q2kzsNBxh1Knp8Rxuvaqg77LEpWX4MHpje4v7iel0kUf DwDeKCsMRY27hBErBUXGLU2BAUxYHYdPns+NpJw= X-Google-Smtp-Source: APXvYqyO3QybKHVRVVsTTofS1madrxaun1zf0LrpoV/nYVTjCI6YCFdvFa+1EKSL71IOwVRwJdb55D4OYml4jdNFgfk= X-Received: by 2002:a37:4fd0:: with SMTP id d199mr28794997qkb.103.1577135660173; Mon, 23 Dec 2019 13:14:20 -0800 (PST) MIME-Version: 1.0 References: <201912201622.xBKGMEdl019516@repo.freebsd.org> In-Reply-To: <201912201622.xBKGMEdl019516@repo.freebsd.org> From: Kyle Evans Date: Mon, 23 Dec 2019 15:14:07 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355936 - in head/sys: arm/broadcom/bcm2835 arm/freescale/imx arm/ti/am335x arm/versatile powerpc/ofw To: src-committers Cc: svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 21:14:21 -0000 On Fri, Dec 20, 2019 at 10:22 AM Kyle Evans wrote: > > Author: kevans > Date: Fri Dec 20 16:22:14 2019 > New Revision: 355936 > URL: https://svnweb.freebsd.org/changeset/base/355936 > > Log: > Kill off dummy kbd drivers > > As far as I can tell, these are an artifact of times when linker sets > couldn't be empty, otherwise the kernel build would fail due to unresolved > symbols. hselasky fixed this in r268138, and I've audited the kbd portions > to make sure nothing would blow up due to the empty linker set and > successfully compiled+ran a kernel with no keyboard support at all. > > Kill them off now since they're no longer required. > > MFC after: 1 week > It turns out that I missed one of these in ^/sys/dev/terasic/mtl/terasic_mtl_syscons.c, which has the following note that shows my analysis to be not inaccurate but incorrect: /* * XXXRW: For historical reasons, syscons can't register video consoles * without a keyboard implementation. Provide a dummy. */ As far as I can tell, this isn't the case anymore as sckbdprobe's return value is ignored and other references to the keyboard appear to be properly gated on sc->keyboard being valid. I only have a single machine that can run syscons, but I built a kernel with the same modifications to remove all of the keyboard drivers (-ukbd, kbdmux, hyperv) for that machine and encountered no problems in practice. I will proceed with removing the last dummy driver and MFC as scheduled. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Mon Dec 23 21:32:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A73A21D0BBC; Mon, 23 Dec 2019 21:32:08 +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 47hXcS3dpxz44RP; Mon, 23 Dec 2019 21:32:08 +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 781181DE9A; Mon, 23 Dec 2019 21:32:08 +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 xBNLW8n8066408; Mon, 23 Dec 2019 21:32:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNLW7vC066405; Mon, 23 Dec 2019 21:32:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912232132.xBNLW7vC066405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 23 Dec 2019 21:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356043 - in head/sys: dev/syscons isa X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: dev/syscons isa X-SVN-Commit-Revision: 356043 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 21:32:08 -0000 Author: kevans Date: Mon Dec 23 21:32:07 2019 New Revision: 356043 URL: https://svnweb.freebsd.org/changeset/base/356043 Log: syscons: drop keyboard index from softc Analysis seems to reveal that sc->keyboard >= 0 implies sc->kbd != NULL and there's no such scenario where sc->kbd is set (and theoretically used to rebuild sc->keyboard) with the keyboard unavailable. Drop the index softc. The index is only explicitly needed in few places, in which case we can just as easily grab it from sc->kbd. There's no need for keeping sc->kbd and sc->keyboard in sync when it can be readily accomplished with just the former. Modified: head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h head/sys/isa/syscons_isa.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Mon Dec 23 20:41:55 2019 (r356042) +++ head/sys/dev/syscons/syscons.c Mon Dec 23 21:32:07 2019 (r356043) @@ -635,8 +635,8 @@ sc_attach_unit(int unit, int flags) printf("%s%d:", SC_DRIVER_NAME, unit); if (sc->adapter >= 0) printf(" fb%d", sc->adapter); - if (sc->keyboard >= 0) - printf(", kbd%d", sc->keyboard); + if (sc->kbd != NULL) + printf(", kbd%d", sc->kbd->kb_index); if (scp->tsw) printf(", terminal emulator: %s (%s)", scp->tsw->te_name, scp->tsw->te_desc); @@ -838,8 +838,7 @@ sckbdevent(keyboard_t *thiskbd, int event, void *arg) break; case KBDIO_UNLOADING: sc->kbd = NULL; - sc->keyboard = -1; - kbd_release(thiskbd, (void *)&sc->keyboard); + kbd_release(thiskbd, (void *)&sc->kbd); goto done; default: error = EINVAL; @@ -1523,17 +1522,16 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, error = 0; if (sc->kbd != newkbd) { i = kbd_allocate(newkbd->kb_name, newkbd->kb_unit, - (void *)&sc->keyboard, sckbdevent, sc); + (void *)&sc->kbd, sckbdevent, sc); /* i == newkbd->kb_index */ if (i >= 0) { if (sc->kbd != NULL) { save_kbd_state(sc->cur_scp); kbd_release( - sc->kbd, (void *)&sc->keyboard); + sc->kbd, (void *)&sc->kbd); } sc->kbd = kbd_get_keyboard(i); /* sc->kbd == newkbd */ - sc->keyboard = i; (void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&sc->cur_scp->kbd_mode); update_kbd_state(sc->cur_scp, @@ -1551,11 +1549,9 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, error = 0; if (sc->kbd != NULL) { save_kbd_state(sc->cur_scp); - error = kbd_release(sc->kbd, (void *)&sc->keyboard); - if (error == 0) { + error = kbd_release(sc->kbd, (void *)&sc->kbd); + if (error == 0) sc->kbd = NULL; - sc->keyboard = -1; - } } splx(s); return error; @@ -2200,6 +2196,7 @@ scrn_timer(void *arg) sc_softc_t *sc; scr_stat *scp; int again, rate; + int kbdidx; again = (arg != NULL); if (arg != NULL) @@ -2220,9 +2217,9 @@ scrn_timer(void *arg) /* try to allocate a keyboard automatically */ if (kbd_time_stamp != time_uptime) { kbd_time_stamp = time_uptime; - sc->keyboard = sc_allocate_keyboard(sc, -1); - if (sc->keyboard >= 0) { - sc->kbd = kbd_get_keyboard(sc->keyboard); + kbdidx = sc_allocate_keyboard(sc, -1); + if (kbdidx >= 0) { + sc->kbd = kbd_get_keyboard(kbdidx); (void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&sc->cur_scp->kbd_mode); update_kbd_state(sc->cur_scp, @@ -3229,6 +3226,7 @@ scinit(int unit, int flags) scr_stat *scp; video_adapter_t *adp; int col; + int kbdidx; int row; int i; @@ -3256,9 +3254,10 @@ scinit(int unit, int flags) adp = sc->adp; sc->adp = NULL; } - if (sc->keyboard >= 0) { - DPRINTF(5, ("sc%d: releasing kbd%d\n", unit, sc->keyboard)); - i = kbd_release(sc->kbd, (void *)&sc->keyboard); + if (sc->kbd != NULL) { + DPRINTF(5, ("sc%d: releasing kbd%d\n", unit, + sc->kbd->kb_index)); + i = kbd_release(sc->kbd, (void *)&sc->kbd); DPRINTF(5, ("sc%d: kbd_release returned %d\n", unit, i)); if (sc->kbd != NULL) { DPRINTF(5, @@ -3272,10 +3271,10 @@ scinit(int unit, int flags) sc->adp = vid_get_adapter(sc->adapter); /* assert((sc->adapter >= 0) && (sc->adp != NULL)) */ - sc->keyboard = sc_allocate_keyboard(sc, unit); - DPRINTF(1, ("sc%d: keyboard %d\n", unit, sc->keyboard)); + kbdidx = sc_allocate_keyboard(sc, unit); + DPRINTF(1, ("sc%d: keyboard %d\n", unit, kbdidx)); - sc->kbd = kbd_get_keyboard(sc->keyboard); + sc->kbd = kbd_get_keyboard(kbdidx); if (sc->kbd != NULL) { DPRINTF(1, ("sc%d: kbd index:%d, unit:%d, flags:0x%x\n", unit, @@ -3463,8 +3462,8 @@ scterm(int unit, int flags) #endif /* release the keyboard and the video card */ - if (sc->keyboard >= 0) - kbd_release(sc->kbd, &sc->keyboard); + if (sc->kbd != NULL) + kbd_release(sc->kbd, &sc->kbd); if (sc->adapter >= 0) vid_release(sc->adp, &sc->adapter); @@ -3491,7 +3490,6 @@ scterm(int unit, int flags) /* XXX vtb, history */ } bzero(sc, sizeof(*sc)); - sc->keyboard = -1; sc->adapter = -1; } @@ -4362,7 +4360,7 @@ sc_allocate_keyboard(sc_softc_t *sc, int unit) keyboard_info_t ki; idx0 = - kbd_allocate("kbdmux", -1, (void *)&sc->keyboard, sckbdevent, sc); + kbd_allocate("kbdmux", -1, (void *)&sc->kbd, sckbdevent, sc); if (idx0 != -1) { k0 = kbd_get_keyboard(idx0); @@ -4381,7 +4379,7 @@ sc_allocate_keyboard(sc_softc_t *sc, int unit) } } else idx0 = kbd_allocate( - "*", unit, (void *)&sc->keyboard, sckbdevent, sc); + "*", unit, (void *)&sc->kbd, sckbdevent, sc); return (idx0); } Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Mon Dec 23 20:41:55 2019 (r356042) +++ head/sys/dev/syscons/syscons.h Mon Dec 23 21:32:07 2019 (r356043) @@ -217,8 +217,7 @@ typedef struct sc_softc { #define SC_INIT_DONE (1 << 16) #define SC_SPLASH_SCRN (1 << 17) - int keyboard; /* -1 if unavailable */ - struct keyboard *kbd; + struct keyboard *kbd; /* NULL if unavailable. */ int adapter; struct video_adapter *adp; Modified: head/sys/isa/syscons_isa.c ============================================================================== --- head/sys/isa/syscons_isa.c Mon Dec 23 20:41:55 2019 (r356042) +++ head/sys/isa/syscons_isa.c Mon Dec 23 21:32:07 2019 (r356043) @@ -117,7 +117,7 @@ sc_softc_t } sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->keyboard = -1; + sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; From owner-svn-src-head@freebsd.org Mon Dec 23 21:41:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 403071D0D14; Mon, 23 Dec 2019 21:41:05 +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 47hXpn0r6Pz44mj; Mon, 23 Dec 2019 21:41:05 +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 17FAF1E003; Mon, 23 Dec 2019 21:41:05 +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 xBNLf4qr068529; Mon, 23 Dec 2019 21:41:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNLf4Tm068527; Mon, 23 Dec 2019 21:41:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912232141.xBNLf4Tm068527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 23 Dec 2019 21:41:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356044 - in head/sys: arm/arm mips/mips sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: arm/arm mips/mips sparc64/sparc64 X-SVN-Commit-Revision: 356044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 21:41:05 -0000 Author: kevans Date: Mon Dec 23 21:41:04 2019 New Revision: 356044 URL: https://svnweb.freebsd.org/changeset/base/356044 Log: sc: fix arm/mips/sparc64 MD bits r356043 missed a couple of references in machdep parts... arguably, these lines could probably be dropped as the softc is likely still zero'd at this point. Pointy hat: kevans Modified: head/sys/arm/arm/sc_machdep.c head/sys/mips/mips/sc_machdep.c head/sys/sparc64/sparc64/sc_machdep.c Modified: head/sys/arm/arm/sc_machdep.c ============================================================================== --- head/sys/arm/arm/sc_machdep.c Mon Dec 23 21:32:07 2019 (r356043) +++ head/sys/arm/arm/sc_machdep.c Mon Dec 23 21:41:04 2019 (r356044) @@ -69,7 +69,7 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->keyboard = -1; + sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; Modified: head/sys/mips/mips/sc_machdep.c ============================================================================== --- head/sys/mips/mips/sc_machdep.c Mon Dec 23 21:32:07 2019 (r356043) +++ head/sys/mips/mips/sc_machdep.c Mon Dec 23 21:41:04 2019 (r356044) @@ -69,7 +69,7 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->keyboard = -1; + sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; Modified: head/sys/sparc64/sparc64/sc_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/sc_machdep.c Mon Dec 23 21:32:07 2019 (r356043) +++ head/sys/sparc64/sparc64/sc_machdep.c Mon Dec 23 21:41:04 2019 (r356044) @@ -131,7 +131,7 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->keyboard = -1; + sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; From owner-svn-src-head@freebsd.org Mon Dec 23 21:46:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5F5B1D0F6F; Mon, 23 Dec 2019 21:46:49 +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 47hXxP4Ns3z4599; Mon, 23 Dec 2019 21:46:49 +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 8D55E1E087; Mon, 23 Dec 2019 21:46:49 +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 xBNLknb2074233; Mon, 23 Dec 2019 21:46:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNLknie074232; Mon, 23 Dec 2019 21:46:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912232146.xBNLknie074232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 23 Dec 2019 21:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356045 - head/sys/dev/terasic/mtl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/terasic/mtl X-SVN-Commit-Revision: 356045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 21:46:49 -0000 Author: kevans Date: Mon Dec 23 21:46:48 2019 New Revision: 356045 URL: https://svnweb.freebsd.org/changeset/base/356045 Log: terasic_mtl: kill off final dummy keyboard driver The rest were removed in r355936, which speculated that the cause of this phenomenon was due to an inability to have an empty linker set. The comment included with this one shows that this was, in fact, not the reason. Regardless, syscons no longer seems to have an issue with not having any keyboard drivers and in-fact ignores the keyboard probe anyways. X-MFC-With: r355936 Modified: head/sys/dev/terasic/mtl/terasic_mtl_syscons.c Modified: head/sys/dev/terasic/mtl/terasic_mtl_syscons.c ============================================================================== --- head/sys/dev/terasic/mtl/terasic_mtl_syscons.c Mon Dec 23 21:41:04 2019 (r356044) +++ head/sys/dev/terasic/mtl/terasic_mtl_syscons.c Mon Dec 23 21:46:48 2019 (r356045) @@ -406,22 +406,6 @@ terasic_mtl_vidsw_putm(video_adapter_t *adp, int x, in return (ENODEV); } -/* - * XXXRW: For historical reasons, syscons can't register video consoles - * without a keyboard implementation. Provide a dummy. - */ -static keyboard_switch_t terasic_mtl_keyboard_switch; - -static int -terasic_mtl_kbd_configure(int flags) -{ - - return (0); -} - -KEYBOARD_DRIVER(mtl_kbd, terasic_mtl_keyboard_switch, - terasic_mtl_kbd_configure); - int terasic_mtl_syscons_attach(struct terasic_mtl_softc *sc) { From owner-svn-src-head@freebsd.org Mon Dec 23 21:57:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6534C1D1187; Mon, 23 Dec 2019 21:57: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 47hY9N1zlnz45XK; Mon, 23 Dec 2019 21:57: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 3ADC81E255; Mon, 23 Dec 2019 21:57: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 xBNLvBjR080194; Mon, 23 Dec 2019 21:57:11 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNLvBjV080193; Mon, 23 Dec 2019 21:57:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912232157.xBNLvBjV080193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 23 Dec 2019 21:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356046 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 356046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 21:57:12 -0000 Author: kevans Date: Mon Dec 23 21:57:11 2019 New Revision: 356046 URL: https://svnweb.freebsd.org/changeset/base/356046 Log: powerpc: repeat of r356044 It would have been nice to not have these duplicated in every single sc_machdep. Modified: head/sys/powerpc/powerpc/sc_machdep.c Modified: head/sys/powerpc/powerpc/sc_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/sc_machdep.c Mon Dec 23 21:46:48 2019 (r356045) +++ head/sys/powerpc/powerpc/sc_machdep.c Mon Dec 23 21:57:11 2019 (r356046) @@ -69,7 +69,7 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->keyboard = -1; + sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; From owner-svn-src-head@freebsd.org Mon Dec 23 23:43:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 326F91D2D7D; Mon, 23 Dec 2019 23:43: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 47hbXR0YjCz4Bfh; Mon, 23 Dec 2019 23:43: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 0E8141F651; Mon, 23 Dec 2019 23:43: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 xBNNhoCw047626; Mon, 23 Dec 2019 23:43:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBNNhoBL047623; Mon, 23 Dec 2019 23:43:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912232343.xBNNhoBL047623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 23 Dec 2019 23:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356047 - head/sys/dev/oce X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/oce X-SVN-Commit-Revision: 356047 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 23:43:51 -0000 Author: markj Date: Mon Dec 23 23:43:50 2019 New Revision: 356047 URL: https://svnweb.freebsd.org/changeset/base/356047 Log: oce: Disallow the passthrough ioctl for unprivileged users. A missing check meant that unprivileged users could send passthrough commands to the device firmware. Reported by: Ilja Van Sprundel MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/oce/oce_if.c head/sys/dev/oce/oce_if.h Modified: head/sys/dev/oce/oce_if.c ============================================================================== --- head/sys/dev/oce/oce_if.c Mon Dec 23 21:57:11 2019 (r356046) +++ head/sys/dev/oce/oce_if.c Mon Dec 23 23:43:50 2019 (r356047) @@ -620,6 +620,9 @@ oce_ioctl(struct ifnet *ifp, u_long command, caddr_t d break; case SIOCGPRIVATE_0: + rc = priv_check(curthread, PRIV_DRIVER); + if (rc != 0) + break; rc = oce_handle_passthrough(ifp, data); break; default: Modified: head/sys/dev/oce/oce_if.h ============================================================================== --- head/sys/dev/oce/oce_if.h Mon Dec 23 21:57:11 2019 (r356046) +++ head/sys/dev/oce/oce_if.h Mon Dec 23 23:43:50 2019 (r356047) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include From owner-svn-src-head@freebsd.org Tue Dec 24 01:47:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0DEA1D64EF; Tue, 24 Dec 2019 01:47:08 +0000 (UTC) (envelope-from cem@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 47hfGh4shdz4Hsb; Tue, 24 Dec 2019 01:47:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A27E620C70; Tue, 24 Dec 2019 01:47:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBO1l8ai018992; Tue, 24 Dec 2019 01:47:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBO1l8Lp018991; Tue, 24 Dec 2019 01:47:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912240147.xBO1l8Lp018991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 24 Dec 2019 01:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356048 - head/lib/geom/part X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/geom/part X-SVN-Commit-Revision: 356048 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 01:47:08 -0000 Author: cem Date: Tue Dec 24 01:47:08 2019 New Revision: 356048 URL: https://svnweb.freebsd.org/changeset/base/356048 Log: gpart(8): ms-basic-data is used for exFAT on GPT Be explicit about it; the first mention of exFAT is for the MBR type 'ntfs', and the reader must work back from there to the GPT type and infer that a reference to MBR ntfs type means ms-basic-data is canonical for exFAT. (It'd also be great if gpart had convenient aliases that did the right thing for the partition scheme, such as 'ntfs' => ms-basic-data on GPT schemes or 'exfat' => 'ntfs' in MBR schemes. The tool is also bad about providing user-meaningful reasons for EINVAL failures.) Modified: head/lib/geom/part/gpart.8 Modified: head/lib/geom/part/gpart.8 ============================================================================== --- head/lib/geom/part/gpart.8 Mon Dec 23 23:43:50 2019 (r356047) +++ head/lib/geom/part/gpart.8 Tue Dec 24 01:47:08 2019 (r356048) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 13, 2019 +.Dd December 23, 2019 .Dt GPART 8 .Os .Sh NAME @@ -863,6 +863,7 @@ In the GPT this type is the equivalent to partition ty and .Cm ntfs in MBR. +This type is used for GPT exFAT partitions. The scheme-specific type is .Qq Li "!ebd0a0a2-b9e5-4433-87c0-68b6b72699c7" for GPT. From owner-svn-src-head@freebsd.org Tue Dec 24 06:08:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3D421DE86B; Tue, 24 Dec 2019 06:08:29 +0000 (UTC) (envelope-from cem@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 47hm4F5Bt1z4VvG; Tue, 24 Dec 2019 06:08:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AD98923D0D; Tue, 24 Dec 2019 06:08:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBO68T4O073312; Tue, 24 Dec 2019 06:08:29 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBO68Tho073311; Tue, 24 Dec 2019 06:08:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912240608.xBO68Tho073311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 24 Dec 2019 06:08:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356049 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356049 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 06:08:29 -0000 Author: cem Date: Tue Dec 24 06:08:29 2019 New Revision: 356049 URL: https://svnweb.freebsd.org/changeset/base/356049 Log: kern_synch: Fix some UB It is UB to evaluate pointer comparisons when pointers do not point within the same object. Instead, convert the pointers to numbers and compare the numbers. Reported by: kib Discussed with: rlibby Modified: head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Tue Dec 24 01:47:08 2019 (r356048) +++ head/sys/kern/kern_synch.c Tue Dec 24 06:08:29 2019 (r356049) @@ -77,7 +77,7 @@ SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_F NULL); int hogticks; -static uint8_t pause_wchan[MAXCPU]; +static char pause_wchan[MAXCPU]; static struct callout loadav_callout; @@ -169,8 +169,8 @@ _sleep(void *ident, struct lock_object *lock, int prio KASSERT(!TD_ON_SLEEPQ(td), ("recursive sleep")); - if ((uint8_t *)ident >= &pause_wchan[0] && - (uint8_t *)ident <= &pause_wchan[MAXCPU - 1]) + if ((uintptr_t)ident >= (uintptr_t)&pause_wchan[0] && + (uintptr_t)ident <= (uintptr_t)&pause_wchan[MAXCPU - 1]) sleepq_flags = SLEEPQ_PAUSE; else sleepq_flags = SLEEPQ_SLEEP; From owner-svn-src-head@freebsd.org Tue Dec 24 14:48:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 489441EA148; Tue, 24 Dec 2019 14:48:49 +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 47hzcd1szWz3QNY; Tue, 24 Dec 2019 14:48:49 +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 1CE411AAE; Tue, 24 Dec 2019 14:48:49 +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 xBOEmnIx079696; Tue, 24 Dec 2019 14:48:49 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOEmkVf079686; Tue, 24 Dec 2019 14:48:46 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912241448.xBOEmkVf079686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 24 Dec 2019 14:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356050 - in head: share/man/man9 sys/arm/arm sys/arm64/arm64 sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 sys/sys sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head: share/man/man9 sys/arm/arm sys/arm64/arm64 sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 sys/sys sys/x86/x86 X-SVN-Commit-Revision: 356050 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 14:48:49 -0000 Author: scottl Date: Tue Dec 24 14:48:46 2019 New Revision: 356050 URL: https://svnweb.freebsd.org/changeset/base/356050 Log: Introduce the concept of busdma tag templates. A template can be allocated off the stack, initialized to default values, and then filled in with driver-specific values, all without having to worry about the numerous other fields in the tag. The resulting template is then passed into busdma and the normal opaque tag object created. See the man page for details on how to initialize a template. Templates do not support tag filters. Filters have been broken for many years, and only existed for an ancient make/model of hardware that had a quirky DMA engine. Instead of breaking the ABI/API and changing the arugment signature of bus_dma_tag_create() to remove the filter arguments, templates allow us to ignore them, and also significantly reduce the complexity of creating and managing tags. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D22906 Modified: head/share/man/man9/bus_dma.9 head/sys/arm/arm/busdma_machdep-v4.c head/sys/arm/arm/busdma_machdep-v6.c head/sys/arm64/arm64/busdma_machdep.c head/sys/mips/mips/busdma_machdep.c head/sys/powerpc/powerpc/busdma_machdep.c head/sys/riscv/riscv/busdma_machdep.c head/sys/sparc64/sparc64/bus_machdep.c head/sys/sys/bus_dma.h head/sys/x86/x86/busdma_machdep.c Modified: head/share/man/man9/bus_dma.9 ============================================================================== --- head/share/man/man9/bus_dma.9 Tue Dec 24 06:08:29 2019 (r356049) +++ head/share/man/man9/bus_dma.9 Tue Dec 24 14:48:46 2019 (r356050) @@ -60,6 +60,9 @@ .Nm bus_dma , .Nm bus_dma_tag_create , .Nm bus_dma_tag_destroy , +.Nm bus_dma_template_init , +.Nm bus_dma_template_tag , +.Nm bus_dma_template_clone , .Nm bus_dmamap_create , .Nm bus_dmamap_destroy , .Nm bus_dmamap_load , @@ -83,7 +86,22 @@ "void *lockfuncarg" "bus_dma_tag_t *dmat" .Ft int .Fn bus_dma_tag_destroy "bus_dma_tag_t dmat" +.Ft void +.Fo bus_dma_template_init +.Fa "bus_dma_template_t template" +.Fa "bus_dma_tag_t parent" +.Fc .Ft int +.Fo bus_dma_template_tag +.Fa "bus_dma_template_t template" +.Fa "bus_dma_tag_t *dmat" +.Fc +.Ft void +.Fo bus_dma_template_clone +.Fa "bus_dma_template_t template" +.Fa "bus_dma_tag_t dmat" +.Fc +.Ft int .Fn bus_dmamap_create "bus_dma_tag_t dmat" "int flags" "bus_dmamap_t *mapp" .Ft int .Fn bus_dmamap_destroy "bus_dma_tag_t dmat" "bus_dmamap_t map" @@ -282,6 +300,34 @@ DMA tags are organized into a hierarchy, with each chi tag inheriting the restrictions of its parent. This allows all devices along the path of DMA transactions to contribute to the constraints of those transactions. +.It Vt bus_dma_template_t +A template structure for creating a +.Fa bus_dma_tag_t +from a set of defaults. +Once initialized with +.Fn bus_dma_template_init , +a driver can over-ride individual fields to suit its needs. +The following fields have the indicated values: +.Bd -literal + alignment 1 + boundary 0 + lowaddr BUS_SPACE_MAXADDR + highaddr BUS_SPACE_MAXADDR + maxsize BUS_SPACE_MAXSIZE + nsegments BUS_SPACE_UNRESTRICTED + maxsegsize BUS_SPACE_MAXSIZE + flags 0 + lockfunc NULL + lockfuncarg NULL +.Ed +.Pp +Descriptions of each field are documented with +.Fn bus_dma_tag_create . +Note that the +.Fa filtfunc +and +.Fa filtfuncarg +attributes of the DMA tag are not supported with templates. .It Vt bus_dma_filter_t Client specified address filter having the format: .Bl -tag -width indent @@ -633,6 +679,25 @@ if any DMA maps remain associated with or .Ql 0 on success. +.It Fn bus_dma_template_init "*template" "parent" +Initializes a +.Fa bus_dma_template_t +structure and associates it with an optional +.Fa parent . +The +.Fa parent +argument may be NULL. +.It Fn bus_dma_template_tag "*template" "*dmat" +Unpacks a template into a tag, and returns the tag via the +.Fa dmat . +All return values are identical to +.Fn bus_dma_tag_create . +.It Fn bus_dma_template_clone "*template" "dmat" +Clones the fields from a tag to a template. +This is useful for cloning tags when paired with +.Fn bus_dma_template_tag . +A template that is filled in as a clone does not need to be initialized +first. .It Fn bus_dmamap_create "dmat" "flags" "*mapp" Allocates and initializes a DMA map. Arguments are as follows: Modified: head/sys/arm/arm/busdma_machdep-v4.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v4.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/arm/arm/busdma_machdep-v4.c Tue Dec 24 14:48:46 2019 (r356050) @@ -501,6 +501,57 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + + if (t == NULL || dmat == NULL) + return; + + t->parent = dmat->parent; + t->alignment = dmat->alignment; + t->boundary = dmat->boundary; + t->lowaddr = dmat->lowaddr; + t->highaddr = dmat->highaddr; + t->maxsize = dmat->maxsize; + t->nsegments = dmat->nsegments; + t->maxsegsize = dmat->maxsegsz; + t->flags = dmat->flags; + t->lockfunc = dmat->lockfunc; + t->lockfuncarg = dmat->lockfuncarg; +} + int bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) { Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Dec 24 14:48:46 2019 (r356050) @@ -575,6 +575,57 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + + if (t == NULL || dmat == NULL) + return; + + t->parent = dmat->parent; + t->alignment = dmat->alignment; + t->boundary = dmat->boundary; + t->lowaddr = dmat->lowaddr; + t->highaddr = dmat->highaddr; + t->maxsize = dmat->maxsize; + t->nsegments = dmat->nsegments; + t->maxsegsize = dmat->maxsegsz; + t->flags = dmat->flags; + t->lockfunc = dmat->lockfunc; + t->lockfuncarg = dmat->lockfuncarg; +} + int bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) { Modified: head/sys/arm64/arm64/busdma_machdep.c ============================================================================== --- head/sys/arm64/arm64/busdma_machdep.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/arm64/arm64/busdma_machdep.c Tue Dec 24 14:48:46 2019 (r356050) @@ -214,6 +214,60 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + struct bus_dma_tag_common *common; + + if (t == NULL || dmat == NULL) + return; + + common = (struct bus_dma_tag_common *)dmat; + + t->parent = (bus_dma_tag_t)common->parent; + t->alignment = common->alignment; + t->boundary = common->boundary; + t->lowaddr = common->lowaddr; + t->highaddr = common->highaddr; + t->maxsize = common->maxsize; + t->nsegments = common->nsegments; + t->maxsegsize = common->maxsegsz; + t->flags = common->flags; + t->lockfunc = common->lockfunc; + t->lockfuncarg = common->lockfuncarg; +} + int bus_dma_tag_destroy(bus_dma_tag_t dmat) { Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/mips/mips/busdma_machdep.c Tue Dec 24 14:48:46 2019 (r356050) @@ -476,6 +476,57 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + + if (t == NULL || dmat == NULL) + return; + + t->parent = dmat->parent; + t->alignment = dmat->alignment; + t->boundary = dmat->boundary; + t->lowaddr = dmat->lowaddr; + t->highaddr = dmat->highaddr; + t->maxsize = dmat->maxsize; + t->nsegments = dmat->nsegments; + t->maxsegsize = dmat->maxsegsz; + t->flags = dmat->flags; + t->lockfunc = dmat->lockfunc; + t->lockfuncarg = dmat->lockfuncarg; +} + int bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) { Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/powerpc/powerpc/busdma_machdep.c Tue Dec 24 14:48:46 2019 (r356050) @@ -340,6 +340,57 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + + if (t == NULL || dmat == NULL) + return; + + t->parent = dmat->parent; + t->alignment = dmat->alignment; + t->boundary = dmat->boundary; + t->lowaddr = dmat->lowaddr; + t->highaddr = dmat->highaddr; + t->maxsize = dmat->maxsize; + t->nsegments = dmat->nsegments; + t->maxsegsize = dmat->maxsegsz; + t->flags = dmat->flags; + t->lockfunc = dmat->lockfunc; + t->lockfuncarg = dmat->lockfuncarg; +} + int bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) { Modified: head/sys/riscv/riscv/busdma_machdep.c ============================================================================== --- head/sys/riscv/riscv/busdma_machdep.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/riscv/riscv/busdma_machdep.c Tue Dec 24 14:48:46 2019 (r356050) @@ -214,6 +214,60 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + struct bus_dma_tag_common *common; + + if (t == NULL || dmat == NULL) + return; + + common = (struct bus_dma_tag_common *)dmat; + + t->parent = (bus_dma_tag_t)common->parent; + t->alignment = common->alignment; + t->boundary = common->boundary; + t->lowaddr = common->lowaddr; + t->highaddr = common->highaddr; + t->maxsize = common->maxsize; + t->nsegments = common->nsegments; + t->maxsegsize = common->maxsegsz; + t->flags = common->flags; + t->lockfunc = common->lockfunc; + t->lockfuncarg = common->lockfuncarg; +} + int bus_dma_tag_destroy(bus_dma_tag_t dmat) { Modified: head/sys/sparc64/sparc64/bus_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/bus_machdep.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/sparc64/sparc64/bus_machdep.c Tue Dec 24 14:48:46 2019 (r356050) @@ -250,6 +250,57 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (0); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + + if (t == NULL || dmat == NULL) + return; + + t->parent = dmat->dt_parent; + t->alignment = dmat->dt_alignment; + t->boundary = dmat->dt_boundary; + t->lowaddr = dmat->dt_lowaddr; + t->highaddr = dmat->dt_highaddr; + t->maxsize = dmat->dt_maxsize; + t->nsegments = dmat->dt_nsegments; + t->maxsegsize = dmat->dt_maxsegsz; + t->flags = dmat->dt_flags; + t->lockfunc = dmat->dt_lockfunc; + t->lockfuncarg = dmat->dt_lockfuncarg; +} + int bus_dma_tag_destroy(bus_dma_tag_t dmat) { Modified: head/sys/sys/bus_dma.h ============================================================================== --- head/sys/sys/bus_dma.h Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/sys/bus_dma.h Tue Dec 24 14:48:46 2019 (r356050) @@ -179,6 +179,24 @@ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_ bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat); +/* Functions for creating and cloning tags via a template */ +typedef struct { + bus_dma_tag_t parent; + bus_size_t alignment; + bus_addr_t boundary; + bus_addr_t lowaddr; + bus_addr_t highaddr; + bus_size_t maxsize; + int nsegments; + bus_size_t maxsegsize; + int flags; + bus_dma_lock_t *lockfunc; + void *lockfuncarg; +} bus_dma_tag_template_t; +void bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent); +int bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat); +void bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat); + /* * Set the memory domain to be used for allocations. * Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Tue Dec 24 06:08:29 2019 (r356049) +++ head/sys/x86/x86/busdma_machdep.c Tue Dec 24 14:48:46 2019 (r356050) @@ -238,6 +238,60 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +void +bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent) +{ + + if (t == NULL) + return; + + t->parent = parent; + t->alignment = 1; + t->boundary = 0; + t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR; + t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE; + t->nsegments = BUS_SPACE_UNRESTRICTED; + t->lockfunc = NULL; + t->lockfuncarg = NULL; + t->flags = 0; +} + +int +bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat) +{ + + if (t == NULL || dmat == NULL) + return (EINVAL); + + return (bus_dma_tag_create(t->parent, t->alignment, t->boundary, + t->lowaddr, t->highaddr, NULL, NULL, t->maxsize, + t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg, + dmat)); +} + +void +bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat) +{ + struct bus_dma_tag_common *common; + + if (t == NULL || dmat == NULL) + return; + + common = (struct bus_dma_tag_common *)dmat; + + t->parent = (bus_dma_tag_t)common->parent; + t->alignment = common->alignment; + t->boundary = common->boundary; + t->lowaddr = common->lowaddr; + t->highaddr = common->highaddr; + t->maxsize = common->maxsize; + t->nsegments = common->nsegments; + t->maxsegsize = common->maxsegsz; + t->flags = common->flags; + t->lockfunc = common->lockfunc; + t->lockfuncarg = common->lockfuncarg; +} + int bus_dma_tag_destroy(bus_dma_tag_t dmat) { From owner-svn-src-head@freebsd.org Tue Dec 24 14:49:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C32F61EA1E1; Tue, 24 Dec 2019 14:49:37 +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 47hzdY4nRsz3QWK; Tue, 24 Dec 2019 14:49:37 +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 9F7321AB0; Tue, 24 Dec 2019 14:49:37 +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 xBOEnbZK079776; Tue, 24 Dec 2019 14:49:37 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOEnbgj079775; Tue, 24 Dec 2019 14:49:37 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912241449.xBOEnbgj079775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 24 Dec 2019 14:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356051 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 356051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 14:49:37 -0000 Author: scottl Date: Tue Dec 24 14:49:37 2019 New Revision: 356051 URL: https://svnweb.freebsd.org/changeset/base/356051 Log: Bump __FreeBSD_version for the addition of busdma templates. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Dec 24 14:48:46 2019 (r356050) +++ head/sys/sys/param.h Tue Dec 24 14:49:37 2019 (r356051) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300068 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300069 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Tue Dec 24 14:50:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CE1D1EA26E; Tue, 24 Dec 2019 14:50:18 +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 47hzfK74Jxz3Qfw; Tue, 24 Dec 2019 14:50:17 +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 EDE951ACB; Tue, 24 Dec 2019 14:50:17 +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 xBOEoH9A079889; Tue, 24 Dec 2019 14:50:17 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOEoHPu079886; Tue, 24 Dec 2019 14:50:17 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912241450.xBOEoHPu079886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 24 Dec 2019 14:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356052 - head/sys/dev/mpr X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/dev/mpr X-SVN-Commit-Revision: 356052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 14:50:18 -0000 Author: scottl Date: Tue Dec 24 14:50:17 2019 New Revision: 356052 URL: https://svnweb.freebsd.org/changeset/base/356052 Log: Convert the mpr driver to use busdma templates. Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_pci.c head/sys/dev/mpr/mpr_user.c Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Tue Dec 24 14:49:37 2019 (r356051) +++ head/sys/dev/mpr/mpr.c Tue Dec 24 14:50:17 2019 (r356052) @@ -1311,6 +1311,7 @@ mpr_alloc_queues(struct mpr_softc *sc) static int mpr_alloc_hw_queues(struct mpr_softc *sc) { + bus_dma_tag_template_t t; bus_addr_t queues_busaddr; uint8_t *queues; int qsize, fqsize, pqsize; @@ -1332,17 +1333,12 @@ mpr_alloc_hw_queues(struct mpr_softc *sc) pqsize = sc->pqdepth * 8; qsize = fqsize + pqsize; - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 16, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - qsize, /* maxsize */ - 1, /* nsegments */ - qsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->queues_dmat)) { + bus_dma_template_init(&t, sc->mpr_parent_dmat); + t.alignment = 16; + t.lowaddr = BUS_SPACE_MAXADDR_32BIT; + t.maxsize = t.maxsegsize = qsize; + t.nsegments = 1; + if (bus_dma_template_tag(&t, &sc->queues_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate queues DMA tag\n"); return (ENOMEM); } @@ -1370,6 +1366,7 @@ mpr_alloc_hw_queues(struct mpr_softc *sc) static int mpr_alloc_replies(struct mpr_softc *sc) { + bus_dma_tag_template_t t; int rsize, num_replies; /* Store the reply frame size in bytes rather than as 32bit words */ @@ -1383,17 +1380,12 @@ mpr_alloc_replies(struct mpr_softc *sc) num_replies = max(sc->fqdepth, sc->num_replies); rsize = sc->replyframesz * num_replies; - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 4, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - rsize, /* maxsize */ - 1, /* nsegments */ - rsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->reply_dmat)) { + bus_dma_template_init(&t, sc->mpr_parent_dmat); + t.alignment = 4; + t.lowaddr = BUS_SPACE_MAXADDR_32BIT; + t.maxsize = t.maxsegsize = rsize; + t.nsegments = 1; + if (bus_dma_template_tag(&t, &sc->reply_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate replies DMA tag\n"); return (ENOMEM); } @@ -1440,21 +1432,17 @@ mpr_load_chains_cb(void *arg, bus_dma_segment_t *segs, static int mpr_alloc_requests(struct mpr_softc *sc) { + bus_dma_tag_template_t t; struct mpr_command *cm; int i, rsize, nsegs; rsize = sc->reqframesz * sc->num_reqs; - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 16, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - rsize, /* maxsize */ - 1, /* nsegments */ - rsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->req_dmat)) { + bus_dma_template_init(&t, sc->mpr_parent_dmat); + t.alignment = 16; + t.lowaddr = BUS_SPACE_MAXADDR_32BIT; + t.maxsize = t.maxsegsize = rsize; + t.nsegments = 1; + if (bus_dma_template_tag(&t, &sc->req_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate request DMA tag\n"); return (ENOMEM); } @@ -1476,17 +1464,11 @@ mpr_alloc_requests(struct mpr_softc *sc) return (ENOMEM); } rsize = sc->chain_frame_size * sc->num_chains; - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 16, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - rsize, /* maxsize */ - howmany(rsize, PAGE_SIZE), /* nsegments */ - rsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->chain_dmat)) { + bus_dma_template_init(&t, sc->mpr_parent_dmat); + t.alignment = 16; + t.maxsize = t.maxsegsize = rsize; + t.nsegments = howmany(rsize, PAGE_SIZE); + if (bus_dma_template_tag(&t, &sc->chain_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate chain DMA tag\n"); return (ENOMEM); } @@ -1504,17 +1486,9 @@ mpr_alloc_requests(struct mpr_softc *sc) } rsize = MPR_SENSE_LEN * sc->num_reqs; - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - rsize, /* maxsize */ - 1, /* nsegments */ - rsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->sense_dmat)) { + bus_dma_template_clone(&t, sc->req_dmat); + t.maxsize = t.maxsegsize = rsize; + if (bus_dma_template_tag(&t, &sc->sense_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate sense DMA tag\n"); return (ENOMEM); } @@ -1540,18 +1514,12 @@ mpr_alloc_requests(struct mpr_softc *sc) } nsegs = (sc->maxio / PAGE_SIZE) + 1; - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsize */ - nsegs, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - busdma_lock_mutex, /* lockfunc */ - &sc->mpr_mtx, /* lockarg */ - &sc->buffer_dmat)) { + bus_dma_template_init(&t, sc->mpr_parent_dmat); + t.nsegments = nsegs; + t.flags = BUS_DMA_ALLOCNOW; + t.lockfunc = busdma_lock_mutex; + t.lockfuncarg = &sc->mpr_mtx; + if (bus_dma_template_tag(&t, &sc->buffer_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate buffer DMA tag\n"); return (ENOMEM); } @@ -1608,9 +1576,10 @@ mpr_alloc_requests(struct mpr_softc *sc) static int mpr_alloc_nvme_prp_pages(struct mpr_softc *sc) { + bus_dma_tag_template_t t; + struct mpr_prp_page *prp_page; int PRPs_per_page, PRPs_required, pages_required; int rsize, i; - struct mpr_prp_page *prp_page; /* * Assuming a MAX_IO_SIZE of 1MB and a PAGE_SIZE of 4k, the max number @@ -1637,17 +1606,12 @@ mpr_alloc_nvme_prp_pages(struct mpr_softc *sc) sc->prp_buffer_size = PAGE_SIZE * pages_required; rsize = sc->prp_buffer_size * NVME_QDEPTH; - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 4, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - rsize, /* maxsize */ - 1, /* nsegments */ - rsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->prp_page_dmat)) { + bus_dma_template_init(&t, sc->mpr_parent_dmat); + t.alignment = 4; + t.lowaddr = BUS_SPACE_MAXADDR_32BIT; + t.maxsize = t.maxsegsize = rsize; + t.nsegments = 1; + if (bus_dma_template_tag(&t, &sc->prp_page_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate NVMe PRP DMA " "tag\n"); return (ENOMEM); Modified: head/sys/dev/mpr/mpr_pci.c ============================================================================== --- head/sys/dev/mpr/mpr_pci.c Tue Dec 24 14:49:37 2019 (r356051) +++ head/sys/dev/mpr/mpr_pci.c Tue Dec 24 14:50:17 2019 (r356052) @@ -220,6 +220,7 @@ mpr_pci_probe(device_t dev) static int mpr_pci_attach(device_t dev) { + bus_dma_tag_template_t t; struct mpr_softc *sc; struct mpr_ident *m; int error, i; @@ -267,17 +268,8 @@ mpr_pci_attach(device_t dev) sc->mpr_bhandle = rman_get_bushandle(sc->mpr_regs_resource); /* Allocate the parent DMA tag */ - if (bus_dma_tag_create( bus_get_dma_tag(dev), /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsize */ - BUS_SPACE_UNRESTRICTED, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->mpr_parent_dmat)) { + bus_dma_template_init(&t, bus_get_dma_tag(dev)); + if (bus_dma_template_tag(&t, &sc->mpr_parent_dmat)) { mpr_printf(sc, "Cannot allocate parent DMA tag\n"); mpr_pci_free(sc); return (ENOMEM); Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Tue Dec 24 14:49:37 2019 (r356051) +++ head/sys/dev/mpr/mpr_user.c Tue Dec 24 14:50:17 2019 (r356052) @@ -1452,6 +1452,7 @@ static int mpr_diag_register(struct mpr_softc *sc, mpr_fw_diag_register_t *diag_register, uint32_t *return_code) { + bus_dma_tag_template_t t; mpr_fw_diagnostic_buffer_t *pBuffer; struct mpr_busdma_context *ctx; uint8_t extended_type, buffer_type, i; @@ -1514,17 +1515,11 @@ mpr_diag_register(struct mpr_softc *sc, mpr_fw_diag_re *return_code = MPR_FW_DIAG_ERROR_NO_BUFFER; return (MPR_DIAG_FAILURE); } - if (bus_dma_tag_create( sc->mpr_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - buffer_size, /* maxsize */ - 1, /* nsegments */ - buffer_size, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->fw_diag_dmat)) { + bus_dma_template_init(&t, sc->mpr_parent_dmat); + t.lowaddr = BUS_SPACE_MAXADDR_32BIT; + t.maxsize = t.maxsegsize = buffer_size; + t.nsegments = 1; + if (bus_dma_template_tag(&t, &sc->fw_diag_dmat)) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate FW diag buffer DMA tag\n"); *return_code = MPR_FW_DIAG_ERROR_NO_BUFFER; From owner-svn-src-head@freebsd.org Tue Dec 24 15:56:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BC5E1EB963; Tue, 24 Dec 2019 15:56:26 +0000 (UTC) (envelope-from bdragon@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 47j16f39dtz3ySP; Tue, 24 Dec 2019 15:56:26 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 682E32745; Tue, 24 Dec 2019 15:56:26 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOFuQ1K020529; Tue, 24 Dec 2019 15:56:26 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOFuO6l020520; Tue, 24 Dec 2019 15:56:24 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912241556.xBOFuO6l020520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Tue, 24 Dec 2019 15:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356053 - in head/sys: arm/arm arm64/arm64 i386/i386 kern powerpc/powerpc riscv/riscv sparc64/sparc64 sys X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys: arm/arm arm64/arm64 i386/i386 kern powerpc/powerpc riscv/riscv sparc64/sparc64 sys X-SVN-Commit-Revision: 356053 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 15:56:26 -0000 Author: bdragon Date: Tue Dec 24 15:56:24 2019 New Revision: 356053 URL: https://svnweb.freebsd.org/changeset/base/356053 Log: [PowerPC] Implement Secure-PLT jump table processing for ppc32. Due to clang and LLD's tendency to use a PLT for builtins, and as they don't have full support for EABI, we sometimes have to deal with a PLT in .ko files in a clang-built kernel. As such, augment the in-kernel linker to support jump table processing. As there is no particular reason to support lazy binding in kernel modules, only implement Secure-PLT immediate binding. As part of these changes, add elf_cpu_parse_dynamic() to the MD API of the in-kernel linker (except on platforms that use raw object files.) The new function will allow MD code to act on MD tags in _DYNAMIC. Use this new function in the PowerPC MD code to ensure BSS-PLT modules using PLT will be rejected during insertion, and to poison the runtime resolver to ensure we get a clear panic reason if a call is made to the resolver. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22608 Modified: head/sys/arm/arm/elf_machdep.c head/sys/arm64/arm64/elf_machdep.c head/sys/i386/i386/elf_machdep.c head/sys/kern/link_elf.c head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c head/sys/riscv/riscv/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c head/sys/sys/linker.h Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/arm/arm/elf_machdep.c Tue Dec 24 15:56:24 2019 (r356053) @@ -321,6 +321,13 @@ elf_cpu_load_file(linker_file_t lf) } int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} + +int elf_cpu_unload_file(linker_file_t lf) { Modified: head/sys/arm64/arm64/elf_machdep.c ============================================================================== --- head/sys/arm64/arm64/elf_machdep.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/arm64/arm64/elf_machdep.c Tue Dec 24 15:56:24 2019 (r356053) @@ -216,3 +216,10 @@ elf_cpu_unload_file(linker_file_t lf __unused) return (0); } + +int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/i386/i386/elf_machdep.c Tue Dec 24 15:56:24 2019 (r356053) @@ -295,3 +295,10 @@ elf_cpu_unload_file(linker_file_t lf __unused) return (0); } + +int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/kern/link_elf.c Tue Dec 24 15:56:24 2019 (r356053) @@ -611,7 +611,7 @@ parse_dynamic(elf_file_t ef) ef->ddbstrtab = ef->strtab; ef->ddbstrcnt = ef->strsz; - return (0); + return elf_cpu_parse_dynamic(&ef->lf, ef->dynamic); } #define LS_PADDING 0x90909090 Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/powerpc/powerpc/elf32_machdep.c Tue Dec 24 15:56:24 2019 (r356053) @@ -63,6 +63,7 @@ extern const char *freebsd32_syscallnames[]; static void ppc32_fixlimit(struct rlimit *rl, int which); +static void ppc32_runtime_resolve(void); static SYSCTL_NODE(_compat, OID_AUTO, ppc32, CTLFLAG_RW, 0, "32-bit mode"); @@ -296,6 +297,20 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas *where = elf_relocaddr(lf, relocbase + addend); break; + case R_PPC_JMP_SLOT: /* PLT jump slot entry */ + /* + * We currently only support Secure-PLT jump slots. + * Given that we reject BSS-PLT modules during load, we + * don't need to check again. + * The method we are using here is equivilent to + * LD_BIND_NOW. + */ + error = lookup(lf, symidx, 1, &addr); + if (error != 0) + return -1; + *where = elf_relocaddr(lf, addr + addend); + break; + default: printf("kldload: unexpected relocation type %d\n", (int) rtype); @@ -356,6 +371,7 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, int elf_cpu_load_file(linker_file_t lf) { + /* Only sync the cache for non-kernel modules */ if (lf->id != 1) __syncicache(lf->address, lf->size); @@ -366,6 +382,47 @@ int elf_cpu_unload_file(linker_file_t lf __unused) { + return (0); +} + +static void +ppc32_runtime_resolve() +{ + + /* + * Since we don't support lazy binding, panic immediately if anyone + * manages to call the runtime resolver. + */ + panic("kldload: Runtime resolver was called unexpectedly!"); +} + +int +elf_cpu_parse_dynamic(linker_file_t lf, Elf_Dyn *dynamic) +{ + Elf_Dyn *dp; + bool has_plt = false; + bool secure_plt = false; + Elf_Addr *got; + + for (dp = dynamic; dp->d_tag != DT_NULL; dp++) { + switch (dp->d_tag) { + case DT_PPC_GOT: + secure_plt = true; + got = (Elf_Addr *)(lf->address + dp->d_un.d_ptr); + /* Install runtime resolver canary. */ + got[1] = (Elf_Addr)ppc32_runtime_resolve; + got[2] = (Elf_Addr)0; + break; + case DT_PLTGOT: + has_plt = true; + break; + } + } + + if (has_plt && !secure_plt) { + printf("kldload: BSS-PLT modules are not supported.\n"); + return (-1); + } return (0); } #endif Modified: head/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf64_machdep.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/powerpc/powerpc/elf64_machdep.c Tue Dec 24 15:56:24 2019 (r356053) @@ -410,3 +410,10 @@ elf_cpu_unload_file(linker_file_t lf __unused) return (0); } + +int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} Modified: head/sys/riscv/riscv/elf_machdep.c ============================================================================== --- head/sys/riscv/riscv/elf_machdep.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/riscv/riscv/elf_machdep.c Tue Dec 24 15:56:24 2019 (r356053) @@ -504,3 +504,10 @@ elf_cpu_unload_file(linker_file_t lf __unused) return (0); } + +int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/sparc64/sparc64/elf_machdep.c Tue Dec 24 15:56:24 2019 (r356053) @@ -429,3 +429,10 @@ elf_cpu_unload_file(linker_file_t lf __unused) return (0); } + +int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} Modified: head/sys/sys/linker.h ============================================================================== --- head/sys/sys/linker.h Tue Dec 24 14:50:17 2019 (r356052) +++ head/sys/sys/linker.h Tue Dec 24 15:56:24 2019 (r356053) @@ -305,6 +305,10 @@ int linker_ctf_get(linker_file_t, linker_ctf_t *); int elf_cpu_load_file(linker_file_t); int elf_cpu_unload_file(linker_file_t); +/* amd64 and mips use objects instead of shared libraries */ +#if !defined(__amd64__) && !defined(__mips__) +int elf_cpu_parse_dynamic(linker_file_t, Elf_Dyn *); +#endif /* values for type */ #define ELF_RELOC_REL 1 From owner-svn-src-head@freebsd.org Tue Dec 24 16:03:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C21F51EBC58; Tue, 24 Dec 2019 16:03:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47j1Gt4nsgz3ywR; Tue, 24 Dec 2019 16:03:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FC092914; Tue, 24 Dec 2019 16:03:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOG3YKD026293; Tue, 24 Dec 2019 16:03:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOG3Ya5026291; Tue, 24 Dec 2019 16:03:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912241603.xBOG3Ya5026291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 24 Dec 2019 16:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356054 - in head: share/mk stand X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: share/mk stand X-SVN-Commit-Revision: 356054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 16:03:34 -0000 Author: jhibbits Date: Tue Dec 24 16:03:33 2019 New Revision: 356054 URL: https://svnweb.freebsd.org/changeset/base/356054 Log: [PowerPC64] Use ld.bfd to build LIB32 and STAND - when using llvm Summary: This patch is to support ongoing work for replacing "GCC/BFD" by "CLANG/LLD" on target PowerPC64 [1], by proposing a way to specify and/or locate a secondary ld.bfd linker. This is necessary as LLD currently doesn't support PowerPC 32 bits, so we keep using BFD for the 32 bit stuff on PowePC64(LIB32 compatibility and STAND/slof/loader.) - creates LD_BFD variable pointing to ld.bfd - use LD_BFD as linker for LIB32/compat - Default behavior for other platforms aren't changed. [1] https://wiki.freebsd.org/powerpc/llvm-elfv2 Submitted by: alfredo.junior_eldorado.org.br Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D20261 Modified: head/share/mk/bsd.compat.mk head/share/mk/bsd.cpu.mk head/stand/defs.mk Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Tue Dec 24 15:56:24 2019 (r356053) +++ head/share/mk/bsd.compat.mk Tue Dec 24 16:03:33 2019 (r356054) @@ -47,11 +47,20 @@ LIB32CPUFLAGS= -mcpu=powerpc .else LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif + +.if ${COMPAT_COMPILER_TYPE} == "gcc" LIB32CPUFLAGS+= -m32 +.else +LIB32CPUFLAGS+= -target powerpc-unknown-freebsd13.0 + +# Use BFD to workaround ld.lld issues on PowerPC 32 bit +LIB32CPUFLAGS+= -fuse-ld=${LD_BFD} +.endif + LIB32_MACHINE= powerpc LIB32_MACHINE_ARCH= powerpc LIB32WMAKEFLAGS= \ - LD="${XLD} -m elf32ppc_fbsd" + LD="${LD_BFD} -m elf32ppc_fbsd" .elif ${COMPAT_ARCH:Mmips64*} != "" HAS_COMPAT=32 Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Tue Dec 24 15:56:24 2019 (r356053) +++ head/share/mk/bsd.cpu.mk Tue Dec 24 16:03:33 2019 (r356054) @@ -412,3 +412,17 @@ CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}} # These come from make.conf or the command line or the environment. CFLAGS += ${CFLAGS.${MACHINE_ARCH}} CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}} + + +# Defines a variable for Binutils linker, to be used to workaround some +# issue with LLVM LLD (i.e. support for PowerPC32 bit on PowerPC64) +# +# This is an unavoidable cross coupling with Makefile.inc1 and +# normal builds works when CROSS_BINUTILS_PREFIX and could be removed +# when LLD PowerPC 32 bit support is completed +.if defined(CROSS_BINUTILS_PREFIX) +LD_BFD=${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd +.else +LD_BFD=${OBJTOP}/tmp/usr/bin/ld.bfd +.endif + Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Tue Dec 24 15:56:24 2019 (r356053) +++ head/stand/defs.mk Tue Dec 24 16:03:33 2019 (r356054) @@ -99,6 +99,10 @@ CFLAGS+= -DLOADER_DISK_SUPPORT # or powerpc64. .if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -mcpu=powerpc +# Use ld.bfd to workaround ld.lld issues on PowerPC 32 bit +.if "${COMPILER_TYPE}" == "clang" && "${LINKER_TYPE}" == "lld" +CFLAGS+= -fuse-ld=${LD_BFD} +.endif .endif # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is From owner-svn-src-head@freebsd.org Tue Dec 24 16:07:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2894C1EBD54; Tue, 24 Dec 2019 16:07:36 +0000 (UTC) (envelope-from bdragon@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 47j1MX0z0Zz405l; Tue, 24 Dec 2019 16:07:36 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1C539291F; Tue, 24 Dec 2019 16:07:36 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOG7Zxs026519; Tue, 24 Dec 2019 16:07:35 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOG7Zx9026517; Tue, 24 Dec 2019 16:07:35 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912241607.xBOG7Zx9026517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Tue, 24 Dec 2019 16:07:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356055 - head/libexec/rtld-elf/powerpc64 X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/libexec/rtld-elf/powerpc64 X-SVN-Commit-Revision: 356055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 16:07:36 -0000 Author: bdragon Date: Tue Dec 24 16:07:35 2019 New Revision: 356055 URL: https://svnweb.freebsd.org/changeset/base/356055 Log: [PowerPC] powerpc64 rtld IFUNC handling code As PowerPC is moving to clang, we can finally start taking advantage of IFUNC. Implement the MD parts of IFUNC handling for rtld. Currently, it is necessary to look for R_PPC_IRELATIVE in the PLT in addition to RELA. This is an ABI violation, but LLD9 has some .iplt bugs that require this as a workaround. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22789 Modified: head/libexec/rtld-elf/powerpc64/reloc.c head/libexec/rtld-elf/powerpc64/rtld_machdep.h Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Tue Dec 24 16:03:33 2019 (r356054) +++ head/libexec/rtld-elf/powerpc64/reloc.c Tue Dec 24 16:07:35 2019 (r356055) @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -160,83 +161,84 @@ static int reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache, int flags, RtldLockState *lockstate) { - Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - const Elf_Sym *def; - const Obj_Entry *defobj; - Elf_Addr tmp; + const Elf_Sym *def = NULL; + const Obj_Entry *defobj; + Elf_Addr *where, symval = 0; + /* + * First, resolve symbol for relocations which + * reference symbols. + */ switch (ELF_R_TYPE(rela->r_info)) { - case R_PPC_NONE: - break; - - case R_PPC64_UADDR64: /* doubleword64 S + A */ - case R_PPC64_ADDR64: - case R_PPC_GLOB_DAT: + case R_PPC64_UADDR64: /* doubleword64 S + A */ + case R_PPC64_ADDR64: + case R_PPC_GLOB_DAT: + case R_PPC64_DTPMOD64: + case R_PPC64_TPREL64: + case R_PPC64_DTPREL64: def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, flags, cache, lockstate); if (def == NULL) { return (-1); } - - tmp = (Elf_Addr)(defobj->relocbase + def->st_value + - rela->r_addend); - - /* Don't issue write if unnecessary; avoid COW page fault */ - if (*where != tmp) { - *where = tmp; - } - break; - - case R_PPC_RELATIVE: /* doubleword64 B + A */ - tmp = (Elf_Addr)(obj->relocbase + rela->r_addend); - - /* As above, don't issue write unnecessarily */ - if (*where != tmp) { - *where = tmp; - } - break; - - case R_PPC_COPY: /* - * These are deferred until all other relocations - * have been done. All we do here is make sure - * that the COPY relocation is not in a shared - * library. They are allowed only in executable - * files. + * If symbol is IFUNC, only perform relocation + * when caller allowed it by passing + * SYMLOOK_IFUNC flag. Skip the relocations + * otherwise. + * + * Also error out in case IFUNC relocations + * are specified for TLS, which cannot be + * usefully interpreted. */ - if (!obj->mainprog) { - _rtld_error("%s: Unexpected R_COPY " - " relocation in shared library", - obj->path); - return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + switch (ELF_R_TYPE(rela->r_info)) { + case R_PPC64_UADDR64: + case R_PPC64_ADDR64: + case R_PPC_GLOB_DAT: + if ((flags & SYMLOOK_IFUNC) == 0) { + dbg("Non-PLT reference to IFUNC found!"); + obj->non_plt_gnu_ifunc = true; + return (0); + } + symval = (Elf_Addr)rtld_resolve_ifunc( + defobj, def); + break; + default: + _rtld_error("%s: IFUNC for TLS reloc", + obj->path); + return (-1); + } + } else { + if ((flags & SYMLOOK_IFUNC) != 0) + return (0); + symval = (Elf_Addr)defobj->relocbase + + def->st_value; } break; + default: + if ((flags & SYMLOOK_IFUNC) != 0) + return (0); + } - case R_PPC_JMP_SLOT: - /* - * These will be handled by the plt/jmpslot routines - */ - break; + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + switch (ELF_R_TYPE(rela->r_info)) { + case R_PPC_NONE: + break; + case R_PPC64_UADDR64: + case R_PPC64_ADDR64: + case R_PPC_GLOB_DAT: + /* Don't issue write if unnecessary; avoid COW page fault */ + if (*where != symval + rela->r_addend) { + *where = symval + rela->r_addend; + } + break; case R_PPC64_DTPMOD64: - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - - if (def == NULL) - return (-1); - *where = (Elf_Addr) defobj->tlsindex; - break; - case R_PPC64_TPREL64: - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - - if (def == NULL) - return (-1); - /* * We lazily allocate offsets for static TLS as we * see the first relocation that references the @@ -257,27 +259,52 @@ reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_ *(Elf_Addr **)where = *where * sizeof(Elf_Addr) + (Elf_Addr *)(def->st_value + rela->r_addend + defobj->tlsoffset - TLS_TP_OFFSET - TLS_TCB_SIZE); - break; - case R_PPC64_DTPREL64: - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - - if (def == NULL) - return (-1); - *where += (Elf_Addr)(def->st_value + rela->r_addend - TLS_DTV_OFFSET); + break; + case R_PPC_RELATIVE: /* doubleword64 B + A */ + symval = (Elf_Addr)(obj->relocbase + rela->r_addend); + /* As above, don't issue write unnecessarily */ + if (*where != symval) { + *where = symval; + } break; + case R_PPC_COPY: + /* + * These are deferred until all other relocations + * have been done. All we do here is make sure + * that the COPY relocation is not in a shared + * library. They are allowed only in executable + * files. + */ + if (!obj->mainprog) { + _rtld_error("%s: Unexpected R_COPY " + " relocation in shared library", + obj->path); + return (-1); + } + break; + case R_PPC_IRELATIVE: + /* + * These will be handled by reloc_iresolve(). + */ + obj->irelative = true; + break; + case R_PPC_JMP_SLOT: + /* + * These will be handled by the plt/jmpslot routines + */ + break; default: _rtld_error("%s: Unsupported relocation type %ld" " in non-PLT relocations\n", obj->path, ELF_R_TYPE(rela->r_info)); return (-1); - } + } return (0); } @@ -296,10 +323,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int int bytes = obj->dynsymcount * sizeof(SymCache); int r = -1; - if ((flags & SYMLOOK_IFUNC) != 0) - /* XXX not implemented */ - return (0); - /* * The dynamic loader may be called from a thread, we have * limited amounts of stack available so we cannot use alloca(). @@ -365,13 +388,13 @@ reloc_plt_object(Obj_Entry *obj, const Elf_Rela *rela) 8*((reloff < 0x8000) ? reloff : 0x8000) + 12*((reloff < 0x8000) ? 0 : (reloff - 0x8000)); #else + /* 64-Bit ELF V2 ABI Specification, sec. 4.2.5.3. */ *where = (Elf_Addr)obj->glink + 4*reloff + 32; #endif return (0); } - /* * Process the PLT relocations. */ @@ -385,6 +408,19 @@ reloc_plt(Obj_Entry *obj, int flags __unused, RtldLock relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { + +#if defined(_CALL_ELF) && _CALL_ELF == 2 + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) { + dbg("ABI violation - found IRELATIVE in the PLT."); + obj->irelative = true; + continue; + } +#endif + /* + * PowerPC(64) .rela.plt is composed of an array of + * R_PPC_JMP_SLOT relocations. Unlike other platforms, + * this is the ONLY relocation type that is valid here. + */ assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); if (reloc_plt_object(obj, rela) < 0) { @@ -396,7 +432,6 @@ reloc_plt(Obj_Entry *obj, int flags __unused, RtldLock return (0); } - /* * LD_BIND_NOW was set - force relocation for all jump slots */ @@ -413,6 +448,9 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { + /* This isn't actually a jump slot, ignore it. */ + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) + continue; assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, @@ -432,6 +470,11 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat *where = 0; #endif } else { + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + /* LD_BIND_NOW, ifunc in shared lib.*/ + obj->gnu_ifunc = true; + continue; + } reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *) rela); } @@ -494,34 +537,119 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const ((struct funcdesc *)(wherep))->toc += (Elf_Addr)defobj->relocbase; } -out: #else dbg(" reloc_jmpslot: where=%p, target=%p", (void *)wherep, (void *)target); - if (!ld_bind_not) + assert(target >= (Elf_Addr)defobj->relocbase); + + if (ld_bind_not) + goto out; + + if (*wherep != target) *wherep = target; + #endif +out: return (target); } int -reloc_iresolve(Obj_Entry *obj __unused, - struct Struct_RtldLockState *lockstate __unused) +reloc_iresolve(Obj_Entry *obj, + struct Struct_RtldLockState *lockstate) { - + /* + * Since PLT slots on PowerPC64 are always R_PPC_JMP_SLOT, + * R_PPC_IRELATIVE is in RELA. + */ +#if !defined(_CALL_ELF) || _CALL_ELF == 1 + (void)(obj); + (void)(lockstate); /* XXX not implemented */ return (0); +#else + const Elf_Rela *relalim; + const Elf_Rela *rela; + Elf_Addr *where, target, *ptr; + + if (!obj->irelative) + return (0); + + relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); + for (rela = obj->rela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) { + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + + lock_release(rtld_bind_lock, lockstate); + target = call_ifunc_resolver(ptr); + wlock_acquire(rtld_bind_lock, lockstate); + + *where = target; + } + } + /* + * XXX Remove me when lld is fixed! + * LLD currently makes illegal relocations in the PLT. + */ + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) { + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + + lock_release(rtld_bind_lock, lockstate); + target = call_ifunc_resolver(ptr); + wlock_acquire(rtld_bind_lock, lockstate); + + *where = target; + } + } + + obj->irelative = false; + return (0); +#endif } int reloc_gnu_ifunc(Obj_Entry *obj __unused, int flags __unused, struct Struct_RtldLockState *lockstate __unused) { - +#if !defined(_CALL_ELF) || _CALL_ELF == 1 + _rtld_error("reloc_gnu_ifunc(): Not implemented!"); /* XXX not implemented */ + return (-1); +#else + + const Elf_Rela *relalim; + const Elf_Rela *rela; + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + if (!obj->gnu_ifunc) + return (0); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT) { + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, + SYMLOOK_IN_PLT | flags, NULL, lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + lock_release(rtld_bind_lock, lockstate); + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); + reloc_jmpslot(where, target, defobj, obj, + (const Elf_Rel *)rela); + } + } + obj->gnu_ifunc = false; return (0); +#endif } void @@ -542,6 +670,27 @@ init_pltgot(Obj_Entry *obj) memcpy(pltcall, _rtld_bind_start, sizeof(struct funcdesc)); pltcall[2] = (Elf_Addr)obj; #endif +} + +/* + * Actual values are 32 bit. + */ +u_long cpu_features; +u_long cpu_features2; + +void +powerpc64_abi_variant_hook(Elf_Auxinfo** aux_info) +{ + /* + * Since aux_info[] is easier to work with than aux, go ahead and + * initialize cpu_features / cpu_features2. + */ + cpu_features = -1UL; + cpu_features2 = -1UL; + if (aux_info[AT_HWCAP] != NULL) + cpu_features = (uint32_t)aux_info[AT_HWCAP]->a_un.a_val; + if (aux_info[AT_HWCAP2] != NULL) + cpu_features2 = (uint32_t)aux_info[AT_HWCAP2]->a_un.a_val; } void Modified: head/libexec/rtld-elf/powerpc64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc64/rtld_machdep.h Tue Dec 24 16:03:33 2019 (r356054) +++ head/libexec/rtld-elf/powerpc64/rtld_machdep.h Tue Dec 24 16:07:35 2019 (r356055) @@ -53,8 +53,13 @@ void reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocb #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +extern u_long cpu_features; /* r3 */ +extern u_long cpu_features2; /* r4 */ +/* r5-r10: ifunc resolver parameters reserved for future assignment. */ #define call_ifunc_resolver(ptr) \ - (((Elf_Addr (*)(void))ptr)()) + (((Elf_Addr (*)(uint32_t, uint32_t, uint64_t, uint64_t, uint64_t, \ + uint64_t, uint64_t, uint64_t))ptr)((uint32_t)cpu_features, \ + (uint32_t)cpu_features2, 0, 0, 0, 0, 0, 0)) /* * TLS @@ -83,6 +88,7 @@ extern void *__tls_get_addr(tls_index* ti); #define RTLD_DEFAULT_STACK_PF_EXEC PF_X #define RTLD_DEFAULT_STACK_EXEC PROT_EXEC -#define md_abi_variant_hook(x) +extern void powerpc64_abi_variant_hook(Elf_Auxinfo **); +#define md_abi_variant_hook(x) powerpc64_abi_variant_hook(x) #endif From owner-svn-src-head@freebsd.org Tue Dec 24 16:13:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E033B1EBF96; Tue, 24 Dec 2019 16:13:15 +0000 (UTC) (envelope-from bdragon@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 47j1V36PhVz40X7; Tue, 24 Dec 2019 16:13:15 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 D6D572AEB; Tue, 24 Dec 2019 16:13:15 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOGDFMn032187; Tue, 24 Dec 2019 16:13:15 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOGDFQp032185; Tue, 24 Dec 2019 16:13:15 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912241613.xBOGDFQp032185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Tue, 24 Dec 2019 16:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356056 - head/libexec/rtld-elf/powerpc X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/libexec/rtld-elf/powerpc X-SVN-Commit-Revision: 356056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 16:13:15 -0000 Author: bdragon Date: Tue Dec 24 16:13:15 2019 New Revision: 356056 URL: https://svnweb.freebsd.org/changeset/base/356056 Log: [PowerPC] powerpc32 rtld IFUNC handling code As PowerPC is moving to clang, we can finally start taking advantage of IFUNC. Implement the MD parts of IFUNC handling for rtld. Currently, it is necessary to look for R_PPC_IRELATIVE in the PLT in addition to RELA. This is an ABI violation, but LLD9 has some .iplt bugs that require this as a workaround. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22855 Modified: head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc/rtld_machdep.h Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Tue Dec 24 16:07:35 2019 (r356055) +++ head/libexec/rtld-elf/powerpc/reloc.c Tue Dec 24 16:13:15 2019 (r356056) @@ -166,82 +166,84 @@ static int reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache, int flags, RtldLockState *lockstate) { - Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - const Elf_Sym *def; - const Obj_Entry *defobj; - Elf_Addr tmp; + const Elf_Sym *def = NULL; + const Obj_Entry *defobj; + Elf_Addr *where, symval = 0; + /* + * First, resolve symbol for relocations which + * reference symbols. + */ switch (ELF_R_TYPE(rela->r_info)) { - case R_PPC_NONE: - break; - - case R_PPC_ADDR32: /* word32 S + A */ - case R_PPC_GLOB_DAT: /* word32 S + A */ + case R_PPC_UADDR32: /* word32 S + A */ + case R_PPC_ADDR32: + case R_PPC_GLOB_DAT: /* word32 S + A */ + case R_PPC_DTPMOD32: + case R_PPC_TPREL32: + case R_PPC_DTPREL32: def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, flags, cache, lockstate); if (def == NULL) { return (-1); } - tmp = (Elf_Addr)(defobj->relocbase + def->st_value + - rela->r_addend); - - /* Don't issue write if unnecessary; avoid COW page fault */ - if (*where != tmp) { - *where = tmp; - } - break; - - case R_PPC_RELATIVE: /* word32 B + A */ - tmp = (Elf_Addr)(obj->relocbase + rela->r_addend); - - /* As above, don't issue write unnecessarily */ - if (*where != tmp) { - *where = tmp; - } - break; - - case R_PPC_COPY: /* - * These are deferred until all other relocations - * have been done. All we do here is make sure - * that the COPY relocation is not in a shared - * library. They are allowed only in executable - * files. + * If symbol is IFUNC, only perform relocation + * when caller allowed it by passing + * SYMLOOK_IFUNC flag. Skip the relocations + * otherwise. + * + * Also error out in case IFUNC relocations + * are specified for TLS, which cannot be + * usefully interpreted. */ - if (!obj->mainprog) { - _rtld_error("%s: Unexpected R_COPY " - " relocation in shared library", - obj->path); - return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + switch (ELF_R_TYPE(rela->r_info)) { + case R_PPC_UADDR32: + case R_PPC_ADDR32: + case R_PPC_GLOB_DAT: + if ((flags & SYMLOOK_IFUNC) == 0) { + dbg("Non-PLT reference to IFUNC found!"); + obj->non_plt_gnu_ifunc = true; + return (0); + } + symval = (Elf_Addr)rtld_resolve_ifunc( + defobj, def); + break; + default: + _rtld_error("%s: IFUNC for TLS reloc", + obj->path); + return (-1); + } + } else { + if ((flags & SYMLOOK_IFUNC) != 0) + return (0); + symval = (Elf_Addr)defobj->relocbase + + def->st_value; } break; + default: + if ((flags & SYMLOOK_IFUNC) != 0) + return (0); + } + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - case R_PPC_JMP_SLOT: - /* - * These will be handled by the plt/jmpslot routines - */ + switch (ELF_R_TYPE(rela->r_info)) { + case R_PPC_NONE: break; - + case R_PPC_UADDR32: + case R_PPC_ADDR32: + case R_PPC_GLOB_DAT: + /* Don't issue write if unnecessary; avoid COW page fault */ + if (*where != symval + rela->r_addend) { + *where = symval + rela->r_addend; + } + break; case R_PPC_DTPMOD32: - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - - if (def == NULL) - return (-1); - *where = (Elf_Addr) defobj->tlsindex; - break; - case R_PPC_TPREL32: - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - - if (def == NULL) - return (-1); - /* * We lazily allocate offsets for static TLS as we * see the first relocation that references the @@ -262,27 +264,52 @@ reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_ *(Elf_Addr **)where = *where * sizeof(Elf_Addr) + (Elf_Addr *)(def->st_value + rela->r_addend + defobj->tlsoffset - TLS_TP_OFFSET - TLS_TCB_SIZE); - break; - case R_PPC_DTPREL32: - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - - if (def == NULL) - return (-1); - *where += (Elf_Addr)(def->st_value + rela->r_addend - TLS_DTV_OFFSET); + break; + case R_PPC_RELATIVE: /* word32 B + A */ + symval = (Elf_Addr)(obj->relocbase + rela->r_addend); + /* As above, don't issue write unnecessarily */ + if (*where != symval) { + *where = symval; + } break; - + case R_PPC_COPY: + /* + * These are deferred until all other relocations + * have been done. All we do here is make sure + * that the COPY relocation is not in a shared + * library. They are allowed only in executable + * files. + */ + if (!obj->mainprog) { + _rtld_error("%s: Unexpected R_COPY " + " relocation in shared library", + obj->path); + return (-1); + } + break; + case R_PPC_IRELATIVE: + /* + * These will be handled by reloc_iresolve(). + */ + obj->irelative = true; + break; + case R_PPC_JMP_SLOT: + /* + * These will be handled by the plt/jmpslot routines + */ + break; + default: _rtld_error("%s: Unsupported relocation type %d" " in non-PLT relocations\n", obj->path, ELF_R_TYPE(rela->r_info)); return (-1); - } + } return (0); } @@ -300,10 +327,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int SymCache *cache; int r = -1; - if ((flags & SYMLOOK_IFUNC) != 0) - /* XXX not implemented */ - return (0); - /* * The dynamic loader may be called from a thread, we have * limited amounts of stack available so we cannot use alloca(). @@ -404,7 +427,6 @@ reloc_plt_object(Obj_Entry *obj, const Elf_Rela *rela) return (0); } - /* * Process the PLT relocations. */ @@ -420,6 +442,17 @@ reloc_plt(Obj_Entry *obj, int flags __unused, RtldLock relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) { + dbg("ABI violation - found IRELATIVE in the PLT."); + obj->irelative = true; + continue; + } + + /* + * PowerPC(64) .rela.plt is composed of an array of + * R_PPC_JMP_SLOT relocations. Unlike other platforms, + * this is the ONLY relocation type that is valid here. + */ assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); if (reloc_plt_object(obj, rela) < 0) { @@ -438,7 +471,6 @@ reloc_plt(Obj_Entry *obj, int flags __unused, RtldLock return (0); } - /* * LD_BIND_NOW was set - force relocation for all jump slots */ @@ -455,6 +487,9 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { + /* This isn't actually a jump slot, ignore it. */ + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) + continue; assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, @@ -466,15 +501,18 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat target = (Elf_Addr)(defobj->relocbase + def->st_value); -#if 0 - /* PG XXX */ - dbg("\"%s\" in \"%s\" --> %p in \"%s\"", - defobj->strtab + def->st_name, basename(obj->path), - (void *)target, basename(defobj->path)); -#endif - - reloc_jmpslot(where, target, defobj, obj, - (const Elf_Rel *) rela); + if (def == &sym_zero) { + /* Zero undefined weak symbols */ + *where = 0; + } else { + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + /* LD_BIND_NOW, ifunc in shared lib.*/ + obj->gnu_ifunc = true; + continue; + } + reloc_jmpslot(where, target, defobj, obj, + (const Elf_Rel *) rela); + } } obj->jmpslots_done = true; @@ -484,9 +522,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat /* - * Update the value of a PLT jump slot. Branch directly to the target if - * it is within +/- 32Mb, otherwise go indirectly via the pltcall - * trampoline call and jump table. + * Update the value of a PLT jump slot. */ Elf_Addr reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, @@ -501,22 +537,32 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, if (ld_bind_not) goto out; + /* - * At the PLT entry pointed at by `wherep', construct - * a direct transfer to the now fully resolved function - * address. + * Process Secure-PLT. */ - offset = target - (Elf_Addr)wherep; - if (obj->gotptr != NULL) { assert(wherep >= (Elf_Word *)obj->pltgot); assert(wherep < (Elf_Word *)obj->pltgot + obj->pltrelasize); - *wherep = target; + if (*wherep != target) + *wherep = target; goto out; } + /* + * BSS-PLT optimization: + * Branch directly to the target if it is within +/- 32Mb, + * otherwise go indirectly via the pltcall trampoline call and + * jump table. + */ + offset = target - (Elf_Addr)wherep; if (abs((int)offset) < 32*1024*1024) { /* inside 32MB? */ + /* + * At the PLT entry pointed at by `wherep', construct + * a direct transfer to the now fully resolved function + * address. + */ /* b value # branch directly */ *wherep = 0x48000000 | (offset & 0x03fffffc); __syncicache(wherep, 4); @@ -557,11 +603,52 @@ out: } int -reloc_iresolve(Obj_Entry *obj __unused, - struct Struct_RtldLockState *lockstate __unused) +reloc_iresolve(Obj_Entry *obj, + struct Struct_RtldLockState *lockstate) { + /* + * Since PLT slots on PowerPC are always R_PPC_JMP_SLOT, + * R_PPC_IRELATIVE is in RELA. + */ + const Elf_Rela *relalim; + const Elf_Rela *rela; + Elf_Addr *where, target, *ptr; - /* XXX not implemented */ + if (!obj->irelative) + return (0); + + relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); + for (rela = obj->rela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) { + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + + lock_release(rtld_bind_lock, lockstate); + target = call_ifunc_resolver(ptr); + wlock_acquire(rtld_bind_lock, lockstate); + + *where = target; + } + } + /* + * XXX Remove me when lld is fixed! + * LLD currently makes illegal relocations in the PLT. + */ + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_PPC_IRELATIVE) { + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + + lock_release(rtld_bind_lock, lockstate); + target = call_ifunc_resolver(ptr); + wlock_acquire(rtld_bind_lock, lockstate); + + *where = target; + } + } + + obj->irelative = false; return (0); } @@ -569,8 +656,32 @@ int reloc_gnu_ifunc(Obj_Entry *obj __unused, int flags __unused, struct Struct_RtldLockState *lockstate __unused) { + const Elf_Rela *relalim; + const Elf_Rela *rela; + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; - /* XXX not implemented */ + if (!obj->gnu_ifunc) + return (0); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT) { + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, + SYMLOOK_IN_PLT | flags, NULL, lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + lock_release(rtld_bind_lock, lockstate); + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); + reloc_jmpslot(where, target, defobj, obj, + (const Elf_Rel *)rela); + } + } + obj->gnu_ifunc = false; return (0); } @@ -662,6 +773,27 @@ init_pltgot(Obj_Entry *obj) * The icache will be sync'd in reloc_plt, which is called * after all the slots have been updated */ +} + +/* + * 32 bit cpu feature flag fields. + */ +u_long cpu_features; +u_long cpu_features2; + +void +powerpc_abi_variant_hook(Elf_Auxinfo** aux_info) +{ + /* + * Since aux_info[] is easier to work with than aux, go ahead and + * initialize cpu_features / cpu_features2. + */ + cpu_features = -1UL; + cpu_features2 = -1UL; + if (aux_info[AT_HWCAP] != NULL) + cpu_features = aux_info[AT_HWCAP]->a_un.a_val; + if (aux_info[AT_HWCAP2] != NULL) + cpu_features2 = aux_info[AT_HWCAP2]->a_un.a_val; } void Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc/rtld_machdep.h Tue Dec 24 16:07:35 2019 (r356055) +++ head/libexec/rtld-elf/powerpc/rtld_machdep.h Tue Dec 24 16:13:15 2019 (r356056) @@ -53,8 +53,13 @@ void reloc_non_plt_self(Elf_Dyn *dynp, Elf_Addr relocb #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +extern u_long cpu_features; /* r3 */ +extern u_long cpu_features2; /* r4 */ +/* r5-10: ifunc resolver parameters reserved for future assignment. */ #define call_ifunc_resolver(ptr) \ - (((Elf_Addr (*)(void))ptr)()) + (((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, \ + uint32_t, uint32_t, uint32_t))ptr)((uint32_t)cpu_features, \ + (uint32_t)cpu_features2, 0, 0, 0, 0, 0, 0)) /* * PLT functions. Not really correct prototypes, but the @@ -91,6 +96,7 @@ extern void *__tls_get_addr(tls_index* ti); #define RTLD_DEFAULT_STACK_PF_EXEC PF_X #define RTLD_DEFAULT_STACK_EXEC PROT_EXEC -#define md_abi_variant_hook(x) +extern void powerpc_abi_variant_hook(Elf_Auxinfo **); +#define md_abi_variant_hook(x) powerpc_abi_variant_hook(x) #endif From owner-svn-src-head@freebsd.org Tue Dec 24 16:19:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF8AB1EC07F; Tue, 24 Dec 2019 16:19:35 +0000 (UTC) (envelope-from cem@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 47j1dM6mycz40hg; Tue, 24 Dec 2019 16:19:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E3BF62B07; Tue, 24 Dec 2019 16:19:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOGJZRl032511; Tue, 24 Dec 2019 16:19:35 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOGJXlg032499; Tue, 24 Dec 2019 16:19:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912241619.xBOGJXlg032499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 24 Dec 2019 16:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356057 - in head: share/man/man9 sys/ddb sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/ddb sys/kern sys/sys X-SVN-Commit-Revision: 356057 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 16:19:36 -0000 Author: cem Date: Tue Dec 24 16:19:33 2019 New Revision: 356057 URL: https://svnweb.freebsd.org/changeset/base/356057 Log: sleep(9), sleepqueue(9): const'ify wchan pointers _sleep(9), wakeup(9), sleepqueue(9), et al do not dereference or modify the channel pointers provided in any way; they are merely used as intptrs into a dictionary structure to match waiters with wakers. Correctly annotate this such that _sleep() and wakeup() may be used on const pointers without invoking ugly patterns like __DECONST(). Plumb const through all of the underlying sleepqueue bits. No functional change. Reviewed by: rlibby Discussed with: kib, markj Differential Revision: https://reviews.freebsd.org/D22914 Modified: head/share/man/man9/sleep.9 head/share/man/man9/sleepqueue.9 head/sys/ddb/db_ps.c head/sys/kern/kern_clock.c head/sys/kern/kern_lock.c head/sys/kern/kern_proc.c head/sys/kern/kern_sx.c head/sys/kern/kern_synch.c head/sys/kern/subr_sleepqueue.c head/sys/sys/proc.h head/sys/sys/sleepqueue.h head/sys/sys/systm.h head/sys/sys/user.h Modified: head/share/man/man9/sleep.9 ============================================================================== --- head/share/man/man9/sleep.9 Tue Dec 24 16:13:15 2019 (r356056) +++ head/share/man/man9/sleep.9 Tue Dec 24 16:19:33 2019 (r356057) @@ -47,14 +47,14 @@ .In sys/systm.h .In sys/proc.h .Ft int -.Fn msleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo" +.Fn msleep "const void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo" .Ft int -.Fn msleep_sbt "void *chan" "struct mtx *mtx" "int priority" \ +.Fn msleep_sbt "const void *chan" "struct mtx *mtx" "int priority" \ "const char *wmesg" "sbintime_t sbt" "sbintime_t pr" "int flags" .Ft int -.Fn msleep_spin "void *chan" "struct mtx *mtx" "const char *wmesg" "int timo" +.Fn msleep_spin "const void *chan" "struct mtx *mtx" "const char *wmesg" "int timo" .Ft int -.Fn msleep_spin_sbt "void *chan" "struct mtx *mtx" "const char *wmesg" \ +.Fn msleep_spin_sbt "const void *chan" "struct mtx *mtx" "const char *wmesg" \ "sbintime_t sbt" "sbintime_t pr" "int flags" .Ft int .Fn pause "const char *wmesg" "int timo" @@ -64,16 +64,16 @@ .Fn pause_sbt "const char *wmesg" "sbintime_t sbt" "sbintime_t pr" \ "int flags" .Ft int -.Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo" +.Fn tsleep "const void *chan" "int priority" "const char *wmesg" "int timo" .Ft int -.Fn tsleep_sbt "void *chan" "int priority" "const char *wmesg" \ +.Fn tsleep_sbt "const void *chan" "int priority" "const char *wmesg" \ "sbintime_t sbt" "sbintime_t pr" "int flags" .Ft void -.Fn wakeup "void *chan" +.Fn wakeup "const void *chan" .Ft void -.Fn wakeup_one "void *chan" +.Fn wakeup_one "const void *chan" .Ft void -.Fn wakeup_any "void *chan" +.Fn wakeup_any "const void *chan" .Sh DESCRIPTION The functions .Fn tsleep , Modified: head/share/man/man9/sleepqueue.9 ============================================================================== --- head/share/man/man9/sleepqueue.9 Tue Dec 24 16:13:15 2019 (r356056) +++ head/share/man/man9/sleepqueue.9 Tue Dec 24 16:19:33 2019 (r356057) @@ -54,40 +54,40 @@ .Ft int .Fn sleepq_abort "struct thread *td" .Ft void -.Fn sleepq_add "void *wchan" "struct lock_object *lock" "const char *wmesg" "int flags" "int queue" +.Fn sleepq_add "const void *wchan" "struct lock_object *lock" "const char *wmesg" "int flags" "int queue" .Ft struct sleepqueue * .Fn sleepq_alloc "void" .Ft int -.Fn sleepq_broadcast "void *wchan" "int flags" "int pri" "int queue" +.Fn sleepq_broadcast "const void *wchan" "int flags" "int pri" "int queue" .Ft void .Fn sleepq_free "struct sleepqueue *sq" .Ft struct sleepqueue * -.Fn sleepq_lookup "void *wchan" +.Fn sleepq_lookup "const void *wchan" .Ft void -.Fn sleepq_lock "void *wchan" +.Fn sleepq_lock "const void *wchan" .Ft void -.Fn sleepq_release "void *wchan" +.Fn sleepq_release "const void *wchan" .Ft void -.Fn sleepq_remove "struct thread *td" "void *wchan" +.Fn sleepq_remove "struct thread *td" "const void *wchan" .Ft int -.Fn sleepq_signal "void *wchan" "int flags" "int pri" "int queue" +.Fn sleepq_signal "const void *wchan" "int flags" "int pri" "int queue" .Ft void -.Fn sleepq_set_timeout "void *wchan" "int timo" +.Fn sleepq_set_timeout "const void *wchan" "int timo" .Ft void -.Fn sleepq_set_timeout_sbt "void *wchan" "sbintime_t sbt" \ +.Fn sleepq_set_timeout_sbt "const void *wchan" "sbintime_t sbt" \ "sbintime_t pr" "int flags" .Ft u_int -.Fn sleepq_sleepcnt "void *wchan" "int queue" +.Fn sleepq_sleepcnt "const void *wchan" "int queue" .Ft int -.Fn sleepq_timedwait "void *wchan" "int pri" +.Fn sleepq_timedwait "const void *wchan" "int pri" .Ft int -.Fn sleepq_timedwait_sig "void *wchan" "int pri" +.Fn sleepq_timedwait_sig "const void *wchan" "int pri" .Ft int -.Fn sleepq_type "void *wchan" +.Fn sleepq_type "const void *wchan" .Ft void -.Fn sleepq_wait "void *wchan" "int pri" +.Fn sleepq_wait "const void *wchan" "int pri" .Ft int -.Fn sleepq_wait_sig "void *wchan" "int pri" +.Fn sleepq_wait_sig "const void *wchan" "int pri" .Sh DESCRIPTION Sleep queues provide a mechanism for suspending execution of a thread until some condition is met. Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/ddb/db_ps.c Tue Dec 24 16:19:33 2019 (r356057) @@ -265,7 +265,7 @@ dumpthread(volatile struct proc *p, volatile struct th { char state[9], wprefix; const char *wmesg; - void *wchan; + const void *wchan; if (all) { db_printf("%6d ", td->td_tid); Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/kern/kern_clock.c Tue Dec 24 16:19:33 2019 (r356057) @@ -212,7 +212,7 @@ deadlres_td_on_lock(struct proc *p, struct thread *td, static void deadlres_td_sleep_q(struct proc *p, struct thread *td, int slpticks) { - void *wchan; + const void *wchan; int i, slptype, tticks; sx_assert(&allproc_lock, SX_LOCKED); Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/kern/kern_lock.c Tue Dec 24 16:19:33 2019 (r356057) @@ -1733,7 +1733,7 @@ _lockmgr_assert(const struct lock *lk, int what, const int lockmgr_chain(struct thread *td, struct thread **ownerp) { - struct lock *lk; + const struct lock *lk; lk = td->td_wchan; Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/kern/kern_proc.c Tue Dec 24 16:19:33 2019 (r356057) @@ -1297,7 +1297,7 @@ pstats_free(struct pstats *ps) * it can be replaced by assignment of zero. */ static inline uint32_t -ptr32_trim(void *ptr) +ptr32_trim(const void *ptr) { uintptr_t uptr; Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/kern/kern_sx.c Tue Dec 24 16:19:33 2019 (r356057) @@ -1526,7 +1526,7 @@ db_show_sx(const struct lock_object *lock) int sx_chain(struct thread *td, struct thread **ownerp) { - struct sx *sx; + const struct sx *sx; /* * Check to see if this thread is blocked on an sx lock. Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/kern/kern_synch.c Tue Dec 24 16:19:33 2019 (r356057) @@ -77,7 +77,7 @@ SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_F NULL); int hogticks; -static char pause_wchan[MAXCPU]; +static const char pause_wchan[MAXCPU]; static struct callout loadav_callout; @@ -131,7 +131,7 @@ SYSINIT(sleepinit, SI_SUB_KMEM, SI_ORDER_ANY, sleepini * flag the lock is not re-locked before returning. */ int -_sleep(void *ident, struct lock_object *lock, int priority, +_sleep(const void *ident, struct lock_object *lock, int priority, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { struct thread *td; @@ -233,7 +233,7 @@ _sleep(void *ident, struct lock_object *lock, int prio } int -msleep_spin_sbt(void *ident, struct mtx *mtx, const char *wmesg, +msleep_spin_sbt(const void *ident, struct mtx *mtx, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { struct thread *td; @@ -409,7 +409,7 @@ refcount_sleep(volatile u_int *count, const char *wmes * Make all threads sleeping on the specified identifier runnable. */ void -wakeup(void *ident) +wakeup(const void *ident) { int wakeup_swapper; @@ -429,7 +429,7 @@ wakeup(void *ident) * swapped out. */ void -wakeup_one(void *ident) +wakeup_one(const void *ident) { int wakeup_swapper; @@ -441,7 +441,7 @@ wakeup_one(void *ident) } void -wakeup_any(void *ident) +wakeup_any(const void *ident) { int wakeup_swapper; Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/kern/subr_sleepqueue.c Tue Dec 24 16:19:33 2019 (r356057) @@ -130,7 +130,7 @@ struct sleepqueue { u_int sq_blockedcnt[NR_SLEEPQS]; /* (c) N. of blocked threads. */ LIST_ENTRY(sleepqueue) sq_hash; /* (c) Chain and free list. */ LIST_HEAD(, sleepqueue) sq_free; /* (c) Free queues. */ - void *sq_wchan; /* (c) Wait channel. */ + const void *sq_wchan; /* (c) Wait channel. */ int sq_type; /* (c) Queue type. */ #ifdef INVARIANTS struct lock_object *sq_lock; /* (c) Associated lock. */ @@ -163,7 +163,7 @@ static uma_zone_t sleepq_zone; /* * Prototypes for non-exported routines. */ -static int sleepq_catch_signals(void *wchan, int pri); +static int sleepq_catch_signals(const void *wchan, int pri); static inline int sleepq_check_signals(void); static inline int sleepq_check_timeout(void); #ifdef INVARIANTS @@ -173,7 +173,7 @@ static int sleepq_init(void *mem, int size, int flags) static int sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri, int srqflags); static void sleepq_remove_thread(struct sleepqueue *sq, struct thread *td); -static void sleepq_switch(void *wchan, int pri); +static void sleepq_switch(const void *wchan, int pri); static void sleepq_timeout(void *arg); SDT_PROBE_DECLARE(sched, , , sleep); @@ -257,7 +257,7 @@ sleepq_free(struct sleepqueue *sq) * Lock the sleep queue chain associated with the specified wait channel. */ void -sleepq_lock(void *wchan) +sleepq_lock(const void *wchan) { struct sleepqueue_chain *sc; @@ -271,7 +271,7 @@ sleepq_lock(void *wchan) * the table, NULL is returned. */ struct sleepqueue * -sleepq_lookup(void *wchan) +sleepq_lookup(const void *wchan) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -289,7 +289,7 @@ sleepq_lookup(void *wchan) * Unlock the sleep queue chain associated with a given wait channel. */ void -sleepq_release(void *wchan) +sleepq_release(const void *wchan) { struct sleepqueue_chain *sc; @@ -304,8 +304,8 @@ sleepq_release(void *wchan) * woken up. */ void -sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags, - int queue) +sleepq_add(const void *wchan, struct lock_object *lock, const char *wmesg, + int flags, int queue) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -390,7 +390,7 @@ sleepq_add(void *wchan, struct lock_object *lock, cons * sleep queue after timo ticks if the thread has not already been awakened. */ void -sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sbintime_t pr, +sleepq_set_timeout_sbt(const void *wchan, sbintime_t sbt, sbintime_t pr, int flags) { struct sleepqueue_chain *sc __unused; @@ -419,7 +419,7 @@ sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sb * Return the number of actual sleepers for the specified queue. */ u_int -sleepq_sleepcnt(void *wchan, int queue) +sleepq_sleepcnt(const void *wchan, int queue) { struct sleepqueue *sq; @@ -438,7 +438,7 @@ sleepq_sleepcnt(void *wchan, int queue) * may have transitioned from the sleepq lock to a run lock. */ static int -sleepq_catch_signals(void *wchan, int pri) +sleepq_catch_signals(const void *wchan, int pri) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -558,7 +558,7 @@ out: * Returns with thread lock. */ static void -sleepq_switch(void *wchan, int pri) +sleepq_switch(const void *wchan, int pri) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -664,7 +664,7 @@ sleepq_check_signals(void) * Block the current thread until it is awakened from its sleep queue. */ void -sleepq_wait(void *wchan, int pri) +sleepq_wait(const void *wchan, int pri) { struct thread *td; @@ -679,7 +679,7 @@ sleepq_wait(void *wchan, int pri) * or it is interrupted by a signal. */ int -sleepq_wait_sig(void *wchan, int pri) +sleepq_wait_sig(const void *wchan, int pri) { int rcatch; @@ -694,7 +694,7 @@ sleepq_wait_sig(void *wchan, int pri) * or it times out while waiting. */ int -sleepq_timedwait(void *wchan, int pri) +sleepq_timedwait(const void *wchan, int pri) { struct thread *td; @@ -712,7 +712,7 @@ sleepq_timedwait(void *wchan, int pri) * it is interrupted by a signal, or it times out waiting to be awakened. */ int -sleepq_timedwait_sig(void *wchan, int pri) +sleepq_timedwait_sig(const void *wchan, int pri) { int rcatch, rvalt, rvals; @@ -731,7 +731,7 @@ sleepq_timedwait_sig(void *wchan, int pri) * Returns the type of sleepqueue given a waitchannel. */ int -sleepq_type(void *wchan) +sleepq_type(const void *wchan) { struct sleepqueue *sq; int type; @@ -910,7 +910,7 @@ sleepq_init(void *mem, int size, int flags) * Find thread sleeping on a wait channel and resume it. */ int -sleepq_signal(void *wchan, int flags, int pri, int queue) +sleepq_signal(const void *wchan, int flags, int pri, int queue) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -971,7 +971,7 @@ match_any(struct thread *td __unused) * Resume all threads sleeping on a specified wait channel. */ int -sleepq_broadcast(void *wchan, int flags, int pri, int queue) +sleepq_broadcast(const void *wchan, int flags, int pri, int queue) { struct sleepqueue *sq; @@ -1023,7 +1023,7 @@ sleepq_timeout(void *arg) struct sleepqueue_chain *sc __unused; struct sleepqueue *sq; struct thread *td; - void *wchan; + const void *wchan; int wakeup_swapper; td = arg; @@ -1067,7 +1067,7 @@ sleepq_timeout(void *arg) * wait channel if it is on that queue. */ void -sleepq_remove(struct thread *td, void *wchan) +sleepq_remove(struct thread *td, const void *wchan) { struct sleepqueue_chain *sc; struct sleepqueue *sq; @@ -1111,7 +1111,7 @@ int sleepq_abort(struct thread *td, int intrval) { struct sleepqueue *sq; - void *wchan; + const void *wchan; THREAD_LOCK_ASSERT(td, MA_OWNED); MPASS(TD_ON_SLEEPQ(td)); @@ -1183,7 +1183,7 @@ sleepq_chains_remove_matching(bool (*matches)(struct t */ #ifdef STACK int -sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, +sleepq_sbuf_print_stacks(struct sbuf *sb, const void *wchan, int queue, int *count_stacks_printed) { struct thread *td, *td_next; Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/sys/proc.h Tue Dec 24 16:19:33 2019 (r356057) @@ -252,7 +252,7 @@ struct thread { int td_pflags; /* (k) Private thread (TDP_*) flags. */ int td_dupfd; /* (k) Ret value from fdopen. XXX */ int td_sqqueue; /* (t) Sleepqueue queue blocked on. */ - void *td_wchan; /* (t) Sleep address. */ + const void *td_wchan; /* (t) Sleep address. */ const char *td_wmesg; /* (t) Reason for sleep. */ volatile u_char td_owepreempt; /* (k*) Preempt on last critical_exit */ u_char td_tsqueue; /* (t) Turnstile queue blocked on. */ Modified: head/sys/sys/sleepqueue.h ============================================================================== --- head/sys/sys/sleepqueue.h Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/sys/sleepqueue.h Tue Dec 24 16:19:33 2019 (r356057) @@ -88,33 +88,33 @@ struct thread; void init_sleepqueues(void); int sleepq_abort(struct thread *td, int intrval); -void sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, - int flags, int queue); +void sleepq_add(const void *wchan, struct lock_object *lock, + const char *wmesg, int flags, int queue); struct sleepqueue *sleepq_alloc(void); -int sleepq_broadcast(void *wchan, int flags, int pri, int queue); +int sleepq_broadcast(const void *wchan, int flags, int pri, int queue); void sleepq_chains_remove_matching(bool (*matches)(struct thread *)); void sleepq_free(struct sleepqueue *sq); -void sleepq_lock(void *wchan); -struct sleepqueue *sleepq_lookup(void *wchan); -void sleepq_release(void *wchan); -void sleepq_remove(struct thread *td, void *wchan); +void sleepq_lock(const void *wchan); +struct sleepqueue *sleepq_lookup(const void *wchan); +void sleepq_release(const void *wchan); +void sleepq_remove(struct thread *td, const void *wchan); int sleepq_remove_matching(struct sleepqueue *sq, int queue, bool (*matches)(struct thread *), int pri); -int sleepq_signal(void *wchan, int flags, int pri, int queue); -void sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, +int sleepq_signal(const void *wchan, int flags, int pri, int queue); +void sleepq_set_timeout_sbt(const void *wchan, sbintime_t sbt, sbintime_t pr, int flags); #define sleepq_set_timeout(wchan, timo) \ sleepq_set_timeout_sbt((wchan), tick_sbt * (timo), 0, C_HARDCLOCK) -u_int sleepq_sleepcnt(void *wchan, int queue); -int sleepq_timedwait(void *wchan, int pri); -int sleepq_timedwait_sig(void *wchan, int pri); -int sleepq_type(void *wchan); -void sleepq_wait(void *wchan, int pri); -int sleepq_wait_sig(void *wchan, int pri); +u_int sleepq_sleepcnt(const void *wchan, int queue); +int sleepq_timedwait(const void *wchan, int pri); +int sleepq_timedwait_sig(const void *wchan, int pri); +int sleepq_type(const void *wchan); +void sleepq_wait(const void *wchan, int pri); +int sleepq_wait_sig(const void *wchan, int pri); #ifdef STACK struct sbuf; -int sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, +int sleepq_sbuf_print_stacks(struct sbuf *sb, const void *wchan, int queue, int *count_stacks_printed); #endif Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/sys/systm.h Tue Dec 24 16:19:33 2019 (r356057) @@ -480,7 +480,7 @@ static __inline void splx(intrmask_t ipl __unused) { * Common `proc' functions are declared here so that proc.h can be included * less often. */ -int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri, +int _sleep(const void * _Nonnull chan, struct lock_object *lock, int pri, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep(chan, mtx, pri, wmesg, timo) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ @@ -488,7 +488,7 @@ int _sleep(void * _Nonnull chan, struct lock_object *l #define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \ (flags)) -int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx, +int msleep_spin_sbt(const void * _Nonnull chan, struct mtx *mtx, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep_spin(chan, mtx, wmesg, timo) \ msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \ @@ -504,9 +504,9 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbint 0, C_HARDCLOCK) #define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \ _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) -void wakeup(void * chan); -void wakeup_one(void * chan); -void wakeup_any(void * chan); +void wakeup(const void *chan); +void wakeup_one(const void *chan); +void wakeup_any(const void *chan); /* * Common `struct cdev *' stuff are declared here to avoid #include poisoning Modified: head/sys/sys/user.h ============================================================================== --- head/sys/sys/user.h Tue Dec 24 16:13:15 2019 (r356056) +++ head/sys/sys/user.h Tue Dec 24 16:19:33 2019 (r356057) @@ -128,7 +128,7 @@ struct kinfo_proc { struct vnode *ki_textvp; /* pointer to executable file */ struct filedesc *ki_fd; /* pointer to open file info */ struct vmspace *ki_vmspace; /* pointer to kernel vmspace struct */ - void *ki_wchan; /* sleep address */ + const void *ki_wchan; /* sleep address */ pid_t ki_pid; /* Process identifier */ pid_t ki_ppid; /* parent process id */ pid_t ki_pgid; /* process group id */ From owner-svn-src-head@freebsd.org Tue Dec 24 16:52:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF6581ECB9F; Tue, 24 Dec 2019 16:52:11 +0000 (UTC) (envelope-from bdragon@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 47j2Lz5SnJz42XS; Tue, 24 Dec 2019 16:52:11 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B6DEE31ED; Tue, 24 Dec 2019 16:52:11 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOGqBZ4055825; Tue, 24 Dec 2019 16:52:11 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOGqBLX055822; Tue, 24 Dec 2019 16:52:11 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912241652.xBOGqBLX055822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Tue, 24 Dec 2019 16:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356058 - in head/sys: amd64/amd64 mips/mips sys X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys: amd64/amd64 mips/mips sys X-SVN-Commit-Revision: 356058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 16:52:12 -0000 Author: bdragon Date: Tue Dec 24 16:52:10 2019 New Revision: 356058 URL: https://svnweb.freebsd.org/changeset/base/356058 Log: Unbreak build. It seems that mips and amd64 still pull in link_elf.c, so we need to have elf_cpu_parse_dynamic() everywhere after all to avoid an undefined symbol. Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/mips/mips/elf_machdep.c head/sys/sys/linker.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Tue Dec 24 16:19:33 2019 (r356057) +++ head/sys/amd64/amd64/elf_machdep.c Tue Dec 24 16:52:10 2019 (r356058) @@ -329,3 +329,10 @@ elf_cpu_unload_file(linker_file_t lf __unused) return (0); } + +int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Tue Dec 24 16:19:33 2019 (r356057) +++ head/sys/mips/mips/elf_machdep.c Tue Dec 24 16:52:10 2019 (r356058) @@ -501,3 +501,10 @@ elf_cpu_unload_file(linker_file_t lf __unused) return (0); } + +int +elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused) +{ + + return (0); +} Modified: head/sys/sys/linker.h ============================================================================== --- head/sys/sys/linker.h Tue Dec 24 16:19:33 2019 (r356057) +++ head/sys/sys/linker.h Tue Dec 24 16:52:10 2019 (r356058) @@ -305,10 +305,7 @@ int linker_ctf_get(linker_file_t, linker_ctf_t *); int elf_cpu_load_file(linker_file_t); int elf_cpu_unload_file(linker_file_t); -/* amd64 and mips use objects instead of shared libraries */ -#if !defined(__amd64__) && !defined(__mips__) int elf_cpu_parse_dynamic(linker_file_t, Elf_Dyn *); -#endif /* values for type */ #define ELF_RELOC_REL 1 From owner-svn-src-head@freebsd.org Tue Dec 24 18:38:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 948C21EE0FA; Tue, 24 Dec 2019 18:38:07 +0000 (UTC) (envelope-from jeff@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 47j4jC3Rlxz45tq; Tue, 24 Dec 2019 18:38:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 56DD84617; Tue, 24 Dec 2019 18:38:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOIc7DX014944; Tue, 24 Dec 2019 18:38:07 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOIc7M5014943; Tue, 24 Dec 2019 18:38:07 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912241838.xBOIc7M5014943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 24 Dec 2019 18:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356059 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 18:38:07 -0000 Author: jeff Date: Tue Dec 24 18:38:06 2019 New Revision: 356059 URL: https://svnweb.freebsd.org/changeset/base/356059 Log: Don't unnecessarily relock the vm object after sleeps. This results in a surprising amount of object contention on loop restarts in fault. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D22821 Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Dec 24 16:52:10 2019 (r356058) +++ head/sys/vm/vm_fault.c Tue Dec 24 18:38:06 2019 (r356059) @@ -713,8 +713,9 @@ vm_fault_busy_sleep(struct faultstate *fs) vm_object_pip_wakeup(fs->object); unlock_map(fs); if (fs->m == vm_page_lookup(fs->object, fs->pindex)) - vm_page_sleep_if_busy(fs->m, "vmpfw"); - VM_OBJECT_WUNLOCK(fs->object); + vm_page_busy_sleep(fs->m, "vmpfw", false); + else + VM_OBJECT_WUNLOCK(fs->object); VM_CNT_INC(v_intrans); vm_object_deallocate(fs->first_object); } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Dec 24 16:52:10 2019 (r356058) +++ head/sys/vm/vm_page.c Tue Dec 24 18:38:06 2019 (r356059) @@ -176,7 +176,7 @@ SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STR static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); -static void _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, +static bool _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, const char *wmesg, bool nonshared, bool locked); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_dequeue_complete(vm_page_t m); @@ -878,8 +878,13 @@ vm_page_acquire_flags(vm_page_t m, int allocflags) return (locked); } +/* + * vm_page_busy_sleep_flags + * + * Sleep for busy according to VM_ALLOC_ parameters. + */ static bool -vm_page_busy_sleep_flags(vm_object_t object, vm_page_t m, const char *wchan, +vm_page_busy_sleep_flags(vm_object_t object, vm_page_t m, const char *wmesg, int allocflags) { @@ -892,9 +897,9 @@ vm_page_busy_sleep_flags(vm_object_t object, vm_page_t */ if ((allocflags & VM_ALLOC_NOCREAT) == 0) vm_page_aflag_set(m, PGA_REFERENCED); - vm_page_busy_sleep(m, wchan, (allocflags & - VM_ALLOC_IGN_SBUSY) != 0); - VM_OBJECT_WLOCK(object); + if (_vm_page_busy_sleep(object, m, wmesg, (allocflags & + VM_ALLOC_IGN_SBUSY) != 0, true)) + VM_OBJECT_WLOCK(object); if ((allocflags & VM_ALLOC_WAITFAIL) != 0) return (false); return (true); @@ -930,9 +935,8 @@ vm_page_busy_acquire(vm_page_t m, int allocflags) else locked = false; MPASS(locked || vm_page_wired(m)); - _vm_page_busy_sleep(obj, m, "vmpba", - (allocflags & VM_ALLOC_SBUSY) != 0, locked); - if (locked) + if (_vm_page_busy_sleep(obj, m, "vmpba", + (allocflags & VM_ALLOC_SBUSY) != 0, locked)) VM_OBJECT_WLOCK(obj); if ((allocflags & VM_ALLOC_WAITFAIL) != 0) return (false); @@ -1055,10 +1059,16 @@ vm_page_busy_sleep(vm_page_t m, const char *wmesg, boo VM_OBJECT_ASSERT_LOCKED(obj); vm_page_lock_assert(m, MA_NOTOWNED); - _vm_page_busy_sleep(obj, m, wmesg, nonshared, true); + if (!_vm_page_busy_sleep(obj, m, wmesg, nonshared, true)) + VM_OBJECT_DROP(obj); } -static void +/* + * _vm_page_busy_sleep: + * + * Internal busy sleep function. + */ +static bool _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, const char *wmesg, bool nonshared, bool locked) { @@ -1072,17 +1082,15 @@ _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, cons if (locked) VM_OBJECT_DROP(obj); vm_object_busy_wait(obj, wmesg); - return; + return (locked); } sleepq_lock(m); x = m->busy_lock; if (x == VPB_UNBUSIED || (nonshared && (x & VPB_BIT_SHARED) != 0) || ((x & VPB_BIT_WAITERS) == 0 && !atomic_cmpset_int(&m->busy_lock, x, x | VPB_BIT_WAITERS))) { - if (locked) - VM_OBJECT_DROP(obj); sleepq_release(m); - return; + return (false); } if (locked) VM_OBJECT_DROP(obj); @@ -1090,6 +1098,7 @@ _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, cons sleepq_add(m, NULL, wmesg, 0, 0); sleepq_wait(m, PVM); PICKUP_GIANT(); + return (locked); } /* From owner-svn-src-head@freebsd.org Tue Dec 24 19:00:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D49CE1EE536; Tue, 24 Dec 2019 19:00:21 +0000 (UTC) (envelope-from pfg@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 47j5Bs5yksz46rW; Tue, 24 Dec 2019 19:00:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD9944990; Tue, 24 Dec 2019 19:00:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOJ0LoU026841; Tue, 24 Dec 2019 19:00:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOJ0K4n026833; Tue, 24 Dec 2019 19:00:20 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201912241900.xBOJ0K4n026833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 24 Dec 2019 19:00:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356060 - head/usr.sbin/fstyp X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.sbin/fstyp X-SVN-Commit-Revision: 356060 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 19:00:21 -0000 Author: pfg Date: Tue Dec 24 19:00:20 2019 New Revision: 356060 URL: https://svnweb.freebsd.org/changeset/base/356060 Log: sbin/fstyp: recgonize Dragonfly's hammer and hammer2. This is based on DragonFly's implementation from about 2019-09-13. It only contains the basic code and header information to identify the disks. Relnotes: yes Differential Revision: https://reviews.freebsd.org/D13369 Added: head/usr.sbin/fstyp/hammer.c (contents, props changed) head/usr.sbin/fstyp/hammer2.c (contents, props changed) head/usr.sbin/fstyp/hammer2_disk.h (contents, props changed) head/usr.sbin/fstyp/hammer_disk.h (contents, props changed) Modified: head/usr.sbin/fstyp/Makefile head/usr.sbin/fstyp/fstyp.8 head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/fstyp.h Modified: head/usr.sbin/fstyp/Makefile ============================================================================== --- head/usr.sbin/fstyp/Makefile Tue Dec 24 18:38:06 2019 (r356059) +++ head/usr.sbin/fstyp/Makefile Tue Dec 24 19:00:20 2019 (r356060) @@ -3,7 +3,8 @@ .include PROG= fstyp -SRCS= apfs.c cd9660.c exfat.c ext2fs.c fstyp.c geli.c hfsplus.c msdosfs.c ntfs.c ufs.c +SRCS= apfs.c cd9660.c exfat.c ext2fs.c fstyp.c geli.c hammer.c \ + hammer2.c hfsplus.c msdosfs.c ntfs.c ufs.c .if ${MK_ZFS} != "no" SRCS += zfs.c Modified: head/usr.sbin/fstyp/fstyp.8 ============================================================================== --- head/usr.sbin/fstyp/fstyp.8 Tue Dec 24 18:38:06 2019 (r356059) +++ head/usr.sbin/fstyp/fstyp.8 Tue Dec 24 19:00:20 2019 (r356060) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 26, 2017 +.Dd December 24, 2019 .Dt FSTYP 8 .Os .Sh NAME @@ -67,6 +67,10 @@ exfat ext2fs .It geli +.It +hammer +.It +hammer2 .It msdosfs .It Modified: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- head/usr.sbin/fstyp/fstyp.c Tue Dec 24 18:38:06 2019 (r356059) +++ head/usr.sbin/fstyp/fstyp.c Tue Dec 24 19:00:20 2019 (r356060) @@ -69,6 +69,8 @@ static struct { { "exfat", &fstyp_exfat, false, EXFAT_ENC }, { "ext2fs", &fstyp_ext2fs, false, NULL }, { "geli", &fstyp_geli, true, NULL }, + { "hammer", &fstyp_hammer, true, NULL }, + { "hammer2", &fstyp_hammer2, true, NULL }, { "hfs+", &fstyp_hfsp, false, NULL }, { "msdosfs", &fstyp_msdosfs, false, NULL }, { "ntfs", &fstyp_ntfs, false, NTFS_ENC }, Modified: head/usr.sbin/fstyp/fstyp.h ============================================================================== --- head/usr.sbin/fstyp/fstyp.h Tue Dec 24 18:38:06 2019 (r356059) +++ head/usr.sbin/fstyp/fstyp.h Tue Dec 24 19:00:20 2019 (r356060) @@ -55,6 +55,8 @@ int fstyp_cd9660(FILE *fp, char *label, size_t size); int fstyp_exfat(FILE *fp, char *label, size_t size); int fstyp_ext2fs(FILE *fp, char *label, size_t size); int fstyp_geli(FILE *fp, char *label, size_t size); +int fstyp_hammer(FILE *fp, char *label, size_t size); +int fstyp_hammer2(FILE *fp, char *label, size_t size); int fstyp_hfsp(FILE *fp, char *label, size_t size); int fstyp_msdosfs(FILE *fp, char *label, size_t size); int fstyp_ntfs(FILE *fp, char *label, size_t size); Added: head/usr.sbin/fstyp/hammer.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/hammer.c Tue Dec 24 19:00:20 2019 (r356060) @@ -0,0 +1,198 @@ +/*- + * Copyright (c) 2016 The DragonFly Project + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +#include "hammer_disk.h" + +#include "fstyp.h" + +static hammer_volume_ondisk_t +__read_ondisk(FILE *fp) +{ + hammer_volume_ondisk_t ondisk; + + ondisk = read_buf(fp, 0, sizeof(*ondisk)); + if (ondisk == NULL) + err(1, "failed to read ondisk"); + + return (ondisk); +} + +static int +__test_ondisk(const hammer_volume_ondisk_t ondisk) +{ + static int count = 0; + static hammer_uuid_t fsid, fstype; + static char label[64]; + + if (ondisk->vol_signature != HAMMER_FSBUF_VOLUME && + ondisk->vol_signature != HAMMER_FSBUF_VOLUME_REV) + return (1); + if (ondisk->vol_rootvol != HAMMER_ROOT_VOLNO) + return (2); + if (ondisk->vol_no < 0 || ondisk->vol_no > HAMMER_MAX_VOLUMES - 1) + return (3); + if (ondisk->vol_count < 1 || ondisk->vol_count > HAMMER_MAX_VOLUMES) + return (4); + + if (count == 0) { + count = ondisk->vol_count; + assert(count != 0); + memcpy(&fsid, &ondisk->vol_fsid, sizeof(fsid)); + memcpy(&fstype, &ondisk->vol_fstype, sizeof(fstype)); + strncpy(label, ondisk->vol_label, sizeof(label)); + } else { + if (ondisk->vol_count != count) + return (5); + if (memcmp(&ondisk->vol_fsid, &fsid, sizeof(fsid))) + return (6); + if (memcmp(&ondisk->vol_fstype, &fstype, sizeof(fstype))) + return (7); + if (strncmp(ondisk->vol_label, label, sizeof(label))) + return (8); + } + + return (0); +} + +int +fstyp_hammer(FILE *fp, char *label, size_t size) +{ + hammer_volume_ondisk_t ondisk; + int error = 1; + + ondisk = __read_ondisk(fp); + if (ondisk->vol_no != HAMMER_ROOT_VOLNO) + goto done; + if (ondisk->vol_count != 1) + goto done; + if (__test_ondisk(ondisk)) + goto done; + + strlcpy(label, ondisk->vol_label, size); + error = 0; +done: + free(ondisk); + return (error); +} + +static int +__test_volume(const char *volpath) +{ + hammer_volume_ondisk_t ondisk; + FILE *fp; + int volno = -1; + + if ((fp = fopen(volpath, "r")) == NULL) + err(1, "failed to open %s", volpath); + + ondisk = __read_ondisk(fp); + fclose(fp); + if (__test_ondisk(ondisk)) + goto done; + + volno = ondisk->vol_no; +done: + free(ondisk); + return (volno); +} + +static int +__fsvtyp_hammer(const char *blkdevs, char *label, size_t size, int partial) +{ + hammer_volume_ondisk_t ondisk; + FILE *fp; + char *dup, *p, *volpath, x[HAMMER_MAX_VOLUMES]; + int i, volno, error = 1; + + memset(x, 0, sizeof(x)); + dup = strdup(blkdevs); + p = dup; + + while (p) { + volpath = p; + if ((p = strchr(p, ':')) != NULL) + *p++ = '\0'; + if ((volno = __test_volume(volpath)) == -1) + break; + x[volno]++; + } + + if ((fp = fopen(volpath, "r")) == NULL) + err(1, "failed to open %s", volpath); + ondisk = __read_ondisk(fp); + fclose(fp); + + free(dup); + + if (volno == -1) + goto done; + if (partial) + goto success; + + for (i = 0; i < HAMMER_MAX_VOLUMES; i++) + if (x[i] > 1) + goto done; + for (i = 0; i < HAMMER_MAX_VOLUMES; i++) + if (x[i] == 0) + break; + if (ondisk->vol_count != i) + goto done; + for (; i < HAMMER_MAX_VOLUMES; i++) + if (x[i] != 0) + goto done; +success: + strlcpy(label, ondisk->vol_label, size); + error = 0; +done: + free(ondisk); + return (error); +} + +int +fsvtyp_hammer(const char *blkdevs, char *label, size_t size) +{ + return (__fsvtyp_hammer(blkdevs, label, size, 0)); +} + +int +fsvtyp_hammer_partial(const char *blkdevs, char *label, size_t size) +{ + return (__fsvtyp_hammer(blkdevs, label, size, 1)); +} Added: head/usr.sbin/fstyp/hammer2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/hammer2.c Tue Dec 24 19:00:20 2019 (r356060) @@ -0,0 +1,152 @@ +/*- + * Copyright (c) 2017-2019 The DragonFly Project + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include "hammer2_disk.h" + +#include "fstyp.h" + +static hammer2_volume_data_t* +__read_voldata(FILE *fp) +{ + hammer2_volume_data_t *voldata; + + voldata = read_buf(fp, 0, sizeof(*voldata)); + if (voldata == NULL) + err(1, "failed to read volume data"); + + return (voldata); +} + +static int +__test_voldata(const hammer2_volume_data_t *voldata) +{ + if (voldata->magic != HAMMER2_VOLUME_ID_HBO && + voldata->magic != HAMMER2_VOLUME_ID_ABO) + return (1); + + return (0); +} + +static int +__read_label(FILE *fp, char *label, size_t size) +{ + hammer2_blockref_t broot, best, *bref; + hammer2_media_data_t *vols[HAMMER2_NUM_VOLHDRS], *media; + hammer2_off_t io_off, io_base; + size_t bytes, io_bytes, boff; + int i, best_i, error = 0; + + best_i = -1; + memset(&best, 0, sizeof(best)); + + for (i = 0; i < HAMMER2_NUM_VOLHDRS; i++) { + memset(&broot, 0, sizeof(broot)); + broot.type = HAMMER2_BREF_TYPE_VOLUME; + broot.data_off = (i * HAMMER2_ZONE_BYTES64) | HAMMER2_PBUFRADIX; + vols[i] = read_buf(fp, broot.data_off & ~HAMMER2_OFF_MASK_RADIX, + sizeof(*vols[i])); + broot.mirror_tid = vols[i]->voldata.mirror_tid; + if (best_i < 0 || best.mirror_tid < broot.mirror_tid) { + best_i = i; + best = broot; + } + } + if (best_i == -1) { + warnx("Failed to find volume header from zones"); + error = 1; + goto done; + } + + bref = &vols[best_i]->voldata.sroot_blockset.blockref[0]; + if (bref->type != HAMMER2_BREF_TYPE_INODE) { + warnx("Superroot blockref type is not inode"); + error = 2; + goto done; + } + + bytes = bref->data_off & HAMMER2_OFF_MASK_RADIX; + if (bytes) + bytes = (size_t)1 << bytes; + if (bytes != sizeof(hammer2_inode_data_t)) { + warnx("Superroot blockref size does not match inode size"); + error = 3; + goto done; + } + + io_off = bref->data_off & ~HAMMER2_OFF_MASK_RADIX; + io_base = io_off & ~(hammer2_off_t)(HAMMER2_MINIOSIZE - 1); + boff = io_off - io_base; + + io_bytes = HAMMER2_MINIOSIZE; + while (io_bytes + boff < bytes) + io_bytes <<= 1; + if (io_bytes > sizeof(*media)) { + warnx("Invalid I/O bytes"); + error = 4; + goto done; + } + + media = read_buf(fp, io_base, io_bytes); + if (boff) + memcpy(media, (char*)media + boff, bytes); + + strlcpy(label, (char*)media->ipdata.filename, size); + free(media); +done: + for (i = 0; i < HAMMER2_NUM_VOLHDRS; i++) + free(vols[i]); + + return (error); +} + +int +fstyp_hammer2(FILE *fp, char *label, size_t size) +{ + hammer2_volume_data_t *voldata; + int error = 1; + + voldata = __read_voldata(fp); + if (__test_voldata(voldata)) + goto done; + + error = __read_label(fp, label, size); +done: + free(voldata); + return (error); +} Added: head/usr.sbin/fstyp/hammer2_disk.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/hammer2_disk.h Tue Dec 24 19:00:20 2019 (r356060) @@ -0,0 +1,1390 @@ +/*- + * Copyright (c) 2011-2018 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * by Venkatesh Srinivas + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HAMMER2_DISK_H_ +#define _HAMMER2_DISK_H_ + +#ifndef _SYS_UUID_H_ +#include +#endif +#ifndef _SYS_DMSG_H_ +/* + * dmsg_hdr must be 64 bytes + */ +struct dmsg_hdr { + uint16_t magic; /* 00 sanity, synchro, endian */ + uint16_t reserved02; /* 02 */ + uint32_t salt; /* 04 random salt helps w/crypto */ + + uint64_t msgid; /* 08 message transaction id */ + uint64_t circuit; /* 10 circuit id or 0 */ + uint64_t reserved18; /* 18 */ + + uint32_t cmd; /* 20 flags | cmd | hdr_size / ALIGN */ + uint32_t aux_crc; /* 24 auxillary data crc */ + uint32_t aux_bytes; /* 28 auxillary data length (bytes) */ + uint32_t error; /* 2C error code or 0 */ + uint64_t aux_descr; /* 30 negotiated OOB data descr */ + uint32_t reserved38; /* 38 */ + uint32_t hdr_crc; /* 3C (aligned) extended header crc */ +}; + +typedef struct dmsg_hdr dmsg_hdr_t; +#endif + +/* + * The structures below represent the on-disk media structures for the HAMMER2 + * filesystem. Note that all fields for on-disk structures are naturally + * aligned. The host endian format is typically used - compatibility is + * possible if the implementation detects reversed endian and adjusts accesses + * accordingly. + * + * HAMMER2 primarily revolves around the directory topology: inodes, + * directory entries, and block tables. Block device buffer cache buffers + * are always 64KB. Logical file buffers are typically 16KB. All data + * references utilize 64-bit byte offsets. + * + * Free block management is handled independently using blocks reserved by + * the media topology. + */ + +/* + * The data at the end of a file or directory may be a fragment in order + * to optimize storage efficiency. The minimum fragment size is 1KB. + * Since allocations are in powers of 2 fragments must also be sized in + * powers of 2 (1024, 2048, ... 65536). + * + * For the moment the maximum allocation size is HAMMER2_PBUFSIZE (64K), + * which is 2^16. Larger extents may be supported in the future. Smaller + * fragments might be supported in the future (down to 64 bytes is possible), + * but probably will not be. + * + * A full indirect block use supports 512 x 128-byte blockrefs in a 64KB + * buffer. Indirect blocks down to 1KB are supported to keep small + * directories small. + * + * A maximally sized file (2^64-1 bytes) requires ~6 indirect block levels + * using 64KB indirect blocks (128 byte refs, 512 or radix 9 per indblk). + * + * 16(datablk) + 9 + 9 + 9 + 9 + 9 + 9 = ~70. + * 16(datablk) + 7 + 9 + 9 + 9 + 9 + 9 = ~68. (smaller top level indblk) + * + * The actual depth depends on copies redundancy and whether the filesystem + * has chosen to use a smaller indirect block size at the top level or not. + */ +#define HAMMER2_ALLOC_MIN 1024 /* minimum allocation size */ +#define HAMMER2_RADIX_MIN 10 /* minimum allocation size 2^N */ +#define HAMMER2_ALLOC_MAX 65536 /* maximum allocation size */ +#define HAMMER2_RADIX_MAX 16 /* maximum allocation size 2^N */ +#define HAMMER2_RADIX_KEY 64 /* number of bits in key */ + +/* + * MINALLOCSIZE - The minimum allocation size. This can be smaller + * or larger than the minimum physical IO size. + * + * NOTE: Should not be larger than 1K since inodes + * are 1K. + * + * MINIOSIZE - The minimum IO size. This must be less than + * or equal to HAMMER2_LBUFSIZE. + * + * HAMMER2_LBUFSIZE - Nominal buffer size for I/O rollups. + * + * HAMMER2_PBUFSIZE - Topological block size used by files for all + * blocks except the block straddling EOF. + * + * HAMMER2_SEGSIZE - Allocation map segment size, typically 4MB + * (space represented by a level0 bitmap). + */ + +#define HAMMER2_SEGSIZE (1 << HAMMER2_FREEMAP_LEVEL0_RADIX) +#define HAMMER2_SEGRADIX HAMMER2_FREEMAP_LEVEL0_RADIX + +#define HAMMER2_PBUFRADIX 16 /* physical buf (1<<16) bytes */ +#define HAMMER2_PBUFSIZE 65536 +#define HAMMER2_LBUFRADIX 14 /* logical buf (1<<14) bytes */ +#define HAMMER2_LBUFSIZE 16384 + +/* + * Generally speaking we want to use 16K and 64K I/Os + */ +#define HAMMER2_MINIORADIX HAMMER2_LBUFRADIX +#define HAMMER2_MINIOSIZE HAMMER2_LBUFSIZE + +#define HAMMER2_IND_BYTES_MIN 4096 +#define HAMMER2_IND_BYTES_NOM HAMMER2_LBUFSIZE +#define HAMMER2_IND_BYTES_MAX HAMMER2_PBUFSIZE +#define HAMMER2_IND_RADIX_MIN 12 +#define HAMMER2_IND_RADIX_NOM HAMMER2_LBUFRADIX +#define HAMMER2_IND_RADIX_MAX HAMMER2_PBUFRADIX +#define HAMMER2_IND_COUNT_MIN (HAMMER2_IND_BYTES_MIN / \ + sizeof(hammer2_blockref_t)) +#define HAMMER2_IND_COUNT_MAX (HAMMER2_IND_BYTES_MAX / \ + sizeof(hammer2_blockref_t)) + +/* + * In HAMMER2, arrays of blockrefs are fully set-associative, meaning that + * any element can occur at any index and holes can be anywhere. As a + * future optimization we will be able to flag that such arrays are sorted + * and thus optimize lookups, but for now we don't. + * + * Inodes embed either 512 bytes of direct data or an array of 4 blockrefs, + * resulting in highly efficient storage for files <= 512 bytes and for files + * <= 512KB. Up to 4 directory entries can be referenced from a directory + * without requiring an indirect block. + * + * Indirect blocks are typically either 4KB (64 blockrefs / ~4MB represented), + * or 64KB (1024 blockrefs / ~64MB represented). + */ +#define HAMMER2_SET_RADIX 2 /* radix 2 = 4 entries */ +#define HAMMER2_SET_COUNT (1 << HAMMER2_SET_RADIX) +#define HAMMER2_EMBEDDED_BYTES 512 /* inode blockset/dd size */ +#define HAMMER2_EMBEDDED_RADIX 9 + +#define HAMMER2_PBUFMASK (HAMMER2_PBUFSIZE - 1) +#define HAMMER2_LBUFMASK (HAMMER2_LBUFSIZE - 1) +#define HAMMER2_SEGMASK (HAMMER2_SEGSIZE - 1) + +#define HAMMER2_LBUFMASK64 ((hammer2_off_t)HAMMER2_LBUFMASK) +#define HAMMER2_PBUFSIZE64 ((hammer2_off_t)HAMMER2_PBUFSIZE) +#define HAMMER2_PBUFMASK64 ((hammer2_off_t)HAMMER2_PBUFMASK) +#define HAMMER2_SEGSIZE64 ((hammer2_off_t)HAMMER2_SEGSIZE) +#define HAMMER2_SEGMASK64 ((hammer2_off_t)HAMMER2_SEGMASK) + +#define HAMMER2_UUID_STRING "5cbb9ad1-862d-11dc-a94d-01301bb8a9f5" + +/* + * A 4MB segment is reserved at the beginning of each 2GB zone. This segment + * contains the volume header (or backup volume header), the free block + * table, and possibly other information in the future. A 4MB segment for + * freemap is reserved at the beginning of every 1GB. + * + * 4MB = 64 x 64K blocks. Each 4MB segment is broken down as follows: + * + * ========== + * 0 volume header (for the first four 2GB zones) + * 1 freemap00 level1 FREEMAP_LEAF (256 x 128B bitmap data per 1GB) + * 2 level2 FREEMAP_NODE (256 x 128B indirect block per 256GB) + * 3 level3 FREEMAP_NODE (256 x 128B indirect block per 64TB) + * 4 level4 FREEMAP_NODE (256 x 128B indirect block per 16PB) + * 5 level5 FREEMAP_NODE (256 x 128B indirect block per 4EB) + * 6 freemap01 level1 (rotation) + * 7 level2 + * 8 level3 + * 9 level4 + * 10 level5 + * 11 freemap02 level1 (rotation) + * 12 level2 + * 13 level3 + * 14 level4 + * 15 level5 + * 16 freemap03 level1 (rotation) + * 17 level2 + * 18 level3 + * 19 level4 + * 20 level5 + * 21 freemap04 level1 (rotation) + * 22 level2 + * 23 level3 + * 24 level4 + * 25 level5 + * 26 freemap05 level1 (rotation) + * 27 level2 + * 28 level3 + * 29 level4 + * 30 level5 + * 31 freemap06 level1 (rotation) + * 32 level2 + * 33 level3 + * 34 level4 + * 35 level5 + * 36 freemap07 level1 (rotation) + * 37 level2 + * 38 level3 + * 39 level4 + * 40 level5 + * 41 unused + * .. unused + * 63 unused + * ========== + * + * The first four 2GB zones contain volume headers and volume header backups. + * After that the volume header block# is reserved for future use. Similarly, + * there are many blocks related to various Freemap levels which are not + * used in every segment and those are also reserved for future use. + * Note that each FREEMAP_LEAF or FREEMAP_NODE uses 32KB out of 64KB slot. + * + * Freemap (see the FREEMAP document) + * + * The freemap utilizes blocks #1-40 in 8 sets of 5 blocks. Each block in + * a set represents a level of depth in the freemap topology. Eight sets + * exist to prevent live updates from disturbing the state of the freemap + * were a crash/reboot to occur. That is, a live update is not committed + * until the update's flush reaches the volume root. There are FOUR volume + * roots representing the last four synchronization points, so the freemap + * must be consistent no matter which volume root is chosen by the mount + * code. + * + * Each freemap set is 5 x 64K blocks and represents the 1GB, 256GB, 64TB, + * 16PB and 4EB indirect map. The volume header itself has a set of 4 freemap + * blockrefs representing another 2 bits, giving us a total 64 bits of + * representable address space. + * + * The Level 0 64KB block represents 1GB of storage represented by 32KB + * (256 x struct hammer2_bmap_data). Each structure represents 4MB of storage + * and has a 512 bit bitmap, using 2 bits to represent a 16KB chunk of + * storage. These 2 bits represent the following states: + * + * 00 Free + * 01 (reserved) (Possibly partially allocated) + * 10 Possibly free + * 11 Allocated + * + * One important thing to note here is that the freemap resolution is 16KB, + * but the minimum storage allocation size is 1KB. The hammer2 vfs keeps + * track of sub-allocations in memory, which means that on a unmount or reboot + * the entire 16KB of a partially allocated block will be considered fully + * allocated. It is possible for fragmentation to build up over time, but + * defragmentation is fairly easy to accomplish since all modifications + * allocate a new block. + * + * The Second thing to note is that due to the way snapshots and inode + * replication works, deleting a file cannot immediately free the related + * space. Furthermore, deletions often do not bother to traverse the + * block subhierarchy being deleted. And to go even further, whole + * sub-directory trees can be deleted simply by deleting the directory inode + * at the top. So even though we have a symbol to represent a 'possibly free' + * block (binary 10), only the bulk free scanning code can actually use it. + * Normal 'rm's or other deletions do not. + * + * WARNING! ZONE_SEG and VOLUME_ALIGN must be a multiple of 1<= ZONE_SEG. + * + * In Summary: + * + * (1) Modifications to freemap blocks 'allocate' a new copy (aka use a block + * from the next set). The new copy is reused until a flush occurs at + * which point the next modification will then rotate to the next set. + */ +#define HAMMER2_VOLUME_ALIGN (8 * 1024 * 1024) +#define HAMMER2_VOLUME_ALIGN64 ((hammer2_off_t)HAMMER2_VOLUME_ALIGN) +#define HAMMER2_VOLUME_ALIGNMASK (HAMMER2_VOLUME_ALIGN - 1) +#define HAMMER2_VOLUME_ALIGNMASK64 ((hammer2_off_t)HAMMER2_VOLUME_ALIGNMASK) + +#define HAMMER2_NEWFS_ALIGN (HAMMER2_VOLUME_ALIGN) +#define HAMMER2_NEWFS_ALIGN64 ((hammer2_off_t)HAMMER2_VOLUME_ALIGN) +#define HAMMER2_NEWFS_ALIGNMASK (HAMMER2_VOLUME_ALIGN - 1) +#define HAMMER2_NEWFS_ALIGNMASK64 ((hammer2_off_t)HAMMER2_NEWFS_ALIGNMASK) + +#define HAMMER2_ZONE_BYTES64 (2LLU * 1024 * 1024 * 1024) +#define HAMMER2_ZONE_MASK64 (HAMMER2_ZONE_BYTES64 - 1) +#define HAMMER2_ZONE_SEG (4 * 1024 * 1024) +#define HAMMER2_ZONE_SEG64 ((hammer2_off_t)HAMMER2_ZONE_SEG) +#define HAMMER2_ZONE_BLOCKS_SEG (HAMMER2_ZONE_SEG / HAMMER2_PBUFSIZE) + +#define HAMMER2_ZONE_FREEMAP_INC 5 /* 5 deep */ + +#define HAMMER2_ZONE_VOLHDR 0 /* volume header or backup */ +#define HAMMER2_ZONE_FREEMAP_00 1 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_01 6 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_02 11 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_03 16 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_04 21 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_05 26 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_06 31 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_07 36 /* normal freemap rotation */ +#define HAMMER2_ZONE_FREEMAP_END 41 /* (non-inclusive) */ + +#define HAMMER2_ZONE_UNUSED41 41 +#define HAMMER2_ZONE_UNUSED42 42 +#define HAMMER2_ZONE_UNUSED43 43 +#define HAMMER2_ZONE_UNUSED44 44 +#define HAMMER2_ZONE_UNUSED45 45 +#define HAMMER2_ZONE_UNUSED46 46 +#define HAMMER2_ZONE_UNUSED47 47 +#define HAMMER2_ZONE_UNUSED48 48 +#define HAMMER2_ZONE_UNUSED49 49 +#define HAMMER2_ZONE_UNUSED50 50 +#define HAMMER2_ZONE_UNUSED51 51 +#define HAMMER2_ZONE_UNUSED52 52 +#define HAMMER2_ZONE_UNUSED53 53 +#define HAMMER2_ZONE_UNUSED54 54 +#define HAMMER2_ZONE_UNUSED55 55 +#define HAMMER2_ZONE_UNUSED56 56 +#define HAMMER2_ZONE_UNUSED57 57 +#define HAMMER2_ZONE_UNUSED58 58 +#define HAMMER2_ZONE_UNUSED59 59 +#define HAMMER2_ZONE_UNUSED60 60 +#define HAMMER2_ZONE_UNUSED61 61 +#define HAMMER2_ZONE_UNUSED62 62 +#define HAMMER2_ZONE_UNUSED63 63 +#define HAMMER2_ZONE_END 64 /* non-inclusive */ + +#define HAMMER2_NFREEMAPS 8 /* FREEMAP_00 - FREEMAP_07 */ + + /* relative to FREEMAP_x */ +#define HAMMER2_ZONEFM_LEVEL1 0 /* 1GB leafmap */ +#define HAMMER2_ZONEFM_LEVEL2 1 /* 256GB indmap */ +#define HAMMER2_ZONEFM_LEVEL3 2 /* 64TB indmap */ +#define HAMMER2_ZONEFM_LEVEL4 3 /* 16PB indmap */ +#define HAMMER2_ZONEFM_LEVEL5 4 /* 4EB indmap */ +/* LEVEL6 is a set of 4 blockrefs in the volume header 16EB */ + +/* + * Freemap radix. Assumes a set-count of 4, 128-byte blockrefs, + * 32KB indirect block for freemap (LEVELN_PSIZE below). + * + * Leaf entry represents 4MB of storage broken down into a 512-bit + * bitmap, 2-bits per entry. So course bitmap item represents 16KB. + */ +#if HAMMER2_SET_COUNT != 4 +#error "hammer2_disk.h - freemap assumes SET_COUNT is 4" +#endif +#define HAMMER2_FREEMAP_LEVEL6_RADIX 64 /* 16EB (end) */ +#define HAMMER2_FREEMAP_LEVEL5_RADIX 62 /* 4EB */ +#define HAMMER2_FREEMAP_LEVEL4_RADIX 54 /* 16PB */ +#define HAMMER2_FREEMAP_LEVEL3_RADIX 46 /* 64TB */ +#define HAMMER2_FREEMAP_LEVEL2_RADIX 38 /* 256GB */ +#define HAMMER2_FREEMAP_LEVEL1_RADIX 30 /* 1GB */ +#define HAMMER2_FREEMAP_LEVEL0_RADIX 22 /* 4MB (128by in l-1 leaf) */ + +#define HAMMER2_FREEMAP_LEVELN_PSIZE 32768 /* physical bytes */ + +#define HAMMER2_FREEMAP_LEVEL5_SIZE ((hammer2_off_t)1 << \ + HAMMER2_FREEMAP_LEVEL5_RADIX) +#define HAMMER2_FREEMAP_LEVEL4_SIZE ((hammer2_off_t)1 << \ + HAMMER2_FREEMAP_LEVEL4_RADIX) +#define HAMMER2_FREEMAP_LEVEL3_SIZE ((hammer2_off_t)1 << \ + HAMMER2_FREEMAP_LEVEL3_RADIX) +#define HAMMER2_FREEMAP_LEVEL2_SIZE ((hammer2_off_t)1 << \ + HAMMER2_FREEMAP_LEVEL2_RADIX) +#define HAMMER2_FREEMAP_LEVEL1_SIZE ((hammer2_off_t)1 << \ + HAMMER2_FREEMAP_LEVEL1_RADIX) +#define HAMMER2_FREEMAP_LEVEL0_SIZE ((hammer2_off_t)1 << \ + HAMMER2_FREEMAP_LEVEL0_RADIX) + +#define HAMMER2_FREEMAP_LEVEL5_MASK (HAMMER2_FREEMAP_LEVEL5_SIZE - 1) +#define HAMMER2_FREEMAP_LEVEL4_MASK (HAMMER2_FREEMAP_LEVEL4_SIZE - 1) +#define HAMMER2_FREEMAP_LEVEL3_MASK (HAMMER2_FREEMAP_LEVEL3_SIZE - 1) +#define HAMMER2_FREEMAP_LEVEL2_MASK (HAMMER2_FREEMAP_LEVEL2_SIZE - 1) +#define HAMMER2_FREEMAP_LEVEL1_MASK (HAMMER2_FREEMAP_LEVEL1_SIZE - 1) +#define HAMMER2_FREEMAP_LEVEL0_MASK (HAMMER2_FREEMAP_LEVEL0_SIZE - 1) + +#define HAMMER2_FREEMAP_COUNT (int)(HAMMER2_FREEMAP_LEVELN_PSIZE / \ + sizeof(hammer2_bmap_data_t)) + +/* + * XXX I made a mistake and made the reserved area begin at each LEVEL1 zone, + * which is on a 1GB demark. This will eat a little more space but for + * now we retain compatibility and make FMZONEBASE every 1GB + */ +#define H2FMZONEBASE(key) ((key) & ~HAMMER2_FREEMAP_LEVEL1_MASK) +#define H2FMBASE(key, radix) ((key) & ~(((hammer2_off_t)1 << (radix)) - 1)) + +/* + * 16KB bitmap granularity (x2 bits per entry). + */ +#define HAMMER2_FREEMAP_BLOCK_RADIX 14 +#define HAMMER2_FREEMAP_BLOCK_SIZE (1 << HAMMER2_FREEMAP_BLOCK_RADIX) +#define HAMMER2_FREEMAP_BLOCK_MASK (HAMMER2_FREEMAP_BLOCK_SIZE - 1) + +/* + * bitmap[] structure. 2 bits per HAMMER2_FREEMAP_BLOCK_SIZE. + * + * 8 x 64-bit elements, 2 bits per block. + * 32 blocks (radix 5) per element. + * representing INDEX_SIZE bytes worth of storage per element. + */ + +typedef uint64_t hammer2_bitmap_t; + +#define HAMMER2_BMAP_ALLONES ((hammer2_bitmap_t)-1) +#define HAMMER2_BMAP_ELEMENTS 8 +#define HAMMER2_BMAP_BITS_PER_ELEMENT 64 +#define HAMMER2_BMAP_INDEX_RADIX 5 /* 32 blocks per element */ +#define HAMMER2_BMAP_BLOCKS_PER_ELEMENT (1 << HAMMER2_BMAP_INDEX_RADIX) + +#define HAMMER2_BMAP_INDEX_SIZE (HAMMER2_FREEMAP_BLOCK_SIZE * \ + HAMMER2_BMAP_BLOCKS_PER_ELEMENT) +#define HAMMER2_BMAP_INDEX_MASK (HAMMER2_BMAP_INDEX_SIZE - 1) + +#define HAMMER2_BMAP_SIZE (HAMMER2_BMAP_INDEX_SIZE * \ + HAMMER2_BMAP_ELEMENTS) +#define HAMMER2_BMAP_MASK (HAMMER2_BMAP_SIZE - 1) + +/* + * Two linear areas can be reserved after the initial 4MB segment in the base + * zone (the one starting at offset 0). These areas are NOT managed by the + * block allocator and do not fall under HAMMER2 crc checking rules based + * at the volume header (but can be self-CRCd internally, depending). + */ +#define HAMMER2_BOOT_MIN_BYTES HAMMER2_VOLUME_ALIGN +#define HAMMER2_BOOT_NOM_BYTES (64*1024*1024) +#define HAMMER2_BOOT_MAX_BYTES (256*1024*1024) + +#define HAMMER2_REDO_MIN_BYTES HAMMER2_VOLUME_ALIGN +#define HAMMER2_REDO_NOM_BYTES (256*1024*1024) +#define HAMMER2_REDO_MAX_BYTES (1024*1024*1024) + +/* + * Most HAMMER2 types are implemented as unsigned 64-bit integers. + * Transaction ids are monotonic. + * + * We utilize 32-bit iSCSI CRCs. + */ +typedef uint64_t hammer2_tid_t; +typedef uint64_t hammer2_off_t; +typedef uint64_t hammer2_key_t; +typedef uint32_t hammer2_crc32_t; + +/* + * Miscellanious ranges (all are unsigned). + */ +#define HAMMER2_TID_MIN 1ULL +#define HAMMER2_TID_MAX 0xFFFFFFFFFFFFFFFFULL +#define HAMMER2_KEY_MIN 0ULL +#define HAMMER2_KEY_MAX 0xFFFFFFFFFFFFFFFFULL +#define HAMMER2_OFFSET_MIN 0ULL +#define HAMMER2_OFFSET_MAX 0xFFFFFFFFFFFFFFFFULL + +/* + * HAMMER2 data offset special cases and masking. + * + * All HAMMER2 data offsets have to be broken down into a 64K buffer base + * offset (HAMMER2_OFF_MASK_HI) and a 64K buffer index (HAMMER2_OFF_MASK_LO). + * + * Indexes into physical buffers are always 64-byte aligned. The low 6 bits + * of the data offset field specifies how large the data chunk being pointed + * to as a power of 2. The theoretical minimum radix is thus 6 (The space + * needed in the low bits of the data offset field). However, the practical + * minimum allocation chunk size is 1KB (a radix of 10), so HAMMER2 sets + * HAMMER2_RADIX_MIN to 10. The maximum radix is currently 16 (64KB), but + * we fully intend to support larger extents in the future. + * + * WARNING! A radix of 0 (such as when data_off is all 0's) is a special + * case which means no data associated with the blockref, and + * not the '1 byte' it would otherwise calculate to. + */ +#define HAMMER2_OFF_BAD ((hammer2_off_t)-1) +#define HAMMER2_OFF_MASK 0xFFFFFFFFFFFFFFC0ULL +#define HAMMER2_OFF_MASK_LO (HAMMER2_OFF_MASK & HAMMER2_PBUFMASK64) +#define HAMMER2_OFF_MASK_HI (~HAMMER2_PBUFMASK64) +#define HAMMER2_OFF_MASK_RADIX 0x000000000000003FULL +#define HAMMER2_MAX_COPIES 6 + +/* + * HAMMER2 directory support and pre-defined keys + */ +#define HAMMER2_DIRHASH_VISIBLE 0x8000000000000000ULL +#define HAMMER2_DIRHASH_USERMSK 0x7FFFFFFFFFFFFFFFULL +#define HAMMER2_DIRHASH_LOMASK 0x0000000000007FFFULL +#define HAMMER2_DIRHASH_HIMASK 0xFFFFFFFFFFFF0000ULL +#define HAMMER2_DIRHASH_FORCED 0x0000000000008000ULL /* bit forced on */ + +#define HAMMER2_SROOT_KEY 0x0000000000000000ULL /* volume to sroot */ +#define HAMMER2_BOOT_KEY 0xd9b36ce135528000ULL /* sroot to BOOT PFS */ + +/************************************************************************ + * DMSG SUPPORT * + ************************************************************************ + * LNK_VOLCONF + * + * All HAMMER2 directories directly under the super-root on your local + * media can be mounted separately, even if they share the same physical + * device. + * + * When you do a HAMMER2 mount you are effectively tying into a HAMMER2 + * cluster via local media. The local media does not have to participate + * in the cluster, other than to provide the hammer2_volconf[] array and + * root inode for the mount. + * + * This is important: The mount device path you specify serves to bootstrap + * your entry into the cluster, but your mount will make active connections + * to ALL copy elements in the hammer2_volconf[] array which match the + * PFSID of the directory in the super-root that you specified. The local + * media path does not have to be mentioned in this array but becomes part + * of the cluster based on its type and access rights. ALL ELEMENTS ARE + * TREATED ACCORDING TO TYPE NO MATTER WHICH ONE YOU MOUNT FROM. + * + * The actual cluster may be far larger than the elements you list in the + * hammer2_volconf[] array. You list only the elements you wish to + * directly connect to and you are able to access the rest of the cluster + * indirectly through those connections. + * + * WARNING! This structure must be exactly 128 bytes long for its config + * array to fit in the volume header. + */ +struct hammer2_volconf { + uint8_t copyid; /* 00 copyid 0-255 (must match slot) */ + uint8_t inprog; /* 01 operation in progress, or 0 */ + uint8_t chain_to; /* 02 operation chaining to, or 0 */ + uint8_t chain_from; /* 03 operation chaining from, or 0 */ + uint16_t flags; /* 04-05 flags field */ + uint8_t error; /* 06 last operational error */ + uint8_t priority; /* 07 priority and round-robin flag */ + uint8_t remote_pfs_type;/* 08 probed direct remote PFS type */ + uint8_t reserved08[23]; /* 09-1F */ + uuid_t pfs_clid; /* 20-2F copy target must match this uuid */ + uint8_t label[16]; /* 30-3F import/export label */ + uint8_t path[64]; /* 40-7F target specification string or key */ +} __packed; + +typedef struct hammer2_volconf hammer2_volconf_t; + +#define DMSG_VOLF_ENABLED 0x0001 +#define DMSG_VOLF_INPROG 0x0002 +#define DMSG_VOLF_CONN_RR 0x80 /* round-robin at same priority */ +#define DMSG_VOLF_CONN_EF 0x40 /* media errors flagged */ +#define DMSG_VOLF_CONN_PRI 0x0F /* select priority 0-15 (15=best) */ + +struct dmsg_lnk_hammer2_volconf { + dmsg_hdr_t head; + hammer2_volconf_t copy; /* copy spec */ + int32_t index; + int32_t unused01; + uuid_t mediaid; + int64_t reserved02[32]; +} __packed; + +typedef struct dmsg_lnk_hammer2_volconf dmsg_lnk_hammer2_volconf_t; + +#define DMSG_LNK_HAMMER2_VOLCONF DMSG_LNK(DMSG_LNK_CMD_HAMMER2_VOLCONF, \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Dec 24 20:13:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A47B1EFC55; Tue, 24 Dec 2019 20:13:30 +0000 (UTC) (envelope-from bdragon@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 47j6qG3br0z49w8; Tue, 24 Dec 2019 20:13:30 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 76CCD57B7; Tue, 24 Dec 2019 20:13:30 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOKDU8d073279; Tue, 24 Dec 2019 20:13:30 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOKDU4b073278; Tue, 24 Dec 2019 20:13:30 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912242013.xBOKDU4b073278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Tue, 24 Dec 2019 20:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356061 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 356061 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 20:13:30 -0000 Author: bdragon Date: Tue Dec 24 20:13:29 2019 New Revision: 356061 URL: https://svnweb.freebsd.org/changeset/base/356061 Log: [PowerPC] Define powerpc IFUNC kernel/userspace ABI. This is a prerequisite for anything IFUNC in the ELFv2 / clang switch. Since probing cpu info on powerpc is a privileged operation, define that we pass AT_HWCAP / AT_HWCAP2 through as cpu_features and cpu_features2 to ifunc resolvers. This is particularly important when dealing with non-PLT GNU IFUNC, which is not allowed to PLT call from resolvers and therefore can't access global variables. The naming convention "cpu_features"/"cpu_features2" is an existing FreeBSD PowerPC convention and matches the way we treat these variables in machine/cpu.h. The underlying variables are u_long, however, as per the commit message for r332868, only the low 32 bits are ever used, so the underlying flags are compatible across all of PowerPC. The resolver prototype is defined to reserve the maximum number of register-passed parameters the various PowerPC ABIs allow. This leaves plenty of room for growth without needing to resort to passing via the stack in the future. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22787 Added: head/sys/powerpc/include/ifunc.h (contents, props changed) Added: head/sys/powerpc/include/ifunc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/ifunc.h Tue Dec 24 20:13:29 2019 (r356061) @@ -0,0 +1,60 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Brandon Bergren + * Copyright (c) 2015-2018 The FreeBSD Foundation. All rights reserved. + * + * Part of this software was developed by + * Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __POWERPC_IFUNC_H +#define __POWERPC_IFUNC_H + +#include + +#define DEFINE_IFUNC(qual, ret_type, name, args) \ + static ret_type (*name##_resolver(void))args __used; \ + qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \ + static ret_type (*name##_resolver(void))args + +#define DEFINE_UIFUNC(qual, ret_type, name, args) \ + static ret_type (*name##_resolver(register_t, register_t, \ + register_t, register_t, register_t, register_t, register_t, \ + register_t))args __used; \ + qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \ + static ret_type (*name##_resolver( \ + register_t cpu_features, \ + register_t cpu_features2, \ + register_t arg3 __unused, \ + register_t arg4 __unused, \ + register_t arg5 __unused, \ + register_t arg6 __unused, \ + register_t arg7 __unused, \ + register_t arg8 __unused))args + +#endif From owner-svn-src-head@freebsd.org Tue Dec 24 22:27:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C94591CA8BF; Tue, 24 Dec 2019 22:27:06 +0000 (UTC) (envelope-from bdragon@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 47j9nQ4qjdz4Gh3; Tue, 24 Dec 2019 22:27:06 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9CDCE6F1C; Tue, 24 Dec 2019 22:27:06 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOMR6ZT049874; Tue, 24 Dec 2019 22:27:06 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOMR6xB049873; Tue, 24 Dec 2019 22:27:06 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912242227.xBOMR6xB049873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Tue, 24 Dec 2019 22:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356062 - head/sys/dev/aic7xxx X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/dev/aic7xxx X-SVN-Commit-Revision: 356062 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 22:27:06 -0000 Author: bdragon Date: Tue Dec 24 22:27:06 2019 New Revision: 356062 URL: https://svnweb.freebsd.org/changeset/base/356062 Log: Fix trivial whitespace issue that is tripping -Wmisleading-indentation in clang HEAD. There was an invisible space in the middle of the tabs, and that apprently was enough to throw off clang's column counting. Even if clang is "incorrect" here, it's still a style(9) violation. Modified: head/sys/dev/aic7xxx/aic7xxx.c Modified: head/sys/dev/aic7xxx/aic7xxx.c ============================================================================== --- head/sys/dev/aic7xxx/aic7xxx.c Tue Dec 24 20:13:29 2019 (r356061) +++ head/sys/dev/aic7xxx/aic7xxx.c Tue Dec 24 22:27:06 2019 (r356062) @@ -1749,7 +1749,7 @@ ahc_find_syncrate(struct ahc_softc *ahc, u_int *period * At some speeds, we only support * ST transfers. */ - if ((syncrate->sxfr_u2 & ST_SXFR) != 0) + if ((syncrate->sxfr_u2 & ST_SXFR) != 0) *ppr_options &= ~MSG_EXT_PPR_DT_REQ; break; } From owner-svn-src-head@freebsd.org Tue Dec 24 23:03:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9908F1CB460; Tue, 24 Dec 2019 23:03:13 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47jBb53VZHz4J2p; Tue, 24 Dec 2019 23:03:13 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 731BD7619; Tue, 24 Dec 2019 23:03:13 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBON3DmA073666; Tue, 24 Dec 2019 23:03:13 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBON3DA3073665; Tue, 24 Dec 2019 23:03:13 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201912242303.xBON3DA3073665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 24 Dec 2019 23:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356063 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 356063 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 23:03:13 -0000 Author: mckusick Date: Tue Dec 24 23:03:12 2019 New Revision: 356063 URL: https://svnweb.freebsd.org/changeset/base/356063 Log: When running fsck_ffs manually, do not ask: USE JOURNAL? [yn] when the journal timestamp does not match the filesystem mount time as we are just going to print an error and fall through to a full fsck. Instead, just run a full fsck. Requested by: Bjoern A. Zeeb (bz) MFC after: 7 days Modified: head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Tue Dec 24 22:27:06 2019 (r356062) +++ head/sbin/fsck_ffs/main.c Tue Dec 24 23:03:12 2019 (r356063) @@ -423,13 +423,11 @@ checkfilesys(char *filesys) */ if ((sblock.fs_flags & FS_SUJ) == FS_SUJ) { if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && skipclean) { - if (preen || reply("USE JOURNAL")) { - if (suj_check(filesys) == 0) { - printf("\n***** FILE SYSTEM MARKED CLEAN *****\n"); - if (chkdoreload(mntp) == 0) - exit(0); - exit(4); - } + if (suj_check(filesys) == 0) { + printf("\n***** FILE SYSTEM MARKED CLEAN *****\n"); + if (chkdoreload(mntp) == 0) + exit(0); + exit(4); } printf("** Skipping journal, falling through to full fsck\n\n"); } Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Tue Dec 24 22:27:06 2019 (r356062) +++ head/sbin/fsck_ffs/suj.c Tue Dec 24 23:03:12 2019 (r356063) @@ -2720,6 +2720,8 @@ suj_check(const char *filesys) printf("** SU+J Recovering %s\n", filesys); if (suj_verifyino(jip) != 0) return (-1); + if (!preen && !reply("USE JOURNAL")) + return (-1); /* * Build a list of journal blocks in jblocks before parsing the * available journal blocks in with suj_read(). From owner-svn-src-head@freebsd.org Tue Dec 24 23:43:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3550F1CC095; Tue, 24 Dec 2019 23:43:30 +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 47jCTZ0XzRz4KT2; Tue, 24 Dec 2019 23:43:30 +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 0D9D47D2D; Tue, 24 Dec 2019 23:43:30 +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 xBONhTvP097297; Tue, 24 Dec 2019 23:43:29 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBONhTtC097295; Tue, 24 Dec 2019 23:43:29 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912242343.xBONhTtC097295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 24 Dec 2019 23:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356065 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 356065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 23:43:30 -0000 Author: loos Date: Tue Dec 24 23:43:29 2019 New Revision: 356065 URL: https://svnweb.freebsd.org/changeset/base/356065 Log: Initialize the bounce pages list in armv[4|6] DMA maps. Fixes the crash on the first use of STAILQ_INSERT_TAIL() in add_bounce_page(). Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/arm/busdma_machdep-v4.c head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v4.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v4.c Tue Dec 24 23:20:18 2019 (r356064) +++ head/sys/arm/arm/busdma_machdep-v4.c Tue Dec 24 23:43:29 2019 (r356065) @@ -669,6 +669,7 @@ allocate_map(bus_dma_tag_t dmat, int mflags) return (NULL); } map->segments = (bus_dma_segment_t *)((uintptr_t)map + mapsize); + STAILQ_INIT(&map->bpages); return (map); } Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Dec 24 23:20:18 2019 (r356064) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Dec 24 23:43:29 2019 (r356065) @@ -735,6 +735,7 @@ allocate_map(bus_dma_tag_t dmat, int mflags) return (NULL); } map->segments = (bus_dma_segment_t *)((uintptr_t)map + mapsize); + STAILQ_INIT(&map->bpages); return (map); } From owner-svn-src-head@freebsd.org Wed Dec 25 01:15:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27D161CDE07; Wed, 25 Dec 2019 01:15:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47jFWv02Swz4NQJ; Wed, 25 Dec 2019 01:15:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0AC78D44; Wed, 25 Dec 2019 01:15:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBP1Fc45050402; Wed, 25 Dec 2019 01:15:38 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBP1Fcmk050401; Wed, 25 Dec 2019 01:15:38 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912250115.xBP1Fcmk050401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 25 Dec 2019 01:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356066 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 356066 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 01:15:39 -0000 Author: rmacklem Date: Wed Dec 25 01:15:38 2019 New Revision: 356066 URL: https://svnweb.freebsd.org/changeset/base/356066 Log: Fix nfsmount() so that it will return NFSERR_MINORVERMISMATCH. If nfsrpc_getdirpath() returns NFSERR_MINORVERMISMATCH, it would erroneously get mapped to EIO. This was not particularily harmful, but would make it hard for sysadmins to diagnose why an NFSv4 mount is failing. mount_nfs.c still needs to be fixed so that it does not report NFSERR_MINORVERMISMATCH as an unknown error 10021. MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Tue Dec 24 23:43:29 2019 (r356065) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Wed Dec 25 01:15:38 2019 (r356066) @@ -1544,10 +1544,8 @@ mountnfs(struct nfs_args *argp, struct mount *mp, stru if (error) (void) nfs_catnap(PZERO, error, "nfsgetdirp"); } while (error && --trycnt > 0); - if (error) { - error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0); + if (error) goto bad; - } } /* From owner-svn-src-head@freebsd.org Wed Dec 25 05:26:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5FFD1D299D for ; Wed, 25 Dec 2019 05:26:47 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic308-8.consmr.mail.gq1.yahoo.com (sonic308-8.consmr.mail.gq1.yahoo.com [98.137.68.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47jM5f3Lnqz4Xhy for ; Wed, 25 Dec 2019 05:26:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: CcSNUsMVM1ljvWvcbC6DjQWNpG6NjOpntGsVB8TaxtQ2xHLLDNZVX9W9VDqMSn0 P2trPje19b3TF8CHqKeBOJj0OV2xvCiZWHJIwustDtZw7YdCbuhe6xHXr0zkuprw9nvhBQYr1T72 d.g.zLMziDXPjaRp3Hi5gyVk0UGhSarO7Nn9lfj3f8.kDBmRytsV.FC8QxS.7zKCkyYDacvETvwc c2u9Y4sH3Ri8x3cttsXK1meBw6d9kKF6KClUROmwBi66L6ktfPGFdhqZgrF6SU7yvBcbgxoRjadw qQfthva3rijGTT1wxC3bACbZNqzIX8DI1zk0NrsZTZvKTLthgPAFYyFrSsEqGhpmbiORqwy8Ztoc zq_yJvXpmWDuTqBhGLtveTGD3siKUrNvoEzvUIp0xfdvm7.LjeMpgckdBEhgJlazuYl7wa8Vlg4C 68a2qKL.DFypkRTATrSGQZuY1lIuJYZHhFrjjpMQCzrB6xIv0fcqXF1wTHKvLjKpuWNy6zrfQRLn 9XsfOodJ2k_2fTfSgxo0uXY1.CKQ2zMJYP9jFqqFSLDBE4WNjjnkIhoC5XOoB3esJyc9D7m6CKp1 1z_zDZAiykwH9m2nD6iq_PzrWUKmZmAhL18phQ2sbWSBlS6dgAJfBrY3ItmcPF7haG6hgT5Ol.Io WyoyuPW4HJwuOmOFJSuu6iZPzjMOnFSYpud1CkMvGsRAw3sdocRRKpdUbsr6mzR6CWagjelQOZiu bvd7DK5QEeS8h42dCIUKnjdPn790Gu0gLZKeCgZNHEA4ulT4ZZfsuKv08hvLdJluWB70BS8BkWar A60nOci473xuWqOipCYAV1COs1__qba9sqGhvcYtMSoUZMuUwIoE5cMKFBKrYLS5exNC9W.9FDQs P7xtlJVSe05_bsdL8GbytANI038W8VdqYmXTsxwfmEgwftAcG4W_LsRCcgFCzu3trxFGXHk5fDle t5nFimYNais2cE7LpZEDur.dMyBLPb8OzQhX9L7HC6BuduSTgIW6xk2va4n4b5v_d6F4NlnJbLD6 Umr7khABhSNP8LfidvTpmeRqWtKZiatW_ieEcjd44Z03DqM269z4.UImjiBYG8BfuCO_5OFzIQtJ WztZhwkdxvGBSTUGOEcni2_x8._uAe56hxmh1Xebq_.PzWV1ywvOm9F2A.HrGdmJmGD1pvEYlHOJ BkvOBhMny9l91qVmd8WxEpXpFHjXY9x3Dj.jc1QZyPQOeq9n.WzDChcggPo5cRRYiTFhpYP_wXFm 2APT74msV.1qH.ltfjd0aTJS3Ljz_bijnulndff_g4B31CkwbW_hGndE7w54QGwwPogmlMSmIScR BJ7WSmaawLzzY1kSmm_hE.kejFciDIcOKfNAkQiQ39Yjw13jXPdHEGx_LAhXYer_6LMngTZoryhW 5Ew6Dr_1wzOFI_BBGhvig9a6sXrlvZgFgvA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.gq1.yahoo.com with HTTP; Wed, 25 Dec 2019 05:26:42 +0000 Received: by smtp413.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID b300a30ec1eeb7d6b8e381a70e39a6d8; Wed, 25 Dec 2019 05:26:39 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: svn commit: r356054 - in head: share/mk stand Message-Id: <8A9C94C7-094F-45B4-B156-5A04958C4938@yahoo.com> Date: Tue, 24 Dec 2019 21:26:37 -0800 To: "jhibbits@freebsd.org " , svn-src-head@freebsd.org X-Mailer: Apple Mail (2.3608.40.2.2.4) References: <8A9C94C7-094F-45B4-B156-5A04958C4938.ref@yahoo.com> X-Rspamd-Queue-Id: 47jM5f3Lnqz4Xhy X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.13 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-0.65)[-0.648,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-0.98)[-0.978,0]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[32.68.137.98.list.dnswl.org : 127.0.5.0]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.00)[ip: (1.66), ipnet: 98.137.64.0/21(0.89), asn: 36647(0.71), country: US(-0.05)]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 05:26:48 -0000 In: +# Defines a variable for Binutils linker, to be used to workaround some +# issue with LLVM LLD (i.e. support for PowerPC32 bit on PowerPC64) +# +# This is an unavoidable cross coupling with Makefile.inc1 and +# normal builds works when CROSS_BINUTILS_PREFIX and could be removed +# when LLD PowerPC 32 bit support is completed +.if defined(CROSS_BINUTILS_PREFIX) +LD_BFD=3D${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd +.else +LD_BFD=3D${OBJTOP}/tmp/usr/bin/ld.bfd +.endif I'm confused by the 2 lines: +.if defined(CROSS_BINUTILS_PREFIX) +LD_BFD=3D${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd Looking in /usr/local/share/toolchains/*.mk I see CROSS_BINUTILS_PREFIX as a full path in each case ( based on devel/freebsd-gcc[69] in my context): # grep -r CROSS_BINU /usr/local/share/toolchains/ | more = /usr/local/share/toolchains/aarch64-gcc6.mk:CROSS_BINUTILS_PREFIX=3D/usr/l= ocal/aarch64-unknown-freebsd13.0/bin/ = /usr/local/share/toolchains/amd64-gcc6.mk:CROSS_BINUTILS_PREFIX=3D/usr/loc= al/x86_64-unknown-freebsd13.0/bin/ = /usr/local/share/toolchains/powerpc64-gcc6.mk:CROSS_BINUTILS_PREFIX=3D/usr= /local/powerpc64-unknown-freebsd13.0/bin/ = /usr/local/share/toolchains/aarch64-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr/l= ocal/aarch64-unknown-freebsd13.0/bin/ = /usr/local/share/toolchains/amd64-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr/loc= al/x86_64-unknown-freebsd13.0/bin/ = /usr/local/share/toolchains/powerpc64-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr= /local/powerpc64-unknown-freebsd13.0/bin/ = /usr/local/share/toolchains/powerpc-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr/l= ocal/powerpc-unknown-freebsd13.0/bin/ And when I look in /usr/srcv/Makefile.inc1 I see: = /usr/src/Makefile.inc1:CROSS_BINUTILS_PREFIX=3D/usr/local/${TARGET_TRIPLE}= /bin/ Having an overall path structure like: ${LOCALBASE}/bin/usr/local/powerpc64-unknown-freebsd13.0/bin/-ld.bfd seems strange (using powerpc64 as an example). =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Wed Dec 25 11:26:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA6191DA4E0; Wed, 25 Dec 2019 11:26:38 +0000 (UTC) (envelope-from ganbold@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 47jW4t4TmGz3KVT; Wed, 25 Dec 2019 11:26:38 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 90EF9FBEB; Wed, 25 Dec 2019 11:26:38 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBPBQcfX009988; Wed, 25 Dec 2019 11:26:38 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPBQc0g009987; Wed, 25 Dec 2019 11:26:38 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201912251126.xBPBQc0g009987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Wed, 25 Dec 2019 11:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356075 - head/sys/dev/etherswitch/e6000sw X-SVN-Group: head X-SVN-Commit-Author: ganbold X-SVN-Commit-Paths: head/sys/dev/etherswitch/e6000sw X-SVN-Commit-Revision: 356075 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 11:26:38 -0000 Author: ganbold Date: Wed Dec 25 11:26:38 2019 New Revision: 356075 URL: https://svnweb.freebsd.org/changeset/base/356075 Log: Fix panic when running etherswitchcfg port command. Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000sw.c Wed Dec 25 09:34:16 2019 (r356074) +++ head/sys/dev/etherswitch/e6000sw/e6000sw.c Wed Dec 25 11:26:38 2019 (r356075) @@ -849,6 +849,8 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p) if (!e6000sw_is_portenabled(sc, p->es_port)) return (0); + E6000SW_LOCK(sc); + /* Port flags. */ reg = e6000sw_readreg(sc, REG_PORT(sc, p->es_port), PORT_CONTROL2); if (p->es_flags & ETHERSWITCH_PORT_DROPTAGGED) @@ -862,7 +864,6 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p) e6000sw_writereg(sc, REG_PORT(sc, p->es_port), PORT_CONTROL2, reg); err = 0; - E6000SW_LOCK(sc); if (p->es_pvid != 0) e6000sw_set_pvid(sc, p->es_port, p->es_pvid); if (e6000sw_is_phyport(sc, p->es_port)) { From owner-svn-src-head@freebsd.org Wed Dec 25 15:55:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB6E61DFC05; Wed, 25 Dec 2019 15:55:45 +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 47jd3P54XZz42ky; Wed, 25 Dec 2019 15:55:45 +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 A41E41AC4B; Wed, 25 Dec 2019 15:55: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 xBPFtjml071414; Wed, 25 Dec 2019 15:55:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPFtj2b071412; Wed, 25 Dec 2019 15:55:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912251555.xBPFtj2b071412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 25 Dec 2019 15:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356076 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 356076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 15:55:45 -0000 Author: kevans Date: Wed Dec 25 15:55:45 2019 New Revision: 356076 URL: https://svnweb.freebsd.org/changeset/base/356076 Log: atkbdc: use proper pointer type for KBDC Proper locking for atkbdc will likely replace the kbdc_lock mechanism entirely with a mutex in atkbdc_softc, so that other consumers can also properly ensure locking protocol is followed (e.g. psm.c:doinitialize). The first step to doing this neatly is making KBDC less opaque so that others don't have to jump through weird casting hoops to address the mutex. No functional change intended; this diff effectively just removes a bunch of casting. A future change may remove the KBDC typedef entirely and just opt for using `atkbdc_softc_c *` directly, but this was decidedly a good intermediate step to make these changes simple to audit. Modified: head/sys/dev/atkbdc/atkbdc.c head/sys/dev/atkbdc/atkbdcreg.h Modified: head/sys/dev/atkbdc/atkbdc.c ============================================================================== --- head/sys/dev/atkbdc/atkbdc.c Wed Dec 25 11:26:38 2019 (r356075) +++ head/sys/dev/atkbdc/atkbdc.c Wed Dec 25 15:55:45 2019 (r356076) @@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$"); #define MAX(x, y) ((x) > (y) ? (x) : (y)) #endif -#define kbdcp(p) ((atkbdc_softc_t *)(p)) #define nextq(i) (((i) + 1) % KBDQ_BUFSIZE) #define availq(q) ((q)->head != (q)->tail) #if KBDIO_DEBUG >= 2 @@ -348,7 +347,7 @@ atkbdc_open(int unit) return NULL; if ((atkbdc_softc[unit]->port0 != NULL) || (atkbdc_softc[unit]->ioh0 != 0)) /* XXX */ - return (KBDC)atkbdc_softc[unit]; + return atkbdc_softc[unit]; return NULL; } @@ -396,8 +395,8 @@ kbdc_lock(KBDC p, int lock) { int prevlock; - prevlock = kbdcp(p)->lock; - kbdcp(p)->lock = lock; + prevlock = p->lock; + p->lock = lock; return (prevlock != lock); } @@ -406,8 +405,8 @@ kbdc_lock(KBDC p, int lock) int kbdc_data_ready(KBDC p) { - return (availq(&kbdcp(p)->kbd) || availq(&kbdcp(p)->aux) - || (read_status(kbdcp(p)) & KBDS_ANY_BUFFER_FULL)); + return (availq(&p->kbd) || availq(&p->aux) + || (read_status(p) & KBDS_ANY_BUFFER_FULL)); } /* queuing functions */ @@ -610,9 +609,9 @@ wait_for_aux_ack(struct atkbdc_softc *kbdc) int write_controller_command(KBDC p, int c) { - if (!wait_while_controller_busy(kbdcp(p))) + if (!wait_while_controller_busy(p)) return FALSE; - write_command(kbdcp(p), c); + write_command(p, c); return TRUE; } @@ -620,9 +619,9 @@ write_controller_command(KBDC p, int c) int write_controller_data(KBDC p, int c) { - if (!wait_while_controller_busy(kbdcp(p))) + if (!wait_while_controller_busy(p)) return FALSE; - write_data(kbdcp(p), c); + write_data(p, c); return TRUE; } @@ -630,9 +629,9 @@ write_controller_data(KBDC p, int c) int write_kbd_command(KBDC p, int c) { - if (!wait_while_controller_busy(kbdcp(p))) + if (!wait_while_controller_busy(p)) return FALSE; - write_data(kbdcp(p), c); + write_data(p, c); return TRUE; } @@ -643,7 +642,7 @@ write_aux_command(KBDC p, int c) int f; f = aux_mux_is_enabled(p) ? - KBDC_WRITE_TO_AUX_MUX + kbdcp(p)->aux_mux_port : KBDC_WRITE_TO_AUX; + KBDC_WRITE_TO_AUX_MUX + p->aux_mux_port : KBDC_WRITE_TO_AUX; if (!write_controller_command(p, f)) return FALSE; @@ -660,7 +659,7 @@ send_kbd_command(KBDC p, int c) while (retry-- > 0) { if (!write_kbd_command(p, c)) continue; - res = wait_for_kbd_ack(kbdcp(p)); + res = wait_for_kbd_ack(p); if (res == KBD_ACK) break; } @@ -686,8 +685,8 @@ send_aux_command(KBDC p, int c) * data in order to remove such packets. Well, we may remove * unprocessed, but necessary data byte as well... */ - emptyq(&kbdcp(p)->aux); - res = wait_for_aux_ack(kbdcp(p)); + emptyq(&p->aux); + res = wait_for_aux_ack(p); if (res == PSM_ACK) break; } @@ -704,7 +703,7 @@ send_kbd_command_and_data(KBDC p, int c, int d) for (retry = KBD_MAXRETRY; retry > 0; --retry) { if (!write_kbd_command(p, c)) continue; - res = wait_for_kbd_ack(kbdcp(p)); + res = wait_for_kbd_ack(p); if (res == KBD_ACK) break; else if (res != KBD_RESEND) @@ -716,7 +715,7 @@ send_kbd_command_and_data(KBDC p, int c, int d) for (retry = KBD_MAXRETRY, res = -1; retry > 0; --retry) { if (!write_kbd_command(p, d)) continue; - res = wait_for_kbd_ack(kbdcp(p)); + res = wait_for_kbd_ack(p); if (res != KBD_RESEND) break; } @@ -733,8 +732,8 @@ send_aux_command_and_data(KBDC p, int c, int d) for (retry = KBD_MAXRETRY; retry > 0; --retry) { if (!write_aux_command(p, c)) continue; - emptyq(&kbdcp(p)->aux); - res = wait_for_aux_ack(kbdcp(p)); + emptyq(&p->aux); + res = wait_for_aux_ack(p); if (res == PSM_ACK) break; else if (res != PSM_RESEND) @@ -746,7 +745,7 @@ send_aux_command_and_data(KBDC p, int c, int d) for (retry = KBD_MAXRETRY, res = -1; retry > 0; --retry) { if (!write_aux_command(p, d)) continue; - res = wait_for_aux_ack(kbdcp(p)); + res = wait_for_aux_ack(p); if (res != PSM_RESEND) break; } @@ -760,13 +759,13 @@ send_aux_command_and_data(KBDC p, int c, int d) int read_controller_data(KBDC p) { - if (availq(&kbdcp(p)->kbd)) - return removeq(&kbdcp(p)->kbd); - if (availq(&kbdcp(p)->aux)) - return removeq(&kbdcp(p)->aux); - if (!wait_for_data(kbdcp(p))) + if (availq(&p->kbd)) + return removeq(&p->kbd); + if (availq(&p->aux)) + return removeq(&p->aux); + if (!wait_for_data(p)) return -1; /* timeout */ - return read_data(kbdcp(p)); + return read_data(p); } #if KBDIO_DEBUG >= 2 @@ -782,16 +781,16 @@ read_kbd_data(KBDC p) call = 0; log(LOG_DEBUG, "kbdc: kbd q: %d calls, max %d chars, " "aux q: %d calls, max %d chars\n", - kbdcp(p)->kbd.call_count, kbdcp(p)->kbd.max_qcount, - kbdcp(p)->aux.call_count, kbdcp(p)->aux.max_qcount); + p->kbd.call_count, p->kbd.max_qcount, + p->aux.call_count, p->aux.max_qcount); } #endif - if (availq(&kbdcp(p)->kbd)) - return removeq(&kbdcp(p)->kbd); - if (!wait_for_kbd_data(kbdcp(p))) + if (availq(&p->kbd)) + return removeq(&p->kbd); + if (!wait_for_kbd_data(p)) return -1; /* timeout */ - return read_data(kbdcp(p)); + return read_data(p); } /* read one byte from the keyboard, but return immediately if @@ -807,22 +806,22 @@ read_kbd_data_no_wait(KBDC p) call = 0; log(LOG_DEBUG, "kbdc: kbd q: %d calls, max %d chars, " "aux q: %d calls, max %d chars\n", - kbdcp(p)->kbd.call_count, kbdcp(p)->kbd.max_qcount, - kbdcp(p)->aux.call_count, kbdcp(p)->aux.max_qcount); + p->kbd.call_count, p->kbd.max_qcount, + p->aux.call_count, p->aux.max_qcount); } #endif - if (availq(&kbdcp(p)->kbd)) - return removeq(&kbdcp(p)->kbd); - f = read_status(kbdcp(p)) & KBDS_BUFFER_FULL; + if (availq(&p->kbd)) + return removeq(&p->kbd); + f = read_status(p) & KBDS_BUFFER_FULL; if (f == KBDS_AUX_BUFFER_FULL) { DELAY(KBDD_DELAYTIME); - addq(&kbdcp(p)->aux, read_data(kbdcp(p))); - f = read_status(kbdcp(p)) & KBDS_BUFFER_FULL; + addq(&p->aux, read_data(p)); + f = read_status(p) & KBDS_BUFFER_FULL; } if (f == KBDS_KBD_BUFFER_FULL) { DELAY(KBDD_DELAYTIME); - return read_data(kbdcp(p)); + return read_data(p); } return -1; /* no data */ } @@ -831,11 +830,11 @@ read_kbd_data_no_wait(KBDC p) int read_aux_data(KBDC p) { - if (availq(&kbdcp(p)->aux)) - return removeq(&kbdcp(p)->aux); - if (!wait_for_aux_data(kbdcp(p))) + if (availq(&p->aux)) + return removeq(&p->aux); + if (!wait_for_aux_data(p)) return -1; /* timeout */ - return read_data(kbdcp(p)); + return read_data(p); } /* read one byte from the aux device, but return immediately if @@ -846,17 +845,17 @@ read_aux_data_no_wait(KBDC p) { int f; - if (availq(&kbdcp(p)->aux)) - return removeq(&kbdcp(p)->aux); - f = read_status(kbdcp(p)) & KBDS_BUFFER_FULL; + if (availq(&p->aux)) + return removeq(&p->aux); + f = read_status(p) & KBDS_BUFFER_FULL; if (f == KBDS_KBD_BUFFER_FULL) { DELAY(KBDD_DELAYTIME); - addq(&kbdcp(p)->kbd, read_data(kbdcp(p))); - f = read_status(kbdcp(p)) & KBDS_BUFFER_FULL; + addq(&p->kbd, read_data(p)); + f = read_status(p) & KBDS_BUFFER_FULL; } if (f == KBDS_AUX_BUFFER_FULL) { DELAY(KBDD_DELAYTIME); - return read_data(kbdcp(p)); + return read_data(p); } return -1; /* no data */ } @@ -875,11 +874,11 @@ empty_kbd_buffer(KBDC p, int wait) int delta = 2; for (t = wait; t > 0; ) { - if ((f = read_status(kbdcp(p))) & KBDS_ANY_BUFFER_FULL) { + if ((f = read_status(p)) & KBDS_ANY_BUFFER_FULL) { DELAY(KBDD_DELAYTIME); - b = read_data(kbdcp(p)); + b = read_data(p); if ((f & KBDS_BUFFER_FULL) == KBDS_AUX_BUFFER_FULL) { - addq(&kbdcp(p)->aux, b); + addq(&p->aux, b); #if KBDIO_DEBUG >= 2 ++c2; } else { @@ -897,7 +896,7 @@ empty_kbd_buffer(KBDC p, int wait) log(LOG_DEBUG, "kbdc: %d:%d char read (empty_kbd_buffer)\n", c1, c2); #endif - emptyq(&kbdcp(p)->kbd); + emptyq(&p->kbd); } /* discard data from the aux device */ @@ -914,11 +913,11 @@ empty_aux_buffer(KBDC p, int wait) int delta = 2; for (t = wait; t > 0; ) { - if ((f = read_status(kbdcp(p))) & KBDS_ANY_BUFFER_FULL) { + if ((f = read_status(p)) & KBDS_ANY_BUFFER_FULL) { DELAY(KBDD_DELAYTIME); - b = read_data(kbdcp(p)); + b = read_data(p); if ((f & KBDS_BUFFER_FULL) == KBDS_KBD_BUFFER_FULL) { - addq(&kbdcp(p)->kbd, b); + addq(&p->kbd, b); #if KBDIO_DEBUG >= 2 ++c1; } else { @@ -936,7 +935,7 @@ empty_aux_buffer(KBDC p, int wait) log(LOG_DEBUG, "kbdc: %d:%d char read (empty_aux_buffer)\n", c1, c2); #endif - emptyq(&kbdcp(p)->aux); + emptyq(&p->aux); } /* discard any data from the keyboard or the aux device */ @@ -953,9 +952,9 @@ empty_both_buffers(KBDC p, int wait) int delta = 2; for (t = wait; t > 0; ) { - if ((f = read_status(kbdcp(p))) & KBDS_ANY_BUFFER_FULL) { + if ((f = read_status(p)) & KBDS_ANY_BUFFER_FULL) { DELAY(KBDD_DELAYTIME); - (void)read_data(kbdcp(p)); + (void)read_data(p); #if KBDIO_DEBUG >= 2 if ((f & KBDS_BUFFER_FULL) == KBDS_KBD_BUFFER_FULL) ++c1; @@ -983,8 +982,8 @@ empty_both_buffers(KBDC p, int wait) log(LOG_DEBUG, "kbdc: %d:%d char read (empty_both_buffers)\n", c1, c2); #endif - emptyq(&kbdcp(p)->kbd); - emptyq(&kbdcp(p)->aux); + emptyq(&p->kbd); + emptyq(&p->aux); } /* keyboard and mouse device control */ @@ -1003,7 +1002,7 @@ reset_kbd(KBDC p) empty_both_buffers(p, 10); if (!write_kbd_command(p, KBDC_RESET_KBD)) continue; - emptyq(&kbdcp(p)->kbd); + emptyq(&p->kbd); c = read_controller_data(p); if (verbose || bootverbose) log(LOG_DEBUG, "kbdc: RESET_KBD return code:%04x\n", c); @@ -1041,7 +1040,7 @@ reset_aux_dev(KBDC p) empty_both_buffers(p, 10); if (!write_aux_command(p, PSMC_RESET_DEV)) continue; - emptyq(&kbdcp(p)->aux); + emptyq(&p->aux); /* NOTE: Compaq Armada laptops require extra delay here. XXX */ for (again = KBD_MAXWAIT; again > 0; --again) { DELAY(KBD_RESETDELAY*1000); @@ -1093,7 +1092,7 @@ test_controller(KBDC p) if (retry < 0) return FALSE; - emptyq(&kbdcp(p)->kbd); + emptyq(&p->kbd); while (again-- > 0) { /* wait awhile */ DELAY(KBD_RESETDELAY*1000); @@ -1121,7 +1120,7 @@ test_kbd_port(KBDC p) if (retry < 0) return FALSE; - emptyq(&kbdcp(p)->kbd); + emptyq(&p->kbd); while (again-- > 0) { c = read_controller_data(p); if (c != -1) /* try again if the controller is not ready */ @@ -1147,7 +1146,7 @@ test_aux_port(KBDC p) if (retry < 0) return FALSE; - emptyq(&kbdcp(p)->kbd); + emptyq(&p->kbd); while (again-- > 0) { c = read_controller_data(p); if (c != -1) /* try again if the controller is not ready */ @@ -1161,27 +1160,27 @@ test_aux_port(KBDC p) int kbdc_get_device_mask(KBDC p) { - return kbdcp(p)->command_mask; + return p->command_mask; } void kbdc_set_device_mask(KBDC p, int mask) { - kbdcp(p)->command_mask = - mask & (((kbdcp(p)->quirks & KBDC_QUIRK_KEEP_ACTIVATED) + p->command_mask = + mask & (((p->quirks & KBDC_QUIRK_KEEP_ACTIVATED) ? 0 : KBD_KBD_CONTROL_BITS) | KBD_AUX_CONTROL_BITS); } int get_controller_command_byte(KBDC p) { - if (kbdcp(p)->command_byte != -1) - return kbdcp(p)->command_byte; + if (p->command_byte != -1) + return p->command_byte; if (!write_controller_command(p, KBDC_GET_COMMAND_BYTE)) return -1; - emptyq(&kbdcp(p)->kbd); - kbdcp(p)->command_byte = read_controller_data(p); - return kbdcp(p)->command_byte; + emptyq(&p->kbd); + p->command_byte = read_controller_data(p); + return p->command_byte; } int @@ -1190,7 +1189,7 @@ set_controller_command_byte(KBDC p, int mask, int comm if (get_controller_command_byte(p) == -1) return FALSE; - command = (kbdcp(p)->command_byte & ~mask) | (command & mask); + command = (p->command_byte & ~mask) | (command & mask); if (command & KBD_DISABLE_KBD_PORT) { if (!write_controller_command(p, KBDC_DISABLE_KBD_PORT)) return FALSE; @@ -1199,7 +1198,7 @@ set_controller_command_byte(KBDC p, int mask, int comm return FALSE; if (!write_controller_data(p, command)) return FALSE; - kbdcp(p)->command_byte = command; + p->command_byte = command; if (verbose) log(LOG_DEBUG, "kbdc: new command byte:%04x (set_controller...)\n", @@ -1247,7 +1246,7 @@ set_active_aux_mux_port(KBDC p, int port) if (port < 0 || port >= KBDC_AUX_MUX_NUM_PORTS) return (FALSE); - kbdcp(p)->aux_mux_port = port; + p->aux_mux_port = port; return (TRUE); } @@ -1260,7 +1259,7 @@ enable_aux_mux(KBDC p) version = set_aux_mux_state(p, TRUE); if (version >= 0) { - kbdcp(p)->aux_mux_enabled = TRUE; + p->aux_mux_enabled = TRUE; set_active_aux_mux_port(p, 0); } @@ -1271,7 +1270,7 @@ int disable_aux_mux(KBDC p) { - kbdcp(p)->aux_mux_enabled = FALSE; + p->aux_mux_enabled = FALSE; return (set_aux_mux_state(p, FALSE)); } @@ -1280,5 +1279,5 @@ int aux_mux_is_enabled(KBDC p) { - return (kbdcp(p)->aux_mux_enabled); + return (p->aux_mux_enabled); } Modified: head/sys/dev/atkbdc/atkbdcreg.h ============================================================================== --- head/sys/dev/atkbdc/atkbdcreg.h Wed Dec 25 11:26:38 2019 (r356075) +++ head/sys/dev/atkbdc/atkbdcreg.h Wed Dec 25 15:55:45 2019 (r356076) @@ -222,7 +222,7 @@ enum kbdc_device_ivar { KBDC_IVAR_COMPATID, }; -typedef caddr_t KBDC; +typedef atkbdc_softc_t *KBDC; #define KBDC_RID_KBD 0 #define KBDC_RID_AUX 1 From owner-svn-src-head@freebsd.org Wed Dec 25 17:26:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 437FC1E1612; Wed, 25 Dec 2019 17:26:52 +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 47jg4X151Nz45bn; Wed, 25 Dec 2019 17:26:52 +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 205941BC35; Wed, 25 Dec 2019 17:26:52 +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 xBPHQqmW023862; Wed, 25 Dec 2019 17:26:52 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPHQquK023861; Wed, 25 Dec 2019 17:26:52 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912251726.xBPHQquK023861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 25 Dec 2019 17:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356077 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 356077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 17:26:52 -0000 Author: ian Date: Wed Dec 25 17:26:51 2019 New Revision: 356077 URL: https://svnweb.freebsd.org/changeset/base/356077 Log: For riscv kernel builds, add -N to LDFLAGS instead of replacing the SYSTEM_LD variable. This avoids duplicating the contents of SYSTEM_LD from kern.pre.mk just to add the -N flag to it. If the basic linker command ever needs to be changed, this will be one less place that has to be found and fixed. Some testing by kp@ indicates that the -N flag may not be needed at all, so a comment to that effect is also added, and the -N flag may be removed in a followup commit. Differential Revision: https://reviews.freebsd.org/D22920 Modified: head/sys/conf/Makefile.riscv Modified: head/sys/conf/Makefile.riscv ============================================================================== --- head/sys/conf/Makefile.riscv Wed Dec 25 15:55:45 2019 (r356076) +++ head/sys/conf/Makefile.riscv Wed Dec 25 17:26:51 2019 (r356077) @@ -28,10 +28,10 @@ S= ../../.. INCLUDES+= -I$S/contrib/libfdt -SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \ - --no-warn-mismatch --warn-common --export-dynamic \ - --dynamic-linker /red/herring \ - -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o +# XXX Make text segments writable. This has historically been set for +# riscv, but some preliminary testing shows it may not be needed; this +# can likely be removed after some more testing. +LDFLAGS+= -N .if !empty(DDB_ENABLED) CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls From owner-svn-src-head@freebsd.org Wed Dec 25 18:24:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 712A91E268D; Wed, 25 Dec 2019 18:24:39 +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 47jhMC28JCz482y; Wed, 25 Dec 2019 18:24:39 +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 40CC41C705; Wed, 25 Dec 2019 18:24:39 +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 xBPIOd7e059222; Wed, 25 Dec 2019 18:24:39 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPIOdpA059221; Wed, 25 Dec 2019 18:24:39 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912251824.xBPIOdpA059221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 25 Dec 2019 18:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356078 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 356078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 18:24:39 -0000 Author: ian Date: Wed Dec 25 18:24:38 2019 New Revision: 356078 URL: https://svnweb.freebsd.org/changeset/base/356078 Log: Revert r356077, apparently the change doesn't work after all (failed to build in CI). Modified: head/sys/conf/Makefile.riscv Modified: head/sys/conf/Makefile.riscv ============================================================================== --- head/sys/conf/Makefile.riscv Wed Dec 25 17:26:51 2019 (r356077) +++ head/sys/conf/Makefile.riscv Wed Dec 25 18:24:38 2019 (r356078) @@ -28,10 +28,10 @@ S= ../../.. INCLUDES+= -I$S/contrib/libfdt -# XXX Make text segments writable. This has historically been set for -# riscv, but some preliminary testing shows it may not be needed; this -# can likely be removed after some more testing. -LDFLAGS+= -N +SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \ + --no-warn-mismatch --warn-common --export-dynamic \ + --dynamic-linker /red/herring \ + -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o .if !empty(DDB_ENABLED) CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls From owner-svn-src-head@freebsd.org Wed Dec 25 18:52:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 026021E2E5F; Wed, 25 Dec 2019 18:52:12 +0000 (UTC) (envelope-from kp@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 47jhyz6Jbrz495C; Wed, 25 Dec 2019 18:52:11 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id BF8591F0A8; Wed, 25 Dec 2019 18:52:11 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [10.0.1.237] (78-22-44-167.access.telenet.be [78.22.44.167]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id BF234D294; Wed, 25 Dec 2019 19:52:09 +0100 (CET) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Kristof Provost Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r356078 - head/sys/conf Date: Wed, 25 Dec 2019 19:52:08 +0100 Message-Id: <5AB7B083-8E8D-498A-B3F9-86297D6BB1FE@FreeBSD.org> References: <201912251824.xBPIOdpA059221@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201912251824.xBPIOdpA059221@repo.freebsd.org> To: Ian Lepore X-Mailer: iPhone Mail (17C54) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 18:52:12 -0000 > On 25 Dec 2019, at 19:24, Ian Lepore wrote: >=20 > =EF=BB=BFAuthor: ian > Date: Wed Dec 25 18:24:38 2019 > New Revision: 356078 > URL: https://svnweb.freebsd.org/changeset/base/356078 >=20 > Log: > Revert r356077, apparently the change doesn't work after all (failed to > build in CI). I built with (an external) LLVM, so that might be the difference.=20 Regards, Kristof From owner-svn-src-head@freebsd.org Wed Dec 25 18:59:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7342A1E3070 for ; Wed, 25 Dec 2019 18:59:52 +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 47jj7r0PYnz49Pw for ; Wed, 25 Dec 2019 18:59:51 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1577300390; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=tx8mu44kmbqPk260tk5Megeb8ik1n3xK6PpwrZxJfVTqFERctiFAe1RnTY/7GpyI1gFtdhmy3E9+F WhV5hAqvbGkFaLGSNIToZw77g1lurTyIsUT/vSWW2+TFrax9nFHAqwDlxfigk004QtChsYd8x9rbHK Y1WKNRRYVaXkgBF9M8HiK/GM9TEp9EfxmXYEhDXjn+udW4DBK9flxXON1akFqtQR2FdQOzCI8TUSLu zrz/Uh/vCRyuvAy41c6BsOJybbgLfYlZWQvty+eWJd8kdd7Qe21xPp8lVyXFXAL22RI7O6/j4r2Tlt lEUiIMyDt3U68wIdHHC44t9amZ9B6vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=1d0cMk98kOaWkQLMRPPMHDJ9cO+NiDLWzZqu66ydFAE=; b=h0ux2XHGSpM4UEI7EHCR1QzxZPbPg1NMr6IG4iWNpIBNO2v/eWJ72cZmjQTeYE38N3CSHdpaLm2Wb sd46P3XFF7tbQqjcmCYdSXyCZIP+HXz4USTV8zIDDsDm1cYSBj9mppt8TsebIzdjlk7ldi9Pg1Bd3G CsoPQbjiD7ecJoayLRnqZMNUnzl5c2f3fqVa1QxtilaUVYqz2JbyR9C7go2p/8hWpMrqyZ9kMKZWiG R12j9T39XualOVGg9M5k5H1FFlfIhB+kVAi7z7UEkgVmjT+9nDifm1i95lv0ErAYOz/7x0ArGo5kqS LFaDMPLjTiwHI96T9Le26by9tbNquPA== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=1d0cMk98kOaWkQLMRPPMHDJ9cO+NiDLWzZqu66ydFAE=; b=JES2JQ5vQBCoWexsP99b7NCAnPldoojboyBdmcoHwpw6oILhrSY474qprzLVkdS0ptJk0Jxud4q6M mU8AY0fAx+XINSRzCGhKnlSwGOYbKsnzcVzVZnQ+cOl5UbY0dA0vq9vcW60p8txfUG04qadXUnmMT7 s2uq9A2QlpdiiSXiv6bUOwzeW5DrYk/DhC+i7udDybooEdgfJhPF+dOKh5TFciHDaU1rjVZxr25G/J /404aLvgtRFT1IYHbc579qqoR1xEGP4pJCvw16d/vzo9D3JJbabbjZsUGp+zgSoIM/AmqN/5J6FQkc 6rTg2CBfgogPBOzjdERs12XZXP8HTWg== X-MHO-RoutePath: aGlwcGll X-MHO-User: b893316e-2748-11ea-b80d-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 b893316e-2748-11ea-b80d-052b4a66b6b2; Wed, 25 Dec 2019 18:59:49 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xBPIxlQU083685; Wed, 25 Dec 2019 11:59:47 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r356078 - head/sys/conf From: Ian Lepore To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Wed, 25 Dec 2019 11:59:47 -0700 In-Reply-To: <5AB7B083-8E8D-498A-B3F9-86297D6BB1FE@FreeBSD.org> References: <201912251824.xBPIOdpA059221@repo.freebsd.org> <5AB7B083-8E8D-498A-B3F9-86297D6BB1FE@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: 8bit X-Rspamd-Queue-Id: 47jj7r0PYnz49Pw X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.95 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.95)[-0.951,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-0.99)[-0.995,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 18:59:52 -0000 On Wed, 2019-12-25 at 19:52 +0100, Kristof Provost wrote: > > On 25 Dec 2019, at 19:24, Ian Lepore wrote: > > > > Author: ian > > Date: Wed Dec 25 18:24:38 2019 > > New Revision: 356078 > > URL: https://svnweb.freebsd.org/changeset/base/356078 > > > > Log: > > Revert r356077, apparently the change doesn't work after all > > (failed to > > build in CI). > > I built with (an external) LLVM, so that might be the difference. > > Regards, > Kristof > And I apparently can't build it at all, because when I try to follow the instructions and install the package it tells me to, I get a package with freebsd12.0 in the name, then at runtime it's looking for something with 13.0 in the name. And if I try to update my system to something later, my video card turns into a pumpkin (and it's not an old or obsolete card, although it is almost certainly a lower-end card than any self-respecting video card driver writer owns). -- Ian From owner-svn-src-head@freebsd.org Wed Dec 25 19:26:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE9B51E3C21; Wed, 25 Dec 2019 19:26:35 +0000 (UTC) (envelope-from jeff@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 47jjkg44c4z4Bmx; Wed, 25 Dec 2019 19:26:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 871BC1D20F; Wed, 25 Dec 2019 19:26:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBPJQZju094632; Wed, 25 Dec 2019 19:26:35 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPJQZo9094631; Wed, 25 Dec 2019 19:26:35 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912251926.xBPJQZo9094631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 25 Dec 2019 19:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356079 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 19:26:35 -0000 Author: jeff Date: Wed Dec 25 19:26:35 2019 New Revision: 356079 URL: https://svnweb.freebsd.org/changeset/base/356079 Log: Fix a bug with _NUMA domains introduced in r339686. When M_NOWAIT is specified there was no loop termination condition in keg_fetch_slab(). Reported by: pho Reviewed by: markj Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Dec 25 18:24:38 2019 (r356078) +++ head/sys/vm/uma_core.c Wed Dec 25 19:26:35 2019 (r356079) @@ -3084,6 +3084,8 @@ restart: return (slab); } KEG_LOCK(keg); + if (!rr && (flags & M_WAITOK) == 0) + break; if (rr && vm_domainset_iter_policy(&di, &domain) != 0) { if ((flags & M_WAITOK) != 0) { KEG_UNLOCK(keg); From owner-svn-src-head@freebsd.org Wed Dec 25 20:50:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 194D21E5046; Wed, 25 Dec 2019 20:50:54 +0000 (UTC) (envelope-from jeff@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 47jlby0Prdz4FSc; Wed, 25 Dec 2019 20:50:54 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0922F1E063; Wed, 25 Dec 2019 20:50:54 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBPKosPW041967; Wed, 25 Dec 2019 20:50:54 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPKorE2041962; Wed, 25 Dec 2019 20:50:53 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912252050.xBPKorE2041962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 25 Dec 2019 20:50:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356080 - in head: lib/libmemstat sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head: lib/libmemstat sys/vm X-SVN-Commit-Revision: 356080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 20:50:54 -0000 Author: jeff Date: Wed Dec 25 20:50:53 2019 New Revision: 356080 URL: https://svnweb.freebsd.org/changeset/base/356080 Log: Optimize fast path allocations by storing bucket headers in the per-cpu cache area. This allows us to check on bucket space for all per-cpu buckets with a single cacheline access and fewer branches. Reviewed by: markj, rlibby Differential Revision: https://reviews.freebsd.org/D22825 Modified: head/lib/libmemstat/memstat_uma.c head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/lib/libmemstat/memstat_uma.c ============================================================================== --- head/lib/libmemstat/memstat_uma.c Wed Dec 25 19:26:35 2019 (r356079) +++ head/lib/libmemstat/memstat_uma.c Wed Dec 25 20:50:53 2019 (r356080) @@ -438,28 +438,9 @@ memstat_kvm_uma(struct memory_type_list *list, void *k mtp->mt_numallocs += ucp->uc_allocs; mtp->mt_numfrees += ucp->uc_frees; - if (ucp->uc_allocbucket != NULL) { - ret = kread(kvm, ucp->uc_allocbucket, - &ub, sizeof(ub), 0); - if (ret != 0) { - free(ucp_array); - _memstat_mtl_empty(list); - list->mtl_error = ret; - return (-1); - } - mtp->mt_free += ub.ub_cnt; - } - if (ucp->uc_freebucket != NULL) { - ret = kread(kvm, ucp->uc_freebucket, - &ub, sizeof(ub), 0); - if (ret != 0) { - free(ucp_array); - _memstat_mtl_empty(list); - list->mtl_error = ret; - return (-1); - } - mtp->mt_free += ub.ub_cnt; - } + mtp->mt_free += ucp->uc_allocbucket.ucb_cnt; + mtp->mt_free += ucp->uc_freebucket.ucb_cnt; + mtp->mt_free += ucp->uc_crossbucket.ucb_cnt; } skip_percpu: mtp->mt_size = kz.uk_size; Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Dec 25 19:26:35 2019 (r356079) +++ head/sys/vm/uma_core.c Wed Dec 25 20:50:53 2019 (r356080) @@ -533,6 +533,144 @@ zone_put_bucket(uma_zone_t zone, uma_zone_domain_t zdo zone->uz_bkt_count += bucket->ub_cnt; } +/* Pops an item out of a per-cpu cache bucket. */ +static inline void * +cache_bucket_pop(uma_cache_t cache, uma_cache_bucket_t bucket) +{ + void *item; + + CRITICAL_ASSERT(curthread); + + bucket->ucb_cnt--; + item = bucket->ucb_bucket->ub_bucket[bucket->ucb_cnt]; +#ifdef INVARIANTS + bucket->ucb_bucket->ub_bucket[bucket->ucb_cnt] = NULL; + KASSERT(item != NULL, ("uma_zalloc: Bucket pointer mangled.")); +#endif + cache->uc_allocs++; + + return (item); +} + +/* Pushes an item into a per-cpu cache bucket. */ +static inline void +cache_bucket_push(uma_cache_t cache, uma_cache_bucket_t bucket, void *item) +{ + + CRITICAL_ASSERT(curthread); + KASSERT(bucket->ucb_bucket->ub_bucket[bucket->ucb_cnt] == NULL, + ("uma_zfree: Freeing to non free bucket index.")); + + bucket->ucb_bucket->ub_bucket[bucket->ucb_cnt] = item; + bucket->ucb_cnt++; + cache->uc_frees++; +} + +/* + * Unload a UMA bucket from a per-cpu cache. + */ +static inline uma_bucket_t +cache_bucket_unload(uma_cache_bucket_t bucket) +{ + uma_bucket_t b; + + b = bucket->ucb_bucket; + if (b != NULL) { + MPASS(b->ub_entries == bucket->ucb_entries); + b->ub_cnt = bucket->ucb_cnt; + bucket->ucb_bucket = NULL; + bucket->ucb_entries = bucket->ucb_cnt = 0; + } + + return (b); +} + +static inline uma_bucket_t +cache_bucket_unload_alloc(uma_cache_t cache) +{ + + return (cache_bucket_unload(&cache->uc_allocbucket)); +} + +static inline uma_bucket_t +cache_bucket_unload_free(uma_cache_t cache) +{ + + return (cache_bucket_unload(&cache->uc_freebucket)); +} + +static inline uma_bucket_t +cache_bucket_unload_cross(uma_cache_t cache) +{ + + return (cache_bucket_unload(&cache->uc_crossbucket)); +} + +/* + * Load a bucket into a per-cpu cache bucket. + */ +static inline void +cache_bucket_load(uma_cache_bucket_t bucket, uma_bucket_t b) +{ + + CRITICAL_ASSERT(curthread); + MPASS(bucket->ucb_bucket == NULL); + + bucket->ucb_bucket = b; + bucket->ucb_cnt = b->ub_cnt; + bucket->ucb_entries = b->ub_entries; +} + +static inline void +cache_bucket_load_alloc(uma_cache_t cache, uma_bucket_t b) +{ + + cache_bucket_load(&cache->uc_allocbucket, b); +} + +static inline void +cache_bucket_load_free(uma_cache_t cache, uma_bucket_t b) +{ + + cache_bucket_load(&cache->uc_freebucket, b); +} + +#ifdef UMA_XDOMAIN +static inline void +cache_bucket_load_cross(uma_cache_t cache, uma_bucket_t b) +{ + + cache_bucket_load(&cache->uc_crossbucket, b); +} +#endif + +/* + * Copy and preserve ucb_spare. + */ +static inline void +cache_bucket_copy(uma_cache_bucket_t b1, uma_cache_bucket_t b2) +{ + + b1->ucb_bucket = b2->ucb_bucket; + b1->ucb_entries = b2->ucb_entries; + b1->ucb_cnt = b2->ucb_cnt; +} + +/* + * Swap two cache buckets. + */ +static inline void +cache_bucket_swap(uma_cache_bucket_t b1, uma_cache_bucket_t b2) +{ + struct uma_cache_bucket b3; + + CRITICAL_ASSERT(curthread); + + cache_bucket_copy(&b3, b1); + cache_bucket_copy(b1, b2); + cache_bucket_copy(b2, &b3); +} + static void zone_log_warning(uma_zone_t zone) { @@ -801,6 +939,7 @@ static void cache_drain(uma_zone_t zone) { uma_cache_t cache; + uma_bucket_t bucket; int cpu; /* @@ -817,18 +956,21 @@ cache_drain(uma_zone_t zone) */ CPU_FOREACH(cpu) { cache = &zone->uz_cpu[cpu]; - bucket_drain(zone, cache->uc_allocbucket); - if (cache->uc_allocbucket != NULL) - bucket_free(zone, cache->uc_allocbucket, NULL); - cache->uc_allocbucket = NULL; - bucket_drain(zone, cache->uc_freebucket); - if (cache->uc_freebucket != NULL) - bucket_free(zone, cache->uc_freebucket, NULL); - cache->uc_freebucket = NULL; - bucket_drain(zone, cache->uc_crossbucket); - if (cache->uc_crossbucket != NULL) - bucket_free(zone, cache->uc_crossbucket, NULL); - cache->uc_crossbucket = NULL; + bucket = cache_bucket_unload_alloc(cache); + if (bucket != NULL) { + bucket_drain(zone, bucket); + bucket_free(zone, bucket, NULL); + } + bucket = cache_bucket_unload_free(cache); + if (bucket != NULL) { + bucket_drain(zone, bucket); + bucket_free(zone, bucket, NULL); + } + bucket = cache_bucket_unload_cross(cache); + if (bucket != NULL) { + bucket_drain(zone, bucket); + bucket_free(zone, bucket, NULL); + } } ZONE_LOCK(zone); bucket_cache_reclaim(zone, true); @@ -866,24 +1008,17 @@ cache_drain_safe_cpu(uma_zone_t zone, void *unused) else domain = 0; cache = &zone->uz_cpu[curcpu]; - if (cache->uc_allocbucket) { - if (cache->uc_allocbucket->ub_cnt != 0) - zone_put_bucket(zone, &zone->uz_domain[domain], - cache->uc_allocbucket, false); - else - b1 = cache->uc_allocbucket; - cache->uc_allocbucket = NULL; + b1 = cache_bucket_unload_alloc(cache); + if (b1 != NULL && b1->ub_cnt != 0) { + zone_put_bucket(zone, &zone->uz_domain[domain], b1, false); + b1 = NULL; } - if (cache->uc_freebucket) { - if (cache->uc_freebucket->ub_cnt != 0) - zone_put_bucket(zone, &zone->uz_domain[domain], - cache->uc_freebucket, false); - else - b2 = cache->uc_freebucket; - cache->uc_freebucket = NULL; + b2 = cache_bucket_unload_free(cache); + if (b2 != NULL && b2->ub_cnt != 0) { + zone_put_bucket(zone, &zone->uz_domain[domain], b2, false); + b2 = NULL; } - b3 = cache->uc_crossbucket; - cache->uc_crossbucket = NULL; + b3 = cache_bucket_unload_cross(cache); critical_exit(); ZONE_UNLOCK(zone); if (b1) @@ -2666,33 +2801,6 @@ uma_zfree_pcpu_arg(uma_zone_t zone, void *item, void * uma_zfree_arg(zone, item, udata); } -static inline void * -bucket_pop(uma_zone_t zone, uma_cache_t cache, uma_bucket_t bucket) -{ - void *item; - - bucket->ub_cnt--; - item = bucket->ub_bucket[bucket->ub_cnt]; -#ifdef INVARIANTS - bucket->ub_bucket[bucket->ub_cnt] = NULL; - KASSERT(item != NULL, ("uma_zalloc: Bucket pointer mangled.")); -#endif - cache->uc_allocs++; - - return (item); -} - -static inline void -bucket_push(uma_zone_t zone, uma_cache_t cache, uma_bucket_t bucket, - void *item) -{ - KASSERT(bucket->ub_bucket[bucket->ub_cnt] == NULL, - ("uma_zfree: Freeing to non free bucket index.")); - bucket->ub_bucket[bucket->ub_cnt] = item; - bucket->ub_cnt++; - cache->uc_frees++; -} - static void * item_ctor(uma_zone_t zone, void *udata, int flags, void *item) { @@ -2749,7 +2857,7 @@ item_dtor(uma_zone_t zone, void *item, void *udata, en void * uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) { - uma_bucket_t bucket; + uma_cache_bucket_t bucket; uma_cache_t cache; void *item; int cpu, domain; @@ -2806,9 +2914,9 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags do { cpu = curcpu; cache = &zone->uz_cpu[cpu]; - bucket = cache->uc_allocbucket; - if (__predict_true(bucket != NULL && bucket->ub_cnt != 0)) { - item = bucket_pop(zone, cache, bucket); + bucket = &cache->uc_allocbucket; + if (__predict_true(bucket->ucb_cnt != 0)) { + item = cache_bucket_pop(cache, bucket); critical_exit(); return (item_ctor(zone, udata, flags, item)); } @@ -2846,18 +2954,15 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * * If we have run out of items in our alloc bucket see * if we can switch with the free bucket. */ - bucket = cache->uc_freebucket; - if (bucket != NULL && bucket->ub_cnt != 0) { - cache->uc_freebucket = cache->uc_allocbucket; - cache->uc_allocbucket = bucket; + if (cache->uc_freebucket.ucb_cnt != 0) { + cache_bucket_swap(&cache->uc_freebucket, &cache->uc_allocbucket); return (true); } /* * Discard any empty allocation bucket while we hold no locks. */ - bucket = cache->uc_allocbucket; - cache->uc_allocbucket = NULL; + bucket = cache_bucket_unload_alloc(cache); critical_exit(); if (bucket != NULL) bucket_free(zone, bucket, udata); @@ -2887,7 +2992,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * cache = &zone->uz_cpu[cpu]; /* See if we lost the race to fill the cache. */ - if (cache->uc_allocbucket != NULL) { + if (cache->uc_allocbucket.ucb_bucket != NULL) { ZONE_UNLOCK(zone); return (true); } @@ -2907,7 +3012,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * ZONE_UNLOCK(zone); KASSERT(bucket->ub_cnt != 0, ("uma_zalloc_arg: Returning an empty bucket.")); - cache->uc_allocbucket = bucket; + cache_bucket_load_alloc(cache, bucket); return (true); } /* We are no longer associated with this CPU. */ @@ -2937,10 +3042,10 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * */ cpu = curcpu; cache = &zone->uz_cpu[cpu]; - if (cache->uc_allocbucket == NULL && + if (cache->uc_allocbucket.ucb_bucket == NULL && ((zone->uz_flags & UMA_ZONE_NUMA) == 0 || domain == PCPU_GET(domain))) { - cache->uc_allocbucket = bucket; + cache_bucket_load_alloc(cache, bucket); zdom->uzd_imax += bucket->ub_cnt; } else if (zone->uz_bkt_count >= zone->uz_bkt_max) { critical_exit(); @@ -3361,7 +3466,7 @@ void uma_zfree_arg(uma_zone_t zone, void *item, void *udata) { uma_cache_t cache; - uma_bucket_t bucket; + uma_cache_bucket_t bucket; int cpu, domain, itemdomain; /* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ @@ -3411,7 +3516,7 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata do { cpu = curcpu; cache = &zone->uz_cpu[cpu]; - bucket = cache->uc_allocbucket; + bucket = &cache->uc_allocbucket; #ifdef UMA_XDOMAIN if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) { itemdomain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); @@ -3419,7 +3524,7 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata } if ((zone->uz_flags & UMA_ZONE_NUMA) != 0 && domain != itemdomain) { - bucket = cache->uc_crossbucket; + bucket = &cache->uc_crossbucket; } else #endif @@ -3428,11 +3533,10 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata * for cache-hot datastructures. Spill over into the freebucket * if necessary. Alloc will swap them if one runs dry. */ - if (bucket == NULL || bucket->ub_cnt >= bucket->ub_entries) - bucket = cache->uc_freebucket; - if (__predict_true(bucket != NULL && - bucket->ub_cnt < bucket->ub_entries)) { - bucket_push(zone, cache, bucket, item); + if (__predict_false(bucket->ucb_cnt >= bucket->ucb_entries)) + bucket = &cache->uc_freebucket; + if (__predict_true(bucket->ucb_cnt < bucket->ucb_entries)) { + cache_bucket_push(cache, bucket, item); critical_exit(); return; } @@ -3536,16 +3640,12 @@ cache_free(uma_zone_t zone, uma_cache_t cache, void *u itemdomain = domain = 0; #ifdef UMA_XDOMAIN if (domain != itemdomain) { - bucket = cache->uc_crossbucket; - cache->uc_crossbucket = NULL; + bucket = cache_bucket_unload_cross(cache); if (bucket != NULL) atomic_add_64(&zone->uz_xdomain, bucket->ub_cnt); } else #endif - { - bucket = cache->uc_freebucket; - cache->uc_freebucket = NULL; - } + bucket = cache_bucket_unload_free(cache); /* We are no longer associated with this CPU. */ @@ -3570,8 +3670,9 @@ cache_free(uma_zone_t zone, uma_cache_t cache, void *u */ if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) { domain = PCPU_GET(domain); - if (domain != itemdomain && cache->uc_crossbucket == NULL) { - cache->uc_crossbucket = bucket; + if (domain != itemdomain && + cache->uc_crossbucket.ucb_bucket == NULL) { + cache_bucket_load_cross(cache, bucket); return (true); } } @@ -3579,12 +3680,12 @@ cache_free(uma_zone_t zone, uma_cache_t cache, void *u /* * We may have lost the race to fill the bucket or switched CPUs. */ - if (cache->uc_freebucket != NULL) { + if (cache->uc_freebucket.ucb_bucket != NULL) { critical_exit(); bucket_free(zone, bucket, udata); critical_enter(); } else - cache->uc_freebucket = bucket; + cache_bucket_load_free(cache, bucket); return (true); } @@ -4175,9 +4276,6 @@ uma_avail(void) * Note: does not update the zone statistics, as it can't safely clear the * per-CPU cache statistic. * - * XXXRW: Following the uc_allocbucket and uc_freebucket pointers here isn't - * safe from off-CPU; we should modify the caches to track this information - * directly so that we don't have to. */ static void uma_zone_sumstat(uma_zone_t z, long *cachefreep, uint64_t *allocsp, @@ -4191,14 +4289,10 @@ uma_zone_sumstat(uma_zone_t z, long *cachefreep, uint6 cachefree = 0; CPU_FOREACH(cpu) { cache = &z->uz_cpu[cpu]; - if (cache->uc_allocbucket != NULL) - cachefree += cache->uc_allocbucket->ub_cnt; - if (cache->uc_freebucket != NULL) - cachefree += cache->uc_freebucket->ub_cnt; - if (cache->uc_crossbucket != NULL) { - xdomain += cache->uc_crossbucket->ub_cnt; - cachefree += cache->uc_crossbucket->ub_cnt; - } + cachefree += cache->uc_allocbucket.ucb_cnt; + cachefree += cache->uc_freebucket.ucb_cnt; + xdomain += cache->uc_crossbucket.ucb_cnt; + cachefree += cache->uc_crossbucket.ucb_cnt; allocs += cache->uc_allocs; frees += cache->uc_frees; } @@ -4244,7 +4338,6 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon struct uma_percpu_stat *ups, bool internal) { uma_zone_domain_t zdom; - uma_bucket_t bucket; uma_cache_t cache; int i; @@ -4272,15 +4365,9 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon if (internal || CPU_ABSENT(i)) continue; cache = &z->uz_cpu[i]; - bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_allocbucket); - if (bucket != NULL) - ups[i].ups_cache_free += bucket->ub_cnt; - bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_freebucket); - if (bucket != NULL) - ups[i].ups_cache_free += bucket->ub_cnt; - bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_crossbucket); - if (bucket != NULL) - ups[i].ups_cache_free += bucket->ub_cnt; + ups[i].ups_cache_free += cache->uc_allocbucket.ucb_cnt; + ups[i].ups_cache_free += cache->uc_freebucket.ucb_cnt; + ups[i].ups_cache_free += cache->uc_crossbucket.ucb_cnt; ups[i].ups_allocs = cache->uc_allocs; ups[i].ups_frees = cache->uc_frees; } Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Wed Dec 25 19:26:35 2019 (r356079) +++ head/sys/vm/uma_int.h Wed Dec 25 20:50:53 2019 (r356080) @@ -171,13 +171,14 @@ struct uma_hash { #if defined(__amd64__) || defined(__powerpc64__) #define UMA_ALIGN __aligned(128) #else -#define UMA_ALIGN +#define UMA_ALIGN __aligned(CACHE_LINE_SIZE) #endif /* - * Structures for per cpu queues. + * The uma_bucket structure is used to queue and manage buckets divorced + * from per-cpu caches. They are loaded into uma_cache_bucket structures + * for use. */ - struct uma_bucket { TAILQ_ENTRY(uma_bucket) ub_link; /* Link into the zone */ int16_t ub_cnt; /* Count of items in bucket. */ @@ -187,12 +188,29 @@ struct uma_bucket { typedef struct uma_bucket * uma_bucket_t; +/* + * The uma_cache_bucket structure is statically allocated on each per-cpu + * cache. Its use reduces branches and cache misses in the fast path. + */ +struct uma_cache_bucket { + uma_bucket_t ucb_bucket; + int16_t ucb_cnt; + int16_t ucb_entries; + uint32_t ucb_spare; +}; + +typedef struct uma_cache_bucket * uma_cache_bucket_t; + +/* + * The uma_cache structure is allocated for each cpu for every zone + * type. This optimizes synchronization out of the allocator fast path. + */ struct uma_cache { - uma_bucket_t uc_freebucket; /* Bucket we're freeing to */ - uma_bucket_t uc_allocbucket; /* Bucket to allocate from */ - uma_bucket_t uc_crossbucket; /* cross domain bucket */ - uint64_t uc_allocs; /* Count of allocations */ - uint64_t uc_frees; /* Count of frees */ + struct uma_cache_bucket uc_freebucket; /* Bucket we're freeing to */ + struct uma_cache_bucket uc_allocbucket; /* Bucket to allocate from */ + struct uma_cache_bucket uc_crossbucket; /* cross domain bucket */ + uint64_t uc_allocs; /* Count of allocations */ + uint64_t uc_frees; /* Count of frees */ } UMA_ALIGN; typedef struct uma_cache * uma_cache_t; @@ -200,7 +218,7 @@ typedef struct uma_cache * uma_cache_t; LIST_HEAD(slabhead, uma_slab); /* - * Per-domain memory list. Embedded in the kegs. + * Per-domain slab lists. Embedded in the kegs. */ struct uma_domain { struct slabhead ud_part_slab; /* partially allocated slabs */ From owner-svn-src-head@freebsd.org Wed Dec 25 20:57:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0587D1E52B1; Wed, 25 Dec 2019 20:57:25 +0000 (UTC) (envelope-from jeff@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 47jllS6Fb1z4Fqw; Wed, 25 Dec 2019 20:57:24 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B32001E1FD; Wed, 25 Dec 2019 20:57:24 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBPKvO98046976; Wed, 25 Dec 2019 20:57:24 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPKvON8046974; Wed, 25 Dec 2019 20:57:24 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912252057.xBPKvON8046974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 25 Dec 2019 20:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356081 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356081 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 20:57:25 -0000 Author: jeff Date: Wed Dec 25 20:57:24 2019 New Revision: 356081 URL: https://svnweb.freebsd.org/changeset/base/356081 Log: Further reduce the cacheline footprint of fast allocations by duplicating the zone size and flags fields in the per-cpu caches. This allows fast alloctions to proceed only touching the single per-cpu cacheline and simplifies the common case when no ctor/dtor is specified. Reviewed by: markj, rlibby Differential Revision: https://reviews.freebsd.org/D22826 Modified: head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Dec 25 20:50:53 2019 (r356080) +++ head/sys/vm/uma_core.c Wed Dec 25 20:57:24 2019 (r356081) @@ -281,7 +281,6 @@ static uma_keg_t uma_kcreate(uma_zone_t zone, size_t s uma_fini fini, int align, uint32_t flags); static int zone_import(void *, void **, int, int, int); static void zone_release(void *, void **, int); -static void uma_zero_item(void *, uma_zone_t); static bool cache_alloc(uma_zone_t, uma_cache_t, void *, int); static bool cache_free(uma_zone_t, uma_cache_t, void *, void *, int); @@ -2183,6 +2182,17 @@ zone_count(uma_zone_t zone, void *arg) zone->uz_namecnt + 1); } +static void +zone_update_caches(uma_zone_t zone) +{ + int i; + + for (i = 0; i <= mp_maxid; i++) { + cache_set_uz_size(&zone->uz_cpu[i], zone->uz_size); + cache_set_uz_flags(&zone->uz_cpu[i], zone->uz_flags); + } +} + /* * Zone header ctor. This initializes all fields, locks, etc. * @@ -2228,7 +2238,7 @@ zone_ctor(void *mem, int size, void *udata, int flags) #ifdef INVARIANTS if (arg->uminit == trash_init && arg->fini == trash_fini) - zone->uz_flags |= UMA_ZFLAG_TRASH; + zone->uz_flags |= UMA_ZFLAG_TRASH | UMA_ZFLAG_CTORDTOR; #endif /* @@ -2327,6 +2337,9 @@ out: else zone->uz_bucket_size = bucket_select(zone->uz_size); zone->uz_bucket_size_min = zone->uz_bucket_size; + if (zone->uz_dtor != NULL || zone->uz_ctor != NULL) + zone->uz_flags |= UMA_ZFLAG_CTORDTOR; + zone_update_caches(zone); return (0); } @@ -2801,8 +2814,14 @@ uma_zfree_pcpu_arg(uma_zone_t zone, void *item, void * uma_zfree_arg(zone, item, udata); } +#ifdef INVARIANTS +#define UMA_ALWAYS_CTORDTOR 1 +#else +#define UMA_ALWAYS_CTORDTOR 0 +#endif + static void * -item_ctor(uma_zone_t zone, void *udata, int flags, void *item) +item_ctor(uma_zone_t zone, int size, void *udata, int flags, void *item) { #ifdef INVARIANTS bool skipdbg; @@ -2810,10 +2829,10 @@ item_ctor(uma_zone_t zone, void *udata, int flags, voi skipdbg = uma_dbg_zskip(zone, item); if (!skipdbg && (zone->uz_flags & UMA_ZFLAG_TRASH) != 0 && zone->uz_ctor != trash_ctor) - trash_ctor(item, zone->uz_size, udata, flags); + trash_ctor(item, size, udata, flags); #endif if (__predict_false(zone->uz_ctor != NULL) && - zone->uz_ctor(item, zone->uz_size, udata, flags) != 0) { + zone->uz_ctor(item, size, udata, flags) != 0) { counter_u64_add(zone->uz_fails, 1); zone_free_item(zone, item, udata, SKIP_DTOR | SKIP_CNT); return (NULL); @@ -2823,13 +2842,14 @@ item_ctor(uma_zone_t zone, void *udata, int flags, voi uma_dbg_alloc(zone, NULL, item); #endif if (flags & M_ZERO) - uma_zero_item(item, zone); + bzero(item, size); return (item); } static inline void -item_dtor(uma_zone_t zone, void *item, void *udata, enum zfreeskip skip) +item_dtor(uma_zone_t zone, void *item, int size, void *udata, + enum zfreeskip skip) { #ifdef INVARIANTS bool skipdbg; @@ -2842,13 +2862,13 @@ item_dtor(uma_zone_t zone, void *item, void *udata, en uma_dbg_free(zone, NULL, item); } #endif - if (skip < SKIP_DTOR) { + if (__predict_true(skip < SKIP_DTOR)) { if (zone->uz_dtor != NULL) - zone->uz_dtor(item, zone->uz_size, udata); + zone->uz_dtor(item, size, udata); #ifdef INVARIANTS if (!skipdbg && (zone->uz_flags & UMA_ZFLAG_TRASH) != 0 && zone->uz_dtor != trash_dtor) - trash_dtor(item, zone->uz_size, udata); + trash_dtor(item, size, udata); #endif } } @@ -2860,7 +2880,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags uma_cache_bucket_t bucket; uma_cache_t cache; void *item; - int cpu, domain; + int domain, size, uz_flags; /* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA); @@ -2869,16 +2889,21 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags CTR4(KTR_UMA, "uma_zalloc_arg thread %x zone %s(%p) flags %d", curthread, zone->uz_name, zone, flags); +#ifdef WITNESS if (flags & M_WAITOK) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "uma_zalloc_arg: zone \"%s\"", zone->uz_name); } +#endif + +#ifdef INVARIANTS KASSERT((flags & M_EXEC) == 0, ("uma_zalloc_arg: called with M_EXEC")); KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(), ("uma_zalloc_arg: called with spinlock or critical section held")); if (zone->uz_flags & UMA_ZONE_PCPU) KASSERT((flags & M_ZERO) == 0, ("allocating from a pcpu zone " "with M_ZERO passed")); +#endif #ifdef DEBUG_MEMGUARD if (memguard_cmp_zone(zone)) { @@ -2912,13 +2937,19 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags */ critical_enter(); do { - cpu = curcpu; - cache = &zone->uz_cpu[cpu]; + cache = &zone->uz_cpu[curcpu]; bucket = &cache->uc_allocbucket; + size = cache_uz_size(cache); + uz_flags = cache_uz_flags(cache); if (__predict_true(bucket->ucb_cnt != 0)) { item = cache_bucket_pop(cache, bucket); critical_exit(); - return (item_ctor(zone, udata, flags, item)); + if (__predict_false((uz_flags & UMA_ZFLAG_CTORDTOR) != 0 || + UMA_ALWAYS_CTORDTOR)) + return (item_ctor(zone, size, udata, flags, item)); + if (flags & M_ZERO) + bzero(item, size); + return (item); } } while (cache_alloc(zone, cache, udata, flags)); critical_exit(); @@ -2926,7 +2957,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags /* * We can not get a bucket so try to return a single item. */ - if (zone->uz_flags & UMA_ZONE_NUMA) + if (uz_flags & UMA_ZONE_NUMA) domain = PCPU_GET(domain); else domain = UMA_ANYDOMAIN; @@ -2945,7 +2976,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * { uma_zone_domain_t zdom; uma_bucket_t bucket; - int cpu, domain; + int domain; bool lockfail; CRITICAL_ASSERT(curthread); @@ -2988,8 +3019,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * if (zone->uz_bucket_size == 0 || bucketdisable) return (false); - cpu = curcpu; - cache = &zone->uz_cpu[cpu]; + cache = &zone->uz_cpu[curcpu]; /* See if we lost the race to fill the cache. */ if (cache->uc_allocbucket.ucb_bucket != NULL) { @@ -3040,8 +3070,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * * initialized bucket to make this less likely or claim * the memory directly. */ - cpu = curcpu; - cache = &zone->uz_cpu[cpu]; + cache = &zone->uz_cpu[curcpu]; if (cache->uc_allocbucket.ucb_bucket == NULL && ((zone->uz_flags & UMA_ZONE_NUMA) == 0 || domain == PCPU_GET(domain))) { @@ -3437,7 +3466,7 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i goto fail_cnt; } } - item = item_ctor(zone, udata, flags, item); + item = item_ctor(zone, zone->uz_size, udata, flags, item); if (item == NULL) goto fail; @@ -3467,7 +3496,7 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata { uma_cache_t cache; uma_cache_bucket_t bucket; - int cpu, domain, itemdomain; + int domain, itemdomain, uz_flags; /* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA); @@ -3491,14 +3520,26 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata return; } #endif - item_dtor(zone, item, udata, SKIP_NONE); /* + * We are accessing the per-cpu cache without a critical section to + * fetch size and flags. This is acceptable, if we are preempted we + * will simply read another cpu's line. + */ + cache = &zone->uz_cpu[curcpu]; + uz_flags = cache_uz_flags(cache); + if (__predict_false((uz_flags & UMA_ZFLAG_CTORDTOR) != 0 || + UMA_ALWAYS_CTORDTOR)) + item_dtor(zone, item, cache_uz_size(cache), udata, SKIP_NONE); + + /* * The race here is acceptable. If we miss it we'll just have to wait * a little longer for the limits to be reset. */ - if (zone->uz_sleepers > 0) - goto zfree_item; + if (__predict_false(uz_flags & UMA_ZFLAG_LIMIT)) { + if (zone->uz_sleepers > 0) + goto zfree_item; + } /* * If possible, free to the per-CPU cache. There are two @@ -3514,16 +3555,14 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata domain = itemdomain = 0; critical_enter(); do { - cpu = curcpu; - cache = &zone->uz_cpu[cpu]; + cache = &zone->uz_cpu[curcpu]; bucket = &cache->uc_allocbucket; #ifdef UMA_XDOMAIN - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) { + if ((uz_flags & UMA_ZONE_NUMA) != 0) { itemdomain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); domain = PCPU_GET(domain); } - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0 && - domain != itemdomain) { + if ((uz_flags & UMA_ZONE_NUMA) != 0 && domain != itemdomain) { bucket = &cache->uc_crossbucket; } else #endif @@ -3615,15 +3654,14 @@ cache_free(uma_zone_t zone, uma_cache_t cache, void *u int itemdomain) { uma_bucket_t bucket; - int cpu, domain; + int domain; CRITICAL_ASSERT(curthread); if (zone->uz_bucket_size == 0 || bucketdisable) return false; - cpu = curcpu; - cache = &zone->uz_cpu[cpu]; + cache = &zone->uz_cpu[curcpu]; /* * NUMA domains need to free to the correct zdom. When XDOMAIN @@ -3660,8 +3698,7 @@ cache_free(uma_zone_t zone, uma_cache_t cache, void *u critical_enter(); if (bucket == NULL) return (false); - cpu = curcpu; - cache = &zone->uz_cpu[cpu]; + cache = &zone->uz_cpu[curcpu]; #ifdef UMA_XDOMAIN /* * Check to see if we should be populating the cross bucket. If it @@ -3783,7 +3820,7 @@ static void zone_free_item(uma_zone_t zone, void *item, void *udata, enum zfreeskip skip) { - item_dtor(zone, item, udata, skip); + item_dtor(zone, item, zone->uz_size, udata, skip); if (skip < SKIP_FINI && zone->uz_fini) zone->uz_fini(item, zone->uz_size); @@ -3819,6 +3856,8 @@ uma_zone_set_max(uma_zone_t zone, int nitems) if (zone->uz_bucket_size_min > zone->uz_bucket_size_max) zone->uz_bucket_size_min = zone->uz_bucket_size_max; zone->uz_max_items = nitems; + zone->uz_flags |= UMA_ZFLAG_LIMIT; + zone_update_caches(zone); ZONE_UNLOCK(zone); return (nitems); @@ -4086,7 +4125,9 @@ uma_zone_reserve_kva(uma_zone_t zone, int count) #else keg->uk_allocf = noobj_alloc; #endif - keg->uk_flags |= UMA_ZONE_NOFREE; + keg->uk_flags |= UMA_ZFLAG_LIMIT | UMA_ZONE_NOFREE; + zone->uz_flags |= UMA_ZFLAG_LIMIT | UMA_ZONE_NOFREE; + zone_update_caches(zone); ZONE_UNLOCK(zone); return (1); @@ -4231,13 +4272,6 @@ int uma_zone_exhausted_nolock(uma_zone_t zone) { return (zone->uz_sleepers > 0); -} - -static void -uma_zero_item(void *item, uma_zone_t zone) -{ - - bzero(item, zone->uz_size); } unsigned long Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Wed Dec 25 20:50:53 2019 (r356080) +++ head/sys/vm/uma_int.h Wed Dec 25 20:57:24 2019 (r356081) @@ -218,6 +218,39 @@ typedef struct uma_cache * uma_cache_t; LIST_HEAD(slabhead, uma_slab); /* + * The cache structure pads perfectly into 64 bytes so we use spare + * bits from the embedded cache buckets to store information from the zone + * and keep all fast-path allocations accessing a single per-cpu line. + */ +static inline void +cache_set_uz_flags(uma_cache_t cache, uint32_t flags) +{ + + cache->uc_freebucket.ucb_spare = flags; +} + +static inline void +cache_set_uz_size(uma_cache_t cache, uint32_t size) +{ + + cache->uc_allocbucket.ucb_spare = size; +} + +static inline uint32_t +cache_uz_flags(uma_cache_t cache) +{ + + return (cache->uc_freebucket.ucb_spare); +} + +static inline uint32_t +cache_uz_size(uma_cache_t cache) +{ + + return (cache->uc_allocbucket.ucb_spare); +} + +/* * Per-domain slab lists. Embedded in the kegs. */ struct uma_domain { @@ -442,6 +475,8 @@ struct uma_zone { /* * These flags must not overlap with the UMA_ZONE flags specified in uma.h. */ +#define UMA_ZFLAG_CTORDTOR 0x01000000 /* Zone has ctor/dtor set. */ +#define UMA_ZFLAG_LIMIT 0x02000000 /* Zone has limit set. */ #define UMA_ZFLAG_CACHE 0x04000000 /* uma_zcache_create()d it */ #define UMA_ZFLAG_RECLAIMING 0x08000000 /* Running zone_reclaim(). */ #define UMA_ZFLAG_BUCKET 0x10000000 /* Bucket zone. */ @@ -459,6 +494,8 @@ struct uma_zone { "\35BUCKET" \ "\34RECLAIMING" \ "\33CACHE" \ + "\32LIMIT" \ + "\31CTORDTOR" \ "\22MINBUCKET" \ "\21NUMA" \ "\20PCPU" \ From owner-svn-src-head@freebsd.org Wed Dec 25 22:25:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C8CD1E6D15; Wed, 25 Dec 2019 22:25:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47jnj72WGqz4KHp; Wed, 25 Dec 2019 22:25:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32CD31F209; Wed, 25 Dec 2019 22:25:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBPMPUNT000135; Wed, 25 Dec 2019 22:25:30 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPMPUVU000134; Wed, 25 Dec 2019 22:25:30 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912252225.xBPMPUVU000134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 25 Dec 2019 22:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356084 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 356084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 22:25:31 -0000 Author: rmacklem Date: Wed Dec 25 22:25:30 2019 New Revision: 356084 URL: https://svnweb.freebsd.org/changeset/base/356084 Log: Add NFSv4.1 and NFSv4.2 errors to nfsv4_errstr.h. nfsv4_errstr.h only had strings for NFSv4.0 errors. This patch adds the errors for NFSv4.1 and NFSv4.2. At this time, this file is not used by any sources in the tree, so the change is not significant. I do plan on using nfsv4_errstr.h in a future patch to mount_nfs.c. Since I am doing this patch so that "minor version mismatch" will be recognized, I made that string less abbreviated. Modified: head/sys/fs/nfs/nfsv4_errstr.h Modified: head/sys/fs/nfs/nfsv4_errstr.h ============================================================================== --- head/sys/fs/nfs/nfsv4_errstr.h Wed Dec 25 22:19:23 2019 (r356083) +++ head/sys/fs/nfs/nfsv4_errstr.h Wed Dec 25 22:25:30 2019 (r356084) @@ -36,7 +36,7 @@ * a library of one function for this, since it is only currently used by * mount_newnfs.c. */ -static const char *nfsv4_errstr[48] = { +static const char *nfsv4_errstr[NFSERR_XATTR2BIG - 10000] = { "Illegal filehandle", "Undefined NFSv4 err", "READDIR cookie is stale", @@ -57,7 +57,7 @@ static const char *nfsv4_errstr[48] = { "resource exhaustion", "filesystem relocated", "current FH is not set", - "minor vers not supp", + "minor version not supported", "server has rebooted", "server has rebooted", "state is out of sync", @@ -85,6 +85,54 @@ static const char *nfsv4_errstr[48] = { "open file blocks op", "lockowner state revoked", "callback path down" + "Bad IO mode", + "Bad layout", + "Bad session digest", + "Bad session", + "Bad slot", + "Complete already", + "Not bound to session", + "Delegation already wanted", + "Back channel busy", + "Layout try later", + "Layout unavailable", + "No matching layout", + "Recall conflict", + "Unknown layout type", + "Sequence misordered", + "Sequence position", + "Request too big", + "Reply too big", + "Reply too big to cache", + "Retry uncached reply", + "Unsafe compound", + "Too many operations", + "Operation not in session", + "Hash algorithm unsupported", + "Unknown error", + "ClientID busy", + "pNFS IO hole", + "Sequence false retry", + "Bad high slot", + "Dead session", + "Encrypt algorithm unsupported", + "pNFS no layout", + "Not only operation", + "Wrong credential", + "Wrong type", + "Directory delegation unavailable", + "Reject delegation", + "Return conflict", + "Delegation revoked", + "Partner not supported", + "Partner no auth", + "Union not supported", + "Offload denied", + "Wrong LFS", + "Bad label", + "Offload no request", + "No extended attribute", + "Extended attribute too big", }; /* @@ -95,7 +143,7 @@ static const char * nfsv4_geterrstr(int errval) { - if (errval < NFSERR_BADHANDLE || errval > NFSERR_CBPATHDOWN) + if (errval < NFSERR_BADHANDLE || errval > NFSERR_XATTR2BIG) return (NULL); return (nfsv4_errstr[errval - NFSERR_BADHANDLE]); } From owner-svn-src-head@freebsd.org Wed Dec 25 22:33:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 652291E6FDB; Wed, 25 Dec 2019 22:33:48 +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 47jnth20GTz4KfL; Wed, 25 Dec 2019 22:33:48 +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 3FA0D1F3C1; Wed, 25 Dec 2019 22:33:48 +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 xBPMXm3G005997; Wed, 25 Dec 2019 22:33:48 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBPMXmC0005996; Wed, 25 Dec 2019 22:33:48 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912252233.xBPMXmC0005996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 25 Dec 2019 22:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356085 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 356085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 22:33:48 -0000 Author: ian Date: Wed Dec 25 22:33:47 2019 New Revision: 356085 URL: https://svnweb.freebsd.org/changeset/base/356085 Log: In kern.pre.mk, split SYSTEM_LD into two variables to avoid duplication in other files. Arm and mips systems need to replace the SYSTEM_LD variable because they need to create intermediate files which are post-processed with objcopy to create the final .TARGET file. Previously they did so by pasting the full expansion of SYSTEM_LD with the output filename replaced. This means changing SYSTEM_LD in kern.pre.mk means you need to chase down anything that replaces it and figure out how it differs so you can paste your changes in there too. Now there is a SYSTEM_LD_BASECMD variable that holds the entire basic kernel linker command without the input and output files. This will allow arm and mips makefiles to create their custom versions by refering to SYSTEM_LD_BASECMD, which then becomes the one place where you have to make changes to the basic linker command args. Differential Revision: https://reviews.freebsd.org/D22921 Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Wed Dec 25 22:25:30 2019 (r356084) +++ head/sys/conf/kern.pre.mk Wed Dec 25 22:33:47 2019 (r356085) @@ -266,10 +266,11 @@ MD_ROOT_SIZE_CONFIGURED!= grep MD_ROOT_SIZE opt_md.h | SYSTEM_OBJS+= embedfs_${MFS_IMAGE:T:R}.o .endif .endif -SYSTEM_LD= @${LD} -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \ +SYSTEM_LD_BASECMD= \ + ${LD} -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \ --no-warn-mismatch --warn-common --export-dynamic \ - --dynamic-linker /red/herring \ - -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o + --dynamic-linker /red/herring -X +SYSTEM_LD= @${SYSTEM_LD_BASECMD} -o ${.TARGET} ${SYSTEM_OBJS} vers.o SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET} SYSTEM_DEP+= ${LDSCRIPT} From owner-svn-src-head@freebsd.org Thu Dec 26 02:22:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E4B61EC57B; Thu, 26 Dec 2019 02:22:39 +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 47jtyl1lrxz4Tn3; Thu, 26 Dec 2019 02:22:39 +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 3788121D99; Thu, 26 Dec 2019 02:22:39 +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 xBQ2MdKc040079; Thu, 26 Dec 2019 02:22:39 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQ2Md7s040078; Thu, 26 Dec 2019 02:22:39 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912260222.xBQ2Md7s040078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 26 Dec 2019 02:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356086 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 356086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 02:22:39 -0000 Author: ian Date: Thu Dec 26 02:22:38 2019 New Revision: 356086 URL: https://svnweb.freebsd.org/changeset/base/356086 Log: Add comments to a couple i2c device lines. Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Dec 25 22:33:47 2019 (r356085) +++ head/sys/conf/NOTES Thu Dec 26 02:22:38 2019 (r356086) @@ -2322,10 +2322,10 @@ device jedec_dimm # iicbb generic I2C bit-banging code (needed by lpbb, bktr) # device iicbus # Bus support, required for ic/iic/iicsmb below. -device iicbb +device iicbb # bitbang driver; implements i2c on a pair of gpio pins device ic -device iic +device iic # userland access to i2c slave devices via ioctl(8) device iicsmb # smb over i2c bridge device iicoc # OpenCores I2C controller support From owner-svn-src-head@freebsd.org Thu Dec 26 15:21:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2027A1D2DF6; Thu, 26 Dec 2019 15:21:35 +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 47kDFW02Mzz428L; Thu, 26 Dec 2019 15:21:35 +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 D70A8273C; Thu, 26 Dec 2019 15:21:34 +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 xBQFLYap000461; Thu, 26 Dec 2019 15:21:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQFLYIx000459; Thu, 26 Dec 2019 15:21:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912261521.xBQFLYIx000459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 26 Dec 2019 15:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356087 - in head/sys: dev/kbd kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: dev/kbd kern X-SVN-Commit-Revision: 356087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 15:21:35 -0000 Author: kevans Date: Thu Dec 26 15:21:34 2019 New Revision: 356087 URL: https://svnweb.freebsd.org/changeset/base/356087 Log: kbd: merge linker set drivers into standard kbd driver list This leads to the revert of r355806; this reduces duplication in keyboard registration and driver switch lookup and leaves us with one authoritative source for currently registered drivers. The reduced duplication later is nice as we have more procedure involved in keyboard setup. keyboard_driver->flags is used to more quickly detect bogus adds/removes. From KPI consumers' perspective, nothing changes- kbd_add_driver of an already-registered driver will succeed, and a single kbd_delete_driver will later remove it as expected. In contrast to historical behavior, kbd_delete_driver on a driver registered via linker set will now actually de-register the driver so that it may not be used -- e.g. if kbdmux's MOD_LOAD handler fails somewhere. Detection for already-registered drivers in kbd_add_driver has improved, as the previous SLIST_NEXT(driver) != NULL check would not have caught a driver that's at the tail end. kbdinit is now called from cninit() rather than via SYSINIT so that keyboard drivers are available as early as console drivers. This is particularly important as cnprobe will, in both syscons and vt, attempt to do any early configuration of keyboard drivers built-in (see: kbd_configure). Reviewed by: imp (earlier version, pre-cninit change) Differential Revision: https://reviews.freebsd.org/D22835 Modified: head/sys/dev/kbd/kbd.c head/sys/dev/kbd/kbdreg.h head/sys/kern/kern_cons.c Modified: head/sys/dev/kbd/kbd.c ============================================================================== --- head/sys/dev/kbd/kbd.c Thu Dec 26 02:22:38 2019 (r356086) +++ head/sys/dev/kbd/kbd.c Thu Dec 26 15:21:34 2019 (r356087) @@ -70,7 +70,7 @@ static void genkbd_diag(keyboard_t *kbd, int level); static SLIST_HEAD(, keyboard_driver) keyboard_drivers = SLIST_HEAD_INITIALIZER(keyboard_drivers); -SET_DECLARE(kbddriver_set, const keyboard_driver_t); +SET_DECLARE(kbddriver_set, keyboard_driver_t); /* local arrays */ @@ -163,12 +163,18 @@ kbd_set_maps(keyboard_t *kbd, keymap_t *keymap, accent int kbd_add_driver(keyboard_driver_t *driver) { - if (SLIST_NEXT(driver, link)) - return (EINVAL); + + if ((driver->flags & KBDF_REGISTERED) != 0) + return (0); + + KASSERT(SLIST_NEXT(driver, link) == NULL, + ("%s: keyboard driver list garbage detected", __func__)); if (driver->kbdsw->get_fkeystr == NULL) driver->kbdsw->get_fkeystr = genkbd_get_fkeystr; if (driver->kbdsw->diag == NULL) driver->kbdsw->diag = genkbd_diag; + + driver->flags |= KBDF_REGISTERED; SLIST_INSERT_HEAD(&keyboard_drivers, driver, link); return (0); } @@ -176,6 +182,11 @@ kbd_add_driver(keyboard_driver_t *driver) int kbd_delete_driver(keyboard_driver_t *driver) { + + if ((driver->flags & KBDF_REGISTERED) == 0) + return (EINVAL); + + driver->flags &= ~KBDF_REGISTERED; SLIST_REMOVE(&keyboard_drivers, driver, keyboard_driver, link); SLIST_NEXT(driver, link) = NULL; return (0); @@ -185,7 +196,6 @@ kbd_delete_driver(keyboard_driver_t *driver) int kbd_register(keyboard_t *kbd) { - const keyboard_driver_t **list; const keyboard_driver_t *p; keyboard_t *mux; keyboard_info_t ki; @@ -226,24 +236,7 @@ kbd_register(keyboard_t *kbd) return (index); } } - SET_FOREACH(list, kbddriver_set) { - p = *list; - if (strcmp(p->name, kbd->kb_name) == 0) { - kbd->kb_drv = p; - keyboard[index] = kbd; - if (mux != NULL) { - bzero(&ki, sizeof(ki)); - strcpy(ki.kb_name, kbd->kb_name); - ki.kb_unit = kbd->kb_unit; - - (void)kbdd_ioctl(mux, KBADDKBD, (caddr_t) &ki); - } - - return (index); - } - } - return (-1); } @@ -282,18 +275,12 @@ kbd_unregister(keyboard_t *kbd) keyboard_switch_t * kbd_get_switch(char *driver) { - const keyboard_driver_t **list; const keyboard_driver_t *p; SLIST_FOREACH(p, &keyboard_drivers, link) { if (strcmp(p->name, driver) == 0) return (p->kbdsw); } - SET_FOREACH(list, kbddriver_set) { - p = *list; - if (strcmp(p->name, driver) == 0) - return (p->kbdsw); - } return (NULL); } @@ -435,18 +422,12 @@ kbd_get_keyboard(int index) int kbd_configure(int flags) { - const keyboard_driver_t **list; const keyboard_driver_t *p; SLIST_FOREACH(p, &keyboard_drivers, link) { if (p->configure != NULL) (*p->configure)(flags); } - SET_FOREACH(list, kbddriver_set) { - p = *list; - if (p->configure != NULL) - (*p->configure)(flags); - } return (0); } @@ -1507,19 +1488,27 @@ kbd_ev_event(keyboard_t *kbd, uint16_t type, uint16_t } } -static void -kbd_drv_init(void) +void +kbdinit(void) { - const keyboard_driver_t **list; - const keyboard_driver_t *p; + keyboard_driver_t *drv, **list; SET_FOREACH(list, kbddriver_set) { - p = *list; - if (p->kbdsw->get_fkeystr == NULL) - p->kbdsw->get_fkeystr = genkbd_get_fkeystr; - if (p->kbdsw->diag == NULL) - p->kbdsw->diag = genkbd_diag; + drv = *list; + + /* + * The following printfs will almost universally get dropped, + * with exception to kernel configs with EARLY_PRINTF and + * special setups where msgbufinit() is called early with a + * static buffer to capture output occurring before the dynamic + * message buffer is mapped. + */ + if (kbd_add_driver(drv) != 0) + printf("kbd: failed to register driver '%s'\n", + drv->name); + else if (bootverbose) + printf("kbd: registered driver '%s'\n", + drv->name); } -} -SYSINIT(kbd_drv_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, kbd_drv_init, NULL); +} Modified: head/sys/dev/kbd/kbdreg.h ============================================================================== --- head/sys/dev/kbd/kbdreg.h Thu Dec 26 02:22:38 2019 (r356086) +++ head/sys/dev/kbd/kbdreg.h Thu Dec 26 15:21:34 2019 (r356087) @@ -107,8 +107,11 @@ typedef struct keyboard_driver { keyboard_switch_t * const kbdsw; /* backdoor for the console driver */ int (* const configure)(int); + int flags; } keyboard_driver_t; +#define KBDF_REGISTERED 0x0001 + /* keyboard */ struct keyboard { /* the following fields are managed by kbdio */ @@ -396,6 +399,9 @@ int kbd_detach(keyboard_t *kbd); #define LED_SCR (1 << 2) #define LED_MASK (LED_CAP | LED_NUM | LED_SCR) */ + +/* Initialization for the kbd layer, performed by cninit. */ +void kbdinit(void); int genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg); int genkbd_keyaction(keyboard_t *kbd, int keycode, int up, Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Thu Dec 26 02:22:38 2019 (r356086) +++ head/sys/kern/kern_cons.c Thu Dec 26 15:21:34 2019 (r356087) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -69,6 +70,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include @@ -122,6 +125,14 @@ cninit(void) |RB_SINGLE |RB_VERBOSE |RB_ASKNAME)) == RB_MUTE); + + /* + * Bring up the kbd layer just in time for cnprobe. Console drivers + * have a dependency on kbd being ready, so this fits nicely between the + * machdep callers of cninit() and MI probing/initialization of consoles + * here. + */ + kbdinit(); /* * Find the first console with the highest priority. From owner-svn-src-head@freebsd.org Thu Dec 26 15:47:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F5771D340D; Thu, 26 Dec 2019 15:47: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 47kDqC6cQpz43WP; Thu, 26 Dec 2019 15:47: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 DE33B2C15; Thu, 26 Dec 2019 15:47: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 xBQFlJZx015467; Thu, 26 Dec 2019 15:47:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQFlJvZ015466; Thu, 26 Dec 2019 15:47:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912261547.xBQFlJvZ015466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 26 Dec 2019 15:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356088 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 15:47:20 -0000 Author: kevans Date: Thu Dec 26 15:47:19 2019 New Revision: 356088 URL: https://svnweb.freebsd.org/changeset/base/356088 Log: kern_cons: add a stub kbdinit for configs with no keyboard/console drivers A weak symbol here is decidedly cleaner than any #ifdef soup or relocating kbdinit, the former leading to maintenance required on addition of any console/keyboard drivers and the latter pushing kbd init bits away from where they're used. Modified: head/sys/kern/kern_cons.c Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Thu Dec 26 15:21:34 2019 (r356087) +++ head/sys/kern/kern_cons.c Thu Dec 26 15:47:19 2019 (r356088) @@ -110,6 +110,19 @@ static struct consdev cons_consdev; DATA_SET(cons_set, cons_consdev); SET_DECLARE(cons_set, struct consdev); +/* + * Stub for configurations that don't actually have a keyboard driver. Inclusion + * of kbd.c is contingent on any number of keyboard/console drivers being + * present in the kernel; rather than trying to catch them all, we'll just + * maintain this weak kbdinit that will be overridden by the strong version in + * kbd.c if it's present. + */ +__weak_symbol void +kbdinit(void) +{ + +} + void cninit(void) { From owner-svn-src-head@freebsd.org Thu Dec 26 17:09:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB871D5220; Thu, 26 Dec 2019 17:09:38 +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 47kGfB2JP1z489V; Thu, 26 Dec 2019 17:09:38 +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 45CC83CA0; Thu, 26 Dec 2019 17:09:38 +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 xBQH9cT8064857; Thu, 26 Dec 2019 17:09:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQH9boq064851; Thu, 26 Dec 2019 17:09:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912261709.xBQH9boq064851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 26 Dec 2019 17:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356091 - in head/sys/dev: adb gpio hyperv/input kbdmux usb/input vkbd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys/dev: adb gpio hyperv/input kbdmux usb/input vkbd X-SVN-Commit-Revision: 356091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 17:09:38 -0000 Author: kevans Date: Thu Dec 26 17:09:36 2019 New Revision: 356091 URL: https://svnweb.freebsd.org/changeset/base/356091 Log: Revert r355806: kbd drivers: don't double register keyboard drivers r356087 made it rather innocuous to double-register built-in keyboard drivers; we now set a flag to indicate that it's been registered and only act once on a registration anyways. There is no misleading here, as the follow-up kbd_delete_driver will actually remove the driver as needed now that the linker set isn't also consulted after kbdinit. Modified: head/sys/dev/adb/adb_kbd.c head/sys/dev/gpio/gpiokeys.c head/sys/dev/hyperv/input/hv_kbd.c head/sys/dev/kbdmux/kbdmux.c head/sys/dev/usb/input/ukbd.c head/sys/dev/vkbd/vkbd.c Modified: head/sys/dev/adb/adb_kbd.c ============================================================================== --- head/sys/dev/adb/adb_kbd.c Thu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/adb/adb_kbd.c Thu Dec 26 17:09:36 2019 (r356091) @@ -850,15 +850,11 @@ akbd_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: -#ifdef KLD_MODULE kbd_add_driver(&akbd_kbd_driver); -#endif break; case MOD_UNLOAD: -#ifdef KLD_MODULE kbd_delete_driver(&akbd_kbd_driver); -#endif break; default: Modified: head/sys/dev/gpio/gpiokeys.c ============================================================================== --- head/sys/dev/gpio/gpiokeys.c Thu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/gpio/gpiokeys.c Thu Dec 26 17:09:36 2019 (r356091) @@ -983,8 +983,6 @@ KEYBOARD_DRIVER(gpiokeys, gpiokeyssw, gpiokeys_configu static int gpiokeys_driver_load(module_t mod, int what, void *arg) { - -#ifdef KLD_MODULE switch (what) { case MOD_LOAD: kbd_add_driver(&gpiokeys_kbd_driver); @@ -993,7 +991,6 @@ gpiokeys_driver_load(module_t mod, int what, void *arg kbd_delete_driver(&gpiokeys_kbd_driver); break; } -#endif return (0); } Modified: head/sys/dev/hyperv/input/hv_kbd.c ============================================================================== --- head/sys/dev/hyperv/input/hv_kbd.c Thu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/hyperv/input/hv_kbd.c Thu Dec 26 17:09:36 2019 (r356091) @@ -490,8 +490,6 @@ hv_kbd_intr(hv_kbd_sc *sc) int hvkbd_driver_load(module_t mod, int what, void *arg) { - -#ifdef KLD_MODULE switch (what) { case MOD_LOAD: kbd_add_driver(&hvkbd_kbd_driver); @@ -500,7 +498,6 @@ hvkbd_driver_load(module_t mod, int what, void *arg) kbd_delete_driver(&hvkbd_kbd_driver); break; } -#endif return (0); } Modified: head/sys/dev/kbdmux/kbdmux.c ============================================================================== --- head/sys/dev/kbdmux/kbdmux.c Thu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/kbdmux/kbdmux.c Thu Dec 26 17:09:36 2019 (r356091) @@ -1423,15 +1423,11 @@ kbdmux_modevent(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: -#ifdef KLD_MODULE if ((error = kbd_add_driver(&kbdmux_kbd_driver)) != 0) break; -#endif if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) { -#ifdef KLD_MODULE kbd_delete_driver(&kbdmux_kbd_driver); -#endif error = ENXIO; break; } @@ -1440,18 +1436,14 @@ kbdmux_modevent(module_t mod, int type, void *data) if ((error = (*sw->probe)(0, NULL, 0)) != 0 || (error = (*sw->init)(0, &kbd, NULL, 0)) != 0) { -#ifdef KLD_MODULE kbd_delete_driver(&kbdmux_kbd_driver); -#endif break; } #ifdef KBD_INSTALL_CDEV if ((error = kbd_attach(kbd)) != 0) { (*sw->term)(kbd); -#ifdef KLD_MODULE kbd_delete_driver(&kbdmux_kbd_driver); -#endif break; } #endif @@ -1462,9 +1454,7 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd_detach(kbd); #endif (*sw->term)(kbd); -#ifdef KLD_MODULE kbd_delete_driver(&kbdmux_kbd_driver); -#endif break; } break; @@ -1480,9 +1470,7 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd_detach(kbd); #endif (*sw->term)(kbd); -#ifdef KLD_MODULE kbd_delete_driver(&kbdmux_kbd_driver); -#endif } error = 0; break; Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Thu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/usb/input/ukbd.c Thu Dec 26 17:09:36 2019 (r356091) @@ -2290,7 +2290,6 @@ KEYBOARD_DRIVER(ukbd, ukbdsw, ukbd_configure); static int ukbd_driver_load(module_t mod, int what, void *arg) { -#ifdef KLD_MODULE switch (what) { case MOD_LOAD: kbd_add_driver(&ukbd_kbd_driver); @@ -2299,7 +2298,6 @@ ukbd_driver_load(module_t mod, int what, void *arg) kbd_delete_driver(&ukbd_kbd_driver); break; } -#endif return (0); } Modified: head/sys/dev/vkbd/vkbd.c ============================================================================== --- head/sys/dev/vkbd/vkbd.c Thu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/vkbd/vkbd.c Thu Dec 26 17:09:36 2019 (r356091) @@ -1360,15 +1360,11 @@ vkbd_modevent(module_t mod, int type, void *data) clone_cleanup(&vkbd_dev_clones); return (ENOMEM); } -#ifdef KLD_MODULE kbd_add_driver(&vkbd_kbd_driver); -#endif break; case MOD_UNLOAD: -#ifdef KLD_MODULE kbd_delete_driver(&vkbd_kbd_driver); -#endif EVENTHANDLER_DEREGISTER(dev_clone, tag); clone_cleanup(&vkbd_dev_clones); break; From owner-svn-src-head@freebsd.org Thu Dec 26 17:25:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9013D1D5687; Thu, 26 Dec 2019 17:25: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 47kH0w326rz48s7; Thu, 26 Dec 2019 17:25: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 5EC114050; Thu, 26 Dec 2019 17:25: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 xBQHPqbn076461; Thu, 26 Dec 2019 17:25:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQHPq8u076460; Thu, 26 Dec 2019 17:25:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912261725.xBQHPq8u076460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 26 Dec 2019 17:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356092 - head/sys/dev/kbdmux X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/kbdmux X-SVN-Commit-Revision: 356092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 17:25:52 -0000 Author: kevans Date: Thu Dec 26 17:25:51 2019 New Revision: 356092 URL: https://svnweb.freebsd.org/changeset/base/356092 Log: kbdmux: simplify modevent handler In the event of a MOD_LOAD failure, MOD_UNLOAD will be invoked to unwind module load. Most of the reversion in MOD_LOAD can just be deferred to normal MOD_UNLOAD cleanup, rather than duplicating the effort. A NULL return of kbd_get_switch in the MOD_UNLOAD handler has been downgraded from a panic to a successful return, as that certainly just means that kbd_add_driver failed (not possible at the moment) and we have no work to do. Modified: head/sys/dev/kbdmux/kbdmux.c Modified: head/sys/dev/kbdmux/kbdmux.c ============================================================================== --- head/sys/dev/kbdmux/kbdmux.c Thu Dec 26 17:09:36 2019 (r356091) +++ head/sys/dev/kbdmux/kbdmux.c Thu Dec 26 17:25:51 2019 (r356092) @@ -1427,7 +1427,6 @@ kbdmux_modevent(module_t mod, int type, void *data) break; if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) { - kbd_delete_driver(&kbdmux_kbd_driver); error = ENXIO; break; } @@ -1435,33 +1434,25 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd = NULL; if ((error = (*sw->probe)(0, NULL, 0)) != 0 || - (error = (*sw->init)(0, &kbd, NULL, 0)) != 0) { - kbd_delete_driver(&kbdmux_kbd_driver); + (error = (*sw->init)(0, &kbd, NULL, 0)) != 0) break; - } #ifdef KBD_INSTALL_CDEV if ((error = kbd_attach(kbd)) != 0) { (*sw->term)(kbd); - kbd_delete_driver(&kbdmux_kbd_driver); break; } #endif - if ((error = (*sw->enable)(kbd)) != 0) { - (*sw->disable)(kbd); -#ifdef KBD_INSTALL_CDEV - kbd_detach(kbd); -#endif - (*sw->term)(kbd); - kbd_delete_driver(&kbdmux_kbd_driver); + if ((error = (*sw->enable)(kbd)) != 0) break; - } break; case MOD_UNLOAD: - if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) - panic("kbd_get_switch(" KEYBOARD_NAME ") == NULL"); + if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) { + error = 0; + break; + } kbd = kbd_get_keyboard(kbd_find_keyboard(KEYBOARD_NAME, 0)); if (kbd != NULL) { @@ -1470,8 +1461,8 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd_detach(kbd); #endif (*sw->term)(kbd); - kbd_delete_driver(&kbdmux_kbd_driver); } + kbd_delete_driver(&kbdmux_kbd_driver); error = 0; break; From owner-svn-src-head@freebsd.org Thu Dec 26 18:25:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C196E1D6784; Thu, 26 Dec 2019 18:25:08 +0000 (UTC) (envelope-from cem@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 47kJKJ4RgRz4CJJ; Thu, 26 Dec 2019 18:25:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8F43F4B5B; Thu, 26 Dec 2019 18:25:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBQIP8BE011969; Thu, 26 Dec 2019 18:25:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQIP8l8011967; Thu, 26 Dec 2019 18:25:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912261825.xBQIP8l8011967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 26 Dec 2019 18:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356094 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 356094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 18:25:08 -0000 Author: cem Date: Thu Dec 26 18:25:07 2019 New Revision: 356094 URL: https://svnweb.freebsd.org/changeset/base/356094 Log: gone_in(9): Trivial string grammar and style cleanups Modified: head/sys/kern/subr_bus.c head/sys/sys/systm.h Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu Dec 26 18:05:38 2019 (r356093) +++ head/sys/kern/subr_bus.c Thu Dec 26 18:25:07 2019 (r356094) @@ -5971,7 +5971,7 @@ _gone_in(int major, const char *msg) gone_panic(major, P_OSREL_MAJOR(__FreeBSD_version), msg); if (P_OSREL_MAJOR(__FreeBSD_version) >= major) - printf("Obsolete code will removed soon: %s\n", msg); + printf("Obsolete code will be removed soon: %s\n", msg); else printf("Deprecated code (to be removed in FreeBSD %d): %s\n", major, msg); @@ -5984,7 +5984,7 @@ _gone_in_dev(device_t dev, int major, const char *msg) gone_panic(major, P_OSREL_MAJOR(__FreeBSD_version), msg); if (P_OSREL_MAJOR(__FreeBSD_version) >= major) device_printf(dev, - "Obsolete code will removed soon: %s\n", msg); + "Obsolete code will be removed soon: %s\n", msg); else device_printf(dev, "Deprecated code (to be removed in FreeBSD %d): %s\n", Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Thu Dec 26 18:05:38 2019 (r356093) +++ head/sys/sys/systm.h Thu Dec 26 18:25:07 2019 (r356094) @@ -593,7 +593,7 @@ void _gone_in_dev(struct device *dev, int major, const #ifdef NO_OBSOLETE_CODE #define __gone_ok(m, msg) \ _Static_assert(m < P_OSREL_MAJOR(__FreeBSD_version)), \ - "Obsolete code" msg); + "Obsolete code: " msg); #else #define __gone_ok(m, msg) #endif From owner-svn-src-head@freebsd.org Thu Dec 26 19:32:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64C7D1D79BF; Thu, 26 Dec 2019 19:32:13 +0000 (UTC) (envelope-from cem@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 47kKpj0sBgz4Fk7; Thu, 26 Dec 2019 19:32:13 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0006657B3; Thu, 26 Dec 2019 19:32:12 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBQJWCDm052398; Thu, 26 Dec 2019 19:32:12 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQJWBbH052389; Thu, 26 Dec 2019 19:32:11 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912261932.xBQJWBbH052389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 26 Dec 2019 19:32:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356096 - in head: . sys/dev/random sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: . sys/dev/random sys/sys X-SVN-Commit-Revision: 356096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 19:32:13 -0000 Author: cem Date: Thu Dec 26 19:32:11 2019 New Revision: 356096 URL: https://svnweb.freebsd.org/changeset/base/356096 Log: random(4): Simplify RANDOM_LOADABLE Simplify RANDOM_LOADABLE by removing the ability to unload a LOADABLE random(4) implementation. This allows one-time random module selection at boot, by loader(8). Swapping modules on the fly doesn't seem especially useful. This removes the need to hold a lock over the sleepable module calls read_random and read_random_uio. init/deinit have been pulled out of random_algorithm entirely. Algorithms can run their own sysinits to initialize; deinit is removed entirely, as algorithms can not be unloaded. Algorithms should initialize at SI_SUB_RANDOM:SI_ORDER_SECOND. In LOADABLE systems, algorithms install a pointer to their local random_algorithm context in p_random_alg_context at that time. Go ahead and const'ify random_algorithm objects; there is no need to mutate them at runtime. LOADABLE kernel NULL checks are removed from random_harvestq by ordering random_harvestq initialization at SI_SUB_RANDOM:SI_ORDER_THIRD, after algorithm init. Prior to random_harvestq init, hc_harvest_mask is zero and no events are forwarded to algorithms; after random_harvestq init, the relevant pointers will already have been installed. Remove the bulk of random_infra shim wrappers and instead expose the bare function pointers in sys/random.h. In LOADABLE systems, read_random(9) et al are just thin shim macros around invoking the associated function pointer. We do not provide a registration system but instead expect LOADABLE modules to register themselves at SI_SUB_RANDOM:SI_ORDER_SECOND. An example is provided in randomdev.c, as used in the random_fortuna.ko module. Approved by: csprng(markm) Discussed with: gordon Differential Revision: https://reviews.freebsd.org/D22512 Modified: head/UPDATING head/sys/dev/random/fortuna.c head/sys/dev/random/other_algorithm.c head/sys/dev/random/random_harvestq.c head/sys/dev/random/random_infra.c head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev.h head/sys/sys/random.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Dec 26 18:59:43 2019 (r356095) +++ head/UPDATING Thu Dec 26 19:32:11 2019 (r356096) @@ -26,6 +26,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191226: + Kernel-loadable random(4) modules are no longer unloadable. + 20191222: Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have been upgraded to 9.0.1. Please see the 20141231 entry below for Modified: head/sys/dev/random/fortuna.c ============================================================================== --- head/sys/dev/random/fortuna.c Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/dev/random/fortuna.c Thu Dec 26 19:32:11 2019 (r356096) @@ -261,15 +261,14 @@ static void random_fortuna_read(uint8_t *, size_t); static bool random_fortuna_seeded(void); static bool random_fortuna_seeded_internal(void); static void random_fortuna_process_event(struct harvest_event *); -static void random_fortuna_init_alg(void *); -static void random_fortuna_deinit_alg(void *); static void random_fortuna_reseed_internal(uint32_t *entropy_data, u_int blockcount); -struct random_algorithm random_alg_context = { +#ifdef RANDOM_LOADABLE +static +#endif +const struct random_algorithm random_alg_context = { .ra_ident = "Fortuna", - .ra_init_alg = random_fortuna_init_alg, - .ra_deinit_alg = random_fortuna_deinit_alg, .ra_pre_read = random_fortuna_pre_read, .ra_read = random_fortuna_read, .ra_seeded = random_fortuna_seeded, @@ -286,6 +285,10 @@ random_fortuna_init_alg(void *unused __unused) struct sysctl_oid *random_fortuna_o; #endif +#ifdef RANDOM_LOADABLE + p_random_alg_context = &random_alg_context; +#endif + RANDOM_RESEED_INIT_LOCK(); /* * Fortuna parameters. Do not adjust these unless you have @@ -330,18 +333,8 @@ random_fortuna_init_alg(void *unused __unused) fortuna_state.fs_counter = UINT128_ZERO; explicit_bzero(&fortuna_state.fs_key, sizeof(fortuna_state.fs_key)); } - -/* ARGSUSED */ -static void -random_fortuna_deinit_alg(void *unused __unused) -{ - - RANDOM_RESEED_DEINIT_LOCK(); - explicit_bzero(&fortuna_state, sizeof(fortuna_state)); -#ifdef _KERNEL - sysctl_ctx_free(&random_clist); -#endif -} +SYSINIT(random_alg, SI_SUB_RANDOM, SI_ORDER_SECOND, random_fortuna_init_alg, + NULL); /*- * FS&K - AddRandomEvent() Modified: head/sys/dev/random/other_algorithm.c ============================================================================== --- head/sys/dev/random/other_algorithm.c Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/dev/random/other_algorithm.c Thu Dec 26 19:32:11 2019 (r356096) @@ -87,8 +87,6 @@ static void random_other_pre_read(void); static void random_other_read(uint8_t *, size_t); static bool random_other_seeded(void); static void random_other_process_event(struct harvest_event *); -static void random_other_init_alg(void *); -static void random_other_deinit_alg(void *); /* * RANDOM_OTHER_NPOOLS is used when reading hardware random @@ -97,10 +95,11 @@ static void random_other_deinit_alg(void *); */ #define RANDOM_OTHER_NPOOLS 1 -struct random_algorithm random_alg_context = { +#ifdef RANDOM_LOADABLE +static +#endif +const struct random_algorithm random_alg_context = { .ra_ident = "other", - .ra_init_alg = random_other_init_alg, - .ra_deinit_alg = random_other_deinit_alg, .ra_pre_read = random_other_pre_read, .ra_read = random_other_read, .ra_seeded = random_other_seeded, @@ -112,34 +111,20 @@ struct random_algorithm random_alg_context = { static mtx_t other_mtx; /* - * void random_other_init_alg(void *unused __unused) - * * Do algorithm-specific initialisation here. */ -void +static void random_other_init_alg(void *unused __unused) { +#ifdef RANDOM_LOADABLE + p_random_alg_context = &random_alg_context; +#endif + RANDOM_RESEED_INIT_LOCK(); - /* - * Do set-up work here! - */ } - -/* - * void random_other_deinit_alg(void *unused __unused) - * - * Do algorithm-specific deinitialisation here. - */ -static void -random_other_deinit_alg(void *unused __unused) -{ - - /* - * Do tear-down work here! - */ - RANDOM_RESEED_DEINIT_LOCK(); -} +SYSINIT(random_alg, SI_SUB_RANDOM, SI_ORDER_SECOND, random_other_init_alg, + NULL); /* * void random_other_pre_read(void) Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/dev/random/random_harvestq.c Thu Dec 26 19:32:11 2019 (r356096) @@ -49,11 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(RANDOM_LOADABLE) -#include -#include -#endif - #include #include @@ -163,14 +158,7 @@ static struct kproc_desc random_proc_kp = { static __inline void random_harvestq_fast_process_event(struct harvest_event *event) { -#if defined(RANDOM_LOADABLE) - RANDOM_CONFIG_S_LOCK(); - if (p_random_alg_context) -#endif p_random_alg_context->ra_event_processor(event); -#if defined(RANDOM_LOADABLE) - RANDOM_CONFIG_S_UNLOCK(); -#endif explicit_bzero(event, sizeof(*event)); } @@ -230,11 +218,6 @@ random_sources_feed(void) * Step over all of live entropy sources, and feed their output * to the system-wide RNG. */ -#if defined(RANDOM_LOADABLE) - RANDOM_CONFIG_S_LOCK(); - if (p_random_alg_context) { - /* It's an indenting error. Yeah, Yeah. */ -#endif local_read_rate = atomic_readandclear_32(&read_rate); /* Perform at least one read per round */ local_read_rate = MAX(local_read_rate, 1); @@ -261,10 +244,6 @@ random_sources_feed(void) } } explicit_bzero(entropy, sizeof(entropy)); -#if defined(RANDOM_LOADABLE) - } - RANDOM_CONFIG_S_UNLOCK(); -#endif } void @@ -396,7 +375,7 @@ random_harvestq_init(void *unused __unused) RANDOM_HARVEST_INIT_LOCK(); harvest_context.hc_entropy_ring.in = harvest_context.hc_entropy_ring.out = 0; } -SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_SECOND, random_harvestq_init, NULL); +SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_THIRD, random_harvestq_init, NULL); /* * Subroutine to slice up a contiguous chunk of 'entropy' and feed it into the @@ -485,7 +464,7 @@ random_harvestq_deinit(void *unused __unused) while (random_kthread_control >= 0) tsleep(&harvest_context.hc_kthread_proc, 0, "harvqterm", hz/5); } -SYSUNINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_SECOND, random_harvestq_deinit, NULL); +SYSUNINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_THIRD, random_harvestq_deinit, NULL); /*- * Entropy harvesting queue routine. Modified: head/sys/dev/random/random_infra.c ============================================================================== --- head/sys/dev/random/random_infra.c Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/dev/random/random_infra.c Thu Dec 26 19:32:11 2019 (r356096) @@ -35,11 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(RANDOM_LOADABLE) -#include -#include -#endif - #include /* Set up the sysctl root node for the entropy device */ @@ -102,107 +97,8 @@ SYSCTL_BOOL(_kern_random_initial_seeding, OID_AUTO, MALLOC_DEFINE(M_ENTROPY, "entropy", "Entropy harvesting buffers and data structures"); #if defined(RANDOM_LOADABLE) -struct random_algorithm *p_random_alg_context = NULL; -#else /* !defined(RANDOM_LOADABLE) */ -struct random_algorithm *p_random_alg_context = &random_alg_context; -#endif /* defined(RANDOM_LOADABLE) */ - -#if defined(RANDOM_LOADABLE) - -static void -null_read_random(void *dummy __unused, u_int dummy2 __unused) -{ - panic("%s: no random module is loaded", __func__); -} - -static bool -null_is_random_seeded(void) -{ - return (false); -} - -struct random_readers { - int (*read_random_uio)(struct uio *, bool); - void (*read_random)(void *, u_int); - bool (*is_random_seeded)(void); -} random_reader_context = { - (int (*)(struct uio *, bool))nullop, - null_read_random, - null_is_random_seeded, -}; - -struct sx randomdev_config_lock; - -static void -random_infra_sysinit(void *dummy __unused) -{ - - RANDOM_CONFIG_INIT_LOCK(); -} -SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_FIRST, random_infra_sysinit, NULL); - -void -random_infra_init(int (*p_random_read_uio)(struct uio *, bool), - void (*p_random_read)(void *, u_int), - bool (*p_is_random_seeded)(void)) -{ - - RANDOM_CONFIG_X_LOCK(); - random_reader_context.read_random_uio = p_random_read_uio; - random_reader_context.read_random = p_random_read; - random_reader_context.is_random_seeded = p_is_random_seeded; - RANDOM_CONFIG_X_UNLOCK(); -} - -void -random_infra_uninit(void) -{ - - RANDOM_CONFIG_X_LOCK(); - random_reader_context.read_random_uio = (int (*)(struct uio *, bool))nullop; - random_reader_context.read_random = null_read_random; - random_reader_context.is_random_seeded = null_is_random_seeded; - RANDOM_CONFIG_X_UNLOCK(); -} - -static void -random_infra_sysuninit(void *dummy __unused) -{ - - RANDOM_CONFIG_DEINIT_LOCK(); -} -SYSUNINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_FIRST, random_infra_sysuninit, NULL); - -int -read_random_uio(struct uio *uio, bool nonblock) -{ - int retval; - - RANDOM_CONFIG_S_LOCK(); - retval = random_reader_context.read_random_uio(uio, nonblock); - RANDOM_CONFIG_S_UNLOCK(); - return (retval); -} - -void -read_random(void *buf, u_int len) -{ - - RANDOM_CONFIG_S_LOCK(); - random_reader_context.read_random(buf, len); - RANDOM_CONFIG_S_UNLOCK(); -} - -bool -is_random_seeded(void) -{ - bool result; - - RANDOM_CONFIG_S_LOCK(); - result = random_reader_context.is_random_seeded(); - RANDOM_CONFIG_S_UNLOCK(); - return (result); -} - - +const struct random_algorithm *p_random_alg_context; +void (*_read_random)(void *, u_int); +int (*_read_random_uio)(struct uio *, bool); +bool (*_is_random_seeded)(void); #endif /* defined(RANDOM_LOADABLE) */ Modified: head/sys/dev/random/randomdev.c ============================================================================== --- head/sys/dev/random/randomdev.c Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/dev/random/randomdev.c Thu Dec 26 19:32:11 2019 (r356096) @@ -59,17 +59,17 @@ __FBSDID("$FreeBSD$"); #define RANDOM_UNIT 0 +/* + * In loadable random, the core randomdev.c / random(9) routines have static + * visibility and an alternative name to avoid conflicting with the function + * pointers of the real names in the core kernel. random_alg_context_init + * installs pointers to the loadable static names into the core kernel's + * function pointers at SI_SUB_RANDOM:SI_ORDER_SECOND. + */ #if defined(RANDOM_LOADABLE) -#define READ_RANDOM_UIO _read_random_uio -#define READ_RANDOM _read_random -#define IS_RANDOM_SEEDED _is_random_seeded -static int READ_RANDOM_UIO(struct uio *, bool); -static void READ_RANDOM(void *, u_int); -static bool IS_RANDOM_SEEDED(void); -#else -#define READ_RANDOM_UIO read_random_uio -#define READ_RANDOM read_random -#define IS_RANDOM_SEEDED is_random_seeded +static int (read_random_uio)(struct uio *, bool); +static void (read_random)(void *, u_int); +static bool (is_random_seeded)(void); #endif static d_read_t randomdev_read; @@ -89,31 +89,18 @@ static struct cdevsw random_cdevsw = { /* For use with make_dev(9)/destroy_dev(9). */ static struct cdev *random_dev; -static void -random_alg_context_ra_init_alg(void *data) -{ - - p_random_alg_context = &random_alg_context; - p_random_alg_context->ra_init_alg(data); #if defined(RANDOM_LOADABLE) - random_infra_init(READ_RANDOM_UIO, READ_RANDOM, IS_RANDOM_SEEDED); -#endif -} - static void -random_alg_context_ra_deinit_alg(void *data) +random_alg_context_init(void *dummy __unused) { - -#if defined(RANDOM_LOADABLE) - random_infra_uninit(); -#endif - p_random_alg_context->ra_deinit_alg(data); - p_random_alg_context = NULL; + _read_random_uio = (read_random_uio); + _read_random = (read_random); + _is_random_seeded = (is_random_seeded); } +SYSINIT(random_device, SI_SUB_RANDOM, SI_ORDER_SECOND, random_alg_context_init, + NULL); +#endif -SYSINIT(random_device, SI_SUB_RANDOM, SI_ORDER_THIRD, random_alg_context_ra_init_alg, NULL); -SYSUNINIT(random_device, SI_SUB_RANDOM, SI_ORDER_THIRD, random_alg_context_ra_deinit_alg, NULL); - static struct selinfo rsel; /* @@ -124,7 +111,7 @@ static int randomdev_read(struct cdev *dev __unused, struct uio *uio, int flags) { - return (READ_RANDOM_UIO(uio, (flags & O_NONBLOCK) != 0)); + return ((read_random_uio)(uio, (flags & O_NONBLOCK) != 0)); } /* @@ -154,7 +141,7 @@ randomdev_wait_until_seeded(bool interruptible) if (spamcount == 0) printf("random: %s unblock wait\n", __func__); spamcount = (spamcount + 1) % 100; - error = tsleep(&random_alg_context, slpflags, "randseed", + error = tsleep(p_random_alg_context, slpflags, "randseed", hz / 10); if (error == ERESTART || error == EINTR) { KASSERT(interruptible, @@ -170,7 +157,7 @@ randomdev_wait_until_seeded(bool interruptible) } int -READ_RANDOM_UIO(struct uio *uio, bool nonblock) +(read_random_uio)(struct uio *uio, bool nonblock) { /* 16 MiB takes about 0.08 s CPU time on my 2017 AMD Zen CPU */ #define SIGCHK_PERIOD (16 * 1024 * 1024) @@ -238,7 +225,7 @@ READ_RANDOM_UIO(struct uio *uio, bool nonblock) */ if (error == 0 && uio->uio_resid != 0 && total_read % sigchk_period == 0) { - error = tsleep_sbt(&random_alg_context, PCATCH, + error = tsleep_sbt(p_random_alg_context, PCATCH, "randrd", SBT_1NS, 0, C_HARDCLOCK); /* Squash tsleep timeout condition */ if (error == EWOULDBLOCK) @@ -271,7 +258,7 @@ READ_RANDOM_UIO(struct uio *uio, bool nonblock) * 'kern.random.initial_seeding.read_random_bypassed_before_seeding'. */ void -READ_RANDOM(void *random_buf, u_int len) +(read_random)(void *random_buf, u_int len) { KASSERT(random_buf != NULL, ("No suitable random buffer in %s", __func__)); @@ -305,7 +292,7 @@ READ_RANDOM(void *random_buf, u_int len) } bool -IS_RANDOM_SEEDED(void) +(is_random_seeded)(void) { return (p_random_alg_context->ra_seeded()); } @@ -356,7 +343,7 @@ randomdev_write(struct cdev *dev __unused, struct uio if (error) break; randomdev_accumulate(random_buf, c); - tsleep(&random_alg_context, 0, "randwr", hz/10); + tsleep(p_random_alg_context, 0, "randwr", hz/10); } if (nbytes != uio->uio_resid && (error == ERESTART || error == EINTR)) /* Partial write, not error. */ @@ -385,7 +372,7 @@ randomdev_unblock(void) { selwakeuppri(&rsel, PUSER); - wakeup(&random_alg_context); + wakeup(p_random_alg_context); printf("random: unblocking device.\n"); /* Do random(9) a favour while we are about it. */ (void)atomic_cmpset_int(&arc4rand_iniseed_state, ARC4_ENTR_NONE, ARC4_ENTR_HAVE); @@ -424,7 +411,7 @@ randomdev_modevent(module_t mod __unused, int type, vo make_dev_alias(random_dev, "urandom"); /* compatibility */ break; case MOD_UNLOAD: - destroy_dev(random_dev); + error = EBUSY; break; case MOD_SHUTDOWN: break; Modified: head/sys/dev/random/randomdev.h ============================================================================== --- head/sys/dev/random/randomdev.h Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/dev/random/randomdev.h Thu Dec 26 19:32:11 2019 (r356096) @@ -79,15 +79,18 @@ typedef u_int random_source_read_t(void *, u_int); struct random_algorithm { const char *ra_ident; u_int ra_poolcount; - void (*ra_init_alg)(void *); - void (*ra_deinit_alg)(void *); random_alg_pre_read_t *ra_pre_read; random_alg_read_t *ra_read; random_alg_seeded_t *ra_seeded; random_alg_eventprocessor_t *ra_event_processor; }; -extern struct random_algorithm random_alg_context, *p_random_alg_context; +#if defined(RANDOM_LOADABLE) +extern const struct random_algorithm *p_random_alg_context; +#else +extern const struct random_algorithm random_alg_context; +#define p_random_alg_context (&random_alg_context) +#endif #ifdef _KERNEL @@ -104,19 +107,6 @@ struct random_source { void random_source_register(struct random_source *); void random_source_deregister(struct random_source *); - -#if defined(RANDOM_LOADABLE) -extern struct sx randomdev_config_lock; -#define RANDOM_CONFIG_INIT_LOCK(x) sx_init(&randomdev_config_lock, "configuration change lock") -#define RANDOM_CONFIG_X_LOCK(x) sx_xlock(&randomdev_config_lock) -#define RANDOM_CONFIG_X_UNLOCK(x) sx_xunlock(&randomdev_config_lock) -#define RANDOM_CONFIG_S_LOCK(x) sx_slock(&randomdev_config_lock) -#define RANDOM_CONFIG_S_UNLOCK(x) sx_sunlock(&randomdev_config_lock) -#define RANDOM_CONFIG_DEINIT_LOCK(x) sx_destroy(&randomdev_config_lock) -void random_infra_init(int (*)(struct uio *, bool), void (*)(void *, u_int), - bool (*)(void)); -void random_infra_uninit(void); -#endif #endif /* _KERNEL */ Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/sys/random.h Thu Dec 26 19:32:11 2019 (r356096) @@ -37,9 +37,35 @@ struct uio; +/* + * In the loadable random world, there are set of dangling pointers left in the + * core kernel: + * * read_random, read_random_uio, is_random_seeded are function pointers, + * rather than functions. + * * p_random_alg_context is a true pointer in loadable random kernels. + * + * These are initialized at SI_SUB_RANDOM:SI_ORDER_SECOND during boot. The + * read-type pointers are initialized by random_alg_context_init() in + * randomdev.c and p_random_alg_context in the algorithm, e.g., fortuna.c's + * random_fortuna_init_alg(). The nice thing about function pointers is they + * have a similar calling convention to ordinary functions. + * + * (In !loadable, the read_random, etc, routines are just plain functions; + * p_random_alg_context is a macro for the public visibility + * &random_alg_context.) + */ +#if defined(RANDOM_LOADABLE) +extern void (*_read_random)(void *, u_int); +extern int (*_read_random_uio)(struct uio *, bool); +extern bool (*_is_random_seeded)(void); +#define read_random(a, b) (*_read_random)(a, b) +#define read_random_uio(a, b) (*_read_random_uio)(a, b) +#define is_random_seeded() (*_is_random_seeded)() +#else void read_random(void *, u_int); int read_random_uio(struct uio *, bool); bool is_random_seeded(void); +#endif /* * Note: if you add or remove members of random_entropy_source, remember to From owner-svn-src-head@freebsd.org Thu Dec 26 19:41:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 120001D7C3F; Thu, 26 Dec 2019 19:41:11 +0000 (UTC) (envelope-from cem@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 47kL126jHDz4GSV; Thu, 26 Dec 2019 19:41:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E18325934; Thu, 26 Dec 2019 19:41:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBQJfADF053713; Thu, 26 Dec 2019 19:41:10 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQJf9mL053706; Thu, 26 Dec 2019 19:41:09 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912261941.xBQJf9mL053706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 26 Dec 2019 19:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356097 - in head: share/man/man9 sys/compat/ndis sys/dev/oce sys/kern sys/libkern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/compat/ndis sys/dev/oce sys/kern sys/libkern sys/sys X-SVN-Commit-Revision: 356097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 19:41:11 -0000 Author: cem Date: Thu Dec 26 19:41:09 2019 New Revision: 356097 URL: https://svnweb.freebsd.org/changeset/base/356097 Log: random(9): Deprecate random(9), remove meaningless srandom(9) srandom(9) is meaningless on SMP systems or any system with, say, interrupts. One could never rely on random(9) to produce a reproducible sequence of outputs on the basis of a specific srandom() seed because the global state was shared by all kernel contexts. As such, removing it is literally indistinguishable to random(9) consumers (as compared with retaining it). Mark random(9) as deprecated and slated for quick removal. This is not to say we intend to remove all fast, non-cryptographic PRNG(s) in the kernel. It/they just won't be random(9), as it exists today, in either name or implementation. Before random(9) is removed, a replacement will be provided and in-tree consumers will be converted. Note that despite the name, the random(9) interface does not bear any resemblance to random(3). Instead, it is the same crummy 1988 Park-Miller LCG used in libc rand(3). Modified: head/share/man/man9/random.9 head/sys/compat/ndis/subr_ntoskrnl.c head/sys/dev/oce/oce_mbox.c head/sys/kern/init_main.c head/sys/kern/subr_stats.c head/sys/libkern/random.c head/sys/sys/libkern.h Modified: head/share/man/man9/random.9 ============================================================================== --- head/share/man/man9/random.9 Thu Dec 26 19:32:11 2019 (r356096) +++ head/share/man/man9/random.9 Thu Dec 26 19:41:09 2019 (r356097) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" " -.Dd April 16, 2019 +.Dd December 26, 2019 .Dt RANDOM 9 .Os .Sh NAME @@ -36,8 +36,7 @@ .Nm is_random_seeded , .Nm random , .Nm read_random , -.Nm read_random_uio , -.Nm srandom +.Nm read_random_uio .Nd supply pseudo-random numbers .Sh SYNOPSIS .In sys/libkern.h @@ -57,8 +56,6 @@ .Fn read_random_uio "struct uio *uio" "bool nonblock" .Ss LEGACY ROUTINES .In sys/libkern.h -.Ft void -.Fn srandom "u_long seed" .Ft u_long .Fn random "void" .Sh DESCRIPTION @@ -134,19 +131,16 @@ Otherwise, this function may block interruptibly until If the function is interrupted before the random device is seeded, no data is returned. .Pp -The legacy -.Fn random -function will produce a sequence of numbers that can be duplicated by calling -.Fn srandom -with some constant as the -.Fa seed . -The legacy -.Fn srandom -function may be called with any -.Fa seed -value. +The deprecated +.Xr random 9 +function will produce a sequence of pseudorandom numbers using a similar weak +linear congruential generator as +.Xr rand 3 +(the 1988 Park-Miller LCG). +It is obsolete and scheduled to be removed in +.Fx 13.0 . It is strongly advised that the -.Fn random +.Xr random 9 function not be used to generate random numbers. See .Sx SECURITY CONSIDERATIONS . @@ -173,23 +167,6 @@ the number of bytes placed in .Fn read_random_uio returns zero when successful, otherwise an error code is returned. -.Pp -The legacy -.Fn random -function uses -a non-linear additive feedback random number generator -employing a default table -of size 31 -containing long integers -to return successive pseudo-random -numbers in the range from 0 to -.if t 2\u\s731\s10\d\(mi1. -.if n (2**31)\(mi1. -The period of this random number generator -is very large, -approximately -.if t 16\(mu(2\u\s731\s10\d\(mi1). -.if n 16*((2**31)\(mi1). .Sh ERRORS .Fn read_random_uio may fail if: @@ -212,8 +189,6 @@ wrote .Sh SECURITY CONSIDERATIONS Do not use .Fn random -or -.Fn srandom in new code. .Pp It is important to remember that the Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Thu Dec 26 19:32:11 2019 (r356096) +++ head/sys/compat/ndis/subr_ntoskrnl.c Thu Dec 26 19:41:09 2019 (r356097) @@ -3195,10 +3195,8 @@ rand(void) } static void -srand(unsigned int seed) +srand(unsigned int seed __unused) { - - srandom(seed); } static uint8_t Modified: head/sys/dev/oce/oce_mbox.c ============================================================================== --- head/sys/dev/oce/oce_mbox.c Thu Dec 26 19:32:11 2019 (r356096) +++ head/sys/dev/oce/oce_mbox.c Thu Dec 26 19:41:09 2019 (r356097) @@ -859,7 +859,6 @@ oce_config_nic_rss(POCE_SOFTC sc, uint32_t if_id, uint fwcmd->params.req.if_id = LE_32(if_id); - srandom(arc4random()); /* random entropy seed */ read_random(fwcmd->params.req.hash, sizeof(fwcmd->params.req.hash)); rc = oce_rss_itbl_init(sc, fwcmd); Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Dec 26 19:32:11 2019 (r356096) +++ head/sys/kern/init_main.c Thu Dec 26 19:41:09 2019 (r356097) @@ -624,7 +624,6 @@ SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc static void proc0_post(void *dummy __unused) { - struct timespec ts; struct proc *p; struct rusage ru; struct thread *td; @@ -656,27 +655,8 @@ proc0_post(void *dummy __unused) sx_sunlock(&allproc_lock); PCPU_SET(switchtime, cpu_ticks()); PCPU_SET(switchticks, ticks); - - /* - * Give the ``random'' number generator a thump. - */ - nanotime(&ts); - srandom(ts.tv_sec ^ ts.tv_nsec); } SYSINIT(p0post, SI_SUB_INTRINSIC_POST, SI_ORDER_FIRST, proc0_post, NULL); - -static void -random_init(void *dummy __unused) -{ - - /* - * After CPU has been started we have some randomness on most - * platforms via get_cyclecount(). For platforms that don't - * we will reseed random(9) in proc0_post() as well. - */ - srandom(get_cyclecount()); -} -SYSINIT(random, SI_SUB_RANDOM, SI_ORDER_FIRST, random_init, NULL); /* *************************************************************************** Modified: head/sys/kern/subr_stats.c ============================================================================== --- head/sys/kern/subr_stats.c Thu Dec 26 19:32:11 2019 (r356096) +++ head/sys/kern/subr_stats.c Thu Dec 26 19:41:09 2019 (r356097) @@ -2963,7 +2963,14 @@ stats_v1_vsd_tdgst_compress(enum vsd_dtype vs_dtype, * re-inserting the mu/cnt of each as a value and corresponding weight. */ -#define bitsperrand 31 /* Per random(3). */ + /* + * XXXCEM: random(9) is currently rand(3), not random(3). rand(3) + * RAND_MAX happens to be approximately 31 bits (range [0, + * 0x7ffffffd]), so the math kinda works out. When/if this portion of + * the code is compiled in userspace, it gets the random(3) behavior, + * which has expected range [0, 0x7fffffff]. + */ +#define bitsperrand 31 ebits = 0; nebits = 0; bitsperidx = fls(maxctds); @@ -2971,7 +2978,6 @@ stats_v1_vsd_tdgst_compress(enum vsd_dtype vs_dtype, ("%s: bitsperidx=%d, ebits=%d", __func__, bitsperidx, (int)(sizeof(ebits) << 3))); idxmask = (UINT64_C(1) << bitsperidx) - 1; - srandom(stats_sbinuptime()); /* Initialise the free list with randomised centroid indices. */ for (; remctds > 0; remctds--) { Modified: head/sys/libkern/random.c ============================================================================== --- head/sys/libkern/random.c Thu Dec 26 19:32:11 2019 (r356096) +++ head/sys/libkern/random.c Thu Dec 26 19:41:09 2019 (r356097) @@ -34,31 +34,30 @@ #include __FBSDID("$FreeBSD$"); +#include #include +#include -#define NSHUFF 50 /* to drop some "seed -> 1st value" linearity */ - static u_long randseed = 937186357; /* after srandom(1), NSHUFF counted */ -void -srandom(u_long seed) -{ - int i; - - randseed = seed; - for (i = 0; i < NSHUFF; i++) - (void)random(); -} - /* * Pseudo-random number generator for perturbing the profiling clock, * and whatever else we might use it for. The result is uniform on * [0, 2^31 - 1]. */ u_long -random() +random(void) { + static bool warned = false; + long x, hi, lo, t; + + /* Warn only once, or it gets very spammy. */ + if (!warned) { + gone_in(13, + "random(9) is the obsolete Park-Miller LCG from 1988"); + warned = true; + } /* * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Thu Dec 26 19:32:11 2019 (r356096) +++ head/sys/sys/libkern.h Thu Dec 26 19:41:09 2019 (r356097) @@ -166,7 +166,6 @@ void qsort_r(void *base, size_t nmemb, size_t size, v int (*compar)(void *, const void *, const void *)); u_long random(void); int scanc(u_int, const u_char *, const u_char *, int); -void srandom(u_long); int strcasecmp(const char *, const char *); char *strcat(char * __restrict, const char * __restrict); char *strchr(const char *, int); From owner-svn-src-head@freebsd.org Thu Dec 26 21:00:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 607731D9127; Thu, 26 Dec 2019 21:00:07 +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 47kMm71vbQz4KbB; Thu, 26 Dec 2019 21:00:07 +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 3CA5D664A; Thu, 26 Dec 2019 21:00:07 +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 xBQL07Pa001005; Thu, 26 Dec 2019 21:00:07 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQL06Tu001003; Thu, 26 Dec 2019 21:00:06 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912262100.xBQL06Tu001003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Thu, 26 Dec 2019 21:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356098 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 356098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 21:00:07 -0000 Author: scottl Date: Thu Dec 26 21:00:06 2019 New Revision: 356098 URL: https://svnweb.freebsd.org/changeset/base/356098 Log: Abstract the locking for PCIe hotplug. It still uses Giant so there's no functional change yet. Modified: head/sys/dev/pci/pci_pci.c head/sys/dev/pci/pcib_private.h Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Thu Dec 26 19:41:09 2019 (r356097) +++ head/sys/dev/pci/pci_pci.c Thu Dec 26 21:00:06 2019 (r356098) @@ -1174,6 +1174,7 @@ pcib_pcie_intr_hotplug(void *arg) sc = arg; dev = sc->dev; + PCIB_HP_LOCK(sc); old_slot_sta = sc->pcie_slot_sta; sc->pcie_slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); @@ -1221,6 +1222,7 @@ pcib_pcie_intr_hotplug(void *arg) } pcib_pcie_hotplug_update(sc, 0, 0, true); + PCIB_HP_UNLOCK(sc); } static void @@ -1230,7 +1232,7 @@ pcib_pcie_hotplug_task(void *context, int pending) device_t dev; sc = context; - mtx_lock(&Giant); + PCIB_HP_LOCK(sc); dev = sc->dev; if (pcib_hotplug_present(sc) != 0) { if (sc->child == NULL) { @@ -1243,7 +1245,7 @@ pcib_pcie_hotplug_task(void *context, int pending) sc->child = NULL; } } - mtx_unlock(&Giant); + PCIB_HP_UNLOCK(sc); } static void @@ -1252,7 +1254,7 @@ pcib_pcie_ab_timeout(void *arg) struct pcib_softc *sc; sc = arg; - mtx_assert(&Giant, MA_OWNED); + PCIB_HP_LOCK_ASSERT(sc); if (sc->flags & PCIB_DETACH_PENDING) { sc->flags |= PCIB_DETACHING; sc->flags &= ~PCIB_DETACH_PENDING; @@ -1269,7 +1271,7 @@ pcib_pcie_cc_timeout(void *arg) sc = arg; dev = sc->dev; - mtx_assert(&Giant, MA_OWNED); + PCIB_HP_LOCK_ASSERT(sc); sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); if (!(sta & PCIEM_SLOT_STA_CC)) { device_printf(dev, "HotPlug Command Timed Out\n"); @@ -1290,7 +1292,7 @@ pcib_pcie_dll_timeout(void *arg) sc = arg; dev = sc->dev; - mtx_assert(&Giant, MA_OWNED); + PCIB_HP_LOCK_ASSERT(sc); sta = pcie_read_config(dev, PCIER_LINK_STA, 2); if (!(sta & PCIEM_LINK_STA_DL_ACTIVE)) { device_printf(dev, @@ -1345,7 +1347,7 @@ pcib_alloc_pcie_irq(struct pcib_softc *sc) return (ENXIO); } - error = bus_setup_intr(dev, sc->pcie_irq, INTR_TYPE_MISC, + error = bus_setup_intr(dev, sc->pcie_irq, INTR_TYPE_MISC|INTR_MPSAFE, NULL, pcib_pcie_intr_hotplug, sc, &sc->pcie_ihand); if (error) { device_printf(dev, "Failed to setup PCI-e interrupt handler\n"); @@ -1384,6 +1386,7 @@ pcib_setup_hotplug(struct pcib_softc *sc) callout_init(&sc->pcie_cc_timer, 0); callout_init(&sc->pcie_dll_timer, 0); TASK_INIT(&sc->pcie_hp_task, 0, pcib_pcie_hotplug_task, sc); + sc->pcie_hp_lock = &Giant; /* Allocate IRQ. */ if (pcib_alloc_pcie_irq(sc) != 0) Modified: head/sys/dev/pci/pcib_private.h ============================================================================== --- head/sys/dev/pci/pcib_private.h Thu Dec 26 19:41:09 2019 (r356097) +++ head/sys/dev/pci/pcib_private.h Thu Dec 26 21:00:06 2019 (r356098) @@ -141,7 +141,12 @@ struct pcib_softc struct callout pcie_ab_timer; struct callout pcie_cc_timer; struct callout pcie_dll_timer; + struct mtx *pcie_hp_lock; }; + +#define PCIB_HP_LOCK(sc) mtx_lock((sc)->pcie_hp_lock) +#define PCIB_HP_UNLOCK(sc) mtx_unlock((sc)->pcie_hp_lock) +#define PCIB_HP_LOCK_ASSERT(sc) mtx_assert((sc)->pcie_hp_lock, MA_OWNED) #define PCIB_SUPPORTED_ARI_VER 1 From owner-svn-src-head@freebsd.org Thu Dec 26 21:06:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 740B01D93B7; Thu, 26 Dec 2019 21:06:35 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kMvb2NMKz4L74; Thu, 26 Dec 2019 21:06:35 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 347C96806; Thu, 26 Dec 2019 21:06:35 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBQL6ZYY006712; Thu, 26 Dec 2019 21:06:35 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQL6ZqZ006711; Thu, 26 Dec 2019 21:06:35 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912262106.xBQL6ZqZ006711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 26 Dec 2019 21:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356099 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 356099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 21:06:35 -0000 Author: rmacklem Date: Thu Dec 26 21:06:34 2019 New Revision: 356099 URL: https://svnweb.freebsd.org/changeset/base/356099 Log: Change NFSv4.1 and NFSv4.2 error strings to start with lower case letter. r356084 added error strings for NFSv4.1 and NFSv4.2, with the first character capitalized. Since the other error strings were not capitalized and these strings would usually be imbedded in an error, I decided to make the first characters lower cased. No real effect but more consistent. Modified: head/sys/fs/nfs/nfsv4_errstr.h Modified: head/sys/fs/nfs/nfsv4_errstr.h ============================================================================== --- head/sys/fs/nfs/nfsv4_errstr.h Thu Dec 26 21:00:06 2019 (r356098) +++ head/sys/fs/nfs/nfsv4_errstr.h Thu Dec 26 21:06:34 2019 (r356099) @@ -85,54 +85,54 @@ static const char *nfsv4_errstr[NFSERR_XATTR2BIG - 100 "open file blocks op", "lockowner state revoked", "callback path down" - "Bad IO mode", - "Bad layout", - "Bad session digest", - "Bad session", - "Bad slot", - "Complete already", - "Not bound to session", - "Delegation already wanted", - "Back channel busy", - "Layout try later", - "Layout unavailable", - "No matching layout", - "Recall conflict", - "Unknown layout type", - "Sequence misordered", - "Sequence position", - "Request too big", - "Reply too big", - "Reply too big to cache", - "Retry uncached reply", - "Unsafe compound", - "Too many operations", - "Operation not in session", - "Hash algorithm unsupported", - "Unknown error", - "ClientID busy", + "bad IO mode", + "bad layout", + "bad session digest", + "bad session", + "bad slot", + "complete already", + "not bound to session", + "delegation already wanted", + "back channel busy", + "layout try later", + "layout unavailable", + "no matching layout", + "recall conflict", + "unknown layout type", + "sequence misordered", + "sequence position", + "request too big", + "reply too big", + "reply too big to cache", + "retry uncached reply", + "unsafe compound", + "too many operations", + "operation not in session", + "hash algorithm unsupported", + "unknown error", + "clientID busy", "pNFS IO hole", - "Sequence false retry", - "Bad high slot", - "Dead session", - "Encrypt algorithm unsupported", + "sequence false retry", + "bad high slot", + "dead session", + "encrypt algorithm unsupported", "pNFS no layout", - "Not only operation", - "Wrong credential", - "Wrong type", - "Directory delegation unavailable", - "Reject delegation", - "Return conflict", - "Delegation revoked", - "Partner not supported", - "Partner no auth", - "Union not supported", - "Offload denied", - "Wrong LFS", - "Bad label", - "Offload no request", - "No extended attribute", - "Extended attribute too big", + "not only operation", + "wrong credential", + "wrong type", + "directory delegation unavailable", + "reject delegation", + "return conflict", + "delegation revoked", + "partner not supported", + "partner no auth", + "union not supported", + "offload denied", + "wrong LFS", + "bad label", + "offload no request", + "no extended attribute", + "extended attribute too big", }; /* From owner-svn-src-head@freebsd.org Thu Dec 26 21:20:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3093F1D96B0; Thu, 26 Dec 2019 21:20:46 +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 47kNCy0Sqmz4LtF; Thu, 26 Dec 2019 21:20:46 +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 E47216A14; Thu, 26 Dec 2019 21:20:45 +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 xBQLKj7U013894; Thu, 26 Dec 2019 21:20:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQLKjSt013860; Thu, 26 Dec 2019 21:20:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912262120.xBQLKjSt013860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 26 Dec 2019 21:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356100 - head/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 356100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 21:20:46 -0000 Author: dim Date: Thu Dec 26 21:20:45 2019 New Revision: 356100 URL: https://svnweb.freebsd.org/changeset/base/356100 Log: Merge commit d3aeac8e2 from llvm git (by Justin Hibbits) [PowerPC] Only use PLT annotations if using PIC relocation model Summary: The default static (non-PIC, non-PIE) model for 32-bit powerpc does not use @PLT annotations and relocations in GCC. LLVM shouldn't use @PLT annotations either, because it breaks secure-PLT linking with (some versions of?) GNU LD. Update the available-externally.ll test to reflect that default mode should be the same as the static relocation, by using the same check prefix. Reviewed by: sfertile Differential Revision: https://reviews.llvm.org/D70570 Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22913 Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Dec 26 21:06:34 2019 (r356099) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Dec 26 21:20:45 2019 (r356100) @@ -4952,7 +4952,12 @@ PrepareCall(SelectionDAG &DAG, SDValue &Callee, SDValu if (auto *G = dyn_cast(Callee)) GV = G->getGlobal(); bool Local = TM.shouldAssumeDSOLocal(*Mod, GV); - bool UsePlt = !Local && Subtarget.isTargetELF() && !isPPC64; + // The PLT is only used in 32-bit ELF PIC mode. Attempting to use the PLT in + // a static relocation model causes some versions of GNU LD (2.17.50, at + // least) to force BSS-PLT, instead of secure-PLT, even if all objects are + // built with secure-PLT. + bool UsePlt = !Local && Subtarget.isTargetELF() && !isPPC64 && + Subtarget.getTargetMachine().getRelocationModel() == Reloc::PIC_; // If the callee is a GlobalAddress/ExternalSymbol node (quite common, // every direct call is) turn it into a TargetGlobalAddress / From owner-svn-src-head@freebsd.org Thu Dec 26 22:33:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8A121DAB89; Thu, 26 Dec 2019 22:33:20 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kPqh4RLMz4Pbt; Thu, 26 Dec 2019 22:33:20 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93888781A; Thu, 26 Dec 2019 22:33:20 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBQMXKff060024; Thu, 26 Dec 2019 22:33:20 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQMXKME060023; Thu, 26 Dec 2019 22:33:20 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912262233.xBQMXKME060023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 26 Dec 2019 22:33:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356101 - head/sbin/mount_nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sbin/mount_nfs X-SVN-Commit-Revision: 356101 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 22:33:20 -0000 Author: rmacklem Date: Thu Dec 26 22:33:20 2019 New Revision: 356101 URL: https://svnweb.freebsd.org/changeset/base/356101 Log: Fix mount_nfs to recognize the NFSv4 specific errors returned by nmount(2). When mount_nfs calls nmount(2), certain NFSv4 specific errors such as NFSERR_MINORVERMISMATCH can be returned. Without this patch, 10021 is reported as an unknown error. This is not particulcarily serious, but make it difficult for sysadmins to figure out why the mount attempt is failing. This patch uses nfsv4_errstr.h to convert 10021 and similar to error strings that can be printed out. A positive side effect of this patch is the removal of a reference to sys/nfsclient/nfs.h, which should no longer be used, since it is part of the old NFS client. This patch should only affect reporting of failed mount attempts and not the semantics of NFS mount attempts. Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Thu Dec 26 21:20:45 2019 (r356100) +++ head/sbin/mount_nfs/mount_nfs.c Thu Dec 26 22:33:20 2019 (r356101) @@ -61,7 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include @@ -155,7 +156,7 @@ main(int argc, char *argv[]) char *mntname, *p, *spec, *tmp; char mntpath[MAXPATHLEN], errmsg[255]; char hostname[MAXHOSTNAMELEN + 1], gssn[MAXHOSTNAMELEN + 50]; - const char *gssname; + const char *gssname, *nmount_errstr; iov = NULL; iovlen = 0; @@ -462,9 +463,14 @@ main(int argc, char *argv[]) build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - if (nmount(iov, iovlen, 0)) - err(1, "nmount: %s%s%s", mntpath, errmsg[0] ? ", " : "", - errmsg); + if (nmount(iov, iovlen, 0)) { + nmount_errstr = nfsv4_geterrstr(errno); + if (mountmode == V4 && nmount_errstr != NULL) + errx(1, "nmount: %s, %s", mntpath, nmount_errstr); + else + err(1, "nmount: %s%s%s", mntpath, errmsg[0] ? ", " : "", + errmsg); + } exit(0); } From owner-svn-src-head@freebsd.org Thu Dec 26 22:47:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAE721DAE55; Thu, 26 Dec 2019 22:47:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kQ7w61Jtz4Q7V; Thu, 26 Dec 2019 22:47:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9C597A02; Thu, 26 Dec 2019 22:47:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBQMlOVs066158; Thu, 26 Dec 2019 22:47:24 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQMlOpU066157; Thu, 26 Dec 2019 22:47:24 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912262247.xBQMlOpU066157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 26 Dec 2019 22:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356102 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 356102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 22:47:25 -0000 Author: jhibbits Date: Thu Dec 26 22:47:24 2019 New Revision: 356102 URL: https://svnweb.freebsd.org/changeset/base/356102 Log: powerpc: Move ppc32_runtime_resolve() declaration to the right place The function is only used in 32-bit kernels, so move the declaration to !powerpc64. Modified: head/sys/powerpc/powerpc/elf32_machdep.c Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Thu Dec 26 22:33:20 2019 (r356101) +++ head/sys/powerpc/powerpc/elf32_machdep.c Thu Dec 26 22:47:24 2019 (r356102) @@ -63,7 +63,6 @@ extern const char *freebsd32_syscallnames[]; static void ppc32_fixlimit(struct rlimit *rl, int which); -static void ppc32_runtime_resolve(void); static SYSCTL_NODE(_compat, OID_AUTO, ppc32, CTLFLAG_RW, 0, "32-bit mode"); @@ -75,6 +74,8 @@ SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxdsiz, CTLFLAG u_long ppc32_maxssiz = PPC32_MAXSSIZ; SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxssiz, CTLFLAG_RWTUN, &ppc32_maxssiz, 0, ""); +#else +static void ppc32_runtime_resolve(void); #endif struct sysentvec elf32_freebsd_sysvec = { From owner-svn-src-head@freebsd.org Thu Dec 26 22:49:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14F1A1DAF38; Thu, 26 Dec 2019 22:49: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 47kQB76nVbz4QGW; Thu, 26 Dec 2019 22:49: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 E43417A05; Thu, 26 Dec 2019 22:49: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 xBQMnJ1P066278; Thu, 26 Dec 2019 22:49:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQMnJW5066277; Thu, 26 Dec 2019 22:49:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912262249.xBQMnJW5066277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 26 Dec 2019 22:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356103 - head/usr.sbin/cron/cron X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/cron/cron X-SVN-Commit-Revision: 356103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 22:49:20 -0000 Author: kevans Date: Thu Dec 26 22:49:19 2019 New Revision: 356103 URL: https://svnweb.freebsd.org/changeset/base/356103 Log: cron(8): use proper variable to determine mailer process status While the mailer is normally opened/set if the mailto is set, this is not the case if the grandchild actually didn't produce any output. This change corrects the situation to only attempt to kill/close the mail process if it was actually opened in the first place. The reporter initially stumbled on the -n (suppress mail on success) flag leading to a SIGKILL of the process group, but simultaneously discovered/reported the behavior with !-n jobs if MAILTO was set and no output happened. All of these places that are checking mailto should actually be checking whether mail is set, so do that for consistency+correctness. This set of bugs were introduced by r352668. Submitted by: sigsys@gmail.com Reported by: sigsys@gmail.com Modified: head/usr.sbin/cron/cron/do_command.c Modified: head/usr.sbin/cron/cron/do_command.c ============================================================================== --- head/usr.sbin/cron/cron/do_command.c Thu Dec 26 22:47:24 2019 (r356102) +++ head/usr.sbin/cron/cron/do_command.c Thu Dec 26 22:49:19 2019 (r356103) @@ -460,6 +460,8 @@ child_process(e, u) _exit(ERROR_EXIT); } + mail = NULL; + ch = getc(in); if (ch != EOF) { Debug(DPROC|DEXT, @@ -531,7 +533,7 @@ child_process(e, u) while (EOF != (ch = getc(in))) { bytes++; - if (mailto) + if (mail) putc(ch, mail); } } @@ -555,12 +557,12 @@ child_process(e, u) */ if (WIFEXITED(waiter) && WEXITSTATUS(waiter) == 0 && (e->flags & MAIL_WHEN_ERR) == MAIL_WHEN_ERR - && mailto) { + && mail) { Debug(DPROC, ("[%d] %s executed successfully, mail suppressed\n", getpid(), "grandchild command job")) kill(mailpid, SIGKILL); (void)fclose(mail); - mailto = NULL; + mail = NULL; } @@ -568,7 +570,7 @@ child_process(e, u) * mailing... */ - if (mailto) { + if (mail) { Debug(DPROC, ("[%d] closing pipe to mail\n", getpid())) /* Note: the pclose will probably see From owner-svn-src-head@freebsd.org Thu Dec 26 23:06:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36A001DB58D; Thu, 26 Dec 2019 23:06:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kQYx6hLnz4R07; Thu, 26 Dec 2019 23:06:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC3657D76; Thu, 26 Dec 2019 23:06:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBQN6Td8077965; Thu, 26 Dec 2019 23:06:29 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBQN6T0v077962; Thu, 26 Dec 2019 23:06:29 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912262306.xBQN6T0v077962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 26 Dec 2019 23:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356104 - in head: contrib/llvm-project/clang/lib/AST contrib/llvm-project/compiler-rt/lib/builtins lib/libcompiler_rt X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: contrib/llvm-project/clang/lib/AST contrib/llvm-project/compiler-rt/lib/builtins lib/libcompiler_rt X-SVN-Commit-Revision: 356104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2019 23:06:30 -0000 Author: jhibbits Date: Thu Dec 26 23:06:28 2019 New Revision: 356104 URL: https://svnweb.freebsd.org/changeset/base/356104 Log: [PowerPC] enable atomic.c in compiler_rt and do not check and forces lock/lock_free decisions in compiled time Summary: Enables atomic.c in compiler_rt and forces clang to not emit a call for runtime decision about lock/lock_free. At compiling time, if clang can't decide if atomic operation can be lock free, it emits calls to external functions like `__atomic_is_lock_free`, `__c11_atomic_is_lock_free` and `__atomic_always_lock_free`, postponing decision to a runtime check. According to LLVM code documentation, the mechanism exists due to differences between x86_64 processors that can't be decided at runtime. On PowerPC and PowerPCSPE (32 bits), we already know in advance it can't be lock free, so we force the decision at compile time and avoid having to implement it in an external library. This patch was made after 32 bit users testing the PowePC32 bit ISO reported llvm could not be compiled with in-base llvm due to `__atomic_load8` not implemented. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: jhibbits, dim Differential Revision: https://reviews.freebsd.org/D22549 Modified: head/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c head/lib/libcompiler_rt/Makefile.inc Modified: head/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp Thu Dec 26 22:49:19 2019 (r356103) +++ head/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp Thu Dec 26 23:06:28 2019 (r356104) @@ -9896,6 +9896,13 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const Call } } + // Avoid emiting call for runtime decision on PowerPC 32-bit + // The lock free possibilities on this platform are covered by the lines + // above and we know in advance other cases require lock + if (Info.Ctx.getTargetInfo().getTriple().getArch() == llvm::Triple::ppc) { + return Success(0, E); + } + return BuiltinOp == Builtin::BI__atomic_always_lock_free ? Success(0, E) : Error(E); } Modified: head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c ============================================================================== --- head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c Thu Dec 26 22:49:19 2019 (r356103) +++ head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c Thu Dec 26 23:06:28 2019 (r356104) @@ -51,8 +51,8 @@ static const long SPINLOCK_MASK = SPINLOCK_COUNT - 1; //////////////////////////////////////////////////////////////////////////////// #ifdef __FreeBSD__ #include -#include #include +#include #include typedef struct _usem Lock; __inline static void unlock(Lock *l) { @@ -117,13 +117,20 @@ static __inline Lock *lock_for_pointer(void *ptr) { return locks + (hash & SPINLOCK_MASK); } -/// Macros for determining whether a size is lock free. Clang can not yet -/// codegen __atomic_is_lock_free(16), so for now we assume 16-byte values are -/// not lock free. +/// Macros for determining whether a size is lock free. #define IS_LOCK_FREE_1 __c11_atomic_is_lock_free(1) #define IS_LOCK_FREE_2 __c11_atomic_is_lock_free(2) #define IS_LOCK_FREE_4 __c11_atomic_is_lock_free(4) + +/// 32 bit PowerPC doesn't support 8-byte lock_free atomics +#if !defined(__powerpc64__) && defined(__powerpc__) +#define IS_LOCK_FREE_8 0 +#else #define IS_LOCK_FREE_8 __c11_atomic_is_lock_free(8) +#endif + +/// Clang can not yet codegen __atomic_is_lock_free(16), so for now we assume +/// 16-byte values are not lock free. #define IS_LOCK_FREE_16 0 /// Macro that calls the compiler-generated lock-free versions of functions Modified: head/lib/libcompiler_rt/Makefile.inc ============================================================================== --- head/lib/libcompiler_rt/Makefile.inc Thu Dec 26 22:49:19 2019 (r356103) +++ head/lib/libcompiler_rt/Makefile.inc Thu Dec 26 23:06:28 2019 (r356104) @@ -205,6 +205,14 @@ CFLAGS+= -DEMIT_SYNC_ATOMICS SRCF+= stdatomic .endif + +.if "${COMPILER_TYPE}" == "clang" && \ + (${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe") +SRCS+= atomic.c +CFLAGS.atomic.c+= -Wno-atomic-alignment +.endif + + .for file in ${SRCF} .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \ && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S) From owner-svn-src-head@freebsd.org Fri Dec 27 01:11:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 333671DDE29; Fri, 27 Dec 2019 01:11:27 +0000 (UTC) (envelope-from pfg@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 47kTL709Nhz4WbH; Fri, 27 Dec 2019 01:11:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0106792DF; Fri, 27 Dec 2019 01:11:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR1BQS1049761; Fri, 27 Dec 2019 01:11:26 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR1BQUZ049759; Fri, 27 Dec 2019 01:11:26 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201912270111.xBR1BQUZ049759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 27 Dec 2019 01:11:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356106 - head/lib/msun/bsdsrc X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/msun/bsdsrc X-SVN-Commit-Revision: 356106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 01:11:27 -0000 Author: pfg Date: Fri Dec 27 01:11:26 2019 New Revision: 356106 URL: https://svnweb.freebsd.org/changeset/base/356106 Log: msun: drop clause 3 from the Berkeley license. Per the University California Regents letter, drop the so-called "advertisement" clause. Discussed with: bde, kargl (2017) Differential Revision: https://reviews.freebsd.org/D22928 Modified: head/lib/msun/bsdsrc/b_exp.c head/lib/msun/bsdsrc/b_log.c head/lib/msun/bsdsrc/b_tgamma.c Modified: head/lib/msun/bsdsrc/b_exp.c ============================================================================== --- head/lib/msun/bsdsrc/b_exp.c Fri Dec 27 00:49:49 2019 (r356105) +++ head/lib/msun/bsdsrc/b_exp.c Fri Dec 27 01:11:26 2019 (r356106) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * Modified: head/lib/msun/bsdsrc/b_log.c ============================================================================== --- head/lib/msun/bsdsrc/b_log.c Fri Dec 27 00:49:49 2019 (r356105) +++ head/lib/msun/bsdsrc/b_log.c Fri Dec 27 01:11:26 2019 (r356106) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * Modified: head/lib/msun/bsdsrc/b_tgamma.c ============================================================================== --- head/lib/msun/bsdsrc/b_tgamma.c Fri Dec 27 00:49:49 2019 (r356105) +++ head/lib/msun/bsdsrc/b_tgamma.c Fri Dec 27 01:11:26 2019 (r356106) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * From owner-svn-src-head@freebsd.org Fri Dec 27 01:12:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 958B81DE064; Fri, 27 Dec 2019 01:12:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kTMp3TJ2z4Wty; Fri, 27 Dec 2019 01:12:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72617945A; Fri, 27 Dec 2019 01:12:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR1CsOt053619; Fri, 27 Dec 2019 01:12:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR1CsAc053618; Fri, 27 Dec 2019 01:12:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912270112.xBR1CsAc053618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 27 Dec 2019 01:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356107 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 356107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 01:12:54 -0000 Author: markj Date: Fri Dec 27 01:12:54 2019 New Revision: 356107 URL: https://svnweb.freebsd.org/changeset/base/356107 Log: Plug some ifaddr refcount leaks. - Only take an ifaddr ref in in rt_exportinfo() if the caller explicitly requests it. Take care to release it in this case. - Don't unconditionally take a ref in rtrequest1_fib(). rt_getifa_fib() will acquire a reference, in which case we would previously acquire two references. - Stop taking a reference in rtinit1() before calling rtrequest1_fib(). rtrequest1_fib() will acquire a reference for the RTM_ADD case. PR: 242746 Reviewed by: melifaro (previous version) Tested by: ghuckriede@blackberry.com MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22912 Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Fri Dec 27 01:11:26 2019 (r356106) +++ head/sys/net/route.c Fri Dec 27 01:12:54 2019 (r356107) @@ -833,7 +833,7 @@ rtrequest_fib(int req, * to reflect size of the provided buffer. if no NHR_COPY is specified, * point dst,netmask and gw @info fields to appropriate @rt values. * - * if @flags contains NHR_REF, do refcouting on rt_ifp. + * if @flags contains NHR_REF, do refcouting on rt_ifp and rt_ifa. * * Returns 0 on success. */ @@ -903,10 +903,9 @@ rt_exportinfo(struct rtentry *rt, struct rt_addrinfo * info->rti_flags = rt->rt_flags; info->rti_ifp = rt->rt_ifp; info->rti_ifa = rt->rt_ifa; - ifa_ref(info->rti_ifa); if (flags & NHR_REF) { - /* Do 'traditional' refcouting */ if_ref(info->rti_ifp); + ifa_ref(info->rti_ifa); } return (0); @@ -916,8 +915,8 @@ rt_exportinfo(struct rtentry *rt, struct rt_addrinfo * * Lookups up route entry for @dst in RIB database for fib @fibnum. * Exports entry data to @info using rt_exportinfo(). * - * if @flags contains NHR_REF, refcouting is performed on rt_ifp. - * All references can be released later by calling rib_free_info() + * If @flags contains NHR_REF, refcouting is performed on rt_ifp and rt_ifa. + * All references can be released later by calling rib_free_info(). * * Returns 0 on success. * Returns ENOENT for lookup failure, ENOMEM for export failure. @@ -963,6 +962,7 @@ void rib_free_info(struct rt_addrinfo *info) { + ifa_free(info->rti_ifa); if_rele(info->rti_ifp); } @@ -1631,9 +1631,12 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru error = rt_getifa_fib(info, fibnum); if (error) return (error); + } else { + ifa_ref(info->rti_ifa); } rt = uma_zalloc(V_rtzone, M_NOWAIT); if (rt == NULL) { + ifa_free(info->rti_ifa); return (ENOBUFS); } rt->rt_flags = RTF_UP | flags; @@ -1642,6 +1645,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru * Add the gateway. Possibly re-malloc-ing the storage for it. */ if ((error = rt_setgate(rt, dst, gateway)) != 0) { + ifa_free(info->rti_ifa); uma_zfree(V_rtzone, rt); return (error); } @@ -1665,7 +1669,6 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru * examine the ifa and ifa->ifa_ifp if it so desires. */ ifa = info->rti_ifa; - ifa_ref(ifa); rt->rt_ifa = ifa; rt->rt_ifp = ifa->ifa_ifp; rt->rt_weight = 1; @@ -2108,7 +2111,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fi * Do the actual request */ bzero((caddr_t)&info, sizeof(info)); - ifa_ref(ifa); info.rti_ifa = ifa; info.rti_flags = flags | (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; @@ -2122,7 +2124,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fi info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr; info.rti_info[RTAX_NETMASK] = netmask; error = rtrequest1_fib(cmd, &info, &rt, fibnum); - if (error == 0 && rt != NULL) { /* * notify any listening routing agents of the change From owner-svn-src-head@freebsd.org Fri Dec 27 01:36:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3AFB1DEAE4; Fri, 27 Dec 2019 01:36:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kTvV4pLLz4Y3r; Fri, 27 Dec 2019 01:36:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BC069818; Fri, 27 Dec 2019 01:36:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR1asCY065837; Fri, 27 Dec 2019 01:36:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR1aruf065831; Fri, 27 Dec 2019 01:36:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912270136.xBR1aruf065831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Dec 2019 01:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356108 - head/sys/geom/vinum X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/vinum X-SVN-Commit-Revision: 356108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 01:36:54 -0000 Author: mav Date: Fri Dec 27 01:36:53 2019 New Revision: 356108 URL: https://svnweb.freebsd.org/changeset/base/356108 Log: Reimplement gvinum orphanization. gvinum was the only GEOM class, using consumer nstart/nend fields. Making it do its own accounting for orphanization purposes allows in perspective to remove burden of that expensive for SMP accounting from GEOM. Also the previous implementation spinned in a tight event loop, waiting for all active BIOs to complete, while the new one knows exactly when it is possible to close the consumer. MFC after: 1 month Sponsored by: iXsystems, Inc. Modified: head/sys/geom/vinum/geom_vinum.h head/sys/geom/vinum/geom_vinum_events.c head/sys/geom/vinum/geom_vinum_plex.c head/sys/geom/vinum/geom_vinum_raid5.c head/sys/geom/vinum/geom_vinum_var.h head/sys/geom/vinum/geom_vinum_volume.c Modified: head/sys/geom/vinum/geom_vinum.h ============================================================================== --- head/sys/geom/vinum/geom_vinum.h Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum.h Fri Dec 27 01:36:53 2019 (r356108) @@ -127,6 +127,7 @@ void gv_post_event(struct gv_softc *, int, void *, voi void gv_worker_exit(struct gv_softc *); struct gv_event *gv_get_event(struct gv_softc *); void gv_remove_event(struct gv_softc *, struct gv_event *); +void gv_drive_done(struct gv_drive *); void gv_drive_tasted(struct gv_softc *, struct g_provider *); void gv_drive_lost(struct gv_softc *, struct gv_drive *); void gv_setup_objects(struct gv_softc *); Modified: head/sys/geom/vinum/geom_vinum_events.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_events.c Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum_events.c Fri Dec 27 01:36:53 2019 (r356108) @@ -195,6 +195,20 @@ failed: } /* + * Count completed BIOs and handle orphanization when all are done. + */ +void +gv_drive_done(struct gv_drive *d) +{ + + KASSERT(d->active >= 0, ("Negative number of BIOs (%d)", d->active)); + if (--d->active == 0 && (d->flags & GV_DRIVE_ORPHANED)) { + d->flags &= ~GV_DRIVE_ORPHANED; + gv_post_event(d->vinumconf, GV_EVENT_DRIVE_LOST, d, NULL, 0, 0); + } +} + +/* * When losing a drive (e.g. hardware failure), we cut down the consumer * attached to the underlying device and bring the drive itself to a * "referenced" state so that normal tasting could bring it up cleanly if it @@ -214,10 +228,10 @@ gv_drive_lost(struct gv_softc *sc, struct gv_drive *d) cp = d->consumer; if (cp != NULL) { - if (cp->nstart != cp->nend) { - G_VINUM_DEBUG(0, "dead drive '%s' has still active " + if (d->active > 0) { + G_VINUM_DEBUG(2, "dead drive '%s' has still active " "requests, unable to detach consumer", d->name); - gv_post_event(sc, GV_EVENT_DRIVE_LOST, d, NULL, 0, 0); + d->flags |= GV_DRIVE_ORPHANED; return; } g_topology_lock(); Modified: head/sys/geom/vinum/geom_vinum_plex.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_plex.c Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum_plex.c Fri Dec 27 01:36:53 2019 (r356108) @@ -278,6 +278,7 @@ gv_plex_normal_request(struct gv_plex *p, struct bio * cbp->bio_data = addr; cbp->bio_done = gv_done; cbp->bio_caller1 = s; + s->drive_sc->active++; /* Store the sub-requests now and let others issue them. */ bioq_insert_tail(p->bqueue, cbp); @@ -580,10 +581,10 @@ gv_sync_request(struct gv_plex *from, struct gv_plex * return (ENOMEM); } bp->bio_length = length; - bp->bio_done = gv_done; + bp->bio_done = NULL; bp->bio_pflags |= GV_BIO_SYNCREQ; bp->bio_offset = offset; - bp->bio_caller1 = from; + bp->bio_caller1 = from; bp->bio_caller2 = to; bp->bio_cmd = type; if (data == NULL) @@ -694,7 +695,7 @@ gv_grow_request(struct gv_plex *p, off_t offset, off_t } bp->bio_cmd = type; - bp->bio_done = gv_done; + bp->bio_done = NULL; bp->bio_error = 0; bp->bio_caller1 = p; bp->bio_offset = offset; @@ -802,7 +803,7 @@ gv_init_request(struct gv_sd *s, off_t start, caddr_t } bp->bio_cmd = BIO_WRITE; bp->bio_data = data; - bp->bio_done = gv_done; + bp->bio_done = NULL; bp->bio_error = 0; bp->bio_length = length; bp->bio_pflags |= GV_BIO_INIT; @@ -819,6 +820,7 @@ gv_init_request(struct gv_sd *s, off_t start, caddr_t } cbp->bio_done = gv_done; cbp->bio_caller1 = s; + d->active++; /* Send it off to the consumer. */ g_io_request(cbp, cp); } @@ -905,7 +907,7 @@ gv_parity_request(struct gv_plex *p, int flags, off_t } bp->bio_cmd = BIO_WRITE; - bp->bio_done = gv_done; + bp->bio_done = NULL; bp->bio_error = 0; bp->bio_length = p->stripesize; bp->bio_caller1 = p; Modified: head/sys/geom/vinum/geom_vinum_raid5.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_raid5.c Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum_raid5.c Fri Dec 27 01:36:53 2019 (r356108) @@ -93,11 +93,13 @@ gv_raid5_start(struct gv_plex *p, struct bio *bp, cadd if (wp->waiting != NULL) { if (wp->waiting->bio_cflags & GV_BIO_MALLOC) g_free(wp->waiting->bio_data); + gv_drive_done(wp->waiting->bio_caller1); g_destroy_bio(wp->waiting); } if (wp->parity != NULL) { if (wp->parity->bio_cflags & GV_BIO_MALLOC) g_free(wp->parity->bio_data); + gv_drive_done(wp->parity->bio_caller1); g_destroy_bio(wp->parity); } g_free(wp); @@ -118,6 +120,7 @@ gv_raid5_start(struct gv_plex *p, struct bio *bp, cadd while (cbp != NULL) { if (cbp->bio_cflags & GV_BIO_MALLOC) g_free(cbp->bio_data); + gv_drive_done(cbp->bio_caller1); g_destroy_bio(cbp); cbp = bioq_takefirst(p->bqueue); } @@ -657,6 +660,7 @@ gv_raid5_clone_bio(struct bio *bp, struct gv_sd *s, st cbp->bio_length = wp->length; cbp->bio_done = gv_done; cbp->bio_caller1 = s; + s->drive_sc->active++; if (use_wp) cbp->bio_caller2 = wp; Modified: head/sys/geom/vinum/geom_vinum_var.h ============================================================================== --- head/sys/geom/vinum/geom_vinum_var.h Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum_var.h Fri Dec 27 01:36:53 2019 (r356108) @@ -260,10 +260,12 @@ struct gv_drive { #define GV_DRIVE_REFERENCED 0x01 /* The drive isn't really existing, but was referenced by a subdisk during taste. */ +#define GV_DRIVE_ORPHANED 0x02 /* The drive was orphaned. */ struct gv_hdr *hdr; /* The drive header. */ struct g_consumer *consumer; /* Consumer attached to this drive. */ + int active; /* Number of active requests. */ int freelist_entries; /* Count of freelist entries. */ LIST_HEAD(,gv_freelist) freelist; /* List of freelist entries. */ Modified: head/sys/geom/vinum/geom_vinum_volume.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_volume.c Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum_volume.c Fri Dec 27 01:36:53 2019 (r356108) @@ -163,4 +163,6 @@ gv_bio_done(struct gv_softc *sc, struct bio *bp) gv_plex_raid5_done(p, bp); break; } + + gv_drive_done(s->drive_sc); } From owner-svn-src-head@freebsd.org Fri Dec 27 01:50:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 820BF1DEDA8; Fri, 27 Dec 2019 01:50:17 +0000 (UTC) (envelope-from jeff@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 47kVBx2t7bz4YSG; Fri, 27 Dec 2019 01:50:17 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 59B5899D4; Fri, 27 Dec 2019 01:50:17 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR1oHFJ071622; Fri, 27 Dec 2019 01:50:17 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR1oHnD071621; Fri, 27 Dec 2019 01:50:17 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912270150.xBR1oHnD071621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 27 Dec 2019 01:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356109 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 01:50:17 -0000 Author: jeff Date: Fri Dec 27 01:50:16 2019 New Revision: 356109 URL: https://svnweb.freebsd.org/changeset/base/356109 Log: Fix a pair of bugs introduced in r356002. When we reclaim physical pages we allocate them with VM_ALLOC_NOOBJ which means they are not busy. For now move the busy assert for the new page in vm_page_replace into the public api and out of the private api used by contig reclaim. Fix another issue where we would leak busy if the page could not be removed from pmap. Reported by: pho Discussed with: markj Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Dec 27 01:36:53 2019 (r356108) +++ head/sys/vm/vm_page.c Fri Dec 27 01:50:16 2019 (r356109) @@ -1751,7 +1751,6 @@ vm_page_replace_hold(vm_page_t mnew, vm_object_t objec bool dropped; VM_OBJECT_ASSERT_WLOCKED(object); - vm_page_assert_xbusied(mnew); vm_page_assert_xbusied(mold); KASSERT(mnew->object == NULL && (mnew->ref_count & VPRC_OBJREF) == 0, ("vm_page_replace: page %p already in object", mnew)); @@ -1795,6 +1794,8 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm vm_page_t mold) { + vm_page_assert_xbusied(mnew); + if (vm_page_replace_hold(mnew, object, pindex, mold)) vm_page_free(mold); } @@ -2793,6 +2794,7 @@ retry: */ if (object->ref_count != 0 && !vm_page_try_remove_all(m)) { + vm_page_xunbusy(m); vm_page_free(m_new); error = EBUSY; goto unlock; From owner-svn-src-head@freebsd.org Fri Dec 27 03:54:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39F3C1E1673; Fri, 27 Dec 2019 03:54:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kXyD0nzdz4f67; Fri, 27 Dec 2019 03:54:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 167D1B153; Fri, 27 Dec 2019 03:54:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR3sRgF048263; Fri, 27 Dec 2019 03:54:27 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR3sRHr048261; Fri, 27 Dec 2019 03:54:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912270354.xBR3sRHr048261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 27 Dec 2019 03:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356111 - in head/share: man/man7 mk X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/share: man/man7 mk X-SVN-Commit-Revision: 356111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 03:54:28 -0000 Author: jhibbits Date: Fri Dec 27 03:54:27 2019 New Revision: 356111 URL: https://svnweb.freebsd.org/changeset/base/356111 Log: Use LLVM as default toolchain for all PowerPC targets This enables LLVM as the default compiler for powerpc, powerpc64, and powerpcspe, as well as LLD as the default linker for powerpc64. LLD is not yet ready for prime time for powerpc and powerpcspe, but work is continuing on it. Submitted by: alfredo.junior_eldorado.org.br Relnotes: YES Differential Revision: https://reviews.freebsd.org/D20378 Modified: head/share/man/man7/arch.7 head/share/mk/src.opts.mk Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Fri Dec 27 03:00:18 2019 (r356110) +++ head/share/man/man7/arch.7 Fri Dec 27 03:54:27 2019 (r356111) @@ -323,9 +323,9 @@ This table shows the default tool chain for each archi .It mips64el Ta GCC 4.2.1 Ta GNU ld 2.17.50 .It mips64elhf Ta GCC 4.2.1 Ta GNU ld 2.17.50 .It mips64hf Ta GCC 4.2.1 Ta GNU ld 2.17.50 -.It powerpc Ta GCC 4.2.1 Ta GNU ld 2.17.50 -.It powerpcspe Ta GCC 4.2.1 Ta GNU ld 2.17.50 -.It powerpc64 Ta GCC 4.2.1 Ta GNU ld 2.17.50 +.It powerpc Ta Clang Ta GNU ld 2.17.50 +.It powerpcspe Ta Clang Ta GNU ld 2.17.50 +.It powerpc64 Ta Clang Ta lld .It riscv64 Ta GCC(1) Ta GNU ld(1) .It riscv64sf Ta GCC(1) Ta GNU ld(1) .It sparc64 Ta GCC 4.2.1 Ta GNU ld 2.17.50 @@ -339,7 +339,7 @@ Any CPU architectures not migrated by then may be removed from the tree after that date. Unless the make variable .Dv MAKE_OBSOLETE_GCC -is defined, make universe will not build mips, powerpc, nor sparc64 +is defined, make universe will not build mips or sparc64 architectures unless the xtoolchain binaries have been installed for the architecture. .Ss MACHINE_ARCH vs MACHINE_CPUARCH vs MACHINE Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Dec 27 03:00:18 2019 (r356110) +++ head/share/mk/src.opts.mk Fri Dec 27 03:54:27 2019 (r356111) @@ -305,7 +305,8 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF # build Clang without using an external compiler. .if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \ - ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") + ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386" || \ + ${__TT} == "powerpc") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC @@ -328,13 +329,13 @@ BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BO BROKEN_OPTIONS+=OFED .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ - ${__T:Mriscv*} != "" || ${__TT} == "mips" + ${__TT} == "powerpc" || ${__T:Mriscv*} != "" || ${__TT} == "mips" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv6" || \ - ${__T} == "armv7" || ${__T} == "i386" + ${__T} == "armv7" || ${__T} == "i386" || ${__T} == "powerpc64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD From owner-svn-src-head@freebsd.org Fri Dec 27 04:00:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 866421E1A35; Fri, 27 Dec 2019 04:00:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kY4j31Nvz4fVf; Fri, 27 Dec 2019 04:00:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62B15B17B; Fri, 27 Dec 2019 04:00:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR40552048756; Fri, 27 Dec 2019 04:00:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR405Fx048755; Fri, 27 Dec 2019 04:00:05 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912270400.xBR405Fx048755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 27 Dec 2019 04:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356112 - in head/contrib/llvm-project: clang/lib/Basic/Targets llvm/lib/Target/PowerPC X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/contrib/llvm-project: clang/lib/Basic/Targets llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 356112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 04:00:05 -0000 Author: jhibbits Date: Fri Dec 27 04:00:04 2019 New Revision: 356112 URL: https://svnweb.freebsd.org/changeset/base/356112 Log: [PowerPC64] Starting from FreeBSD 13.0, default to ELFv2 ABI This changes the LLVM default powerpc64 ABI to ELFv2, if target OS is FreeBSD >= 13.0 This will also be sent upstream. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: dim, luporl Relnotes: YES Differential Revision: https://reviews.freebsd.org/D20383 Modified: head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Modified: head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h ============================================================================== --- head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h Fri Dec 27 03:54:27 2019 (r356111) +++ head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h Fri Dec 27 04:00:04 2019 (r356112) @@ -375,12 +375,29 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public IntMaxType = SignedLong; Int64Type = SignedLong; + if (Triple.getEnvironment() != llvm::Triple::UnknownEnvironment) { + switch (Triple.getEnvironment()){ + case llvm::Triple::ELFv1: + ABI = "elfv1"; + break; + default: + ABI = "elfv2"; + break; + } + } else { + if ((Triple.getOS() == llvm::Triple::FreeBSD) && + (Triple.getOSMajorVersion() < 13)) { + ABI = "elfv1"; + } else { + ABI = "elfv2"; + } + } + + if ((Triple.getArch() == llvm::Triple::ppc64le)) { resetDataLayout("e-m:e-i64:64-n32:64"); - ABI = "elfv2"; } else { resetDataLayout("E-m:e-i64:64-n32:64"); - ABI = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1"; } if (Triple.getOS() == llvm::Triple::AIX) Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Fri Dec 27 03:54:27 2019 (r356111) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Fri Dec 27 04:00:04 2019 (r356112) @@ -209,6 +209,20 @@ static PPCTargetMachine::PPCABI computeTargetABI(const if (TT.isMacOSX()) return PPCTargetMachine::PPC_ABI_UNKNOWN; + if (TT.isOSFreeBSD()) { + switch (TT.getArch()) { + case Triple::ppc64le: + case Triple::ppc64: + if (TT.getOSMajorVersion() >= 13) + return PPCTargetMachine::PPC_ABI_ELFv2; + else + return PPCTargetMachine::PPC_ABI_ELFv1; + case Triple::ppc: + default: + return PPCTargetMachine::PPC_ABI_UNKNOWN; + } + } + switch (TT.getArch()) { case Triple::ppc64le: return PPCTargetMachine::PPC_ABI_ELFv2; From owner-svn-src-head@freebsd.org Fri Dec 27 04:07:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFB1A1E1CD5; Fri, 27 Dec 2019 04:07:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kYDm4WBbz4ftl; Fri, 27 Dec 2019 04:07:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95DB2B33B; Fri, 27 Dec 2019 04:07:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR474SE054691; Fri, 27 Dec 2019 04:07:04 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR473Zh054687; Fri, 27 Dec 2019 04:07:03 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912270407.xBR473Zh054687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 27 Dec 2019 04:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356113 - in head: libexec/rtld-elf sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: libexec/rtld-elf sys/kern sys/sys X-SVN-Commit-Revision: 356113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 04:07:04 -0000 Author: jhibbits Date: Fri Dec 27 04:07:03 2019 New Revision: 356113 URL: https://svnweb.freebsd.org/changeset/base/356113 Log: Eliminate the last MI difference in AT_* definitions (for powerpc). Summary: As a transition aide, implement an alternative elfN_freebsd_fixup which is called for old powerpc binaries. Similarly, add a translation to rtld to convert old values to new ones (as expected by a new rtld). Translation of old<->new values is incomplete, but sufficient to allow an installworld of a new userspace from an old one when a new kernel is running. Test Plan: Someone needs to see how a new kernel/rtld/libc works with an old binary. If if works we can probalby ship this. If not we probalby need some more compat bits. Submitted by: brooks Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20799 Modified: head/libexec/rtld-elf/rtld.c head/sys/kern/imgact_elf.c head/sys/sys/elf_common.h head/sys/sys/param.h Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Fri Dec 27 04:00:04 2019 (r356112) +++ head/libexec/rtld-elf/rtld.c Fri Dec 27 04:07:03 2019 (r356113) @@ -382,6 +382,9 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr caddr_t imgentry; char buf[MAXPATHLEN]; int argc, fd, i, phnum, rtld_argc; +#ifdef __powerpc__ + int old_auxv_format = 1; +#endif bool dir_enable, explicit_fd, search_in_path; /* @@ -407,7 +410,28 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { if (auxp->a_type < AT_COUNT) aux_info[auxp->a_type] = auxp; +#ifdef __powerpc__ + if (auxp->a_type == 23) /* AT_STACKPROT */ + old_auxv_format = 0; +#endif } + +#ifdef __powerpc__ + if (old_auxv_format) { + /* Remap from old-style auxv numbers. */ + aux_info[23] = aux_info[21]; /* AT_STACKPROT */ + aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */ + aux_info[19] = aux_info[17]; /* AT_NCPUS */ + aux_info[17] = aux_info[15]; /* AT_CANARYLEN */ + aux_info[15] = aux_info[13]; /* AT_EXECPATH */ + aux_info[13] = NULL; /* AT_GID */ + + aux_info[20] = aux_info[18]; /* AT_PAGESIZES */ + aux_info[18] = aux_info[16]; /* AT_OSRELDATE */ + aux_info[16] = aux_info[14]; /* AT_CANARY */ + aux_info[14] = NULL; /* AT_EGID */ + } +#endif /* Initialize and relocate ourselves. */ assert(aux_info[AT_BASE] != NULL); Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Fri Dec 27 04:00:04 2019 (r356112) +++ head/sys/kern/imgact_elf.c Fri Dec 27 04:07:03 2019 (r356113) @@ -1323,6 +1323,102 @@ ret: #define suword __CONCAT(suword, __ELF_WORD_SIZE) +#ifdef __powerpc__ +#define OLD_AT_NULL AT_NULL +#define OLD_AT_IGNORE AT_IGNORE +#define OLD_AT_EXECFD AT_EXECFD +#define OLD_AT_PHDR AT_PHDR +#define OLD_AT_PHENT AT_PHENT +#define OLD_AT_PHNUM AT_PHNUM +#define OLD_AT_PAGESZ AT_PAGESZ +#define OLD_AT_BASE AT_BASE +#define OLD_AT_FLAGS AT_FLAGS +#define OLD_AT_ENTRY AT_ENTRY +#define OLD_AT_NOTELF AT_NOTELF +#define OLD_AT_UID AT_UID +#define OLD_AT_EUID AT_EUID +#define OLD_AT_EXECPATH 13 +#define OLD_AT_CANARY 14 +#define OLD_AT_CANARYLEN 15 +#define OLD_AT_OSRELDATE 16 +#define OLD_AT_NCPUS 17 +#define OLD_AT_PAGESIZES 18 +#define OLD_AT_PAGESIZESLEN 19 +#define OLD_AT_STACKPROT 21 +#define OLD_AT_TIMEKEEP AT_TIMEKEEP +#define OLD_AT_EHDRFLAGS AT_EHDRFLAGS +#define OLD_AT_HWCAP AT_HWCAP +#define OLD_AT_HWCAP2 AT_HWCAP2 + +#define OLD_AT_COUNT 27 /* Count of defined aux entry types. */ + +static int +__elfN(freebsd_fixup_old_auxargs)(register_t **stack_base, + struct image_params *imgp) +{ + Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; + Elf_Auxinfo *argarray, *pos; + Elf_Addr *base, *auxbase; + int error; + + base = (Elf_Addr *)*stack_base; + auxbase = base + imgp->args->argc + 1 + imgp->args->envc + 1; + argarray = pos = malloc(OLD_AT_COUNT * sizeof(*pos), M_TEMP, + M_WAITOK | M_ZERO); + + if (args->execfd != -1) + AUXARGS_ENTRY(pos, OLD_AT_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, OLD_AT_PHDR, args->phdr); + AUXARGS_ENTRY(pos, OLD_AT_PHENT, args->phent); + AUXARGS_ENTRY(pos, OLD_AT_PHNUM, args->phnum); + AUXARGS_ENTRY(pos, OLD_AT_PAGESZ, args->pagesz); + AUXARGS_ENTRY(pos, OLD_AT_FLAGS, args->flags); + AUXARGS_ENTRY(pos, OLD_AT_ENTRY, args->entry); + AUXARGS_ENTRY(pos, OLD_AT_BASE, args->base); + AUXARGS_ENTRY(pos, OLD_AT_EHDRFLAGS, args->hdr_eflags); + if (imgp->execpathp != 0) + AUXARGS_ENTRY(pos, OLD_AT_EXECPATH, imgp->execpathp); + AUXARGS_ENTRY(pos, OLD_AT_OSRELDATE, + imgp->proc->p_ucred->cr_prison->pr_osreldate); + if (imgp->canary != 0) { + AUXARGS_ENTRY(pos, OLD_AT_CANARY, imgp->canary); + AUXARGS_ENTRY(pos, OLD_AT_CANARYLEN, imgp->canarylen); + } + AUXARGS_ENTRY(pos, OLD_AT_NCPUS, mp_ncpus); + if (imgp->pagesizes != 0) { + AUXARGS_ENTRY(pos, OLD_AT_PAGESIZES, imgp->pagesizes); + AUXARGS_ENTRY(pos, OLD_AT_PAGESIZESLEN, imgp->pagesizeslen); + } + if (imgp->sysent->sv_timekeep_base != 0) { + AUXARGS_ENTRY(pos, OLD_AT_TIMEKEEP, + imgp->sysent->sv_timekeep_base); + } + AUXARGS_ENTRY(pos, OLD_AT_STACKPROT, imgp->sysent->sv_shared_page_obj + != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : + imgp->sysent->sv_stackprot); + if (imgp->sysent->sv_hwcap != NULL) + AUXARGS_ENTRY(pos, OLD_AT_HWCAP, *imgp->sysent->sv_hwcap); + if (imgp->sysent->sv_hwcap2 != NULL) + AUXARGS_ENTRY(pos, OLD_AT_HWCAP2, *imgp->sysent->sv_hwcap2); + AUXARGS_ENTRY(pos, OLD_AT_NULL, 0); + + free(imgp->auxargs, M_TEMP); + imgp->auxargs = NULL; + KASSERT(pos - argarray <= OLD_AT_COUNT, ("Too many auxargs")); + + error = copyout(argarray, auxbase, sizeof(*argarray) * OLD_AT_COUNT); + free(argarray, M_TEMP); + if (error != 0) + return (error); + + base--; + if (suword(base, imgp->args->argc) == -1) + return (EFAULT); + *stack_base = (register_t *)base; + return (0); +} +#endif /* __powerpc__ */ + int __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base) { @@ -1382,6 +1478,11 @@ int __elfN(freebsd_fixup)(uintptr_t *stack_base, struct image_params *imgp) { Elf_Addr *base; + +#ifdef __powerpc__ + if (imgp->proc->p_osrel < P_OSREL_POWERPC_NEW_AUX_ARGS) + return (__elfN(freebsd_fixup_old_auxargs)(stack_base, imgp)); +#endif /* __powerpc__ */ base = (Elf_Addr *)*stack_base; base--; Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Fri Dec 27 04:00:04 2019 (r356112) +++ head/sys/sys/elf_common.h Fri Dec 27 04:07:03 2019 (r356113) @@ -935,7 +935,6 @@ typedef struct { #define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_UID 11 /* Real uid. */ #define AT_EUID 12 /* Effective uid. */ -#ifndef __powerpc__ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ #define AT_EXECPATH 15 /* Path to the executable. */ @@ -945,20 +944,8 @@ typedef struct { #define AT_NCPUS 19 /* Number of CPUs. */ #define AT_PAGESIZES 20 /* Pagesizes. */ #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ -#else /* defined(__powerpc__) */ -#define AT_EXECPATH 13 -#define AT_CANARY 14 -#define AT_CANARYLEN 15 -#define AT_OSRELDATE 16 -#define AT_NCPUS 17 -#define AT_PAGESIZES 18 -#define AT_PAGESIZESLEN 19 -#define AT_STACKPROT 21 -#endif /* defined(__powerpc__) */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ -#ifndef __powerpc__ #define AT_STACKPROT 23 /* Initial stack protection. */ -#endif #define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ #define AT_HWCAP 25 /* CPU feature flags. */ #define AT_HWCAP2 26 /* CPU feature flags 2. */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Dec 27 04:00:04 2019 (r356112) +++ head/sys/sys/param.h Fri Dec 27 04:07:03 2019 (r356113) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300069 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300070 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, @@ -90,6 +90,7 @@ #define P_OSREL_VMTOTAL64 1200054 #define P_OSREL_CK_SUPERBLOCK 1300000 #define P_OSREL_CK_INODE 1300005 +#define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif From owner-svn-src-head@freebsd.org Fri Dec 27 04:07:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DD151E1D62; Fri, 27 Dec 2019 04:07:51 +0000 (UTC) (envelope-from bdragon@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 47kYFg3CBGz4g2K; Fri, 27 Dec 2019 04:07:51 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 692ECB33F; Fri, 27 Dec 2019 04:07:51 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR47pX3054766; Fri, 27 Dec 2019 04:07:51 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR47pE1054765; Fri, 27 Dec 2019 04:07:51 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912270407.xBR47pE1054765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 27 Dec 2019 04:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356114 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 356114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 04:07:51 -0000 Author: bdragon Date: Fri Dec 27 04:07:51 2019 New Revision: 356114 URL: https://svnweb.freebsd.org/changeset/base/356114 Log: [PowerPC] Switch to PIC kernel modules on powerpc* To improve reliability of kernel modules after the clang switch, switch to -fPIC when building for now. This bypasses some limitations to the way clang and LLD handle relocations, and is a more robustly tested compilation regime than the "static shared object" mode that we were previously attempting to convince the compiler stack to use. The kernel linker was recently augmented to be able to handle this mode. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22798 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Fri Dec 27 04:07:03 2019 (r356113) +++ head/sys/conf/kmod.mk Fri Dec 27 04:07:51 2019 (r356114) @@ -132,7 +132,8 @@ CFLAGS+= ${DEBUG_FLAGS} CFLAGS+= -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer .endif -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" || \ + ${MACHINE_CPUARCH} == "powerpc" CFLAGS+= -fPIC .endif From owner-svn-src-head@freebsd.org Fri Dec 27 04:11:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2FA31E1E36; Fri, 27 Dec 2019 04:11:14 +0000 (UTC) (envelope-from brd@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 47kYKZ5GNcz4gJn; Fri, 27 Dec 2019 04:11:14 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AFF62B483; Fri, 27 Dec 2019 04:11:14 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR4BEX6055017; Fri, 27 Dec 2019 04:11:14 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR4BE6I055016; Fri, 27 Dec 2019 04:11:14 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201912270411.xBR4BE6I055016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Fri, 27 Dec 2019 04:11:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356115 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 356115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 04:11:14 -0000 Author: brd Date: Fri Dec 27 04:11:14 2019 New Revision: 356115 URL: https://svnweb.freebsd.org/changeset/base/356115 Log: [gpioths] Fix GPIOTHS_DEBUG Chase the removal of dev from gpioths_dht_readbytes() in r355540. Reviewed by: ian Approved by: will (mentor) Differential Revision: https://reviews.freebsd.org/D22926 Modified: head/sys/dev/gpio/gpioths.c Modified: head/sys/dev/gpio/gpioths.c ============================================================================== --- head/sys/dev/gpio/gpioths.c Fri Dec 27 04:07:51 2019 (r356114) +++ head/sys/dev/gpio/gpioths.c Fri Dec 27 04:11:14 2019 (r356115) @@ -220,10 +220,10 @@ gpioths_dht_readbytes(struct gpioths_softc *sc) #ifdef GPIOTHS_DEBUG /* Debug bits */ for (i = 0; i < GPIOTHS_DHT_CYCLES; i++) - device_printf(dev, "%d: %d %d\n", i, calibrations[i], + device_printf(sc->dev, "%d: %d %d\n", i, calibrations[i], intervals[i]); - device_printf(dev, "len=%d, data=%x, crc=%x/%x\n", avglen, value, crc, + device_printf(sc->dev, "len=%d, data=%x, crc=%x/%x\n", avglen, value, crc, calc); #endif /* GPIOTHS_DEBUG */ From owner-svn-src-head@freebsd.org Fri Dec 27 04:42:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 814D61E25EF; Fri, 27 Dec 2019 04:42:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kZ182cgDz3Cy7; Fri, 27 Dec 2019 04:42:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 553DEBA22; Fri, 27 Dec 2019 04:42:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR4g4MO075098; Fri, 27 Dec 2019 04:42:04 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR4g4hO075097; Fri, 27 Dec 2019 04:42:04 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912270442.xBR4g4hO075097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 27 Dec 2019 04:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356116 - head X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 356116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 04:42:04 -0000 Author: jhibbits Date: Fri Dec 27 04:42:03 2019 New Revision: 356116 URL: https://svnweb.freebsd.org/changeset/base/356116 Log: Add a note to UPDATING on the move to clang for powerpc* Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Dec 27 04:11:14 2019 (r356115) +++ head/UPDATING Fri Dec 27 04:42:03 2019 (r356116) @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20191226: + Clang/LLVM is now the default compiler for all powerpc architectures. + LLD is now the default linker for powerpc64. The change for powerpc64 + also includes a change to the ELFv2 ABI, incompatible with the existing + ABI. + +20191226: Kernel-loadable random(4) modules are no longer unloadable. 20191222: From owner-svn-src-head@freebsd.org Fri Dec 27 04:52:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DA821E2D12; Fri, 27 Dec 2019 04:52:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kZDy2LzQz3Dd5; Fri, 27 Dec 2019 04:52:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C2A2BC9C; Fri, 27 Dec 2019 04:52:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR4qIP1083062; Fri, 27 Dec 2019 04:52:18 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR4qI8N083061; Fri, 27 Dec 2019 04:52:18 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912270452.xBR4qI8N083061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 27 Dec 2019 04:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356117 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 04:52:18 -0000 Author: jhibbits Date: Fri Dec 27 04:52:17 2019 New Revision: 356117 URL: https://svnweb.freebsd.org/changeset/base/356117 Log: Fix the build from r356113. Types had changed from when the patch was first created, and a final build was not done pre-commit. Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Fri Dec 27 04:42:03 2019 (r356116) +++ head/sys/kern/imgact_elf.c Fri Dec 27 04:52:17 2019 (r356117) @@ -1353,7 +1353,7 @@ ret: #define OLD_AT_COUNT 27 /* Count of defined aux entry types. */ static int -__elfN(freebsd_fixup_old_auxargs)(register_t **stack_base, +__elfN(freebsd_fixup_old_auxargs)(uintptr_t *stack_base, struct image_params *imgp) { Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; @@ -1414,7 +1414,7 @@ __elfN(freebsd_fixup_old_auxargs)(register_t **stack_b base--; if (suword(base, imgp->args->argc) == -1) return (EFAULT); - *stack_base = (register_t *)base; + *stack_base = (uintptr_t)base; return (0); } #endif /* __powerpc__ */ From owner-svn-src-head@freebsd.org Fri Dec 27 05:01:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF1E01E2FAF; Fri, 27 Dec 2019 05:01:14 +0000 (UTC) (envelope-from bdragon@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 47kZRG5bf8z3Dq0; Fri, 27 Dec 2019 05:01:14 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 BB54EBE16; Fri, 27 Dec 2019 05:01:14 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBR51EKk085340; Fri, 27 Dec 2019 05:01:14 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBR51EVl085337; Fri, 27 Dec 2019 05:01:14 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912270501.xBR51EVl085337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 27 Dec 2019 05:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356118 - in head/sys: conf contrib/ncsw/Peripherals/BM contrib/ncsw/Peripherals/QM X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys: conf contrib/ncsw/Peripherals/BM contrib/ncsw/Peripherals/QM X-SVN-Commit-Revision: 356118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 05:01:14 -0000 Author: bdragon Date: Fri Dec 27 05:01:13 2019 New Revision: 356118 URL: https://svnweb.freebsd.org/changeset/base/356118 Log: [PowerPC] Clang powerpcspe build fixes * Fix a couple of format errors. * Add some extra compiler flags needed to force clang to build SPE code. (These are temporary until the target triple is fixed) Modified: head/sys/conf/Makefile.powerpc head/sys/contrib/ncsw/Peripherals/BM/bm.h head/sys/contrib/ncsw/Peripherals/QM/qm.c Modified: head/sys/conf/Makefile.powerpc ============================================================================== --- head/sys/conf/Makefile.powerpc Fri Dec 27 04:52:17 2019 (r356117) +++ head/sys/conf/Makefile.powerpc Fri Dec 27 05:01:13 2019 (r356118) @@ -37,7 +37,9 @@ INCLUDES+= -I$S/contrib/libfdt .if "${MACHINE_ARCH}" == "powerpcspe" # Force __SPE__, since the builtin will be removed later with -mno-spe -CFLAGS+= -mabi=spe -D__SPE__ +CFLAGS.gcc+= -mabi=spe -D__SPE__ +CFLAGS.clang+= -mspe -D__SPE__ -m32 +HACK_EXTRA_FLAGS= -shared -m32 -mspe -D__SPE__ .endif CFLAGS+= -msoft-float CFLAGS.gcc+= -Wa,-many Modified: head/sys/contrib/ncsw/Peripherals/BM/bm.h ============================================================================== --- head/sys/contrib/ncsw/Peripherals/BM/bm.h Fri Dec 27 04:52:17 2019 (r356117) +++ head/sys/contrib/ncsw/Peripherals/BM/bm.h Fri Dec 27 05:01:13 2019 (r356118) @@ -395,7 +395,7 @@ static __inline__ uint32_t BmBpidGet(t_Bm *p_Bm, bool size, alignment, "BM BPID MEM"); - KASSERT(ans < UINT32_MAX, ("Oops, %lx > UINT32_MAX!\n", ans)); + KASSERT(ans < UINT32_MAX, ("Oops, %jx > UINT32_MAX!\n", (uintmax_t)ans)); return (uint32_t)ans; } Modified: head/sys/contrib/ncsw/Peripherals/QM/qm.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/QM/qm.c Fri Dec 27 04:52:17 2019 (r356117) +++ head/sys/contrib/ncsw/Peripherals/QM/qm.c Fri Dec 27 05:01:13 2019 (r356118) @@ -560,7 +560,7 @@ uint32_t QmFqidGet(t_Qm *p_Qm, uint32_t size, uint32_t "QM FQID MEM"); XX_UnlockIntrSpinlock(p_Qm->lock, intFlags); - KASSERT(ans < UINT32_MAX, ("Oops, %lx > UINT32_MAX!\n", ans)); + KASSERT(ans < UINT32_MAX, ("Oops, %jx > UINT32_MAX!\n", (uintmax_t)ans)); return (uint32_t)ans; } From owner-svn-src-head@freebsd.org Fri Dec 27 09:39:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECAC81E8E18; Fri, 27 Dec 2019 09:39:21 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47khc83SqVz3R1N; Fri, 27 Dec 2019 09:39:19 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.110.112]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ikm5V-0000Vc-Fe; Fri, 27 Dec 2019 10:39:17 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Justin Hibbits" Subject: Re: svn commit: r356116 - head References: <201912270442.xBR4g4hO075097@repo.freebsd.org> Date: Fri, 27 Dec 2019 10:39:21 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: <201912270442.xBR4g4hO075097@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: -0.2 X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 autolearn=disabled version=3.4.2 X-Scan-Signature: 12f61b0c8dc8dcc8c992b8e1fde77987 X-Rspamd-Queue-Id: 47khc83SqVz3R1N X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ronald-lists@klop.ws designates 195.190.28.88 as permitted sender) smtp.mailfrom=ronald-lists@klop.ws X-Spamd-Result: default: False [-2.53 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:195.190.28.64/27]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[klop.ws]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE(-0.74)[ip: (-0.79), ipnet: 195.190.28.0/24(-0.30), asn: 47172(-2.62), country: NL(0.03)]; RCVD_IN_DNSWL_NONE(0.00)[88.28.190.195.list.dnswl.org : 127.0.10.0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:47172, ipnet:195.190.28.0/24, country:NL]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 09:39:22 -0000 Do powerpc people need to do something special while updating? Like a clean buildkernel/buildworld. Or is this just a note for historical bookkeeping? Regards, Ronald. On Fri, 27 Dec 2019 05:42:04 +0100, Justin Hibbits wrote: > Author: jhibbits > Date: Fri Dec 27 04:42:03 2019 > New Revision: 356116 > URL: https://svnweb.freebsd.org/changeset/base/356116 > > Log: > Add a note to UPDATING on the move to clang for powerpc* > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Fri Dec 27 04:11:14 2019 (r356115) > +++ head/UPDATING Fri Dec 27 04:42:03 2019 (r356116) > @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > 20191226: > + Clang/LLVM is now the default compiler for all powerpc architectures. > + LLD is now the default linker for powerpc64. The change for powerpc64 > + also includes a change to the ELFv2 ABI, incompatible with the existing > + ABI. > + > +20191226: > Kernel-loadable random(4) modules are no longer unloadable. > 20191222: > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Fri Dec 27 11:19:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7813A1EA898; Fri, 27 Dec 2019 11:19:58 +0000 (UTC) (envelope-from mjg@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 47kkrG2ckYz40T6; Fri, 27 Dec 2019 11:19:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54FC1180D8; Fri, 27 Dec 2019 11:19:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBRBJwIb007952; Fri, 27 Dec 2019 11:19:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRBJvFF007947; Fri, 27 Dec 2019 11:19:57 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912271119.xBRBJvFF007947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Dec 2019 11:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356119 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 356119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 11:19:58 -0000 Author: mjg Date: Fri Dec 27 11:19:57 2019 New Revision: 356119 URL: https://svnweb.freebsd.org/changeset/base/356119 Log: Add read-mostly sleepable locks To be used when like rmlocks, except when sleeping for readers needs to be allowed. See the manpage for more information. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D22823 Modified: head/share/man/man9/rmlock.9 head/sys/kern/kern_rmlock.c head/sys/sys/_rmlock.h head/sys/sys/rmlock.h Modified: head/share/man/man9/rmlock.9 ============================================================================== --- head/share/man/man9/rmlock.9 Fri Dec 27 05:01:13 2019 (r356118) +++ head/share/man/man9/rmlock.9 Fri Dec 27 11:19:57 2019 (r356119) @@ -26,7 +26,7 @@ .\" $FreeBSD$ .\" .\" Based on rwlock.9 man page -.Dd November 11, 2017 +.Dd December 27, 2019 .Dt RMLOCK 9 .Os .Sh NAME @@ -43,7 +43,13 @@ .Nm rm_sleep , .Nm rm_assert , .Nm RM_SYSINIT , -.Nm RM_SYSINIT_FLAGS +.Nm RM_SYSINIT_FLAGS , +.Nm rms_init , +.Nm rms_destroy , +.Nm rms_rlock , +.Nm rms_wlock , +.Nm rms_runlock , +.Nm rms_wunlock .Nd kernel reader/writer lock optimized for read-mostly access patterns .Sh SYNOPSIS .In sys/param.h @@ -77,6 +83,18 @@ .In sys/kernel.h .Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc" .Fn RM_SYSINIT_FLAGS "name" "struct rmlock *rm" "const char *desc" "int flags" +.Ft void +.Fn rms_init "struct rmslock *rms" "const char *name" +.Ft void +.Fn rms_destroy "struct rmslock *rms" +.Ft void +.Fn rms_rlock "struct rmslock *rms" +.Ft void +.Fn rms_wlock "struct rmslock *rms" +.Ft void +.Fn rms_runlock "struct rmslock *rms" +.Ft void +.Fn rms_wunlock "struct rmslock *rms" .Sh DESCRIPTION Read-mostly locks allow shared access to protected data by multiple threads, or exclusive access by a single thread. @@ -113,22 +131,22 @@ Readers can recurse if the lock is initialized with th option; however, writers are never allowed to recurse. .Pp -Sleepable read-mostly locks are created by passing +Sleeping for writers can be allowed by passing .Dv RM_SLEEPABLE to .Fn rm_init_flags . -Unlike normal read-mostly locks, -sleepable read-mostly locks follow the same lock ordering rules as +It changes lock ordering rules to the same as for .Xr sx 9 locks. -Sleepable read-mostly locks do not propagate priority to writers, -but they do propagate priority to readers. -Writers are permitted to sleep while holding a read-mostly lock, -but readers are not. -Unlike other sleepable locks such as +They do not propagate priority to writers, but they do propagate priority to +readers. Note that readers are not permitted to sleep regardless of the flag. +.Pp +Sleepable read-mostly locks (created with +.Fn rms_init ) +allow sleeping for both readers and writers, but don't do priority propagation +for either. They follow .Xr sx 9 -locks, -readers must use try operations on other sleepable locks to avoid sleeping. +lock ordering. .Ss Macros and Functions .Bl -tag -width indent .It Fn rm_init "struct rmlock *rm" "const char *name" @@ -286,6 +304,43 @@ Assert that the current thread does not hold a recursi .Fa rm . .El .El +.Bl -tag -width indent +.It Fn rms_init "struct rmslock *rms" "const char *name" +Initialize the sleepable read-mostly lock +.Fa rms . +The +.Fa name +description is used as +.Fa wmesg +parameter to the +.Xr msleep 9 +routine. +This function must be called before any other operations on the lock. +.It Fn rms_rlock "struct rmlock *rm" +Lock +.Fa rms +as a reader. +If any thread holds this lock exclusively, the current thread blocks. +.It Fn rms_wlock "struct rmslock *rms" +Lock +.Fa rms +as a writer. +If the lock is already taken, the current thread blocks. +The +.Fn rms_wlock +function cannot be called recursively. +.It Fn rms_runlock "struct rmslock *rms" +This function releases a shared lock previously acquired by +.Fn rms_rlock . +.It Fn rms_wunlock "struct rmslock *rms" +This function releases an exclusive lock previously acquired by +.Fn rms_wlock . +.It Fn rms_destroy "struct rmslock *rms" +This functions destroys a lock previously initialized with +.Fn rms_init . +The +.Fa rms +lock must be unlocked. .Sh SEE ALSO .Xr locking 9 , .Xr mutex 9 , Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Fri Dec 27 05:01:13 2019 (r356118) +++ head/sys/kern/kern_rmlock.c Fri Dec 27 11:19:57 2019 (r356119) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef DDB #include @@ -853,3 +854,241 @@ db_show_rm(const struct lock_object *lock) lc->lc_ddb_show(&rm->rm_wlock_object); } #endif + +/* + * Read-mostly sleepable locks. + * + * These primitives allow both readers and writers to sleep. However, neither + * readers nor writers are tracked and subsequently there is no priority + * propagation. + * + * They are intended to be only used when write-locking is almost never needed + * (e.g., they can guard against unloading a kernel module) while read-locking + * happens all the time. + * + * Concurrent writers take turns taking the lock while going off cpu. If this is + * of concern for your usecase, this is not the right primitive. + * + * Neither rms_rlock nor rms_runlock use fences. Instead compiler barriers are + * inserted to prevert reordering of generated code. Execution ordering is + * provided with the use of an IPI handler. + */ + +void +rms_init(struct rmslock *rms, const char *name) +{ + + rms->writers = 0; + rms->readers = 0; + mtx_init(&rms->mtx, name, NULL, MTX_DEF | MTX_NEW); + rms->readers_pcpu = uma_zalloc_pcpu(pcpu_zone_int, M_WAITOK | M_ZERO); + rms->readers_influx = uma_zalloc_pcpu(pcpu_zone_int, M_WAITOK | M_ZERO); +} + +void +rms_destroy(struct rmslock *rms) +{ + + MPASS(rms->writers == 0); + MPASS(rms->readers == 0); + mtx_destroy(&rms->mtx); + uma_zfree_pcpu(pcpu_zone_int, rms->readers_pcpu); + uma_zfree_pcpu(pcpu_zone_int, rms->readers_influx); +} + +static void __noinline +rms_rlock_fallback(struct rmslock *rms) +{ + + (*zpcpu_get(rms->readers_influx)) = 0; + critical_exit(); + + mtx_lock(&rms->mtx); + MPASS(*zpcpu_get(rms->readers_pcpu) == 0); + while (rms->writers > 0) + msleep(&rms->readers, &rms->mtx, PUSER - 1, mtx_name(&rms->mtx), 0); + (*zpcpu_get(rms->readers_pcpu))++; + mtx_unlock(&rms->mtx); +} + +void +rms_rlock(struct rmslock *rms) +{ + int *influx; + + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + + critical_enter(); + influx = zpcpu_get(rms->readers_influx); + __compiler_membar(); + *influx = 1; + __compiler_membar(); + if (__predict_false(rms->writers > 0)) { + rms_rlock_fallback(rms); + return; + } + __compiler_membar(); + (*zpcpu_get(rms->readers_pcpu))++; + __compiler_membar(); + *influx = 0; + critical_exit(); +} + +static void __noinline +rms_runlock_fallback(struct rmslock *rms) +{ + + (*zpcpu_get(rms->readers_influx)) = 0; + critical_exit(); + + mtx_lock(&rms->mtx); + MPASS(*zpcpu_get(rms->readers_pcpu) == 0); + MPASS(rms->writers > 0); + MPASS(rms->readers > 0); + rms->readers--; + if (rms->readers == 0) + wakeup_one(&rms->writers); + mtx_unlock(&rms->mtx); +} + +void +rms_runlock(struct rmslock *rms) +{ + int *influx; + + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + + critical_enter(); + influx = zpcpu_get(rms->readers_influx); + __compiler_membar(); + *influx = 1; + __compiler_membar(); + if (__predict_false(rms->writers > 0)) { + rms_runlock_fallback(rms); + return; + } + __compiler_membar(); + (*zpcpu_get(rms->readers_pcpu))--; + __compiler_membar(); + *influx = 0; + critical_exit(); +} + +struct rmslock_ipi { + struct rmslock *rms; + cpuset_t signal; +}; + +static void +rms_wlock_IPI(void *arg) +{ + struct rmslock_ipi *rmsipi; + struct rmslock *rms; + int readers; + + rmsipi = arg; + rms = rmsipi->rms; + + if (*zpcpu_get(rms->readers_influx)) + return; + readers = zpcpu_replace(rms->readers_pcpu, 0); + if (readers != 0) + atomic_add_int(&rms->readers, readers); + CPU_CLR_ATOMIC(curcpu, &rmsipi->signal); +} + +static void +rms_wlock_switch(struct rmslock *rms) +{ + struct rmslock_ipi rmsipi; + int *in_op; + int cpu; + + MPASS(rms->readers == 0); + MPASS(rms->writers == 1); + + rmsipi.rms = rms; + + /* + * Publishes rms->writers. rlock and runlock will get this ordered + * via IPI in the worst case. + */ + atomic_thread_fence_rel(); + + /* + * Collect reader counts from all CPUs using an IPI. The handler can + * find itself running while the interrupted CPU was doing either + * rlock or runlock in which case it will fail. + * + * Successful attempts clear the cpu id in the bitmap. + * + * In case of failure we observe all failing CPUs not executing there to + * determine when to make the next attempt. Note that threads having + * the var set have preemption disabled. Setting of readers_influx + * only uses compiler barriers making these loads unreliable, which is + * fine -- the IPI handler will always see the correct result. + * + * We retry until all counts are collected. Forward progress is + * guaranteed by that fact that the total number of threads which can + * be caught like this is finite and they all are going to block on + * their own. + */ + CPU_COPY(&all_cpus, &rmsipi.signal); + for (;;) { + smp_rendezvous_cpus( + rmsipi.signal, + smp_no_rendezvous_barrier, + rms_wlock_IPI, + smp_no_rendezvous_barrier, + &rmsipi); + + if (CPU_EMPTY(&rmsipi.signal)) + break; + + CPU_FOREACH(cpu) { + if (!CPU_ISSET(cpu, &rmsipi.signal)) + continue; + in_op = zpcpu_get_cpu(rms->readers_influx, cpu); + while (atomic_load_int(in_op)) + cpu_spinwait(); + } + } +} + +void +rms_wlock(struct rmslock *rms) +{ + + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + + mtx_lock(&rms->mtx); + rms->writers++; + if (rms->writers > 1) { + msleep(&rms->writers, &rms->mtx, PUSER - 1 | PDROP, mtx_name(&rms->mtx), 0); + MPASS(rms->readers == 0); + return; + } + + rms_wlock_switch(rms); + + if (rms->readers > 0) + msleep(&rms->writers, &rms->mtx, PUSER - 1 | PDROP, mtx_name(&rms->mtx), 0); + else + mtx_unlock(&rms->mtx); + MPASS(rms->readers == 0); +} + +void +rms_wunlock(struct rmslock *rms) +{ + + mtx_lock(&rms->mtx); + MPASS(rms->writers >= 1); + MPASS(rms->readers == 0); + rms->writers--; + if (rms->writers > 0) + wakeup_one(&rms->writers); + else + wakeup(&rms->readers); + mtx_unlock(&rms->mtx); +} Modified: head/sys/sys/_rmlock.h ============================================================================== --- head/sys/sys/_rmlock.h Fri Dec 27 05:01:13 2019 (r356118) +++ head/sys/sys/_rmlock.h Fri Dec 27 11:19:57 2019 (r356119) @@ -68,4 +68,14 @@ struct rm_priotracker { LIST_ENTRY(rm_priotracker) rmp_qentry; }; +#include + +struct rmslock { + struct mtx mtx; + int writers; + int readers; + int *readers_pcpu; + int *readers_influx; +}; + #endif /* !_SYS__RMLOCK_H_ */ Modified: head/sys/sys/rmlock.h ============================================================================== --- head/sys/sys/rmlock.h Fri Dec 27 05:01:13 2019 (r356118) +++ head/sys/sys/rmlock.h Fri Dec 27 11:19:57 2019 (r356119) @@ -133,5 +133,12 @@ struct rm_args { #define rm_assert(rm, what) #endif +void rms_init(struct rmslock *rms, const char *name); +void rms_destroy(struct rmslock *rms); +void rms_rlock(struct rmslock *rms); +void rms_runlock(struct rmslock *rms); +void rms_wlock(struct rmslock *rms); +void rms_wunlock(struct rmslock *rms); + #endif /* _KERNEL */ #endif /* !_SYS_RMLOCK_H_ */ From owner-svn-src-head@freebsd.org Fri Dec 27 11:23:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 062D01EAB6B; Fri, 27 Dec 2019 11:23:33 +0000 (UTC) (envelope-from mjg@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 47kkwN67TFz411y; Fri, 27 Dec 2019 11:23:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDBA5182B8; Fri, 27 Dec 2019 11:23:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBRBNW5t013540; Fri, 27 Dec 2019 11:23:32 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRBNWow013539; Fri, 27 Dec 2019 11:23:32 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912271123.xBRBNWow013539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Dec 2019 11:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356120 - head/sys/security/mac X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/security/mac X-SVN-Commit-Revision: 356120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 11:23:33 -0000 Author: mjg Date: Fri Dec 27 11:23:32 2019 New Revision: 356120 URL: https://svnweb.freebsd.org/changeset/base/356120 Log: mac: use a sleepable rmlock instead of an sx lock If any non-static modules are loaded (and mac_ntpd tends to be), the lock is taken all the time al over the kernel. On platforms like arm64 this results in an avoidable significant performance degradation. Since write-locking is almost never needed, use a primitive optimized towards read-locking. Sample result of building the kernel on tmpfs 11 times: stock 11142.80s user 6704.44s system 4924% cpu 6:02.42 total patched 11118.95s user 2374.94s system 4547% cpu 4:56.71 total Modified: head/sys/security/mac/mac_framework.c Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Fri Dec 27 11:19:57 2019 (r356119) +++ head/sys/security/mac/mac_framework.c Fri Dec 27 11:23:32 2019 (r356120) @@ -176,6 +176,7 @@ MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC temporary lab #ifndef MAC_STATIC static struct rmlock mac_policy_rm; /* Non-sleeping entry points. */ static struct sx mac_policy_sx; /* Sleeping entry points. */ +static struct rmslock mac_policy_rms; #endif struct mac_policy_list_head mac_policy_list; @@ -209,7 +210,7 @@ mac_policy_slock_sleep(void) if (!mac_late) return; - sx_slock(&mac_policy_sx); + rms_rlock(&mac_policy_rms); #endif } @@ -233,7 +234,7 @@ mac_policy_sunlock_sleep(void) if (!mac_late) return; - sx_sunlock(&mac_policy_sx); + rms_runlock(&mac_policy_rms); #endif } @@ -249,6 +250,7 @@ mac_policy_xlock(void) return; sx_xlock(&mac_policy_sx); + rms_wlock(&mac_policy_rms); rm_wlock(&mac_policy_rm); #endif } @@ -262,6 +264,7 @@ mac_policy_xunlock(void) return; rm_wunlock(&mac_policy_rm); + rms_wunlock(&mac_policy_rms); sx_xunlock(&mac_policy_sx); #endif } @@ -294,6 +297,7 @@ mac_init(void) rm_init_flags(&mac_policy_rm, "mac_policy_rm", RM_NOWITNESS | RM_RECURSE); sx_init_flags(&mac_policy_sx, "mac_policy_sx", SX_NOWITNESS); + rms_init(&mac_policy_rms, "mac_policy_rms"); #endif } From owner-svn-src-head@freebsd.org Fri Dec 27 11:26:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12C321EAC11; Fri, 27 Dec 2019 11:26:13 +0000 (UTC) (envelope-from mjg@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 47kkzS6mFzz418l; Fri, 27 Dec 2019 11:26:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE93C182B9; Fri, 27 Dec 2019 11:26:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBRBQCRX013707; Fri, 27 Dec 2019 11:26:12 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRBQCd3013706; Fri, 27 Dec 2019 11:26:12 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912271126.xBRBQCd3013706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Dec 2019 11:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356121 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 11:26:13 -0000 Author: mjg Date: Fri Dec 27 11:26:12 2019 New Revision: 356121 URL: https://svnweb.freebsd.org/changeset/base/356121 Log: vfs: remove production kernel checks and mp == NULL support from vdrop 1. The only place in the tree which calls getnewvnode with mp == NULL does it for vp_crossmp which will never execute this codepath. Any vnode which legally has ->v_mount == NULL is also doomed, which once more wont execute this code. 2. Remove an assertion for v_holdcnt from production kernels. It gets taken care of by refcount macros in debug kernels. Any code which would want to pass NULL mp can construct a fake one instead. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D22722 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Dec 27 11:23:32 2019 (r356120) +++ head/sys/kern/vfs_subr.c Fri Dec 27 11:26:12 2019 (r356121) @@ -3225,35 +3225,20 @@ vdrop_deactivate(struct vnode *vp) ("vdrop: freeing when we shouldn't")); if ((vp->v_iflag & VI_OWEINACT) == 0) { mp = vp->v_mount; - if (mp != NULL) { - mtx_lock(&mp->mnt_listmtx); - if (vp->v_iflag & VI_ACTIVE) { - vp->v_iflag &= ~VI_ACTIVE; - TAILQ_REMOVE(&mp->mnt_activevnodelist, - vp, v_actfreelist); - mp->mnt_activevnodelistsize--; - } - TAILQ_INSERT_TAIL(&mp->mnt_tmpfreevnodelist, - vp, v_actfreelist); - mp->mnt_tmpfreevnodelistsize++; - vp->v_iflag |= VI_FREE; - vp->v_mflag |= VMP_TMPMNTFREELIST; - VI_UNLOCK(vp); - if (mp->mnt_tmpfreevnodelistsize >= - mnt_free_list_batch) - vnlru_return_batch_locked(mp); - mtx_unlock(&mp->mnt_listmtx); - } else { - VNASSERT((vp->v_iflag & VI_ACTIVE) == 0, vp, - ("vdrop: active vnode not on per mount vnode list")); - mtx_lock(&vnode_free_list_mtx); - TAILQ_INSERT_TAIL(&vnode_free_list, vp, - v_actfreelist); - freevnodes++; - vp->v_iflag |= VI_FREE; - VI_UNLOCK(vp); - mtx_unlock(&vnode_free_list_mtx); + mtx_lock(&mp->mnt_listmtx); + if (vp->v_iflag & VI_ACTIVE) { + vp->v_iflag &= ~VI_ACTIVE; + TAILQ_REMOVE(&mp->mnt_activevnodelist, vp, v_actfreelist); + mp->mnt_activevnodelistsize--; } + TAILQ_INSERT_TAIL(&mp->mnt_tmpfreevnodelist, vp, v_actfreelist); + mp->mnt_tmpfreevnodelistsize++; + vp->v_iflag |= VI_FREE; + vp->v_mflag |= VMP_TMPMNTFREELIST; + VI_UNLOCK(vp); + if (mp->mnt_tmpfreevnodelistsize >= mnt_free_list_batch) + vnlru_return_batch_locked(mp); + mtx_unlock(&mp->mnt_listmtx); } else { VI_UNLOCK(vp); counter_u64_add(free_owe_inact, 1); @@ -3266,10 +3251,6 @@ vdrop(struct vnode *vp) ASSERT_VI_UNLOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (__predict_false((int)vp->v_holdcnt <= 0)) { - vn_printf(vp, "vdrop: holdcnt %d", vp->v_holdcnt); - panic("vdrop: wrong holdcnt"); - } if (refcount_release_if_not_last(&vp->v_holdcnt)) return; VI_LOCK(vp); @@ -3282,10 +3263,6 @@ vdropl(struct vnode *vp) ASSERT_VI_LOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (__predict_false((int)vp->v_holdcnt <= 0)) { - vn_printf(vp, "vdrop: holdcnt %d", vp->v_holdcnt); - panic("vdrop: wrong holdcnt"); - } if (!refcount_release(&vp->v_holdcnt)) { VI_UNLOCK(vp); return; From owner-svn-src-head@freebsd.org Fri Dec 27 11:35:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F31151EAF85; Fri, 27 Dec 2019 11:35:15 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47kl9t5LB3z41gq; Fri, 27 Dec 2019 11:35:14 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.110.112]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ikntg-00035u-E4; Fri, 27 Dec 2019 12:35:12 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Mateusz Guzik" Subject: Re: svn commit: r356120 - head/sys/security/mac References: <201912271123.xBRBNWow013539@repo.freebsd.org> Date: Fri, 27 Dec 2019 12:33:56 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: <201912271123.xBRBNWow013539@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: -0.2 X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 autolearn=disabled version=3.4.2 X-Scan-Signature: d3d6c6694e059b137bd8e4e2c0542d46 X-Rspamd-Queue-Id: 47kl9t5LB3z41gq X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ronald-lists@klop.ws designates 195.190.28.88 as permitted sender) smtp.mailfrom=ronald-lists@klop.ws X-Spamd-Result: default: False [-2.53 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:195.190.28.64/27]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[klop.ws]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE(-0.73)[ip: (-0.76), ipnet: 195.190.28.0/24(-0.29), asn: 47172(-2.60), country: NL(0.03)]; RCVD_IN_DNSWL_NONE(0.00)[88.28.190.195.list.dnswl.org : 127.0.10.0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:47172, ipnet:195.190.28.0/24, country:NL]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 11:35:16 -0000 On Fri, 27 Dec 2019 12:23:32 +0100, Mateusz Guzik wrote: > Author: mjg > Date: Fri Dec 27 11:23:32 2019 > New Revision: 356120 > URL: https://svnweb.freebsd.org/changeset/base/356120 > > Log: > mac: use a sleepable rmlock instead of an sx lock > If any non-static modules are loaded (and mac_ntpd tends to be), the > lock is > taken all the time al over the kernel. On platforms like arm64 this > results in > an avoidable significant performance degradation. Since write-locking > is almost > never needed, use a primitive optimized towards read-locking. > Sample result of building the kernel on tmpfs 11 times: > stock 11142.80s user 6704.44s system 4924% cpu 6:02.42 total > patched 11118.95s user 2374.94s system 4547% cpu 4:56.71 total Wow, this looks like a winner. Ronald. > > Modified: > head/sys/security/mac/mac_framework.c > > Modified: head/sys/security/mac/mac_framework.c > ============================================================================== > --- head/sys/security/mac/mac_framework.c Fri Dec 27 11:19:57 > 2019 (r356119) > +++ head/sys/security/mac/mac_framework.c Fri Dec 27 11:23:32 > 2019 (r356120) > @@ -176,6 +176,7 @@ MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC temporary > lab > #ifndef MAC_STATIC > static struct rmlock mac_policy_rm; /* Non-sleeping entry points. */ > static struct sx mac_policy_sx; /* Sleeping entry points. */ > +static struct rmslock mac_policy_rms; > #endif > struct mac_policy_list_head mac_policy_list; > @@ -209,7 +210,7 @@ mac_policy_slock_sleep(void) > if (!mac_late) > return; > - sx_slock(&mac_policy_sx); > + rms_rlock(&mac_policy_rms); > #endif > } > @@ -233,7 +234,7 @@ mac_policy_sunlock_sleep(void) > if (!mac_late) > return; > - sx_sunlock(&mac_policy_sx); > + rms_runlock(&mac_policy_rms); > #endif > } > @@ -249,6 +250,7 @@ mac_policy_xlock(void) > return; > sx_xlock(&mac_policy_sx); > + rms_wlock(&mac_policy_rms); > rm_wlock(&mac_policy_rm); > #endif > } > @@ -262,6 +264,7 @@ mac_policy_xunlock(void) > return; > rm_wunlock(&mac_policy_rm); > + rms_wunlock(&mac_policy_rms); > sx_xunlock(&mac_policy_sx); > #endif > } > @@ -294,6 +297,7 @@ mac_init(void) > rm_init_flags(&mac_policy_rm, "mac_policy_rm", RM_NOWITNESS | > RM_RECURSE); > sx_init_flags(&mac_policy_sx, "mac_policy_sx", SX_NOWITNESS); > + rms_init(&mac_policy_rms, "mac_policy_rms"); > #endif > } > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Fri Dec 27 11:51:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DF9A1EB465; Fri, 27 Dec 2019 11:51:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 47klXf5ZGlz42Lb; Fri, 27 Dec 2019 11:51:30 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C92892600E1; Fri, 27 Dec 2019 12:51:27 +0100 (CET) Subject: Re: svn commit: r356120 - head/sys/security/mac To: Ronald Klop , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Mateusz Guzik References: <201912271123.xBRBNWow013539@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <053d786b-b3ed-53e3-e863-45801dbcd933@selasky.org> Date: Fri, 27 Dec 2019 11:50:02 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47klXf5ZGlz42Lb X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-5.42 / 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)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(-3.12)[ip: (-9.33), ipnet: 88.99.0.0/16(-4.72), asn: 24940(-1.55), country: DE(-0.02)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 11:51:31 -0000 On 2019-12-27 12:33, Ronald Klop wrote: > Wow, this looks like a winner. > > Ronald. Is this a spin-off from epoch methodology? It is possible to use epoch as a part of read mostly locking too. The basic idea here is to have a variable/refcount which when set, fallback to a regular mutex during read-locking. This is all synchronized under epoch. Pseudo code: read_lock() { epoch_enter(); do_lock = writers != 0; if (do_lock) mtx_lock(); } read_unlock() { if (do_lock) mtx_unlock(); epoch_exit(); } write_lock() { writers++; epoch_wait(); mtx_lock(); } write_unlock() { mtx_unlock(); writers--; epoch_wait(); } --HPS From owner-svn-src-head@freebsd.org Fri Dec 27 11:53:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F0A01EB521 for ; Fri, 27 Dec 2019 11:53:43 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic301-21.consmr.mail.gq1.yahoo.com (sonic301-21.consmr.mail.gq1.yahoo.com [98.137.64.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47klbB2BWsz42XC for ; Fri, 27 Dec 2019 11:53:41 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: wna9NoQVM1ljZH4_g2L3voZD9TdmX7NJhjKCalBdqgEkzY6rmZoM0A_x4PZ6ZoI E4vCivaK_EcA2Tqj_pC_XSqIzw2eDmy3sZu2Lpath.0w7iXEtZy.utViJSJdsVmmZsj0hgC3gqDu 2UB56JZSATfkrAsVlbaXO7Lnx.HUJIXouL.ZR7JzpCr.rqUDSefjv2ILeDfrEd7mA7gJnmczYngl 2NoSa4.LPXr3vS1DXeJoGYz61Jh7_CoNZLnnQZTk14sam7T9NU7c3GKNvC8nV48q0EeYFlL7jP16 xoxIp4b_JPP51e03facPxLVPziS_.5YpHLOHneQ.nxGPbxicula.ynp4eZ7aNwN0G_BgxSuQTjhU QFKA3YAS_HoHShnYokIHf_Tkr6xDnjtc8tK0XdHHrbcLe47O4bS2jY6G9LTymxbdkchiJx6DnNeG fssaF6NeHZrt4d28XPcFhU2fAk9jyAPatQGluB22SxcH38SRjmXrRMl.Fe8uWEDpwCfTUBmWjbvv ERcZjlP_SplXsDDSSbWq9yKeQozDc8DnoYD0LBcJweTIqmZWZ1aiGS8qhXuBDj.v7eDj8JjI79kE iZqeddMWqBNxYeE8d1oJ7R.SRisXqCC_sRQicRn_3lTOdBHpzyLMhsEU2dgUGBJ8AnBYTYrM1Nch R19yKQKmlRxkPKiK5Va8jGueaDQo.03cEa79Fyeh5kMxMrjWprJg7vv.TRPXZntQxhkBdslkuo.A xrI_.OmM4j3ftogmcf5BB3O2WCBKTS82zW13xvv8ZMrlzOOWHiUzLhBFz12c0E7zFLlimMc4l.5E a1Y_NkeIeACMcgI6GXwOsflV8scrianPQ76FIyOFnHlnx2Sy93ZX8mSyFGMhyNaFBlkipWU29yt9 AqwifNyAiqW8OnKa3Pp_8CTQqWe9XIECPVoeQOoPrNGg8F8mv2YFnBDDixEKcg02d3hzrBWNVSbi 6xXygCd9zUTgcgpSPYIfy5XiVmR8j2eiTNMFTQk2X8UiQi.qoMUwicKEDbUDuC9MB9RNGDNxI62F sn57G4_8xfH_LOYeR83DRIdgMWD6Se6bd.NugY3Qv6OU10BAd48KyC5a59neifQqiRYVQuyQTEqj WSJ55hHLBAdphQvU1vvzMTtVCVGUnAHtwwp.e6ZdRuIeDl_icLeof._felRVxTTDQSyCefot5yVR d06ecMwq_q2e5ALeQJ.Wa14_Eey2Q3wl2n8sa_0ST7487z6TP3x4.WAFKH3I6luPOUhhITchvdib 7zdhu7FoairGFxxIhjI2oAWxYBze1CGCCo2qUUIohU5g.QD2LOx_x38qKIdpiFy_jaFWB_42Ae.w p88CKCk_RPajCsluQYxQH.WS8udZmV5QVQOkAZi878GcxlXkkpLKrpbcmx5hfcCu_5IME79NrKik yDJekb3PsbOruxRHIn9ltQJMzPgzy6AW__AUfD2tIGQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Fri, 27 Dec 2019 11:53:40 +0000 Received: by smtp425.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID cae4a25bb5dfcc802275082f43ce311f; Fri, 27 Dec 2019 11:53:38 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: svn commit: r356116 - head (powerpc families jumping to clang-based; powerpc64 also to ELFv2) Message-Id: Date: Fri, 27 Dec 2019 03:53:37 -0800 To: svn-src-head@freebsd.org, freebsd-ppc@freebsd.org X-Mailer: Apple Mail (2.3608.40.2.2.4) References: X-Rspamd-Queue-Id: 47klbB2BWsz42XC X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.32 / 15.00]; R_SPF_ALLOW(0.00)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; TO_DN_NONE(0.00)[]; MV_CASE(0.50)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(0.00)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; R_DKIM_ALLOW(0.00)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (5.68), ipnet: 98.137.64.0/21(0.89), asn: 36647(0.71), country: US(-0.05)]; NEURAL_SPAM_MEDIUM(0.93)[0.934,0]; BAD_REP_POLICIES(0.10)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; URIBL_PBL(0.01)[klop.ws]; NEURAL_SPAM_LONG(0.88)[0.877,0]; RCVD_IN_DNSWL_NONE(0.00)[147.64.137.98.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 11:53:43 -0000 Ronald Klop ronald-lists at klop.ws wrote on Fri Dec 27 09:39:22 UTC 2019 : QUOTE Do powerpc people need to do something special while updating? Like a clean buildkernel/buildworld. Or is this just a note for historical bookkeeping? END QUOTE See https://lists.freebsd.org/pipermail/freebsd-ppc/2019-December/011042.html But it was -r356118 before powerpc64 and 32-bit powerpc started to complete builds on ci.freebsd.org . powerpcspe still fails to build there. I agree that UPDATING could use more material guiding actions, especially for powerpc64 where the ELFv1->ELFv2 change is an ABI incompatibility. Quoting from that message: QUOTE Therefore, it is recommended to perform a complete reinstall of the system on powerpc64 platforms. END QUOTE There may well have been an implicit "from scratch" intended in that quote. No use of old port builds either for powerpc64. Those using binary updates of ports via pkg for powerpc64 may have mismatch issues around the transition. I've no clue for binary system updates (if there are such for powerpc64). (I've only built from source for world, kernel, and ports for my normal activity.) Another issue for those that build from source is the RAM use and time taken for buildworld buildkernel , at least on older or low end hardware, such as old PowerMacs. The armv7 and small board aarch64 folks experience with this may prove useful. Avoiding Out Of Memory process kills from free RAM staying low for long periods or from slow paging or other issues can be a challenge. Unfortunately, the messages complain about being "out of swap" even when that is not the issue. It is not always clear just what criteria leads to a OOM process kill, making it hard to figure out how to avoid those happening. Real "out of swap" conditions also normally report console messages of the form: . . . swap_pager_getswapspace . . .: failed Otherwise it is unlikely it is actually out of swap space. For delaying how long free RAM staying low is tolerated, one can increase vm.pageout_oom_seq from 12 to larger. The management of slow paging I've less experience with. With low enough RAM it may not be possible to have enough swap/page space to allow llvm materials to all build, even for -j1 builds. Examples follow that I use in contexts with sufficient RAM that I do not have to worry about out of swap/page space for how I buildworld buildkernel . These I've set in /etc/sysctl.conf . # # Delay when persisstent low free RAM leads to # Out Of Memory killing of processes: vm.pageout_oom_seq=120 # # For plunty of swap/paging space (will not # run out), avoid pageout delays leading to # Out Of Memory killing of processes: vm.pfault_oom_attempts=-1 Note: In my context "plunty" really means sufficient RAM that paging is rare for how I build. But others have reported on using the -1 in contexts where paging was heavy at times and OOM kills had been happening that were eliminated by the assignment (more built). I've no experience with the below alternative to that -1 use: # # For possibly insufficient swap/paging space # (might run out), increase the pageout delay # that leads to Out Of Memory killing of # processes: #vm.pfault_oom_attempts= ??? #vm.pfault_oom_wait= ??? # (The multiplication is the total but there # are other potential tradoffs in the factors # multiplied, even for nearly the same total.) There are folks that have used the likes of: vm.pageout_oom_seq=1200 (but I do not know if such was necessary for their context.) I'm not claiming that these 3 vm.??? figures are always sufficient. Nor am I claiming that tunables are always available that would be sufficient. Nor that it is easy to find the ones that do exist that might help for specific OOM kill issues. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Dec 27 12:17:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A32B1EC36B; Fri, 27 Dec 2019 12:17:18 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 47km6P2gLRz43RY; Fri, 27 Dec 2019 12:17:17 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x330.google.com with SMTP id d139so6783005wmd.0; Fri, 27 Dec 2019 04:17:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CDLq6/FrnaxfhbmEFU1qo/wa47++GmjlMpF2CDc3It8=; b=SMYyNbFtdLvWKF7lIOt756qEi52ImTcB3EqKpSaZbykCk+2F5Mk9tIxImgFAmpQgx8 NhklcN0khgJQyiUfbXgazOA5eK/FZS7YXt5MpybktGGi3JcYyU7bn+nJUmDsqjogOUw9 GF9jFw5YZIeNWOlzzOjG8c3S7IEq1bAJk+JScoyLWqlTSDCYGudGmblmsnjgGdCsBiBe czGbBf+sAMAx4mRsnZ53jbo7meNfGzYML42CGOmiDKe380HDyLLELM5d0/sA68FDgYGi eJ7li1Aoc0I8hJJ9Gt9c45ylsgK6zVVwgcMLZuXEEX2giMdP1M5rfII0AV1OIhyswnUN d65A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CDLq6/FrnaxfhbmEFU1qo/wa47++GmjlMpF2CDc3It8=; b=qh+nNhTcoVkYhkHmTJITFxEAK3keh3xZddaoE17raeZqoSFw1/fZ/feMek6+N1TXZ7 d00YZrCd7sW5mmqNKRvuNwOujJyyYppkPe+zYWgxE8pX7EMhGocbBPykUb8o0b7vJbxl jNKGErNSdyUmcTeKa5GdADHVXViJB7ioJXRq1KzTZXkTCIQiF26VR4Gdcutz+crhnb9i +z8b6Pd6YeutipK7mcgpu2P7GyTcEHoASh7kV1uQssyhWz4DZuntp/jfcA/f8MPgx/mE opSRQvdtBV5NMz/zYSNveo3IkSqpYE6QeMuzl+65Rco7S0KyJmi7GJh0fQaeSfnQi7oz mOKw== X-Gm-Message-State: APjAAAVKE2KvdL77W5JrOSflT30uC2wYQeEKUhxXTwsarJHSsoli00f1 iP1V/O3KC2/HhRCKc/9GcfEK4G8znftThdXsZ0yTHw== X-Google-Smtp-Source: APXvYqxBlHCkGn11T6k7Kedxw7e/kdSGt4dPLAwqlMyMgpPFdYwKmFg9beokfZN0UuB1Jvxgal+QC1q/VcsTMZE2/dg= X-Received: by 2002:a05:600c:24d1:: with SMTP id 17mr18568689wmu.136.1577449035289; Fri, 27 Dec 2019 04:17:15 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:6b02:0:0:0:0:0 with HTTP; Fri, 27 Dec 2019 04:17:14 -0800 (PST) In-Reply-To: <053d786b-b3ed-53e3-e863-45801dbcd933@selasky.org> References: <201912271123.xBRBNWow013539@repo.freebsd.org> <053d786b-b3ed-53e3-e863-45801dbcd933@selasky.org> From: Mateusz Guzik Date: Fri, 27 Dec 2019 13:17:14 +0100 Message-ID: Subject: Re: svn commit: r356120 - head/sys/security/mac To: Hans Petter Selasky Cc: Ronald Klop , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47km6P2gLRz43RY X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=SMYyNbFt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::330 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-9.21), ipnet: 2a00:1450::/32(-2.64), asn: 15169(-1.88), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[0.3.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 12:17:18 -0000 On 12/27/19, Hans Petter Selasky wrote: > On 2019-12-27 12:33, Ronald Klop wrote: >> Wow, this looks like a winner. >> >> Ronald. > > Is this a spin-off from epoch methodology? > > It is possible to use epoch as a part of read mostly locking too. > epoch uses explicit fences which are a completely unnecessary cost for this usecase. This is rmlocks with priority propagation removed and with an extra hack to signal do send extra IPIs if any of the target CPUs got caught in executing the fast path. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Fri Dec 27 13:37:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 954A61ED52D; Fri, 27 Dec 2019 13:37:20 +0000 (UTC) (envelope-from mjg@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 47kntm2Fpmz46cF; Fri, 27 Dec 2019 13:37:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 481FC19972; Fri, 27 Dec 2019 13:37:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBRDbKCC090781; Fri, 27 Dec 2019 13:37:20 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRDbKRS090780; Fri, 27 Dec 2019 13:37:20 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912271337.xBRDbKRS090780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Dec 2019 13:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356122 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 13:37:20 -0000 Author: mjg Date: Fri Dec 27 13:37:19 2019 New Revision: 356122 URL: https://svnweb.freebsd.org/changeset/base/356122 Log: Plug a warning in read-mostly spinlocks reported by gcc. Modified: head/sys/kern/kern_rmlock.c Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Fri Dec 27 11:26:12 2019 (r356121) +++ head/sys/kern/kern_rmlock.c Fri Dec 27 13:37:19 2019 (r356122) @@ -1064,7 +1064,8 @@ rms_wlock(struct rmslock *rms) mtx_lock(&rms->mtx); rms->writers++; if (rms->writers > 1) { - msleep(&rms->writers, &rms->mtx, PUSER - 1 | PDROP, mtx_name(&rms->mtx), 0); + msleep(&rms->writers, &rms->mtx, (PUSER - 1) | PDROP, + mtx_name(&rms->mtx), 0); MPASS(rms->readers == 0); return; } @@ -1072,7 +1073,8 @@ rms_wlock(struct rmslock *rms) rms_wlock_switch(rms); if (rms->readers > 0) - msleep(&rms->writers, &rms->mtx, PUSER - 1 | PDROP, mtx_name(&rms->mtx), 0); + msleep(&rms->writers, &rms->mtx, (PUSER - 1) | PDROP, + mtx_name(&rms->mtx), 0); else mtx_unlock(&rms->mtx); MPASS(rms->readers == 0); From owner-svn-src-head@freebsd.org Fri Dec 27 13:49:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEF971ED8CB; Fri, 27 Dec 2019 13:49:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47kp8w3cdvz47GC; Fri, 27 Dec 2019 13:49:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xBRDnK6G003477 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 27 Dec 2019 15:49:24 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xBRDnK6G003477 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xBRDnKSw003476; Fri, 27 Dec 2019 15:49:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 27 Dec 2019 15:49:20 +0200 From: Konstantin Belousov To: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356113 - in head: libexec/rtld-elf sys/kern sys/sys Message-ID: <20191227134920.GL23031@kib.kiev.ua> References: <201912270407.xBR473Zh054687@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201912270407.xBR473Zh054687@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.3 X-Spam-Checker-Version: SpamAssassin 3.4.3 (2019-12-06) on tom.home X-Rspamd-Queue-Id: 47kp8w3cdvz47GC X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 13:49:36 -0000 On Fri, Dec 27, 2019 at 04:07:03AM +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Fri Dec 27 04:07:03 2019 > New Revision: 356113 > URL: https://svnweb.freebsd.org/changeset/base/356113 > > Log: > Eliminate the last MI difference in AT_* definitions (for powerpc). > > Summary: > As a transition aide, implement an alternative elfN_freebsd_fixup which > is called for old powerpc binaries. Similarly, add a translation to rtld to > convert old values to new ones (as expected by a new rtld). > > Translation of old<->new values is incomplete, but sufficient to allow an > installworld of a new userspace from an old one when a new kernel is running. > > Test Plan: > Someone needs to see how a new kernel/rtld/libc works with an old > binary. If if works we can probalby ship this. If not we probalby need > some more compat bits. > > Submitted by: brooks > Reviewed by: jhibbits > Differential Revision: https://reviews.freebsd.org/D20799 > > Modified: > head/libexec/rtld-elf/rtld.c > head/sys/kern/imgact_elf.c > head/sys/sys/elf_common.h > head/sys/sys/param.h > > Modified: head/libexec/rtld-elf/rtld.c > ============================================================================== > --- head/libexec/rtld-elf/rtld.c Fri Dec 27 04:00:04 2019 (r356112) > +++ head/libexec/rtld-elf/rtld.c Fri Dec 27 04:07:03 2019 (r356113) > @@ -382,6 +382,9 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr > caddr_t imgentry; > char buf[MAXPATHLEN]; > int argc, fd, i, phnum, rtld_argc; > +#ifdef __powerpc__ > + int old_auxv_format = 1; > +#endif > bool dir_enable, explicit_fd, search_in_path; > > /* > @@ -407,7 +410,28 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr > for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { > if (auxp->a_type < AT_COUNT) > aux_info[auxp->a_type] = auxp; > +#ifdef __powerpc__ > + if (auxp->a_type == 23) /* AT_STACKPROT */ > + old_auxv_format = 0; > +#endif > } > + > +#ifdef __powerpc__ > + if (old_auxv_format) { > + /* Remap from old-style auxv numbers. */ > + aux_info[23] = aux_info[21]; /* AT_STACKPROT */ > + aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */ > + aux_info[19] = aux_info[17]; /* AT_NCPUS */ > + aux_info[17] = aux_info[15]; /* AT_CANARYLEN */ > + aux_info[15] = aux_info[13]; /* AT_EXECPATH */ > + aux_info[13] = NULL; /* AT_GID */ > + > + aux_info[20] = aux_info[18]; /* AT_PAGESIZES */ > + aux_info[18] = aux_info[16]; /* AT_OSRELDATE */ > + aux_info[16] = aux_info[14]; /* AT_CANARY */ > + aux_info[14] = NULL; /* AT_EGID */ > + } > +#endif > > /* Initialize and relocate ourselves. */ > assert(aux_info[AT_BASE] != NULL); > > Modified: head/sys/kern/imgact_elf.c > ============================================================================== > --- head/sys/kern/imgact_elf.c Fri Dec 27 04:00:04 2019 (r356112) > +++ head/sys/kern/imgact_elf.c Fri Dec 27 04:07:03 2019 (r356113) > @@ -1323,6 +1323,102 @@ ret: > > #define suword __CONCAT(suword, __ELF_WORD_SIZE) > > +#ifdef __powerpc__ > +#define OLD_AT_NULL AT_NULL > +#define OLD_AT_IGNORE AT_IGNORE > +#define OLD_AT_EXECFD AT_EXECFD > +#define OLD_AT_PHDR AT_PHDR > +#define OLD_AT_PHENT AT_PHENT > +#define OLD_AT_PHNUM AT_PHNUM > +#define OLD_AT_PAGESZ AT_PAGESZ > +#define OLD_AT_BASE AT_BASE > +#define OLD_AT_FLAGS AT_FLAGS > +#define OLD_AT_ENTRY AT_ENTRY > +#define OLD_AT_NOTELF AT_NOTELF > +#define OLD_AT_UID AT_UID > +#define OLD_AT_EUID AT_EUID > +#define OLD_AT_EXECPATH 13 > +#define OLD_AT_CANARY 14 > +#define OLD_AT_CANARYLEN 15 > +#define OLD_AT_OSRELDATE 16 > +#define OLD_AT_NCPUS 17 > +#define OLD_AT_PAGESIZES 18 > +#define OLD_AT_PAGESIZESLEN 19 > +#define OLD_AT_STACKPROT 21 > +#define OLD_AT_TIMEKEEP AT_TIMEKEEP > +#define OLD_AT_EHDRFLAGS AT_EHDRFLAGS > +#define OLD_AT_HWCAP AT_HWCAP > +#define OLD_AT_HWCAP2 AT_HWCAP2 > + > +#define OLD_AT_COUNT 27 /* Count of defined aux entry types. */ Arguably these definitions must be in powerpc/include/elf.h. Then you could use symbolic names in the rtld hack. Ideally the rtld hack would be moved to powerpc64 subdirectory as well, by providing an inline function, trivial on other arches. > + > +static int > +__elfN(freebsd_fixup_old_auxargs)(register_t **stack_base, > + struct image_params *imgp) > +{ > + Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; > + Elf_Auxinfo *argarray, *pos; > + Elf_Addr *base, *auxbase; > + int error; > + > + base = (Elf_Addr *)*stack_base; > + auxbase = base + imgp->args->argc + 1 + imgp->args->envc + 1; > + argarray = pos = malloc(OLD_AT_COUNT * sizeof(*pos), M_TEMP, > + M_WAITOK | M_ZERO); > + > + if (args->execfd != -1) > + AUXARGS_ENTRY(pos, OLD_AT_EXECFD, args->execfd); > + AUXARGS_ENTRY(pos, OLD_AT_PHDR, args->phdr); > + AUXARGS_ENTRY(pos, OLD_AT_PHENT, args->phent); > + AUXARGS_ENTRY(pos, OLD_AT_PHNUM, args->phnum); > + AUXARGS_ENTRY(pos, OLD_AT_PAGESZ, args->pagesz); > + AUXARGS_ENTRY(pos, OLD_AT_FLAGS, args->flags); > + AUXARGS_ENTRY(pos, OLD_AT_ENTRY, args->entry); > + AUXARGS_ENTRY(pos, OLD_AT_BASE, args->base); > + AUXARGS_ENTRY(pos, OLD_AT_EHDRFLAGS, args->hdr_eflags); > + if (imgp->execpathp != 0) > + AUXARGS_ENTRY(pos, OLD_AT_EXECPATH, imgp->execpathp); > + AUXARGS_ENTRY(pos, OLD_AT_OSRELDATE, > + imgp->proc->p_ucred->cr_prison->pr_osreldate); > + if (imgp->canary != 0) { > + AUXARGS_ENTRY(pos, OLD_AT_CANARY, imgp->canary); > + AUXARGS_ENTRY(pos, OLD_AT_CANARYLEN, imgp->canarylen); > + } > + AUXARGS_ENTRY(pos, OLD_AT_NCPUS, mp_ncpus); > + if (imgp->pagesizes != 0) { > + AUXARGS_ENTRY(pos, OLD_AT_PAGESIZES, imgp->pagesizes); > + AUXARGS_ENTRY(pos, OLD_AT_PAGESIZESLEN, imgp->pagesizeslen); > + } > + if (imgp->sysent->sv_timekeep_base != 0) { > + AUXARGS_ENTRY(pos, OLD_AT_TIMEKEEP, > + imgp->sysent->sv_timekeep_base); > + } > + AUXARGS_ENTRY(pos, OLD_AT_STACKPROT, imgp->sysent->sv_shared_page_obj > + != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : > + imgp->sysent->sv_stackprot); > + if (imgp->sysent->sv_hwcap != NULL) > + AUXARGS_ENTRY(pos, OLD_AT_HWCAP, *imgp->sysent->sv_hwcap); > + if (imgp->sysent->sv_hwcap2 != NULL) > + AUXARGS_ENTRY(pos, OLD_AT_HWCAP2, *imgp->sysent->sv_hwcap2); > + AUXARGS_ENTRY(pos, OLD_AT_NULL, 0); > + > + free(imgp->auxargs, M_TEMP); > + imgp->auxargs = NULL; > + KASSERT(pos - argarray <= OLD_AT_COUNT, ("Too many auxargs")); > + > + error = copyout(argarray, auxbase, sizeof(*argarray) * OLD_AT_COUNT); > + free(argarray, M_TEMP); > + if (error != 0) > + return (error); > + > + base--; > + if (suword(base, imgp->args->argc) == -1) > + return (EFAULT); > + *stack_base = (register_t *)base; > + return (0); > +} > +#endif /* __powerpc__ */ > + > int > __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base) > { > @@ -1382,6 +1478,11 @@ int > __elfN(freebsd_fixup)(uintptr_t *stack_base, struct image_params *imgp) > { > Elf_Addr *base; > + > +#ifdef __powerpc__ > + if (imgp->proc->p_osrel < P_OSREL_POWERPC_NEW_AUX_ARGS) > + return (__elfN(freebsd_fixup_old_auxargs)(stack_base, imgp)); > +#endif /* __powerpc__ */ And this must be moved to powerpc/powerpc/elf_machdep.c by providing MD variant of sv_fixup, instead of contaminating the MI code. > > base = (Elf_Addr *)*stack_base; > base--; > > Modified: head/sys/sys/elf_common.h > ============================================================================== > --- head/sys/sys/elf_common.h Fri Dec 27 04:00:04 2019 (r356112) > +++ head/sys/sys/elf_common.h Fri Dec 27 04:07:03 2019 (r356113) > @@ -935,7 +935,6 @@ typedef struct { > #define AT_NOTELF 10 /* Program is not ELF ?? */ > #define AT_UID 11 /* Real uid. */ > #define AT_EUID 12 /* Effective uid. */ > -#ifndef __powerpc__ > #define AT_GID 13 /* Real gid. */ > #define AT_EGID 14 /* Effective gid. */ > #define AT_EXECPATH 15 /* Path to the executable. */ > @@ -945,20 +944,8 @@ typedef struct { > #define AT_NCPUS 19 /* Number of CPUs. */ > #define AT_PAGESIZES 20 /* Pagesizes. */ > #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ > -#else /* defined(__powerpc__) */ > -#define AT_EXECPATH 13 > -#define AT_CANARY 14 > -#define AT_CANARYLEN 15 > -#define AT_OSRELDATE 16 > -#define AT_NCPUS 17 > -#define AT_PAGESIZES 18 > -#define AT_PAGESIZESLEN 19 > -#define AT_STACKPROT 21 > -#endif /* defined(__powerpc__) */ > #define AT_TIMEKEEP 22 /* Pointer to timehands. */ > -#ifndef __powerpc__ > #define AT_STACKPROT 23 /* Initial stack protection. */ > -#endif > #define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ > #define AT_HWCAP 25 /* CPU feature flags. */ > #define AT_HWCAP2 26 /* CPU feature flags 2. */ > > Modified: head/sys/sys/param.h > ============================================================================== > --- head/sys/sys/param.h Fri Dec 27 04:00:04 2019 (r356112) > +++ head/sys/sys/param.h Fri Dec 27 04:07:03 2019 (r356113) > @@ -60,7 +60,7 @@ > * in the range 5 to 9. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1300069 /* Master, propagated to newvers */ > +#define __FreeBSD_version 1300070 /* Master, propagated to newvers */ > > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, > @@ -90,6 +90,7 @@ > #define P_OSREL_VMTOTAL64 1200054 > #define P_OSREL_CK_SUPERBLOCK 1300000 > #define P_OSREL_CK_INODE 1300005 > +#define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 > > #define P_OSREL_MAJOR(x) ((x) / 100000) > #endif From owner-svn-src-head@freebsd.org Fri Dec 27 15:04:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA4F71EE7FA; Fri, 27 Dec 2019 15:04:01 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 47kqpn569Cz4B93; Fri, 27 Dec 2019 15:04:01 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 33CD22600E1; Fri, 27 Dec 2019 16:03:57 +0100 (CET) Subject: Re: svn commit: r356092 - head/sys/dev/kbdmux To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912261725.xBQHPq8u076460@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <62d80c6e-f0c0-05bb-cb22-b6cf40d4c06f@selasky.org> Date: Fri, 27 Dec 2019 15:01:56 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <201912261725.xBQHPq8u076460@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47kqpn569Cz4B93 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 15:04:01 -0000 TODO: Is there a way to distinguish between key events which are key-presses and events which are auto-repeated key-presses? --HPS From owner-svn-src-head@freebsd.org Fri Dec 27 15:33:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D6721EF0B1; Fri, 27 Dec 2019 15:33:44 +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 47krT41q1Wz4Cby; Fri, 27 Dec 2019 15:33:44 +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 399D81AF36; Fri, 27 Dec 2019 15:33:44 +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 xBRFXi1o062458; Fri, 27 Dec 2019 15:33:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRFXikU062457; Fri, 27 Dec 2019 15:33:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912271533.xBRFXikU062457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Dec 2019 15:33:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356123 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 356123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 15:33:44 -0000 Author: emaste Date: Fri Dec 27 15:33:43 2019 New Revision: 356123 URL: https://svnweb.freebsd.org/changeset/base/356123 Log: src.conf.5: regenerate after recent changes r355588 Fix WITHOUT_CLANG build r355646 Revert r354348 r355943 add LDNS build knob dependency on OPENSSL r356111 Use LLVM as default toolchain for all PowerPC targets Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Fri Dec 27 13:37:19 2019 (r356122) +++ head/share/man/man5/src.conf.5 Fri Dec 27 15:33:43 2019 (r356123) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd November 20, 2019 +.Dd December 27, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -376,43 +376,6 @@ When set, it enforces these options: .It .Va WITHOUT_LLVM_COV .El -.Pp -When set, these options are also in effect: -.Pp -.Bl -inset -compact -.It Va WITHOUT_LLVM_TARGET_AARCH64 -(unless -.Va WITH_LLVM_TARGET_AARCH64 -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_ALL -(unless -.Va WITH_LLVM_TARGET_ALL -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_ARM -(unless -.Va WITH_LLVM_TARGET_ARM -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_MIPS -(unless -.Va WITH_LLVM_TARGET_MIPS -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_POWERPC -(unless -.Va WITH_LLVM_TARGET_POWERPC -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_RISCV -(unless -.Va WITH_LLVM_TARGET_RISCV -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_SPARC -(unless -.Va WITH_LLVM_TARGET_SPARC -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_X86 -(unless -.Va WITH_LLVM_TARGET_X86 -is set explicitly) -.El .It Va WITH_CLANG Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp @@ -502,9 +465,15 @@ When set, it enforces these options: .It .Va WITHOUT_KERBEROS .It +.Va WITHOUT_LDNS +.It +.Va WITHOUT_LDNS_UTILS +.It .Va WITHOUT_OPENSSH .It .Va WITHOUT_OPENSSL +.It +.Va WITHOUT_UNBOUND .El .Pp When set, these options are also in effect: @@ -1119,34 +1088,20 @@ amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386 Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp This is a default setting on -sparc64/sparc64. +arm/armv6, arm/armv7 and sparc64/sparc64. .It Va WITH_LLVM_LIBUNWIND Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp This is a default setting on -amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp -This is a default setting on -arm/armv6 and sparc64/sparc64. -.It Va WITH_LLVM_TARGET_AARCH64 -Set to build LLVM target support for AArch64. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ALL Set to only build the required LLVM target support. This option is preferred to specific target support options. -.Pp -This is a default setting on -sparc64/sparc64. When set, these options are also in effect: .Pp .Bl -inset -compact @@ -1175,29 +1130,11 @@ is set explicitly) .Va WITH_LLVM_TARGET_SPARC is set explicitly) .El -.It Va WITH_LLVM_TARGET_ALL -Set to build support for all LLVM targets. -This option is always applied to the bootstrap compiler for buildworld when -LLVM is used. -.Pp -This is a default setting on -amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ARM Set to not build LLVM target support for ARM. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp -This is a default setting on -sparc64/sparc64. -.It Va WITH_LLVM_TARGET_ARM -Set to build LLVM target support for ARM. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LLVM_TARGET_BPF Set to build LLVM target support for BPF. The @@ -1208,81 +1145,26 @@ Set to not build LLVM target support for MIPS. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp -This is a default setting on -arm/armv6 and sparc64/sparc64. -.It Va WITH_LLVM_TARGET_MIPS -Set to build LLVM target support for MIPS. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_POWERPC Set to not build LLVM target support for PowerPC. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp -This is a default setting on -arm/armv6 and sparc64/sparc64. -.It Va WITH_LLVM_TARGET_POWERPC -Set to build LLVM target support for PowerPC. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_RISCV Set to not build LLVM target support for RISC-V. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp -This is a default setting on -arm/armv6 and sparc64/sparc64. -.It Va WITH_LLVM_TARGET_RISCV -Set to build LLVM target support for RISC-V. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_SPARC Set to not build LLVM target support for SPARC. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp -This is a default setting on -arm/armv6 and sparc64/sparc64. -.It Va WITH_LLVM_TARGET_SPARC -Set to build LLVM target support for SPARC. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_X86 Set to not build LLVM target support for X86. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp -This is a default setting on -arm/armv6 and sparc64/sparc64. -.It Va WITH_LLVM_TARGET_X86 -Set to build LLVM target support for X86. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_EFI_SECUREBOOT Enable building .Xr loader 8 @@ -1601,7 +1483,13 @@ When set, it enforces these options: .It .Va WITHOUT_KERBEROS .It +.Va WITHOUT_LDNS +.It +.Va WITHOUT_LDNS_UTILS +.It .Va WITHOUT_OPENSSH +.It +.Va WITHOUT_UNBOUND .El .Pp When set, these options are also in effect: From owner-svn-src-head@freebsd.org Fri Dec 27 15:47:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F64E1EF4EA; Fri, 27 Dec 2019 15:47:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47krn06G9rz4Dkm; Fri, 27 Dec 2019 15:47:32 +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 D21BB1B0F9; Fri, 27 Dec 2019 15:47:32 +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 xBRFlWHV069766; Fri, 27 Dec 2019 15:47:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRFlWSm069765; Fri, 27 Dec 2019 15:47:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912271547.xBRFlWSm069765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Dec 2019 15:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356124 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 15:47:33 -0000 Author: emaste Date: Fri Dec 27 15:47:32 2019 New Revision: 356124 URL: https://svnweb.freebsd.org/changeset/base/356124 Log: src.opts.mk: switch LLVM toolchain to opt-out After PowerPC switched in r356111, the list of targets using LLVM as the default toolchain is much longer than those not using it. Switch the sense of the test to exclude those not using LLVM. Targets not using LLVM is currently mips, riscv5, and sparc64; work is in progress to migrate the first two to LLVM. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Dec 27 15:33:43 2019 (r356123) +++ head/share/mk/src.opts.mk Fri Dec 27 15:47:32 2019 (r356124) @@ -304,9 +304,8 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF # This means that architectures that have GCC 4.2 as default can not # build Clang without using an external compiler. -.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \ - ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386" || \ - ${__TT} == "powerpc") +.if ${COMPILER_FEATURES:Mc++11} && (${__TT} != "mips" && \ + ${__TT} != "riscv" && ${__TT} != "sparc64") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC From owner-svn-src-head@freebsd.org Fri Dec 27 16:12:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E47861EFD0D; Fri, 27 Dec 2019 16:12:43 +0000 (UTC) (envelope-from freebsd@bdragon.rtk0.net) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47ksL26Zhvz4Fwn; Fri, 27 Dec 2019 16:12:42 +0000 (UTC) (envelope-from freebsd@bdragon.rtk0.net) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 9D64B21C57; Fri, 27 Dec 2019 11:12:40 -0500 (EST) Received: from imap1 ([10.202.2.51]) by compute5.internal (MEProxy); Fri, 27 Dec 2019 11:12:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=KIpHnA oM2PtDjxBfKCw4QMgS/2nPtFUH3xYfQyEcKnA=; b=Pd/ygc0UEJjpElea30MCbx r8f9PtkjUqzIoiB8o6vbw0qTM3G1bTY+ONh4QON9axOv2hVXbSH2mAyhsqdlHpiY YCHldgwNYWQXHr/eUhwMt9K8wdM2hkEvYSq1CUitY5KHcU5qqciieGfeQBnxLXLT rxS/Le8bvWOFq7FbAztFJP7WzamS441rYFGE8Tc2LMRU66axhL5Ei3pcTppQ2apy FNUUsiZ6Tfm4t0xMtGNEGdDahcFASzB75EWIvWKM448i+io7OG+siB1sUratmJQB ZCxLyVwz5A38pDiiBrAFYt9RVXp+HJzMxWIFFhccHhXZAi4aXWjYvJ6Ttrk6H8FA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddvkedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdeurhgr nhguohhnuceuvghrghhrvghnfdcuoehfrhgvvggsshgusegsughrrghgohhnrdhrthhktd drnhgvtheqnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfrhgvvggsshgusegsughrrghg ohhnrdhrthhktddrnhgvthenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id BB233C200A4; Fri, 27 Dec 2019 11:12:39 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-694-gd5bab98-fmstable-20191218v1 Mime-Version: 1.0 Message-Id: <7dcd345a-73ab-4ef9-8e4f-f786ec0ecce4@www.fastmail.com> In-Reply-To: References: <201912270442.xBR4g4hO075097@repo.freebsd.org> Date: Fri, 27 Dec 2019 10:12:20 -0600 From: "Brandon Bergren" To: "Ronald Klop" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Justin Hibbits" Subject: Re: svn commit: r356116 - head Content-Type: text/plain X-Rspamd-Queue-Id: 47ksL26Zhvz4Fwn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=Pd/ygc0U; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@bdragon.rtk0.net has no SPF policy when checking 66.111.4.26) smtp.mailfrom=freebsd@bdragon.rtk0.net X-Spamd-Result: default: False [-4.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[messagingengine.com:s=fm1]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; IP_SCORE(-3.48)[ip: (-9.80), ipnet: 66.111.4.0/24(-4.88), asn: 11403(-2.68), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[rtk0.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RWL_MAILSPIKE_GOOD(0.00)[26.4.111.66.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[messagingengine.com:+]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[26.4.111.66.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_WWW(0.50)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 16:12:44 -0000 On Fri, Dec 27, 2019, at 3:39 AM, Ronald Klop wrote: > Do powerpc people need to do something special while updating? > Like a clean buildkernel/buildworld. Or is this just a note for historical > bookkeeping? Yes. Stay put for the moment, because there's currently a bug in freebsd_fixup_old_auxargs that got missed at the last moment that makes the upgrade much harder than it should be. (The kernel is currently panicing when running old binaries.) After that's fixed, we'll come up with better instructions for different upgrade scenarios. The general idea is that this will require a reboot into the new kernel before installing the new world though, to handle the new auxv format that we transitioned to at the same time. This will likely also mean you might need to run installworld *twice* because it will probably crash out the first time. -- Brandon Bergren Technical Generalist From owner-svn-src-head@freebsd.org Fri Dec 27 16:28:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8268C1EFF64; Fri, 27 Dec 2019 16:28:44 +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 47kshX2zD7z4GQN; Fri, 27 Dec 2019 16:28:44 +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 606181B807; Fri, 27 Dec 2019 16:28:44 +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 xBRGSi4D093744; Fri, 27 Dec 2019 16:28:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRGSiJP093743; Fri, 27 Dec 2019 16:28:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912271628.xBRGSiJP093743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Dec 2019 16:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356125 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 16:28:44 -0000 Author: emaste Date: Fri Dec 27 16:28:43 2019 New Revision: 356125 URL: https://svnweb.freebsd.org/changeset/base/356125 Log: src.opts.mk: switch LLVM_LIBUNWIND to opt-out PowerPC switched to LLVM_LIBUNWIND along with the switch to Clang/LLVM in r356111. This leaves only 32-bit Arm and sparc64 not using LLVM's unwinder, so switch the sense to opt-out. I elected to list the individual arm MACHINE_ARCHs so future changes are more clear if LLVM_LIBUNWIND is enabled for one or two but not all 32-bit Arm targets (see PR 233664). Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Dec 27 15:47:32 2019 (r356124) +++ head/share/mk/src.opts.mk Fri Dec 27 16:28:43 2019 (r356125) @@ -327,8 +327,8 @@ BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BO .if ${__T:Mriscv*} != "" BROKEN_OPTIONS+=OFED .endif -.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ - ${__TT} == "powerpc" || ${__T:Mriscv*} != "" || ${__TT} == "mips" +.if ${__T} != "arm" && ${__T} != "armv6" && ${__T} != "armv7" && \ + ${__T} != "sparc64" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND From owner-svn-src-head@freebsd.org Fri Dec 27 16:28:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D7E91EFFB5; Fri, 27 Dec 2019 16:28:58 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kshp3m94z4Gc0; Fri, 27 Dec 2019 16:28:58 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (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 6EA1E12E6C; Fri, 27 Dec 2019 16:28:58 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f51.google.com with SMTP id n8so10188786qvg.11; Fri, 27 Dec 2019 08:28:58 -0800 (PST) X-Gm-Message-State: APjAAAXQAksMEtl+mdoHWudewrfxQcH6LoTTIpjOL7RezSn6yPliTHFM SlPyhXbxpR7hNjTvS8zBYh0/AmipzShVQaR9K1I= X-Google-Smtp-Source: APXvYqzOf8O/JVPktAqh/Ij8OiNUKINwoldREXa3wFNVEhcbaYAz8zA5W51R6T7mt55UsrsPTKOE+bXTgIsctEGYADY= X-Received: by 2002:a05:6214:118d:: with SMTP id t13mr39856294qvv.5.1577464137943; Fri, 27 Dec 2019 08:28:57 -0800 (PST) MIME-Version: 1.0 References: <201912261725.xBQHPq8u076460@repo.freebsd.org> <62d80c6e-f0c0-05bb-cb22-b6cf40d4c06f@selasky.org> In-Reply-To: <62d80c6e-f0c0-05bb-cb22-b6cf40d4c06f@selasky.org> From: Kyle Evans Date: Fri, 27 Dec 2019 10:28:46 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r356092 - head/sys/dev/kbdmux To: Hans Petter Selasky Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 16:28:58 -0000 On Fri, Dec 27, 2019 at 9:04 AM Hans Petter Selasky wrote: > > TODO: > > Is there a way to distinguish between key events which are key-presses > and events which are auto-repeated key-presses? > At the risk of asking a dumb question, where are you wanting to make this distinction at? I haven't thought much about it, but it looks like we could either burn the last keyflag for it (we haven't added one in at least 13 years) or use `NOKEY | keychar` as an indicator for this, as I think that would still make logical sense. NOKEY is currently used a standalone value for 'no key pressed marker', and everything in-tree seems to check (read_char() == NOKEY) rather than (KEYFLAGS(read_char()) == NOKEY) for the current interpretation. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Fri Dec 27 16:36:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C03ED1C8653; Fri, 27 Dec 2019 16:36:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 47ksss4DPSz4HN2; Fri, 27 Dec 2019 16:36:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 655A9260084; Fri, 27 Dec 2019 17:36:47 +0100 (CET) Subject: Re: svn commit: r356092 - head/sys/dev/kbdmux To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head References: <201912261725.xBQHPq8u076460@repo.freebsd.org> <62d80c6e-f0c0-05bb-cb22-b6cf40d4c06f@selasky.org> From: Hans Petter Selasky Message-ID: <3767f83b-c8a0-5aee-c57f-837aaf187ee7@selasky.org> Date: Fri, 27 Dec 2019 16:34:29 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47ksss4DPSz4HN2 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 16:36:49 -0000 On 2019-12-27 17:28, Kyle Evans wrote: > At the risk of asking a dumb question, where are you wanting to make > this distinction at? For example when implementing applications which allow playing the piano via the system keyboard this is useful. See here for example: https://doc.qt.io/qt-5/qkeyevent.html#isAutoRepeat Needs to be implemented for FreeBSD, though! --HPS From owner-svn-src-head@freebsd.org Fri Dec 27 16:43:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B23961C88B3; Fri, 27 Dec 2019 16:43: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 47kt1f46sGz4Hly; Fri, 27 Dec 2019 16:43: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 88D6E1BB7D; Fri, 27 Dec 2019 16:43:34 +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 xBRGhYLc005394; Fri, 27 Dec 2019 16:43:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRGhY4q005393; Fri, 27 Dec 2019 16:43:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912271643.xBRGhY4q005393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 27 Dec 2019 16:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356126 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 356126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 16:43:34 -0000 Author: kib Date: Fri Dec 27 16:43:34 2019 New Revision: 356126 URL: https://svnweb.freebsd.org/changeset/base/356126 Log: ufs: do not leave non-reclaimed vnodes with zero i_mode around. After a recent change, vput() relocks even the exclusively locked vnode before inactivating it. Before that, UFS could safely instantiate a vnode for cleared inode, then the last vput() after ffs_vgetf() noted that ip->i_mode == 0 and recycled. Now, it is possible for other threads to note the half-constructed vnode, e.g. to insert it into hash, which makes other threads to use it despite mode is zero, before inactivation and reclaim. Handle the found cases in SU code, by explicitly doing reclaim. Assert that other places get fully constructed inode from ffs_vgetf(), which cannot be cleared before dependencies are resolved. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Dec 27 16:28:43 2019 (r356125) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Dec 27 16:43:34 2019 (r356126) @@ -8052,7 +8052,9 @@ handle_complete_freeblocks(freeblks, flags) flags, &vp, FFSV_FORCEINSMQ) != 0) return (EBUSY); ip = VTOI(vp); - if (DIP(ip, i_modrev) == freeblks->fb_modrev) { + if (ip->i_mode == 0) { + vgone(vp); + } else if (DIP(ip, i_modrev) == freeblks->fb_modrev) { DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - spare); ip->i_flag |= IN_CHANGE; /* @@ -9835,6 +9837,7 @@ handle_workitem_remove(dirrem, flags) if (ffs_vgetf(mp, oldinum, flags, &vp, FFSV_FORCEINSMQ) != 0) return (EBUSY); ip = VTOI(vp); + MPASS(ip->i_mode != 0); ACQUIRE_LOCK(ump); if ((inodedep_lookup(mp, oldinum, 0, &inodedep)) == 0) panic("handle_workitem_remove: lost inodedep"); @@ -12530,6 +12533,7 @@ restart: VOP_UNLOCK(vp, 0); error = ffs_vgetf(mp, parentino, LK_EXCLUSIVE, &pvp, FFSV_FORCEINSMQ); + MPASS(VTOI(pvp)->i_mode != 0); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (VN_IS_DOOMED(vp)) { if (error == 0) @@ -13172,6 +13176,7 @@ restart: if ((error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &vp, FFSV_FORCEINSMQ))) break; + MPASS(VTOI(vp)->i_mode != 0); error = flush_newblk_dep(vp, mp, 0); /* * If we still have the dependency we might need to @@ -13236,6 +13241,7 @@ retry: if ((error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &vp, FFSV_FORCEINSMQ))) break; + MPASS(VTOI(vp)->i_mode != 0); error = ffs_update(vp, 1); vput(vp); if (error) @@ -13830,6 +13836,7 @@ clear_remove(mp) softdep_error("clear_remove: vget", error); goto finish_write; } + MPASS(VTOI(vp)->i_mode != 0); if ((error = ffs_syncvnode(vp, MNT_NOWAIT, 0))) softdep_error("clear_remove: fsync", error); bo = &vp->v_bufobj; @@ -13911,7 +13918,9 @@ clear_inodedeps(mp) return; } vfs_unbusy(mp); - if (ino == lastino) { + if (VTOI(vp)->i_mode == 0) { + vgone(vp); + } else if (ino == lastino) { if ((error = ffs_syncvnode(vp, MNT_WAIT, 0))) softdep_error("clear_inodedeps: fsync1", error); } else { From owner-svn-src-head@freebsd.org Fri Dec 27 16:59:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DE2F1C8D4D; Fri, 27 Dec 2019 16:59:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ktMz2H27z4JV3; Fri, 27 Dec 2019 16:59:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 493A01BD56; Fri, 27 Dec 2019 16:59:27 +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 xBRGxR4d012208; Fri, 27 Dec 2019 16:59:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRGxRSa012207; Fri, 27 Dec 2019 16:59:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912271659.xBRGxRSa012207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Dec 2019 16:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356127 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 16:59:27 -0000 Author: emaste Date: Fri Dec 27 16:59:26 2019 New Revision: 356127 URL: https://svnweb.freebsd.org/changeset/base/356127 Log: Switch GPL_DTC to default off We use the BSDL devicetree compiler as long as we have a C++11 compiler. dtc is not needed as a build tool on the platforms that are still using GCC 4.2.1 (and it is being disabled very soon, anyhow). Discussed with: imp, kevans Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Dec 27 16:43:34 2019 (r356126) +++ head/share/mk/src.opts.mk Fri Dec 27 16:59:26 2019 (r356127) @@ -200,6 +200,7 @@ __DEFAULT_NO_OPTIONS = \ DTRACE_TESTS \ EXPERIMENTAL \ GNU_GREP_COMPAT \ + GPL_DTC \ HESIOD \ HTTPD \ LIBSOFT \ @@ -308,16 +309,16 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF ${__TT} != "riscv" && ${__TT} != "sparc64") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD -__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC +__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX .elif ${COMPILER_FEATURES:Mc++11} && ${__T} != "sparc64" # If an external compiler that supports C++11 is used as ${CC} and Clang # supports the target, then Clang is enabled but GCC is installed as the # default /usr/bin/cc. -__DEFAULT_YES_OPTIONS+=CLANG GCC GCC_BOOTSTRAP GNUCXX GPL_DTC LLD +__DEFAULT_YES_OPTIONS+=CLANG GCC GCC_BOOTSTRAP GNUCXX LLD __DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC .else # Everything else disables Clang, and uses GCC instead. -__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC +__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD .endif # In-tree binutils/gcc are older versions without modern architecture support. From owner-svn-src-head@freebsd.org Fri Dec 27 17:12:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A60AC1C9453; Fri, 27 Dec 2019 17:12:07 +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 47ktfb30WPz4KP1; Fri, 27 Dec 2019 17:12:07 +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 621671C0A4; Fri, 27 Dec 2019 17:12:07 +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 xBRHC7TF022509; Fri, 27 Dec 2019 17:12:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRHC7vZ022508; Fri, 27 Dec 2019 17:12:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912271712.xBRHC7vZ022508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Dec 2019 17:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356128 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 356128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 17:12:07 -0000 Author: emaste Date: Fri Dec 27 17:12:06 2019 New Revision: 356128 URL: https://svnweb.freebsd.org/changeset/base/356128 Log: src.conf.5: regen after r356127, disable GPL_DTC by default Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Fri Dec 27 16:59:26 2019 (r356127) +++ head/share/man/man5/src.conf.5 Fri Dec 27 17:12:06 2019 (r356128) @@ -822,18 +822,9 @@ amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386 Set to not build .Xr gpioctl 8 as part of the base system. -.It Va WITHOUT_GPL_DTC -Set to build the BSD licensed version of the device tree compiler rather -than the GPLed one from elinux.org. -.Pp -This is a default setting on -amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_GPL_DTC Set to build the GPL'd version of the device tree compiler from elinux.org, instead of the BSD licensed one. -.Pp -This is a default setting on -riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GSSAPI Set to not build libgssapi. .It Va WITHOUT_HAST From owner-svn-src-head@freebsd.org Fri Dec 27 17:38:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B90E21CA10C; Fri, 27 Dec 2019 17:38:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kvDy4VcLz4Lkq; Fri, 27 Dec 2019 17:38:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95B2F1C473; Fri, 27 Dec 2019 17:38:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBRHcQDv035756; Fri, 27 Dec 2019 17:38:26 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRHcPUM035751; Fri, 27 Dec 2019 17:38:25 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912271738.xBRHcPUM035751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 27 Dec 2019 17:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356129 - in head/sys: kern powerpc/include powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: kern powerpc/include powerpc/powerpc X-SVN-Commit-Revision: 356129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 17:38:26 -0000 Author: jhibbits Date: Fri Dec 27 17:38:25 2019 New Revision: 356129 URL: https://svnweb.freebsd.org/changeset/base/356129 Log: Fix the powerpc copyout fixup from r356113 Summary: r356113 used an older patch, which predated the freebsd_copyout_auxargs() addition. Fix this by using a private powerpc_copyout_auxargs() instead, and keep it private to powerpc, not in MI files. Reviewed by: kib, bdragon Differential Revision: https://reviews.freebsd.org/D22935 Added: head/sys/powerpc/powerpc/elf_common.c (contents, props changed) Modified: head/sys/kern/imgact_elf.c head/sys/powerpc/include/elf.h head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Fri Dec 27 17:12:06 2019 (r356128) +++ head/sys/kern/imgact_elf.c Fri Dec 27 17:38:25 2019 (r356129) @@ -1323,102 +1323,6 @@ ret: #define suword __CONCAT(suword, __ELF_WORD_SIZE) -#ifdef __powerpc__ -#define OLD_AT_NULL AT_NULL -#define OLD_AT_IGNORE AT_IGNORE -#define OLD_AT_EXECFD AT_EXECFD -#define OLD_AT_PHDR AT_PHDR -#define OLD_AT_PHENT AT_PHENT -#define OLD_AT_PHNUM AT_PHNUM -#define OLD_AT_PAGESZ AT_PAGESZ -#define OLD_AT_BASE AT_BASE -#define OLD_AT_FLAGS AT_FLAGS -#define OLD_AT_ENTRY AT_ENTRY -#define OLD_AT_NOTELF AT_NOTELF -#define OLD_AT_UID AT_UID -#define OLD_AT_EUID AT_EUID -#define OLD_AT_EXECPATH 13 -#define OLD_AT_CANARY 14 -#define OLD_AT_CANARYLEN 15 -#define OLD_AT_OSRELDATE 16 -#define OLD_AT_NCPUS 17 -#define OLD_AT_PAGESIZES 18 -#define OLD_AT_PAGESIZESLEN 19 -#define OLD_AT_STACKPROT 21 -#define OLD_AT_TIMEKEEP AT_TIMEKEEP -#define OLD_AT_EHDRFLAGS AT_EHDRFLAGS -#define OLD_AT_HWCAP AT_HWCAP -#define OLD_AT_HWCAP2 AT_HWCAP2 - -#define OLD_AT_COUNT 27 /* Count of defined aux entry types. */ - -static int -__elfN(freebsd_fixup_old_auxargs)(uintptr_t *stack_base, - struct image_params *imgp) -{ - Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; - Elf_Auxinfo *argarray, *pos; - Elf_Addr *base, *auxbase; - int error; - - base = (Elf_Addr *)*stack_base; - auxbase = base + imgp->args->argc + 1 + imgp->args->envc + 1; - argarray = pos = malloc(OLD_AT_COUNT * sizeof(*pos), M_TEMP, - M_WAITOK | M_ZERO); - - if (args->execfd != -1) - AUXARGS_ENTRY(pos, OLD_AT_EXECFD, args->execfd); - AUXARGS_ENTRY(pos, OLD_AT_PHDR, args->phdr); - AUXARGS_ENTRY(pos, OLD_AT_PHENT, args->phent); - AUXARGS_ENTRY(pos, OLD_AT_PHNUM, args->phnum); - AUXARGS_ENTRY(pos, OLD_AT_PAGESZ, args->pagesz); - AUXARGS_ENTRY(pos, OLD_AT_FLAGS, args->flags); - AUXARGS_ENTRY(pos, OLD_AT_ENTRY, args->entry); - AUXARGS_ENTRY(pos, OLD_AT_BASE, args->base); - AUXARGS_ENTRY(pos, OLD_AT_EHDRFLAGS, args->hdr_eflags); - if (imgp->execpathp != 0) - AUXARGS_ENTRY(pos, OLD_AT_EXECPATH, imgp->execpathp); - AUXARGS_ENTRY(pos, OLD_AT_OSRELDATE, - imgp->proc->p_ucred->cr_prison->pr_osreldate); - if (imgp->canary != 0) { - AUXARGS_ENTRY(pos, OLD_AT_CANARY, imgp->canary); - AUXARGS_ENTRY(pos, OLD_AT_CANARYLEN, imgp->canarylen); - } - AUXARGS_ENTRY(pos, OLD_AT_NCPUS, mp_ncpus); - if (imgp->pagesizes != 0) { - AUXARGS_ENTRY(pos, OLD_AT_PAGESIZES, imgp->pagesizes); - AUXARGS_ENTRY(pos, OLD_AT_PAGESIZESLEN, imgp->pagesizeslen); - } - if (imgp->sysent->sv_timekeep_base != 0) { - AUXARGS_ENTRY(pos, OLD_AT_TIMEKEEP, - imgp->sysent->sv_timekeep_base); - } - AUXARGS_ENTRY(pos, OLD_AT_STACKPROT, imgp->sysent->sv_shared_page_obj - != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : - imgp->sysent->sv_stackprot); - if (imgp->sysent->sv_hwcap != NULL) - AUXARGS_ENTRY(pos, OLD_AT_HWCAP, *imgp->sysent->sv_hwcap); - if (imgp->sysent->sv_hwcap2 != NULL) - AUXARGS_ENTRY(pos, OLD_AT_HWCAP2, *imgp->sysent->sv_hwcap2); - AUXARGS_ENTRY(pos, OLD_AT_NULL, 0); - - free(imgp->auxargs, M_TEMP); - imgp->auxargs = NULL; - KASSERT(pos - argarray <= OLD_AT_COUNT, ("Too many auxargs")); - - error = copyout(argarray, auxbase, sizeof(*argarray) * OLD_AT_COUNT); - free(argarray, M_TEMP); - if (error != 0) - return (error); - - base--; - if (suword(base, imgp->args->argc) == -1) - return (EFAULT); - *stack_base = (uintptr_t)base; - return (0); -} -#endif /* __powerpc__ */ - int __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base) { @@ -1478,11 +1382,6 @@ int __elfN(freebsd_fixup)(uintptr_t *stack_base, struct image_params *imgp) { Elf_Addr *base; - -#ifdef __powerpc__ - if (imgp->proc->p_osrel < P_OSREL_POWERPC_NEW_AUX_ARGS) - return (__elfN(freebsd_fixup_old_auxargs)(stack_base, imgp)); -#endif /* __powerpc__ */ base = (Elf_Addr *)*stack_base; base--; Modified: head/sys/powerpc/include/elf.h ============================================================================== --- head/sys/powerpc/include/elf.h Fri Dec 27 17:12:06 2019 (r356128) +++ head/sys/powerpc/include/elf.h Fri Dec 27 17:38:25 2019 (r356129) @@ -114,4 +114,32 @@ __ElfType(Auxinfo); #define ET_DYN_LOAD_ADDR 0x01010000 +#define AT_OLD_NULL AT_NULL +#define AT_OLD_IGNORE AT_IGNORE +#define AT_OLD_EXECFD AT_EXECFD +#define AT_OLD_PHDR AT_PHDR +#define AT_OLD_PHENT AT_PHENT +#define AT_OLD_PHNUM AT_PHNUM +#define AT_OLD_PAGESZ AT_PAGESZ +#define AT_OLD_BASE AT_BASE +#define AT_OLD_FLAGS AT_FLAGS +#define AT_OLD_ENTRY AT_ENTRY +#define AT_OLD_NOTELF AT_NOTELF +#define AT_OLD_UID AT_UID +#define AT_OLD_EUID AT_EUID +#define AT_OLD_EXECPATH 13 +#define AT_OLD_CANARY 14 +#define AT_OLD_CANARYLEN 15 +#define AT_OLD_OSRELDATE 16 +#define AT_OLD_NCPUS 17 +#define AT_OLD_PAGESIZES 18 +#define AT_OLD_PAGESIZESLEN 19 +#define AT_OLD_STACKPROT 21 +#define AT_OLD_TIMEKEEP AT_TIMEKEEP +#define AT_OLD_EHDRFLAGS AT_EHDRFLAGS +#define AT_OLD_HWCAP AT_HWCAP +#define AT_OLD_HWCAP2 AT_HWCAP2 + +#define AT_OLD_COUNT 27 /* Count of defined aux entry types. */ + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Fri Dec 27 17:12:06 2019 (r356128) +++ head/sys/powerpc/powerpc/elf32_machdep.c Fri Dec 27 17:38:25 2019 (r356129) @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include #include @@ -57,6 +59,8 @@ #include #include +#include + #ifdef __powerpc64__ #include #include @@ -89,7 +93,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_errtbl = NULL, .sv_transtrap = NULL, .sv_fixup = __elfN(freebsd_fixup), - .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), + .sv_copyout_auxargs = __elfN(powerpc_copyout_auxargs), .sv_sendsig = sendsig, .sv_sigcode = sigcode32, .sv_szsigcode = &szsigcode32, Modified: head/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf64_machdep.c Fri Dec 27 17:12:06 2019 (r356128) +++ head/sys/powerpc/powerpc/elf64_machdep.c Fri Dec 27 17:38:25 2019 (r356129) @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include @@ -52,6 +54,8 @@ #include #include +#include + static void exec_setregs_funcdesc(struct thread *td, struct image_params *imgp, uintptr_t stack); @@ -74,7 +78,7 @@ struct sysentvec elf64_freebsd_sysvec_v1 = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, - .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), + .sv_copyout_auxargs = __elfN(powerpc_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs_funcdesc, .sv_fixlimit = NULL, @@ -112,7 +116,7 @@ struct sysentvec elf64_freebsd_sysvec_v2 = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, - .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), + .sv_copyout_auxargs = __elfN(powerpc_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Added: head/sys/powerpc/powerpc/elf_common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powerpc/elf_common.c Fri Dec 27 17:38:25 2019 (r356129) @@ -0,0 +1,89 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2019 Justin Hibbits + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +static int +__elfN(powerpc_copyout_auxargs)(struct image_params *imgp, uintptr_t base) +{ + Elf_Auxargs *args; + Elf_Auxinfo *argarray, *pos; + int error; + + if (imgp->proc->p_osrel >= P_OSREL_POWERPC_NEW_AUX_ARGS) + return (__elfN(freebsd_copyout_auxargs)(imgp, base)); + + args = (Elf_Auxargs *)imgp->auxargs; + argarray = pos = malloc(AT_OLD_COUNT * sizeof(*pos), M_TEMP, + M_WAITOK | M_ZERO); + + if (args->execfd != -1) + AUXARGS_ENTRY(pos, AT_OLD_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, AT_OLD_PHDR, args->phdr); + AUXARGS_ENTRY(pos, AT_OLD_PHENT, args->phent); + AUXARGS_ENTRY(pos, AT_OLD_PHNUM, args->phnum); + AUXARGS_ENTRY(pos, AT_OLD_PAGESZ, args->pagesz); + AUXARGS_ENTRY(pos, AT_OLD_FLAGS, args->flags); + AUXARGS_ENTRY(pos, AT_OLD_ENTRY, args->entry); + AUXARGS_ENTRY(pos, AT_OLD_BASE, args->base); + AUXARGS_ENTRY(pos, AT_OLD_EHDRFLAGS, args->hdr_eflags); + if (imgp->execpathp != 0) + AUXARGS_ENTRY(pos, AT_OLD_EXECPATH, imgp->execpathp); + AUXARGS_ENTRY(pos, AT_OLD_OSRELDATE, + imgp->proc->p_ucred->cr_prison->pr_osreldate); + if (imgp->canary != 0) { + AUXARGS_ENTRY(pos, AT_OLD_CANARY, imgp->canary); + AUXARGS_ENTRY(pos, AT_OLD_CANARYLEN, imgp->canarylen); + } + AUXARGS_ENTRY(pos, AT_OLD_NCPUS, mp_ncpus); + if (imgp->pagesizes != 0) { + AUXARGS_ENTRY(pos, AT_OLD_PAGESIZES, imgp->pagesizes); + AUXARGS_ENTRY(pos, AT_OLD_PAGESIZESLEN, imgp->pagesizeslen); + } + if (imgp->sysent->sv_timekeep_base != 0) { + AUXARGS_ENTRY(pos, AT_OLD_TIMEKEEP, + imgp->sysent->sv_timekeep_base); + } + AUXARGS_ENTRY(pos, AT_OLD_STACKPROT, imgp->sysent->sv_shared_page_obj + != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : + imgp->sysent->sv_stackprot); + if (imgp->sysent->sv_hwcap != NULL) + AUXARGS_ENTRY(pos, AT_OLD_HWCAP, *imgp->sysent->sv_hwcap); + if (imgp->sysent->sv_hwcap2 != NULL) + AUXARGS_ENTRY(pos, AT_OLD_HWCAP2, *imgp->sysent->sv_hwcap2); + AUXARGS_ENTRY(pos, AT_OLD_NULL, 0); + + free(imgp->auxargs, M_TEMP); + imgp->auxargs = NULL; + KASSERT(pos - argarray <= AT_OLD_COUNT, ("Too many auxargs")); + + error = copyout(argarray, (void *)base, sizeof(*argarray) * AT_OLD_COUNT); + free(argarray, M_TEMP); + return (error); +} From owner-svn-src-head@freebsd.org Fri Dec 27 18:43:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85FDD1CBA24; Fri, 27 Dec 2019 18:43:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kwgv2nwqz4QSs; Fri, 27 Dec 2019 18:43:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-7.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id B820413E74; Fri, 27 Dec 2019 18:43:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r356113 - in head: libexec/rtld-elf sys/kern sys/sys To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912270407.xBR473Zh054687@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <08f3808c-0a93-ac7c-9e20-1798eeb8b0e1@FreeBSD.org> Date: Fri, 27 Dec 2019 10:43:16 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201912270407.xBR473Zh054687@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 18:43:23 -0000 On 12/26/19 8:07 PM, Justin Hibbits wrote: > Author: jhibbits > Date: Fri Dec 27 04:07:03 2019 > New Revision: 356113 > URL: https://svnweb.freebsd.org/changeset/base/356113 > > Log: > Eliminate the last MI difference in AT_* definitions (for powerpc). > > Summary: > As a transition aide, implement an alternative elfN_freebsd_fixup which > is called for old powerpc binaries. Similarly, add a translation to rtld to > convert old values to new ones (as expected by a new rtld). > > Translation of old<->new values is incomplete, but sufficient to allow an > installworld of a new userspace from an old one when a new kernel is running. > > Test Plan: > Someone needs to see how a new kernel/rtld/libc works with an old > binary. If if works we can probalby ship this. If not we probalby need > some more compat bits. > > Submitted by: brooks > Reviewed by: jhibbits > Differential Revision: https://reviews.freebsd.org/D20799 This would be much simpler as a 'sv_copyout_auxargs()' hook instead. You could even set it directly in the ELFv1 sysvec instead of needing a runtime check. You could also move it purely into the powerpc code at that point and not need to stick it in the MI file. It probably should also be under COMPAT_FREEBSD12. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Dec 27 18:48:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 589351CBABE; Fri, 27 Dec 2019 18:48:29 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-yw1-xc44.google.com (mail-yw1-xc44.google.com [IPv6:2607:f8b0:4864:20::c44]) (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 47kwnn1cyfz4Qc5; Fri, 27 Dec 2019 18:48:28 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-yw1-xc44.google.com with SMTP id l22so11583189ywc.8; Fri, 27 Dec 2019 10:48:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=00ytxge8NeP6Lc/m1XtvJ1hNH8sxBdBe1FwBaGeFrDo=; b=fTwlir19Egq6ob+HSBBs9h86II8UhlMvd2skO6QhRQlMtcgUUM6kYvbJelwNjScNrF uUsNaWQ22fqoYJx8Mpw5c2rqWUlJVcWxbKMJWhPIOM2MJmH9s1GyBdtsysDY+L04Em7K G6RrSkULRVen8c1+a+/KxV5zSG+CM8WBRIHjFn7lQNK2wPWsHLxs3zZDbAFyp4doy6JD G1KnRnsLK4A09hbTyNWYTLtE1BlZg9/IKTYYL/xkc7+mr2SuPpcmUgF3Clevp0l6yVBR puiuNmnDp5Xgj3Pht5Ad4U4B9K8MUgO2jFiGr+c6WnhPNTzm5OkqApBIIBkVRZSf49dr 8oUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:organization:mime-version :content-transfer-encoding; bh=00ytxge8NeP6Lc/m1XtvJ1hNH8sxBdBe1FwBaGeFrDo=; b=kdyw9ruuupXPo1gXxCRZa6NTh1aq1F35TBlizUICGD+w1eTC3aTp5wPDQ7iJkcmnc9 OUkPbVdflq/EDeyYyGs8cWAk+gtHN4rG+DfdX4Zue+6Rgaba7+8RwI1xqkQMtSDeWEcG eK+runiqgPdQwYuwRfaAMMg6aLhlLDZBdnobMcoqtavXEqdnHcmRG49jDBj8butpwICl QQmNkYglK3HMm0ATmODxpI4FrIli8xBwflt1d+OGNfvCWTYrdRKisUCG8CBk24NnEqU1 TyB7RI7shIVHX1XUfMxNBr/LH0gaictdy9Bga0FkRvynO7rcgDhBkEkn8sjBCnj3zX5E Vo3w== X-Gm-Message-State: APjAAAVrK4g1O4Rq6wrLDKQjuVox0dmzFLroMHGU4sB76vAdqYFoEXCe LfMedRgF5jTjomK07MKdyF0424ws X-Google-Smtp-Source: APXvYqwHSpK0XaRXm6lVRITC2Byhcn7kfijGA2Ak+7tT8PU6oYj50aNIa2QrZ1pP7gXwapAGhmpK1w== X-Received: by 2002:a81:7c07:: with SMTP id x7mr37349245ywc.291.1577472506808; Fri, 27 Dec 2019 10:48:26 -0800 (PST) Received: from titan.knownspace (173-19-125-130.client.mchsi.com. [173.19.125.130]) by smtp.gmail.com with ESMTPSA id 189sm14276959ywc.16.2019.12.27.10.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 10:48:26 -0800 (PST) Sender: Justin Hibbits Date: Fri, 27 Dec 2019 12:48:23 -0600 From: Justin Hibbits To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356113 - in head: libexec/rtld-elf sys/kern sys/sys Message-ID: <20191227124823.537a8d0c@titan.knownspace> In-Reply-To: <08f3808c-0a93-ac7c-9e20-1798eeb8b0e1@FreeBSD.org> References: <201912270407.xBR473Zh054687@repo.freebsd.org> <08f3808c-0a93-ac7c-9e20-1798eeb8b0e1@FreeBSD.org> Organization: FreeBSD X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47kwnn1cyfz4Qc5 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 18:48:29 -0000 On Fri, 27 Dec 2019 10:43:16 -0800 John Baldwin wrote: > On 12/26/19 8:07 PM, Justin Hibbits wrote: > > Author: jhibbits > > Date: Fri Dec 27 04:07:03 2019 > > New Revision: 356113 > > URL: https://svnweb.freebsd.org/changeset/base/356113 > > > > Log: > > Eliminate the last MI difference in AT_* definitions (for > > powerpc). > > Summary: > > As a transition aide, implement an alternative elfN_freebsd_fixup > > which is called for old powerpc binaries. Similarly, add a > > translation to rtld to convert old values to new ones (as expected > > by a new rtld). > > Translation of old<->new values is incomplete, but sufficient to > > allow an installworld of a new userspace from an old one when a new > > kernel is running. > > Test Plan: > > Someone needs to see how a new kernel/rtld/libc works with an old > > binary. If if works we can probalby ship this. If not we > > probalby need some more compat bits. > > > > Submitted by: brooks > > Reviewed by: jhibbits > > Differential Revision: https://reviews.freebsd.org/D20799 > > This would be much simpler as a 'sv_copyout_auxargs()' hook instead. > You could even set it directly in the ELFv1 sysvec instead of needing > a runtime check. You could also move it purely into the powerpc code > at that point and not need to stick it in the MI file. > > It probably should also be under COMPAT_FREEBSD12. > Already addressed in r356129. Not under COMPAT_FREEBSD12 just because it's needed for 13 before "today", but I'll probably put it under COMPAT_FREEBSD12 in a month or two, after some soak time. - Justin From owner-svn-src-head@freebsd.org Fri Dec 27 18:50:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE02D1CBB73; Fri, 27 Dec 2019 18:50:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kwqY4Yhfz4Qkh; Fri, 27 Dec 2019 18:50:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-7.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 1819A13E75; Fri, 27 Dec 2019 18:50:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r356113 - in head: libexec/rtld-elf sys/kern sys/sys From: John Baldwin To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912270407.xBR473Zh054687@repo.freebsd.org> <08f3808c-0a93-ac7c-9e20-1798eeb8b0e1@FreeBSD.org> Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 27 Dec 2019 10:49:54 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <08f3808c-0a93-ac7c-9e20-1798eeb8b0e1@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 18:50:01 -0000 On 12/27/19 10:43 AM, John Baldwin wrote: > On 12/26/19 8:07 PM, Justin Hibbits wrote: >> Author: jhibbits >> Date: Fri Dec 27 04:07:03 2019 >> New Revision: 356113 >> URL: https://svnweb.freebsd.org/changeset/base/356113 >> >> Log: >> Eliminate the last MI difference in AT_* definitions (for powerpc). >> >> Summary: >> As a transition aide, implement an alternative elfN_freebsd_fixup which >> is called for old powerpc binaries. Similarly, add a translation to rtld to >> convert old values to new ones (as expected by a new rtld). >> >> Translation of old<->new values is incomplete, but sufficient to allow an >> installworld of a new userspace from an old one when a new kernel is running. >> >> Test Plan: >> Someone needs to see how a new kernel/rtld/libc works with an old >> binary. If if works we can probalby ship this. If not we probalby need >> some more compat bits. >> >> Submitted by: brooks >> Reviewed by: jhibbits >> Differential Revision: https://reviews.freebsd.org/D20799 > > This would be much simpler as a 'sv_copyout_auxargs()' hook instead. You could > even set it directly in the ELFv1 sysvec instead of needing a runtime check. > You could also move it purely into the powerpc code at that point and not need > to stick it in the MI file. Oops, should I have finished reading my commit mail, thanks for fixing this. > It probably should also be under COMPAT_FREEBSD12. This should probably still be done if it isn't already, but the entire sysvec that for ELFv1 probably belongs under the #idef, not just the auxargs bit. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Dec 27 19:58:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0ADD1CD77F; Fri, 27 Dec 2019 19:58:14 +0000 (UTC) (envelope-from bdragon@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 47kyLG5mT5z4VQp; Fri, 27 Dec 2019 19:58:14 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 BCE6F1DD6F; Fri, 27 Dec 2019 19:58:14 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBRJwEIH019649; Fri, 27 Dec 2019 19:58:14 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRJwE5H019648; Fri, 27 Dec 2019 19:58:14 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912271958.xBRJwE5H019648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 27 Dec 2019 19:58:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356134 - head/sys/powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/ofw X-SVN-Commit-Revision: 356134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 19:58:15 -0000 Author: bdragon Date: Fri Dec 27 19:58:14 2019 New Revision: 356134 URL: https://svnweb.freebsd.org/changeset/base/356134 Log: [PowerPC] Ignore fortify-source warning in trap vector copy Due to a bug in clang 9.0.0 source tracking, the trap vector copying will always trigger a fortify-source warning. The destination buffers are 0x2f00 bytes, and the bcopy region is 0x2e00 bytes, so there is not an overflow here. (I have been running with this patch since September.) Modified: head/sys/powerpc/ofw/ofw_machdep.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Fri Dec 27 18:53:07 2019 (r356133) +++ head/sys/powerpc/ofw/ofw_machdep.c Fri Dec 27 19:58:14 2019 (r356134) @@ -87,6 +87,9 @@ char save_trap_of[0x2f00]; /* EXC_LAST */ int ofwcall(void *); static int openfirmware(void *args); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wfortify-source" + __inline void ofw_save_trap_vec(char *save_trap_vec) { @@ -106,6 +109,8 @@ ofw_restore_trap_vec(char *restore_trap_vec) EXC_LAST - EXC_RST); __syncicache((void *)PHYS_TO_DMAP(EXC_RSVD), EXC_LAST - EXC_RSVD); } + +#pragma clang diagnostic pop /* * Saved SPRG0-3 from OpenFirmware. Will be restored prior to the callback. From owner-svn-src-head@freebsd.org Fri Dec 27 20:29:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03C741CE4B7; Fri, 27 Dec 2019 20:29:15 +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 47kz226KC1z4WqR; Fri, 27 Dec 2019 20:29:14 +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 D42EF1E2A6; Fri, 27 Dec 2019 20:29:14 +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 xBRKTEVE037509; Fri, 27 Dec 2019 20:29:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRKTDe7037504; Fri, 27 Dec 2019 20:29:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912272029.xBRKTDe7037504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Dec 2019 20:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356135 - in head/sys: dev/usb sys X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: dev/usb sys X-SVN-Commit-Revision: 356135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 20:29:15 -0000 Author: hselasky Date: Fri Dec 27 20:29:13 2019 New Revision: 356135 URL: https://svnweb.freebsd.org/changeset/base/356135 Log: Make USB statistics per device instead of per bus. Bump the FreeBSD version due to structure change to force recompilation of external USB modules. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_transfer.c head/sys/sys/param.h Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Fri Dec 27 19:58:14 2019 (r356134) +++ head/sys/dev/usb/usb_bus.h Fri Dec 27 20:29:13 2019 (r356135) @@ -2,7 +2,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008-2019 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,19 +42,10 @@ struct usb_bus_msg { }; /* - * The following structure defines the USB statistics structure. - */ -struct usb_bus_stat { - uint32_t uds_requests[4]; -}; - -/* * The following structure defines an USB BUS. There is one USB BUS * for every Host or Device controller. */ struct usb_bus { - struct usb_bus_stat stats_err; - struct usb_bus_stat stats_ok; #if USB_HAVE_ROOT_MOUNT_HOLD struct root_hold_token *bus_roothold; #endif Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Fri Dec 27 19:58:14 2019 (r356134) +++ head/sys/dev/usb/usb_device.h Fri Dec 27 20:29:13 2019 (r356135) @@ -2,7 +2,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008-2019 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -177,10 +177,21 @@ union usb_device_scratch { }; /* + * Helper structure to keep track of USB device statistics. + */ +struct usb_device_statistics { + uint32_t uds_requests[4]; +}; + +/* * The following structure defines an USB device. There exists one of * these structures for every USB device. */ struct usb_device { + /* statistics */ + struct usb_device_statistics stats_err; + struct usb_device_statistics stats_ok; + /* generic clear stall message */ struct usb_udev_msg cs_msg[2]; struct sx enum_sx; Modified: head/sys/dev/usb/usb_generic.c ============================================================================== --- head/sys/dev/usb/usb_generic.c Fri Dec 27 19:58:14 2019 (r356134) +++ head/sys/dev/usb/usb_generic.c Fri Dec 27 20:29:13 2019 (r356135) @@ -2223,10 +2223,9 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void * for (n = 0; n != 4; n++) { u.stat->uds_requests_fail[n] = - f->udev->bus->stats_err.uds_requests[n]; - + f->udev->stats_err.uds_requests[n]; u.stat->uds_requests_ok[n] = - f->udev->bus->stats_ok.uds_requests[n]; + f->udev->stats_ok.uds_requests[n]; } break; Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Fri Dec 27 19:58:14 2019 (r356134) +++ head/sys/dev/usb/usb_transfer.c Fri Dec 27 20:29:13 2019 (r356135) @@ -2594,10 +2594,10 @@ usbd_transfer_done(struct usb_xfer *xfer, usb_error_t #endif /* keep some statistics */ if (xfer->error) { - info->bus->stats_err.uds_requests + info->udev->stats_err.uds_requests [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++; } else { - info->bus->stats_ok.uds_requests + info->udev->stats_ok.uds_requests [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++; } Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Dec 27 19:58:14 2019 (r356134) +++ head/sys/sys/param.h Fri Dec 27 20:29:13 2019 (r356135) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300070 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300071 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Fri Dec 27 20:35:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A767A1CE7B8; Fri, 27 Dec 2019 20:35:14 +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 47kz8y3vkhz4XDD; Fri, 27 Dec 2019 20:35:14 +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 7CF6B1E472; Fri, 27 Dec 2019 20:35:14 +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 xBRKZEQa043557; Fri, 27 Dec 2019 20:35:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRKZDSn043551; Fri, 27 Dec 2019 20:35:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912272035.xBRKZDSn043551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Dec 2019 20:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356136 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 356136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 20:35:14 -0000 Author: hselasky Date: Fri Dec 27 20:35:12 2019 New Revision: 356136 URL: https://svnweb.freebsd.org/changeset/base/356136 Log: Implement new libusb v2.0 API function, libusb20_dev_get_stats(). This function is useful when debugging USB device issues. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/lib/libusb/Makefile head/lib/libusb/libusb20.3 head/lib/libusb/libusb20.c head/lib/libusb/libusb20.h head/lib/libusb/libusb20_int.h head/lib/libusb/libusb20_ugen20.c Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Fri Dec 27 20:29:13 2019 (r356135) +++ head/lib/libusb/Makefile Fri Dec 27 20:35:12 2019 (r356136) @@ -219,6 +219,7 @@ MLINKS += libusb20.3 libusb20_dev_get_backend_name.3 MLINKS += libusb20.3 libusb20_dev_get_info.3 MLINKS += libusb20.3 libusb20_dev_get_iface_desc.3 MLINKS += libusb20.3 libusb20_dev_get_desc.3 +MLINKS += libusb20.3 libusb20_dev_get_stats.3 MLINKS += libusb20.3 libusb20_dev_close.3 MLINKS += libusb20.3 libusb20_dev_detach_kernel_driver.3 MLINKS += libusb20.3 libusb20_dev_set_config_index.3 Modified: head/lib/libusb/libusb20.3 ============================================================================== --- head/lib/libusb/libusb20.3 Fri Dec 27 20:29:13 2019 (r356135) +++ head/lib/libusb/libusb20.3 Fri Dec 27 20:35:12 2019 (r356136) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2008 Hans Petter Selasky +.\" Copyright (c) 2008-2019 Hans Petter Selasky .\" .\" All rights reserved. .\" @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2013 +.Dd December 27, 2019 .Dt LIBUSB20 3 .Os .Sh NAME @@ -122,6 +122,8 @@ USB access library (libusb -lusb) .Ft const char * .Fn libusb20_dev_get_desc "struct libusb20_device *pdev" .Ft int +.Fn libusb20_dev_get_stats "struct libusb20_device *pdev" "struct libusb20_device_stats *pstats" +.Ft int .Fn libusb20_dev_close "struct libusb20_device *pdev" .Ft int .Fn libusb20_dev_detach_kernel_driver "struct libusb20_device *pdev" "uint8_t iface_index" @@ -594,6 +596,14 @@ This function returns zero on success else a LIBUSB20_ .Fn libusb20_dev_get_desc returns a zero terminated string describing the given USB device. The format of the string is: "drivername: " +. +.Pp +. +.Fn libusb20_dev_get_stats +retrieves the device statistics into the structure pointed to by the +.Fa pstats +argument. +This function returns zero on success else a LIBUSB20_ERROR value is returned. . .Pp . Modified: head/lib/libusb/libusb20.c ============================================================================== --- head/lib/libusb/libusb20.c Fri Dec 27 20:29:13 2019 (r356135) +++ head/lib/libusb/libusb20.c Fri Dec 27 20:35:12 2019 (r356136) @@ -78,6 +78,7 @@ dummy_callback(struct libusb20_transfer *xfer) #define dummy_set_power_mode (void *)dummy_int #define dummy_get_power_mode (void *)dummy_int #define dummy_get_power_usage (void *)dummy_int +#define dummy_get_stats (void *)dummy_int #define dummy_kernel_driver_active (void *)dummy_int #define dummy_detach_kernel_driver (void *)dummy_int #define dummy_do_request_sync (void *)dummy_int @@ -1047,6 +1048,31 @@ uint8_t libusb20_dev_get_speed(struct libusb20_device *pdev) { return (pdev->usb_speed); +} + +int +libusb20_dev_get_stats(struct libusb20_device *pdev, struct libusb20_device_stats *pstats) +{ + uint8_t do_close; + int error; + + if (!pdev->is_opened) { + error = libusb20_dev_open(pdev, 0); + if (error == 0) { + do_close = 1; + } else { + do_close = 0; + } + } else { + do_close = 0; + } + + error = pdev->methods->get_stats(pdev, pstats); + + if (do_close) + (void) libusb20_dev_close(pdev); + + return (error); } /* if this function returns an error, the device is gone */ Modified: head/lib/libusb/libusb20.h ============================================================================== --- head/lib/libusb/libusb20.h Fri Dec 27 20:29:13 2019 (r356135) +++ head/lib/libusb/libusb20.h Fri Dec 27 20:35:12 2019 (r356136) @@ -195,6 +195,12 @@ struct libusb20_quirk { char quirkname[64 - 12]; }; +struct libusb20_device_stats { + uint64_t xfer_ok[4]; /* sorted by USB transfer type, UE_XXX */ + uint64_t xfer_fail[4]; /* sorted by USB transfer type, UE_XXX */ + uint64_t xfer_reserved[24]; /* reserved */ +}; + #define LIBUSB20_MAX_FRAME_PRE_SCALE (1U << 31) /* USB transfer operations */ @@ -243,6 +249,7 @@ int libusb20_dev_detach_kernel_driver(struct libusb20_ int libusb20_dev_set_config_index(struct libusb20_device *pdev, uint8_t configIndex); int libusb20_dev_get_debug(struct libusb20_device *pdev); int libusb20_dev_get_fd(struct libusb20_device *pdev); +int libusb20_dev_get_stats(struct libusb20_device *pdev, struct libusb20_device_stats *pstat); int libusb20_dev_kernel_driver_active(struct libusb20_device *pdev, uint8_t iface_index); int libusb20_dev_open(struct libusb20_device *pdev, uint16_t transfer_max); int libusb20_dev_process(struct libusb20_device *pdev); Modified: head/lib/libusb/libusb20_int.h ============================================================================== --- head/lib/libusb/libusb20_int.h Fri Dec 27 20:29:13 2019 (r356135) +++ head/lib/libusb/libusb20_int.h Fri Dec 27 20:35:12 2019 (r356136) @@ -108,10 +108,12 @@ typedef int (libusb20_reset_device_t)(struct libusb20_ typedef int (libusb20_set_power_mode_t)(struct libusb20_device *pdev, uint8_t power_mode); typedef int (libusb20_get_power_mode_t)(struct libusb20_device *pdev, uint8_t *power_mode); typedef int (libusb20_get_power_usage_t)(struct libusb20_device *pdev, uint16_t *power_usage); +typedef int (libusb20_get_stats_t)(struct libusb20_device *pdev, struct libusb20_device_stats *pstats); typedef int (libusb20_set_alt_index_t)(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index); typedef int (libusb20_set_config_index_t)(struct libusb20_device *pdev, uint8_t index); typedef int (libusb20_check_connected_t)(struct libusb20_device *pdev); + /* USB transfer specific */ typedef int (libusb20_tr_open_t)(struct libusb20_transfer *xfer, uint32_t MaxBufSize, uint32_t MaxFrameCount, uint8_t ep_no, uint16_t stream_id, uint8_t pre_scale); typedef int (libusb20_tr_close_t)(struct libusb20_transfer *xfer); @@ -131,6 +133,7 @@ typedef void (libusb20_tr_cancel_async_t)(struct libus m(n, set_power_mode) \ m(n, get_power_mode) \ m(n, get_power_usage) \ + m(n, get_stats) \ m(n, set_alt_index) \ m(n, set_config_index) \ m(n, tr_cancel_async) \ Modified: head/lib/libusb/libusb20_ugen20.c ============================================================================== --- head/lib/libusb/libusb20_ugen20.c Fri Dec 27 20:29:13 2019 (r356135) +++ head/lib/libusb/libusb20_ugen20.c Fri Dec 27 20:35:12 2019 (r356136) @@ -80,6 +80,7 @@ static libusb20_check_connected_t ugen20_check_connect static libusb20_set_power_mode_t ugen20_set_power_mode; static libusb20_get_power_mode_t ugen20_get_power_mode; static libusb20_get_power_usage_t ugen20_get_power_usage; +static libusb20_get_stats_t ugen20_get_stats; static libusb20_kernel_driver_active_t ugen20_kernel_driver_active; static libusb20_detach_kernel_driver_t ugen20_detach_kernel_driver; static libusb20_do_request_sync_t ugen20_do_request_sync; @@ -666,6 +667,29 @@ ugen20_get_power_usage(struct libusb20_device *pdev, u return (LIBUSB20_ERROR_OTHER); } *power_usage = temp; + return (0); /* success */ +} + +static int +ugen20_get_stats(struct libusb20_device *pdev, struct libusb20_device_stats *pstats) +{ + struct usb_device_stats st; + + if (ioctl(pdev->file_ctrl, IOUSB(USB_DEVICESTATS), &st)) + return (LIBUSB20_ERROR_OTHER); + + memset(pstats, 0, sizeof(*pstats)); + + pstats->xfer_ok[0] = st.uds_requests_ok[0]; + pstats->xfer_ok[1] = st.uds_requests_ok[1]; + pstats->xfer_ok[2] = st.uds_requests_ok[2]; + pstats->xfer_ok[3] = st.uds_requests_ok[3]; + + pstats->xfer_fail[0] = st.uds_requests_fail[0]; + pstats->xfer_fail[1] = st.uds_requests_fail[1]; + pstats->xfer_fail[2] = st.uds_requests_fail[2]; + pstats->xfer_fail[3] = st.uds_requests_fail[3]; + return (0); /* success */ } From owner-svn-src-head@freebsd.org Fri Dec 27 20:37:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C3741CE953; Fri, 27 Dec 2019 20:37:15 +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 47kzCH1rcyz4XTc; Fri, 27 Dec 2019 20:37:15 +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 3A9861E474; Fri, 27 Dec 2019 20:37:15 +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 xBRKbFlx043681; Fri, 27 Dec 2019 20:37:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRKbEeP043678; Fri, 27 Dec 2019 20:37:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912272037.xBRKbEeP043678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Dec 2019 20:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356137 - head/usr.sbin/usbconfig X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/usr.sbin/usbconfig X-SVN-Commit-Revision: 356137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 20:37:15 -0000 Author: hselasky Date: Fri Dec 27 20:37:14 2019 New Revision: 356137 URL: https://svnweb.freebsd.org/changeset/base/356137 Log: Implement dump_stats command for usbconfig(8). This command is useful when debugging USB device issues. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/usr.sbin/usbconfig/dump.c head/usr.sbin/usbconfig/dump.h head/usr.sbin/usbconfig/usbconfig.8 head/usr.sbin/usbconfig/usbconfig.c Modified: head/usr.sbin/usbconfig/dump.c ============================================================================== --- head/usr.sbin/usbconfig/dump.c Fri Dec 27 20:35:12 2019 (r356136) +++ head/usr.sbin/usbconfig/dump.c Fri Dec 27 20:37:14 2019 (r356137) @@ -483,3 +483,32 @@ dump_string_by_index(struct libusb20_device *pdev, uin } free(pbuf); } + +void +dump_device_stats(struct libusb20_device *pdev) +{ + struct libusb20_device_stats st; + + if (libusb20_dev_get_stats(pdev, &st)) { + printf("{}\n"); + } else { + printf("{\n" + " UE_CONTROL_OK : %llu\n" + " UE_ISOCHRONOUS_OK : %llu\n" + " UE_BULK_OK : %llu\n" + " UE_INTERRUPT_OK : %llu\n" + " UE_CONTROL_FAIL : %llu\n" + " UE_ISOCHRONOUS_FAIL : %llu\n" + " UE_BULK_FAIL : %llu\n" + " UE_INTERRUPT_FAIL : %llu\n" + "}\n", + (unsigned long long)st.xfer_ok[0], + (unsigned long long)st.xfer_ok[1], + (unsigned long long)st.xfer_ok[2], + (unsigned long long)st.xfer_ok[3], + (unsigned long long)st.xfer_fail[0], + (unsigned long long)st.xfer_fail[1], + (unsigned long long)st.xfer_fail[2], + (unsigned long long)st.xfer_fail[3]); + } +} Modified: head/usr.sbin/usbconfig/dump.h ============================================================================== --- head/usr.sbin/usbconfig/dump.h Fri Dec 27 20:35:12 2019 (r356136) +++ head/usr.sbin/usbconfig/dump.h Fri Dec 27 20:37:14 2019 (r356137) @@ -37,6 +37,7 @@ void dump_device_info(struct libusb20_device *pdev, ui void dump_be_quirk_names(struct libusb20_backend *pbe); void dump_be_dev_quirks(struct libusb20_backend *pbe); void dump_device_desc(struct libusb20_device *pdev); +void dump_device_stats(struct libusb20_device *pdev); void dump_config(struct libusb20_device *pdev, uint8_t all_cfg); #endif /* _DUMP_H_ */ Modified: head/usr.sbin/usbconfig/usbconfig.8 ============================================================================== --- head/usr.sbin/usbconfig/usbconfig.8 Fri Dec 27 20:35:12 2019 (r356136) +++ head/usr.sbin/usbconfig/usbconfig.8 Fri Dec 27 20:37:14 2019 (r356137) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.\" Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved. +.\" Copyright (c) 2008-2019 Hans Petter Selasky. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 16, 2019 +.Dd December 27, 2019 .Dt USBCONFIG 8 .Os .Sh NAME @@ -116,6 +116,8 @@ Display all the configuration descriptors. Display string descriptor at selected index. .It Cm dump_info Display summary information about the device. +.It Cm dump_stats +Display USB transfer statistics. .It Cm show_ifdrv Display the list of interface drivers (such as .Xr ukbd 4 Modified: head/usr.sbin/usbconfig/usbconfig.c ============================================================================== --- head/usr.sbin/usbconfig/usbconfig.c Fri Dec 27 20:35:12 2019 (r356136) +++ head/usr.sbin/usbconfig/usbconfig.c Fri Dec 27 20:37:14 2019 (r356137) @@ -82,6 +82,7 @@ struct options { uint8_t got_dump_curr_config:1; uint8_t got_dump_all_config:1; uint8_t got_dump_info:1; + uint8_t got_dump_stats:1; uint8_t got_show_iface_driver:1; uint8_t got_remove_device_quirk:1; uint8_t got_add_device_quirk:1; @@ -121,6 +122,7 @@ enum { T_DUMP_ALL_CONFIG_DESC, T_DUMP_STRING, T_DUMP_INFO, + T_DUMP_STATS, T_SUSPEND, T_RESUME, T_POWER_OFF, @@ -155,6 +157,7 @@ static const struct token token[] = { {"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0}, {"dump_string", T_DUMP_STRING, 1}, {"dump_info", T_DUMP_INFO, 0}, + {"dump_stats", T_DUMP_STATS, 0}, {"show_ifdrv", T_SHOW_IFACE_DRIVER, 0}, {"suspend", T_SUSPEND, 0}, {"resume", T_RESUME, 0}, @@ -296,6 +299,7 @@ usage(void) " dump_all_config_desc" "\n" " dump_string " "\n" " dump_info" "\n" + " dump_stats" "\n" " show_ifdrv" "\n" " suspend" "\n" " resume" "\n" @@ -506,7 +510,8 @@ flush_command(struct libusb20_backend *pbe, struct opt opt->got_dump_device_desc || opt->got_dump_curr_config || opt->got_dump_all_config || - opt->got_dump_info); + opt->got_dump_info || + opt->got_dump_stats); if (opt->got_list || dump_any) { dump_device_info(pdev, @@ -527,6 +532,10 @@ flush_command(struct libusb20_backend *pbe, struct opt dump_device_desc(pdev); dump_config(pdev, 1); } + if (opt->got_dump_stats) { + printf("\n"); + dump_device_stats(pdev); + } if (dump_any) { printf("\n"); } @@ -749,6 +758,12 @@ main(int argc, char **argv) if (opt->got_dump_info) duplicate_option(argv[n]); opt->got_dump_info = 1; + opt->got_any++; + break; + case T_DUMP_STATS: + if (opt->got_dump_stats) + duplicate_option(argv[n]); + opt->got_dump_stats = 1; opt->got_any++; break; case T_DUMP_STRING: From owner-svn-src-head@freebsd.org Fri Dec 27 21:44:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CE0B1D060D; Fri, 27 Dec 2019 21:44:13 +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 47l0hY3dFZz4bdG; Fri, 27 Dec 2019 21:44:13 +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 77A791F0B3; Fri, 27 Dec 2019 21:44: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 xBRLiDp3085122; Fri, 27 Dec 2019 21:44:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRLiDl1085121; Fri, 27 Dec 2019 21:44:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912272144.xBRLiDl1085121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Dec 2019 21:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356138 - head/sys/geom/uzip X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/uzip X-SVN-Commit-Revision: 356138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 21:44:13 -0000 Author: mav Date: Fri Dec 27 21:44:13 2019 New Revision: 356138 URL: https://svnweb.freebsd.org/changeset/base/356138 Log: Fix GEOM_UZIP orphanization. Previous code destroyed softc even with provider still open, that resulted in panic under load. This change postpones the free till the final close, when we know for sure there will be no more I/O requests. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/uzip/g_uzip.c Modified: head/sys/geom/uzip/g_uzip.c ============================================================================== --- head/sys/geom/uzip/g_uzip.c Fri Dec 27 20:37:14 2019 (r356137) +++ head/sys/geom/uzip/g_uzip.c Fri Dec 27 21:44:13 2019 (r356138) @@ -143,13 +143,12 @@ static void g_uzip_read_done(struct bio *bp); static void g_uzip_do(struct g_uzip_softc *, struct bio *bp); static void -g_uzip_softc_free(struct g_uzip_softc *sc, struct g_geom *gp) +g_uzip_softc_free(struct g_geom *gp) { + struct g_uzip_softc *sc = gp->softc; - if (gp != NULL) { - DPRINTF(GUZ_DBG_INFO, ("%s: %d requests, %d cached\n", - gp->name, sc->req_total, sc->req_cached)); - } + DPRINTF(GUZ_DBG_INFO, ("%s: %d requests, %d cached\n", + gp->name, sc->req_total, sc->req_cached)); mtx_lock(&sc->queue_mtx); sc->wrkthr_flags |= GUZ_SHUTDOWN; @@ -166,6 +165,7 @@ g_uzip_softc_free(struct g_uzip_softc *sc, struct g_ge mtx_destroy(&sc->last_mtx); free(sc->last_buf, M_GEOM_UZIP); free(sc, M_GEOM_UZIP); + gp->softc = NULL; } static int @@ -507,20 +507,35 @@ g_uzip_orphan(struct g_consumer *cp) { struct g_geom *gp; - g_trace(G_T_TOPOLOGY, "%s(%p/%s)", __func__, cp, cp->provider->name); g_topology_assert(); - + G_VALID_CONSUMER(cp); gp = cp->geom; - g_uzip_softc_free(gp->softc, gp); - gp->softc = NULL; + g_trace(G_T_TOPOLOGY, "%s(%p/%s)", __func__, cp, gp->name); g_wither_geom(gp, ENXIO); + + /* + * We can safely free the softc now if there are no accesses, + * otherwise g_uzip_access() will do that after the last close. + */ + if ((cp->acr + cp->acw + cp->ace) == 0) + g_uzip_softc_free(gp); } +static void +g_uzip_spoiled(struct g_consumer *cp) +{ + + g_trace(G_T_TOPOLOGY, "%s(%p/%s)", __func__, cp, cp->geom->name); + cp->flags |= G_CF_ORPHAN; + g_uzip_orphan(cp); +} + static int g_uzip_access(struct g_provider *pp, int dr, int dw, int de) { struct g_geom *gp; struct g_consumer *cp; + int error; gp = pp->geom; cp = LIST_FIRST(&gp->consumer); @@ -529,22 +544,17 @@ g_uzip_access(struct g_provider *pp, int dr, int dw, i if (cp->acw + dw > 0) return (EROFS); - return (g_access(cp, dr, dw, de)); -} + error = g_access(cp, dr, dw, de); -static void -g_uzip_spoiled(struct g_consumer *cp) -{ - struct g_geom *gp; + /* + * Free the softc if all providers have been closed and this geom + * is being removed. + */ + if (error == 0 && (gp->flags & G_GEOM_WITHER) != 0 && + (cp->acr + cp->acw + cp->ace) == 0) + g_uzip_softc_free(gp); - G_VALID_CONSUMER(cp); - gp = cp->geom; - g_trace(G_T_TOPOLOGY, "%s(%p/%s)", __func__, cp, gp->name); - g_topology_assert(); - - g_uzip_softc_free(gp->softc, gp); - gp->softc = NULL; - g_wither_geom(gp, ENXIO); + return (error); } static int @@ -954,10 +964,8 @@ g_uzip_destroy_geom(struct gctl_req *req, struct g_cla if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0) return (EBUSY); - g_uzip_softc_free(gp->softc, gp); - gp->softc = NULL; g_wither_geom(gp, ENXIO); - + g_uzip_softc_free(gp); return (0); } From owner-svn-src-head@freebsd.org Fri Dec 27 23:19:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 156391D245C; Fri, 27 Dec 2019 23:19:22 +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 47l2pK6NYCz4gkT; Fri, 27 Dec 2019 23:19:21 +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 D1FDD20087; Fri, 27 Dec 2019 23:19:21 +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 xBRNJLUA038191; Fri, 27 Dec 2019 23:19:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBRNJLVb038190; Fri, 27 Dec 2019 23:19:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912272319.xBRNJLVb038190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 27 Dec 2019 23:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356139 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 23:19:22 -0000 Author: markj Date: Fri Dec 27 23:19:21 2019 New Revision: 356139 URL: https://svnweb.freebsd.org/changeset/base/356139 Log: Remove some stale comments from the page allocator. Since r352110 the page lock is not required to wire pages in any context. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Dec 27 21:44:13 2019 (r356138) +++ head/sys/vm/vm_page.c Fri Dec 27 23:19:21 2019 (r356139) @@ -2072,10 +2072,6 @@ found: if ((req & VM_ALLOC_SBUSY) != 0) m->busy_lock = VPB_SHARERS_WORD(1); if (req & VM_ALLOC_WIRED) { - /* - * The page lock is not required for wiring a page until that - * page is inserted into the object. - */ vm_wire_add(1); m->ref_count = 1; } @@ -2404,10 +2400,6 @@ again: flags = PG_ZERO; m->flags &= flags; if ((req & VM_ALLOC_WIRED) != 0) { - /* - * The page lock is not required for wiring a page that does - * not belong to an object. - */ vm_wire_add(1); m->ref_count = 1; } From owner-svn-src-head@freebsd.org Sat Dec 28 01:35:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 892D61D56EC; Sat, 28 Dec 2019 01:35:33 +0000 (UTC) (envelope-from cem@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 47l5qT32dtz4n4n; Sat, 28 Dec 2019 01:35:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6364921996; Sat, 28 Dec 2019 01:35:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBS1ZXIL021646; Sat, 28 Dec 2019 01:35:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBS1ZXN2021645; Sat, 28 Dec 2019 01:35:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912280135.xBS1ZXN2021645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 28 Dec 2019 01:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356140 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 356140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 01:35:33 -0000 Author: cem Date: Sat Dec 28 01:35:32 2019 New Revision: 356140 URL: https://svnweb.freebsd.org/changeset/base/356140 Log: epoch.9: Add missing functions, clean up documentation Various rototilling. Modified: head/share/man/man9/epoch.9 Modified: head/share/man/man9/epoch.9 ============================================================================== --- head/share/man/man9/epoch.9 Fri Dec 27 23:19:21 2019 (r356139) +++ head/share/man/man9/epoch.9 Sat Dec 28 01:35:32 2019 (r356140) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 28, 2019 +.Dd December 27, 2019 .Dt EPOCH 9 .Os .Sh NAME @@ -37,34 +37,58 @@ .Nm epoch_enter , .Nm epoch_exit , .Nm epoch_wait , +.Nm epoch_enter_preempt , +.Nm epoch_exit_preempt , +.Nm epoch_wait_preempt , .Nm epoch_call , .Nm epoch_drain_callbacks , .Nm in_epoch , +.Nm in_epoch_verbose , .Nd kernel epoch based reclamation .Sh SYNOPSIS .In sys/param.h .In sys/proc.h .In sys/epoch.h +.\" Types +.Bd -literal +struct epoch; /* Opaque */ +.Ed +.Vt typedef "struct epoch *epoch_t" ; +.Bd -literal +struct epoch_context { + void *data[2]; +}; +.Ed +.Vt typedef "struct epoch_context *epoch_context_t" ; +.Bd -literal +struct epoch_tracker; /* Opaque */ +.Ed +.Vt typedef "struct epoch_tracker *epoch_tracker_t" ; +.\" Declarations .Ft epoch_t -.Fn epoch_alloc "int flags" +.Fn epoch_alloc "const char *name" "int flags" .Ft void +.Fn epoch_free "epoch_t epoch" +.Ft void .Fn epoch_enter "epoch_t epoch" .Ft void -.Fn epoch_enter_preempt "epoch_t epoch" "epoch_tracker_t et" -.Ft void .Fn epoch_exit "epoch_t epoch" .Ft void -.Fn epoch_exit_preempt "epoch_t epoch" "epoch_tracker_t et" -.Ft void .Fn epoch_wait "epoch_t epoch" .Ft void +.Fn epoch_enter_preempt "epoch_t epoch" "epoch_tracker_t et" +.Ft void +.Fn epoch_exit_preempt "epoch_t epoch" "epoch_tracker_t et" +.Ft void .Fn epoch_wait_preempt "epoch_t epoch" .Ft void -.Fn epoch_call "epoch_t epoch" "epoch_context_t ctx" "void (*callback) (epoch_context_t)" +.Fn epoch_call "epoch_t epoch" "epoch_context_t ctx" "void (*callback)(epoch_context_t)" .Ft void .Fn epoch_drain_callbacks "epoch_t epoch" .Ft int .Fn in_epoch "epoch_t epoch" +.Ft int +.Fn in_epoch_verbose "epoch_t epoch" "int dump_onfail" .Sh DESCRIPTION Epochs are used to guarantee liveness and immutability of data by deferring reclamation and mutation until a grace period has elapsed. @@ -72,58 +96,105 @@ Epochs do not have any lock ordering issues. Entering and leaving an epoch section will never block. .Pp Epochs are allocated with -.Fn epoch_alloc -and freed with +.Fn epoch_alloc . +The +.Fa name +argument is used for debugging convenience when the +.Cd EPOCH_TRACE +kernel option is configured. +By default, epochs do not allow preemption during sections. +By default mutexes cannot be held across +.Fn epoch_wait_preempt . +The +.Fa flags +specified are formed by +.Em OR Ns 'ing +the following values: +.Bl -tag -offset indent -width Ds +.It Dv EPOCH_LOCKED +Permit holding mutexes across +.Fn epoch_wait_preempt +(requires +.Dv EPOCH_PREEMPT ) . +When doing this one must be cautious of creating a situation where a deadlock +is possible. +.It Dv EPOCH_PREEMPT +The +.Vt epoch +will allow preemption during sections. +Only non-sleepable locks may be acquired during a preemptible epoch. +The functions +.Fn epoch_enter_preempt , +.Fn epoch_exit_preempt , +and +.Fn epoch_wait_preempt +must be used in place of +.Fn epoch_enter , +.Fn epoch_exit , +and +.Fn epoch_wait , +respectively. +.El +.Pp +.Vt epoch Ns s +are freed with .Fn epoch_free . -The flags passed to epoch_alloc determine whether preemption is -allowed during a section or not (the default), as specified by -EPOCH_PREEMPT. +.Pp Threads indicate the start of an epoch critical section by calling -.Fn epoch_enter . -The end of a critical section is indicated by calling -.Fn epoch_exit . -The _preempt variants can be used around code which requires preemption. -A thread can wait until a grace period has elapsed -since any threads have entered -the epoch by calling -.Fn epoch_wait -or -.Fn epoch_wait_preempt , -depending on the epoch_type. -The use of a default epoch type allows one to use -.Fn epoch_wait -which is guaranteed to have much shorter completion times since -we know that none of the threads in an epoch section will be preempted -before completing its section. -If the thread can't sleep or is otherwise in a performance sensitive -path it can ensure that a grace period has elapsed by calling -.Fn epoch_call -with a callback with any work that needs to wait for an epoch to elapse. -Only non-sleepable locks can be acquired during a section protected by +.Fn epoch_enter +(or .Fn epoch_enter_preempt +for preemptible epochs). +Threads call +.Fn epoch_exit +(or +.Fn epoch_exit_preempt +for preemptible epochs) +to indicate the end of a critical section. +.Vt struct epoch_tracker Ns s +are stack objects whose pointers are passed to +.Fn epoch_enter_preempt and -.Fn epoch_exit_preempt . +.Fn epoch_exit_preempt +(much like +.Vt struct rm_priotracker ) . +.Pp +Threads can defer work until a grace period has expired since any thread has +entered the epoch either synchronously or asynchronously. +.Fn epoch_call +defers work asynchronously by invoking the provided +.Fa callback +at a later time. +.Fn epoch_wait +(or +.Fn epoch_wait_preempt ) +blocks the current thread until the grace period has expired and the work can be +done safely. +.Pp +Default, non-preemptible epoch wait +.Fn ( epoch_wait ) +is guaranteed to have much shorter completion times relative to +preemptible epoch wait +.Fn ( epoch_wait_preempt ) . +(In the default type, none of the threads in an epoch section will be preempted +before completing its section.) +.Pp INVARIANTS can assert that a thread is in an epoch by using .Fn in_epoch . +.Fn in_epoch "epoch" +is equivalent to invoking +.Fn in_epoch_verbose "epoch" "0" . +If +.Cd EPOCH_TRACE +is enabled, +.Fn in_epoch_verbose "epoch" "1" +provides additional verbose debugging information. .Pp The epoch API currently does not support sleeping in epoch_preempt sections. A caller should never call .Fn epoch_wait in the middle of an epoch section for the same epoch as this will lead to a deadlock. .Pp -By default mutexes cannot be held across -.Fn epoch_wait_preempt . -To permit this the epoch must be allocated with -EPOCH_LOCKED. -When doing this one must be cautious of creating a situation where a deadlock is -possible. Note that epochs are not a straight replacement for read locks. -Callers must use safe list and tailq traversal routines in an epoch (see ck_queue). -When modifying a list referenced from an epoch section safe removal -routines must be used and the caller can no longer modify a list entry -in place. -An item to be modified must be handled with copy on write -and frees must be deferred until after a grace period has elapsed. -.Pp The .Fn epoch_drain_callbacks function is used to drain all pending callbacks which have been invoked by prior @@ -140,12 +211,18 @@ This function can sleep and is not optimized for perfo will return 1 if curthread is in curepoch, 0 otherwise. .Sh CAVEATS One must be cautious when using -.Fn epoch_wait_preempt -threads are pinned during epoch sections so if a thread in a section is then -preempted by a higher priority compute bound thread on that CPU it can be -prevented from leaving the section. -Thus the wait time for the waiter is -potentially unbounded. +.Fn epoch_wait_preempt . +Threads are pinned during epoch sections, so if a thread in a section is then +preempted by a higher priority compute bound thread on that CPU, it can be +prevented from leaving the section indefinitely. +.Pp +Epochs are not a straight replacement for read locks. +Callers must use safe list and tailq traversal routines in an epoch (see ck_queue). +When modifying a list referenced from an epoch section safe removal +routines must be used and the caller can no longer modify a list entry +in place. +An item to be modified must be handled with copy on write +and frees must be deferred until after a grace period has elapsed. .Sh EXAMPLES Async free example: Thread 1: @@ -154,8 +231,8 @@ int in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_laddr *laddr, struct ucred *cred) { - /* ... */ - epoch_enter(net_epoch); + /* ... */ + epoch_enter(net_epoch); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -167,7 +244,7 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, } } epoch_exit(net_epoch); - /* ... */ + /* ... */ } .Ed Thread 2: @@ -198,8 +275,6 @@ and then defers deletion. More general mutation or a synchronous free would have to follow a call to .Fn epoch_wait . -.Sh ERRORS -None. .Sh NOTES The .Nm From owner-svn-src-head@freebsd.org Sat Dec 28 02:11:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38A3F1D6C1A; Sat, 28 Dec 2019 02:11:42 +0000 (UTC) (envelope-from pfg@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 47l6dB0qdbz4pZ9; Sat, 28 Dec 2019 02:11:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17A8E21FB4; Sat, 28 Dec 2019 02:11:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBS2BfN7044651; Sat, 28 Dec 2019 02:11:41 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBS2Bfvl044650; Sat, 28 Dec 2019 02:11:41 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201912280211.xBS2Bfvl044650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 28 Dec 2019 02:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356141 - head/lib/libc/arm/string X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/arm/string X-SVN-Commit-Revision: 356141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 02:11:42 -0000 Author: pfg Date: Sat Dec 28 02:11:41 2019 New Revision: 356141 URL: https://svnweb.freebsd.org/changeset/base/356141 Log: arm/ffs.S: remove stale comment. We already use the CLZ instruction. Discussed with: andrew Modified: head/lib/libc/arm/string/ffs.S Modified: head/lib/libc/arm/string/ffs.S ============================================================================== --- head/lib/libc/arm/string/ffs.S Sat Dec 28 01:35:32 2019 (r356140) +++ head/lib/libc/arm/string/ffs.S Sat Dec 28 02:11:41 2019 (r356141) @@ -40,9 +40,6 @@ __FBSDID("$FreeBSD$"); * 6 bits as an index into the table. This algorithm should be a win * over the checking each bit in turn as per the C compiled version. * - * under ARMv5 there's an instruction called CLZ (count leading Zero's) that - * could be used - * * This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on * 16 Feb 1994. */ From owner-svn-src-head@freebsd.org Sat Dec 28 02:58:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F6CC1D7A6B; Sat, 28 Dec 2019 02:58:31 +0000 (UTC) (envelope-from pfg@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 47l7gC1qDcz4rFp; Sat, 28 Dec 2019 02:58:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39BDB22828; Sat, 28 Dec 2019 02:58:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBS2wVEt068143; Sat, 28 Dec 2019 02:58:31 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBS2wU2R068141; Sat, 28 Dec 2019 02:58:30 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201912280258.xBS2wU2R068141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 28 Dec 2019 02:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356142 - in head/sys: dev/ofw sys X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: dev/ofw sys X-SVN-Commit-Revision: 356142 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 02:58:31 -0000 Author: pfg Date: Sat Dec 28 02:58:30 2019 New Revision: 356142 URL: https://svnweb.freebsd.org/changeset/base/356142 Log: SPDX: update some tags with two licenses. Modified: head/sys/dev/ofw/openfirm.h head/sys/sys/sched.h Modified: head/sys/dev/ofw/openfirm.h ============================================================================== --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) @@ -1,7 +1,7 @@ /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) * * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. Modified: head/sys/sys/sched.h ============================================================================== --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) * * Copyright (c) 1996, 1997 * HD Associates, Inc. All rights reserved. From owner-svn-src-head@freebsd.org Sat Dec 28 03:16:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 328D11D8668; Sat, 28 Dec 2019 03:16:17 +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 47l83h6kN9z4sm0; Sat, 28 Dec 2019 03:16:16 +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 xBS3GF6i041169; Fri, 27 Dec 2019 19:16:15 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xBS3GFEt041168; Fri, 27 Dec 2019 19:16:15 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912280316.xBS3GFEt041168@gndrsh.dnsmgr.net> Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys In-Reply-To: <201912280258.xBS2wU2R068141@repo.freebsd.org> To: "Pedro F. Giffuni" Date: Fri, 27 Dec 2019 19:16:15 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47l83h6kN9z4sm0 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.985,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 03:16:17 -0000 > Author: pfg > Date: Sat Dec 28 02:58:30 2019 > New Revision: 356142 > URL: https://svnweb.freebsd.org/changeset/base/356142 > > Log: > SPDX: update some tags with two licenses. > > Modified: > head/sys/dev/ofw/openfirm.h > head/sys/sys/sched.h > > Modified: head/sys/dev/ofw/openfirm.h > ============================================================================== > --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) > +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) > @@ -1,7 +1,7 @@ > /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ > > /*- > - * SPDX-License-Identifier: BSD-4-Clause > + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > * > * Copyright (C) 1995, 1996 Wolfgang Solfrank. > * Copyright (C) 1995, 1996 TooLs GmbH. > > Modified: head/sys/sys/sched.h > ============================================================================== > --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) > +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) > @@ -1,5 +1,5 @@ > /*- > - * SPDX-License-Identifier: BSD-4-Clause > + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > * > * Copyright (c) 1996, 1997 > * HD Associates, Inc. All rights reserved. > This situation should not of occured, and leads to an ambigous license state. What code is under license 2 clause and what under 4 clause? It looks to me as if this was done by Jeff Robinson as the 2 clause is attached to his copyright and we should probably just ask him to relax that back to the files existing 4 clause license, and or go after Greg Ansley of HD associtates to get them to relax the 4 clause. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Dec 28 04:08:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A603A1D936C; Sat, 28 Dec 2019 04:08:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47l9Cj3zQyz4vSj; Sat, 28 Dec 2019 04:08:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id EFEA817E30; Sat, 28 Dec 2019 04:08:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912280316.xBS3GFEt041168@gndrsh.dnsmgr.net> From: Pedro Giffuni Autocrypt: addr=pfg@FreeBSD.org; keydata= mQENBFU6tr0BCAC/MABNSg8O9sLZZ1cCl8GczwjnyF6WEvtfLpIkAWEo49H3TuG3cMNwuavi xnwASLS73ppj6ziWK1QsfdAaA8Mkvk25UtenfsCTiA38q0RwvHPn8W6eorJ6rYHRReNnncA+ oPLrLmL6IOUK9dlcLJP5i45PGwpx9YNI+D/BFcji7enpnsGjunhRE3NJ1YBXiKMormfnPvpV yVWpKnnB03nFIQphW108G5U9wytZqsiGkshn0ar0FBGsdJ19d/ePBuMceaWRtf0nJrNkC9sB D8ISmFp6/DAoQBhyJxvemC83/QNV5u9kGdwemaKOJ6SdAmBBZYbdAxCO8i/Eq33mrXx7ABEB AAG0H1BlZHJvIEdpZmZ1bmkgPHBmZ0BGcmVlQlNELm9yZz6JATcEEwEKACEFAlU6tr0CGwMF CwkIBwMFFQoJCAsFFgMCAQACHgECF4AACgkQzWsLls7yLQTFEgf/blVvg7MPpZp/KWwEShqI VpkJLhXLjvYzjoSCrpuVtNMCdpYh3L6gY5mBr9VASc/iWb6DUUxX9g6oLQ4l1e8eEwSHdXda RG/NjxJhz8dsLO8H6dnwl6HEZ+nymXIibX6GGy10gQeyv6sNGsgSCwlyFJZcv2lW2M1ev11w 3yY1eQnIsPq4vyIMYEQ1aIIYu1JPNEzRZ7sDuRGdnvMH7FhHaNzSs8d4PHw2JSwDHPuN/W6S UhK+A/TDW9BQ4ZzDRpKrIPfWqkAa+76NtGglmJWS99WG7rJAoPUIj2xpzojoQbT3z1vbeGxK cgGvOyQMlrJSRZwOtFuhcdbQ6DX4ETI7NrkBDQRVOra9AQgA1ACQK5u/H1MgjSKXQttCv8Kz /k7fHmaWLrhPAJH6bqR7wpv/Hz2y/8uD+5qg/vk9/pwYuj9TzbCXs9NeWye/+DV8Aw7Z22b2 OjB0VbEpHREDs0zS+0KMP7STOPpyHVYdgWCQ7Qgd/LG0gfUP5M0R8s2OH3Il8rcS4ZeEd/tr O3LyoDiK4mInT/X3oJX7xetws3jpSPk51TDOplamehXjndwemttUTw1czITF9MfDosaihoUr o6NcAtBzFYIF2NuKhrASs9prec+e36a3lCUbMOHof62TnBZZnWtNdmnv1RNv3q17yavqi0F/ rvtmckHhJ8NcnYL8/gGD48nhKf60UQARAQABiQEfBBgBCgAJBQJVOra9AhsMAAoJEM1rC5bO 8i0EkGAH+QG/1y0mcOBFsouMdmDUpRusRxWHdmdIjFt4FJ2/K7YDyrliKcUTOp+zjCyfLVE6 UELiRvsT+mg4QcZL7e+JAuLkW5LhiAskz8/1fRgnwVquTcYd7TPJrYnejpLyumhbsgo0bN4G s9yrJeQpKbln6YQxifzT4Eqot3aEeZxlUEKzQd0Vq1ci8PTI1krvda9x+FdGvKxY9Iz4T+SW NZsvBaCXo9hjJZ7U1VaCdWxgHhy5tuTuMAGGS9lCGbdvdKuAbSQDtcvx0jcY5s7Q2t2udCyV mRDbQYrl8PEyJa3Cz3NoBD9g9EEr9PlX05hOWMVf3M5pS4j/XKbzUbKqiBy1VPw= Organization: FreeBSD Message-ID: <31c49f48-db69-4b8b-54d0-8e575bb3d2f4@FreeBSD.org> Date: Fri, 27 Dec 2019 23:08:14 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <201912280316.xBS3GFEt041168@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 04:08:17 -0000 On 2019-12-27 22:16, Rodney W. Grimes wrote: >> Author: pfg >> Date: Sat Dec 28 02:58:30 2019 >> New Revision: 356142 >> URL: https://svnweb.freebsd.org/changeset/base/356142 >> >> Log: >> SPDX: update some tags with two licenses. >> >> Modified: >> head/sys/dev/ofw/openfirm.h >> head/sys/sys/sched.h >> >> Modified: head/sys/dev/ofw/openfirm.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) >> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) >> @@ -1,7 +1,7 @@ >> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ >> =20 >> /*- >> - * SPDX-License-Identifier: BSD-4-Clause >> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) >> * >> * Copyright (C) 1995, 1996 Wolfgang Solfrank. >> * Copyright (C) 1995, 1996 TooLs GmbH. >> >> Modified: head/sys/sys/sched.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) >> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) >> @@ -1,5 +1,5 @@ >> /*- >> - * SPDX-License-Identifier: BSD-4-Clause >> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) >> * >> * Copyright (c) 1996, 1997 >> * HD Associates, Inc. All rights reserved. >> > This situation should not of occured, and leads to an ambigous license = state. It actually happens a lot (I mean two or more licenses in the same file): SPDX explicitly uses AND (not OR) for cases like this. > What code is under license 2 clause and what under 4 clause?=20 Anyone redistributing the file has to respect both licenses. If you are lucky enough to have access to version control you may be able to discern the author and the corresponding license, otherwise you are trapped with both. > It looks to me as if this was done by Jeff Robinson as the 2 clause is > attached to his copyright and we should probably just ask him to relax > that back to the files existing 4 clause license, and or go after Greg > Ansley of HD associtates to get them to relax the 4 clause. > No, Jeff (or anyone else, as I said there are many cases in our tree) is entitled to choose his own license as long as it is compatible with the pre-existing licensing. Pedro. From owner-svn-src-head@freebsd.org Sat Dec 28 04:25:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08AA41D99E9; Sat, 28 Dec 2019 04:25:04 +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 47l9b331hVz3CLQ; Sat, 28 Dec 2019 04:25:02 +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 xBS4OwvX041449; Fri, 27 Dec 2019 20:24:58 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xBS4OwfL041448; Fri, 27 Dec 2019 20:24:58 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912280424.xBS4OwfL041448@gndrsh.dnsmgr.net> Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys In-Reply-To: <31c49f48-db69-4b8b-54d0-8e575bb3d2f4@FreeBSD.org> To: Pedro Giffuni Date: Fri, 27 Dec 2019 20:24:58 -0800 (PST) CC: rgrimes@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Reply-To: rgrimes@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47l9b331hVz3CLQ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.983,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 04:25:04 -0000 [ Charset UTF-8 unsupported, converting... ] > > On 2019-12-27 22:16, Rodney W. Grimes wrote: > >> Author: pfg > >> Date: Sat Dec 28 02:58:30 2019 > >> New Revision: 356142 > >> URL: https://svnweb.freebsd.org/changeset/base/356142 > >> > >> Log: > >> SPDX: update some tags with two licenses. > >> > >> Modified: > >> head/sys/dev/ofw/openfirm.h > >> head/sys/sys/sched.h > >> > >> Modified: head/sys/dev/ofw/openfirm.h > >> ============================================================================== > >> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) > >> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) > >> @@ -1,7 +1,7 @@ > >> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ > >> > >> /*- > >> - * SPDX-License-Identifier: BSD-4-Clause > >> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > >> * > >> * Copyright (C) 1995, 1996 Wolfgang Solfrank. > >> * Copyright (C) 1995, 1996 TooLs GmbH. > >> > >> Modified: head/sys/sys/sched.h > >> ============================================================================== > >> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) > >> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) > >> @@ -1,5 +1,5 @@ > >> /*- > >> - * SPDX-License-Identifier: BSD-4-Clause > >> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > >> * > >> * Copyright (c) 1996, 1997 > >> * HD Associates, Inc. All rights reserved. > >> > > This situation should not of occured, and leads to an ambigous license state. > > It actually happens a lot (I mean two or more licenses in the same > file): SPDX explicitly uses AND (not OR) for cases like this. > > > What code is under license 2 clause and what under 4 clause? > > Anyone redistributing the file has to respect both licenses. If you are > lucky enough to have access to version control you may be able to > discern the author and the corresponding license, otherwise you are > trapped with both. So the 2 clause add is null, so why have it there? > > > It looks to me as if this was done by Jeff Robinson as the 2 clause is > > attached to his copyright and we should probably just ask him to relax > > that back to the files existing 4 clause license, and or go after Greg > > Ansley of HD associtates to get them to relax the 4 clause. > > > No, Jeff (or anyone else, as I said there are many cases in our tree) is > entitled to choose his own license as long as it is compatible with the > pre-existing licensing. I was specifically sighting this one file, sys/sys/sched.h. Actually that might be a grey area, no place does the BSD license grant you rights to modify the terms of the license, and that is in effect what adding this second license does. You can choose your own license for original work, sure, but obliterating parts of an existing license by applying a second license which is in conflict is probably a poor idea. > Pedro. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Dec 28 04:57:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FC7F1DA561; Sat, 28 Dec 2019 04:57:36 +0000 (UTC) (envelope-from pfg@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 47lBJc1yptz3Dg3; Sat, 28 Dec 2019 04:57:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id A672218403; Sat, 28 Dec 2019 04:57:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys To: rgrimes@FreeBSD.org Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201912280424.xBS4OwfL041448@gndrsh.dnsmgr.net> From: Pedro Giffuni Autocrypt: addr=pfg@FreeBSD.org; keydata= mQENBFU6tr0BCAC/MABNSg8O9sLZZ1cCl8GczwjnyF6WEvtfLpIkAWEo49H3TuG3cMNwuavi xnwASLS73ppj6ziWK1QsfdAaA8Mkvk25UtenfsCTiA38q0RwvHPn8W6eorJ6rYHRReNnncA+ oPLrLmL6IOUK9dlcLJP5i45PGwpx9YNI+D/BFcji7enpnsGjunhRE3NJ1YBXiKMormfnPvpV yVWpKnnB03nFIQphW108G5U9wytZqsiGkshn0ar0FBGsdJ19d/ePBuMceaWRtf0nJrNkC9sB D8ISmFp6/DAoQBhyJxvemC83/QNV5u9kGdwemaKOJ6SdAmBBZYbdAxCO8i/Eq33mrXx7ABEB AAG0H1BlZHJvIEdpZmZ1bmkgPHBmZ0BGcmVlQlNELm9yZz6JATcEEwEKACEFAlU6tr0CGwMF CwkIBwMFFQoJCAsFFgMCAQACHgECF4AACgkQzWsLls7yLQTFEgf/blVvg7MPpZp/KWwEShqI VpkJLhXLjvYzjoSCrpuVtNMCdpYh3L6gY5mBr9VASc/iWb6DUUxX9g6oLQ4l1e8eEwSHdXda RG/NjxJhz8dsLO8H6dnwl6HEZ+nymXIibX6GGy10gQeyv6sNGsgSCwlyFJZcv2lW2M1ev11w 3yY1eQnIsPq4vyIMYEQ1aIIYu1JPNEzRZ7sDuRGdnvMH7FhHaNzSs8d4PHw2JSwDHPuN/W6S UhK+A/TDW9BQ4ZzDRpKrIPfWqkAa+76NtGglmJWS99WG7rJAoPUIj2xpzojoQbT3z1vbeGxK cgGvOyQMlrJSRZwOtFuhcdbQ6DX4ETI7NrkBDQRVOra9AQgA1ACQK5u/H1MgjSKXQttCv8Kz /k7fHmaWLrhPAJH6bqR7wpv/Hz2y/8uD+5qg/vk9/pwYuj9TzbCXs9NeWye/+DV8Aw7Z22b2 OjB0VbEpHREDs0zS+0KMP7STOPpyHVYdgWCQ7Qgd/LG0gfUP5M0R8s2OH3Il8rcS4ZeEd/tr O3LyoDiK4mInT/X3oJX7xetws3jpSPk51TDOplamehXjndwemttUTw1czITF9MfDosaihoUr o6NcAtBzFYIF2NuKhrASs9prec+e36a3lCUbMOHof62TnBZZnWtNdmnv1RNv3q17yavqi0F/ rvtmckHhJ8NcnYL8/gGD48nhKf60UQARAQABiQEfBBgBCgAJBQJVOra9AhsMAAoJEM1rC5bO 8i0EkGAH+QG/1y0mcOBFsouMdmDUpRusRxWHdmdIjFt4FJ2/K7YDyrliKcUTOp+zjCyfLVE6 UELiRvsT+mg4QcZL7e+JAuLkW5LhiAskz8/1fRgnwVquTcYd7TPJrYnejpLyumhbsgo0bN4G s9yrJeQpKbln6YQxifzT4Eqot3aEeZxlUEKzQd0Vq1ci8PTI1krvda9x+FdGvKxY9Iz4T+SW NZsvBaCXo9hjJZ7U1VaCdWxgHhy5tuTuMAGGS9lCGbdvdKuAbSQDtcvx0jcY5s7Q2t2udCyV mRDbQYrl8PEyJa3Cz3NoBD9g9EEr9PlX05hOWMVf3M5pS4j/XKbzUbKqiBy1VPw= Organization: FreeBSD Message-ID: <62fe2914-91fd-96ba-5953-57fa43dfe775@FreeBSD.org> Date: Fri, 27 Dec 2019 23:57:33 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <201912280424.xBS4OwfL041448@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 04:57:36 -0000 On 2019-12-27 23:24, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> On 2019-12-27 22:16, Rodney W. Grimes wrote: >>>> Author: pfg >>>> Date: Sat Dec 28 02:58:30 2019 >>>> New Revision: 356142 >>>> URL: https://svnweb.freebsd.org/changeset/base/356142 >>>> >>>> Log: >>>> SPDX: update some tags with two licenses. >>>> >>>> Modified: >>>> head/sys/dev/ofw/openfirm.h >>>> head/sys/sys/sched.h >>>> >>>> Modified: head/sys/dev/ofw/openfirm.h >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) >>>> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) >>>> @@ -1,7 +1,7 @@ >>>> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ >>>> =20 >>>> /*- >>>> - * SPDX-License-Identifier: BSD-4-Clause >>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)= >>>> * >>>> * Copyright (C) 1995, 1996 Wolfgang Solfrank. >>>> * Copyright (C) 1995, 1996 TooLs GmbH. >>>> >>>> Modified: head/sys/sys/sched.h >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) >>>> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) >>>> @@ -1,5 +1,5 @@ >>>> /*- >>>> - * SPDX-License-Identifier: BSD-4-Clause >>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)= >>>> * >>>> * Copyright (c) 1996, 1997 >>>> * HD Associates, Inc. All rights reserved. >>>> >>> This situation should not of occured, and leads to an ambigous licens= e state. >> It actually happens a lot (I mean two or more licenses in the same >> file): SPDX explicitly uses AND (not OR) for cases like this. >> >>> What code is under license 2 clause and what under 4 clause?=20 >> Anyone redistributing the file has to respect both licenses. If you ar= e >> lucky enough to have access to version control you may be able to >> discern the author and the corresponding license, otherwise you are >> trapped with both. > So the 2 clause add is null, so why have it there? So that eventually, when the project gets to a point where sufficient part of the code is rewritten they can opt to change the license to the simpler form. There are ways to relicense projects gradually, and its nothing new, in fact it is very much in the BSD spirit to gradually replace more restricted UNIX code. It may be a long shot but it has happened on other projects as well: libdialog (in our tree) was rewritten and relicensed from GPL to LGPL. >>> It looks to me as if this was done by Jeff Robinson as the 2 clause i= s >>> attached to his copyright and we should probably just ask him to rela= x >>> that back to the files existing 4 clause license, and or go after Gre= g >>> Ansley of HD associtates to get them to relax the 4 clause. >>> >> No, Jeff (or anyone else, as I said there are many cases in our tree) = is >> entitled to choose his own license as long as it is compatible with th= e >> pre-existing licensing. > I was specifically sighting this one file, sys/sys/sched.h. > > Actually that might be a grey area, no place does the BSD license grant= > you rights to modify the terms of the license, and that is in effect > what adding this second license does. No one is modifying the original license: it is there and applies to the original code. > You can choose your own license for original work, sure, but obliterati= ng > parts of an existing license by applying a second license which is in > conflict is probably a poor idea. We don't do that at all: pretty clearly there is no conflict between both licenses as you can comply with both. Pedro. From owner-svn-src-head@freebsd.org Sat Dec 28 05:27:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 308E61DB377; Sat, 28 Dec 2019 05:27:12 +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 47lByl3pddz3G2T; Sat, 28 Dec 2019 05:27:11 +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 xBS5R88x041738; Fri, 27 Dec 2019 21:27:08 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xBS5R8fk041737; Fri, 27 Dec 2019 21:27:08 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys In-Reply-To: <62fe2914-91fd-96ba-5953-57fa43dfe775@FreeBSD.org> To: Pedro Giffuni Date: Fri, 27 Dec 2019 21:27:08 -0800 (PST) CC: rgrimes@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Reply-To: rgrimes@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47lByl3pddz3G2T X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.983,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 05:27:12 -0000 [ Charset UTF-8 unsupported, converting... ] > > On 2019-12-27 23:24, Rodney W. Grimes wrote: > > [ Charset UTF-8 unsupported, converting... ] > >> On 2019-12-27 22:16, Rodney W. Grimes wrote: > >>>> Author: pfg > >>>> Date: Sat Dec 28 02:58:30 2019 > >>>> New Revision: 356142 > >>>> URL: https://svnweb.freebsd.org/changeset/base/356142 > >>>> > >>>> Log: > >>>> SPDX: update some tags with two licenses. > >>>> > >>>> Modified: > >>>> head/sys/dev/ofw/openfirm.h > >>>> head/sys/sys/sched.h > >>>> > >>>> Modified: head/sys/dev/ofw/openfirm.h > >>>> ============================================================================== > >>>> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) > >>>> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) > >>>> @@ -1,7 +1,7 @@ > >>>> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ > >>>> > >>>> /*- > >>>> - * SPDX-License-Identifier: BSD-4-Clause > >>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > >>>> * > >>>> * Copyright (C) 1995, 1996 Wolfgang Solfrank. > >>>> * Copyright (C) 1995, 1996 TooLs GmbH. > >>>> > >>>> Modified: head/sys/sys/sched.h > >>>> ============================================================================== > >>>> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) > >>>> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) > >>>> @@ -1,5 +1,5 @@ > >>>> /*- > >>>> - * SPDX-License-Identifier: BSD-4-Clause > >>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > >>>> * > >>>> * Copyright (c) 1996, 1997 > >>>> * HD Associates, Inc. All rights reserved. > >>>> > >>> This situation should not of occured, and leads to an ambigous license state. > >> It actually happens a lot (I mean two or more licenses in the same > >> file): SPDX explicitly uses AND (not OR) for cases like this. > >> > >>> What code is under license 2 clause and what under 4 clause? > >> Anyone redistributing the file has to respect both licenses. If you are > >> lucky enough to have access to version control you may be able to > >> discern the author and the corresponding license, otherwise you are > >> trapped with both. > > So the 2 clause add is null, so why have it there? > > So that eventually, when the project gets to a point where sufficient > part of the code is rewritten they can opt to change the license to the > simpler form. There are ways to relicense projects gradually, and its > nothing new, in fact it is very much in the BSD spirit to gradually > replace more restricted UNIX code. The only changing we have done to BSD licenses as in thost cases that the Regents requested/granted the right to change to lesser clauses. Until you get HD & Associtates (in this one case) to grant that right your walking on a grey edge I would rather not walk on. The reference to BSD spirit and replacing more restricted UNIX (tm) code is way off base in this context. This is not an AT & T license we are talking about here. And again you can not just modify the existing 4 clause licensed file by slapping a 2 clause license into it, or the project would of done that everyplace ages ago. What is done here in this file is a mistake, and should be corrected. Can you point me to other files that actually have multiple BSD licenses in them? > > It may be a long shot but it has happened on other projects as well: > libdialog (in our tree) was rewritten and relicensed from GPL to LGPL. > > > >>> It looks to me as if this was done by Jeff Robinson as the 2 clause is > >>> attached to his copyright and we should probably just ask him to relax > >>> that back to the files existing 4 clause license, and or go after Greg > >>> Ansley of HD associtates to get them to relax the 4 clause. > >>> > >> No, Jeff (or anyone else, as I said there are many cases in our tree) is > >> entitled to choose his own license as long as it is compatible with the > >> pre-existing licensing. > > I was specifically sighting this one file, sys/sys/sched.h. > > > > Actually that might be a grey area, no place does the BSD license grant > > you rights to modify the terms of the license, and that is in effect > > what adding this second license does. > > No one is modifying the original license: it is there and applies to the > original code. > > > > You can choose your own license for original work, sure, but obliterating > > parts of an existing license by applying a second license which is in > > conflict is probably a poor idea. > > > We don't do that at all: pretty clearly there is no conflict between > both licenses as you can comply with both. The only way to comply with both is to comply with the full 4 clause license. Hense the 2 clause is pointless in being there and can never apply until all 4 clause authors agree to change to 2 clause. > Pedro. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Dec 28 05:34:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 986C81DB813 for ; Sat, 28 Dec 2019 05:34:34 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (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 47lC7F5g8Pz3Gjs for ; Sat, 28 Dec 2019 05:34:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id z76so23264827qka.2 for ; Fri, 27 Dec 2019 21:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CQjoHHfmkEK+VEv0eqIqJaLSd4fncDsVwXDyT5ma/Qo=; b=erjN76b7sboIKwQv1ygrwLGGkCx/aKOL/OQiChs6Edc694M/G6C+xru4ggxcfTczPp 7uw0gdD1lG1/WNkhN7Az3KJlbanKZMpMLoBWI2gTOl0qxTvkvz2+lmQd+V360uifd9dj Mw6ZzlaZwb6rxKJTE2nU6tCvMk8B+kXlgs603KVVRsYYvYwndPJ9q0D5UWwpk7h9pJ5t QsPg6XcDkCAjuReKFU2KD9f3bSNMMqRKI25XDeKwlF85bkMzm7kBzwV7YWaNek2vvWv3 p/AKk0tM6TA2ogNftxeLp1uQrgHyJZkkcyNhPy26Ze16dLYhQ4ZF2m9GyWiFl6An6ZWm 3wqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CQjoHHfmkEK+VEv0eqIqJaLSd4fncDsVwXDyT5ma/Qo=; b=GIiEpUzfP1uJaDNJlHVTJ05U32q6T/9pyLZaT2JOZFvopx7/fhBY1TLaqml30rGIFP yJsK8z9NyHUfZEFu/bvr0gX2BVHAqI+FfvEPAzDGCEaGG8rupsrQEgRfrodHbqrV8jOk EKrH5SmctnAxHBEYfSTuYwGsQxwFNYdPjWXog3TR7fUK04XGNMfzT7DHDfeQMGmfbJof hgESxvtTNHaDSqLpo3tuXKpK3THUuPBDUtkKvnxxRPSzkFjGMkhbk5zHnEpv7nJ0JBuS HrmuIMsi+1LDRJKgEUVVHiJTm8QLkqp6Db6K3aznFt05ltPidCU0M2E5356h/am/tDTp +TYg== X-Gm-Message-State: APjAAAUCZqgXQUgZU+K5sO3iwZ5QQegJmwS9V+0OfWm4OZkeVSzSAYxR rEcF88WVoAY1hZXovdBqzxKqCeTjWrtt8W+FA7H79Wqc3NQ= X-Google-Smtp-Source: APXvYqyBEHhZVETipntqBgQJV3uiNQfHnKMP3qW60WDydxYT/nCLPlEg1goyVb1URStVzSqob7BMOkEmGca1UE222rc= X-Received: by 2002:a05:620a:795:: with SMTP id 21mr46854552qka.60.1577511272591; Fri, 27 Dec 2019 21:34:32 -0800 (PST) MIME-Version: 1.0 References: <62fe2914-91fd-96ba-5953-57fa43dfe775@FreeBSD.org> <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> In-Reply-To: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> From: Warner Losh Date: Fri, 27 Dec 2019 22:34:21 -0700 Message-ID: Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys To: "Rodney W. Grimes" Cc: Pedro Giffuni , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47lC7F5g8Pz3Gjs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=erjN76b7; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.65 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[9.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.65)[ip: (-9.16), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.88), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 05:34:34 -0000 On Fri, Dec 27, 2019 at 10:27 PM Rodney W. Grimes wrote: > > > > You can choose your own license for original work, sure, but > obliterating > > > parts of an existing license by applying a second license which is in > > > conflict is probably a poor idea. > > > > > > We don't do that at all: pretty clearly there is no conflict between > > both licenses as you can comply with both. > > The only way to comply with both is to comply with the full 4 > clause license. Hense the 2 clause is pointless in being there > and can never apply until all 4 clause authors agree to change > to 2 clause. > Until such time as Jeff finishes rewriting the files, then we just nerf the 4 clause one as no longer relevant since it describes no code in the file anymore... We've done exactly the thing Jeff did hundreds if not thousands of times already in the project in code spanning at least the last 25 or so years... Not sure why it's coming up now over an annotation that has a specific meaning that's clear and well defined. Warner From owner-svn-src-head@freebsd.org Sat Dec 28 05:55:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C19831DC026; Sat, 28 Dec 2019 05:55:32 +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 47lCbR58q5z3HRx; Sat, 28 Dec 2019 05:55:31 +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 xBS5tR8q041838; Fri, 27 Dec 2019 21:55:28 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xBS5tRtL041837; Fri, 27 Dec 2019 21:55:27 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912280555.xBS5tRtL041837@gndrsh.dnsmgr.net> Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys In-Reply-To: To: Warner Losh Date: Fri, 27 Dec 2019 21:55:27 -0800 (PST) CC: "Rodney W. Grimes" , Pedro Giffuni , src-committers , svn-src-all , svn-src-head 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: 47lCbR58q5z3HRx 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.58 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.34)[-0.340,0]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.02)[-0.019,0]; 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)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; 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.02), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 05:55:32 -0000 > On Fri, Dec 27, 2019 at 10:27 PM Rodney W. Grimes > wrote: > > > > > > > You can choose your own license for original work, sure, but > > obliterating > > > > parts of an existing license by applying a second license which is in > > > > conflict is probably a poor idea. > > > > > > > > > We don't do that at all: pretty clearly there is no conflict between > > > both licenses as you can comply with both. > > > > The only way to comply with both is to comply with the full 4 > > clause license. Hense the 2 clause is pointless in being there > > and can never apply until all 4 clause authors agree to change > > to 2 clause. > > > > > Until such time as Jeff finishes rewriting the files, then we just nerf the > 4 clause one as no longer relevant since it describes no code in the file > anymore... Slippery slope as that would require a very detailed audit to make sure at no time in any way did Jeff or anyone else copy or retain any original code. > > We've done exactly the thing Jeff did hundreds if not thousands of times > already in the project in code spanning > at least the last 25 or so years... I have to call BS on that claim, the project is just barely past 25 years old, and we certainly did not do any of this at that time, and further the 3 clause came into existance in 1999, and the 2 clause was that same time frame, so possibly 20 years. Please show me the 100 to 1000's of files that this occured in. > Not sure why it's coming up now over an annotation that has a > specific meaning that's clear and well defined. No one pendantically legal has been watching commits for 20 years is probably why? > Warner -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Dec 28 06:56:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1AAA1DDFA4; Sat, 28 Dec 2019 06:56:22 +0000 (UTC) (envelope-from adrian@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 47lDxf3pl4z3LrC; Sat, 28 Dec 2019 06:56:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7DDDC254C6; Sat, 28 Dec 2019 06:56:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBS6uMrM012341; Sat, 28 Dec 2019 06:56:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBS6uL6X012337; Sat, 28 Dec 2019 06:56:21 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201912280656.xBS6uL6X012337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 28 Dec 2019 06:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356145 - head/sys/mips/atheros X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/atheros X-SVN-Commit-Revision: 356145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 06:56:22 -0000 Author: adrian Date: Sat Dec 28 06:56:21 2019 New Revision: 356145 URL: https://svnweb.freebsd.org/changeset/base/356145 Log: [ar71xx] generate a random mac address using eth_gen_addr() This removes a hard-coded random mac address generator and uses the (not so) new system routine. Tested: * TP-Link WDR-4300 (AR934x + AR9580) Modified: head/sys/mips/atheros/ar71xx_macaddr.c head/sys/mips/atheros/ar71xx_macaddr.h head/sys/mips/atheros/if_arge.c Modified: head/sys/mips/atheros/ar71xx_macaddr.c ============================================================================== --- head/sys/mips/atheros/ar71xx_macaddr.c Sat Dec 28 05:28:29 2019 (r356144) +++ head/sys/mips/atheros/ar71xx_macaddr.c Sat Dec 28 06:56:21 2019 (r356145) @@ -93,18 +93,9 @@ ar71xx_mac_addr_init(unsigned char *dst, const unsigne * Returns 0 on success, -1 on error. */ int -ar71xx_mac_addr_random_init(unsigned char *dst) +ar71xx_mac_addr_random_init(struct ifnet *ifp, struct ether_addr *dst) { - uint32_t rnd; - rnd = arc4random(); - - dst[0] = 'b'; - dst[1] = 's'; - dst[2] = 'd'; - dst[3] = (rnd >> 24) & 0xff; - dst[4] = (rnd >> 16) & 0xff; - dst[5] = (rnd >> 8) & 0xff; - + ether_gen_addr(ifp, dst); return (0); } Modified: head/sys/mips/atheros/ar71xx_macaddr.h ============================================================================== --- head/sys/mips/atheros/ar71xx_macaddr.h Sat Dec 28 05:28:29 2019 (r356144) +++ head/sys/mips/atheros/ar71xx_macaddr.h Sat Dec 28 06:56:21 2019 (r356145) @@ -34,6 +34,6 @@ extern uint8_t ar71xx_board_mac_addr[ETHER_ADDR_LEN]; extern int ar71xx_mac_addr_init(unsigned char *dst, const unsigned char *src, int offset, int is_local); -extern int ar71xx_mac_addr_random_init(unsigned char *dst); +extern int ar71xx_mac_addr_random_init(struct ifnet *ifp, struct ether_addr *dst); #endif /* __ATHEROS_AR71XX_MACADDR_H__ */ Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Sat Dec 28 05:28:29 2019 (r356144) +++ head/sys/mips/atheros/if_arge.c Sat Dec 28 06:56:21 2019 (r356145) @@ -876,7 +876,11 @@ arge_attach(device_t dev) if (bootverbose) device_printf(dev, "Generating random ethernet address.\n"); - (void) ar71xx_mac_addr_random_init(sc->arge_eaddr); + if (ar71xx_mac_addr_random_init(ifp, (void *) sc->arge_eaddr) < 0) { + device_printf(dev, "Failed to choose random MAC address\n"); + error = EINVAL; + goto fail; + } } if (arge_dma_alloc(sc) != 0) { From owner-svn-src-head@freebsd.org Sat Dec 28 10:47:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0063C1E4D1B for ; Sat, 28 Dec 2019 10:47:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (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 47lL3l1X1Cz4Fpy for ; Sat, 28 Dec 2019 10:46:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72f.google.com with SMTP id c16so23188758qko.6 for ; Sat, 28 Dec 2019 02:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HdJTKqOiLfEn7gNebA6B7hSglTKDW6iZ39xTfHeploU=; b=qkaN2fgtGPn/C9GDAA9JD9qizZp+t4FWLR6n+FyE3chs+G7PyRLVV1MEFBmRejX0zd vvLvMyCQovbjp4C4fPt/J8pIgaJYrUhscwggZ1Ihvm4YIol4u821AOcZLwZ3r77UTUz7 lfxSsK8w91M45V1kKm+7vc+wj5g2ZvqXl66ix2kX58SAjHhT3o1eRrrZHwFGsYb95pHN JA79iJXRgnaKW5M8A8d8HDTfLVwOCrE4eRSBxL9Lltm6VoNn08DJruHNH6fcvjlo2NYl xx4XYgnxtdCNUXUqaRHaNM5mWXZC4mBiZtfFkYcRcREiEdc+j+xsLCFcc9AIu1OOuThw Z/nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HdJTKqOiLfEn7gNebA6B7hSglTKDW6iZ39xTfHeploU=; b=oE44ncKU63BzwY75qcYNxFVfrqZxwTcBNBc4t2S3V06nUKXLue1CyvWlYIAJC1k/u+ ZyOWyjGoH6GjhaltSZ5LGxaRs3V8B3DZDJCWWlwmY7hLu+7Q5W8fev2qSwlxFxzsGRB4 Ps0v7m+8F9T7aRA3iVvbDTQ/CKAOHMrhxyQF2CHipaOKDlBgI/SzNODfecLfv+3Avgyj pW1bPexKmxbAwEpSv7EPgnYQfJwS5IGXV85SEc15leXTKp7MqGYasqtd/UwP2+VpgRox 5Ozu/XivyzdS2FSY15pp5sbbFNBPCA35Wu0DNJM9QLQMbM4DFEiEMAk1YdkbfU4hHsRL 70lQ== X-Gm-Message-State: APjAAAVwTDgzS1Y8F3O0FsQey0/pbJGqSv6OkaIr5kH/PfCLC9uKlum3 2PMSiiVhzFYCV6k6BoM62mIfAiA7CVUCCFoerfDbqg== X-Google-Smtp-Source: APXvYqzxpjHWkY1TiKpC/ashBwQLsYNDVKFc5IuriaimaYgQdwmPcL7oCc3Un89wH+QNH4x5Jc61HefniUvF5crawCg= X-Received: by 2002:a37:4f8e:: with SMTP id d136mr46594799qkb.495.1577530017629; Sat, 28 Dec 2019 02:46:57 -0800 (PST) MIME-Version: 1.0 References: <201912280555.xBS5tRtL041837@gndrsh.dnsmgr.net> In-Reply-To: <201912280555.xBS5tRtL041837@gndrsh.dnsmgr.net> From: Warner Losh Date: Sat, 28 Dec 2019 03:46:46 -0700 Message-ID: Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys To: "Rodney W. Grimes" Cc: Pedro Giffuni , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47lL3l1X1Cz4Fpy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=qkaN2fgt; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.69 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[f.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.69)[ip: (-9.37), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.88), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 10:47:00 -0000 On Fri, Dec 27, 2019 at 10:55 PM Rodney W. Grimes wrote: > > On Fri, Dec 27, 2019 at 10:27 PM Rodney W. Grimes < > freebsd@gndrsh.dnsmgr.net> > > wrote: > > > > > > > > > > You can choose your own license for original work, sure, but > > > obliterating > > > > > parts of an existing license by applying a second license which is > in > > > > > conflict is probably a poor idea. > > > > > > > > > > > > We don't do that at all: pretty clearly there is no conflict between > > > > both licenses as you can comply with both. > > > > > > The only way to comply with both is to comply with the full 4 > > > clause license. Hense the 2 clause is pointless in being there > > > and can never apply until all 4 clause authors agree to change > > > to 2 clause. > > > > > > > > > Until such time as Jeff finishes rewriting the files, then we just nerf > the > > 4 clause one as no longer relevant since it describes no code in the file > > anymore... > > Slippery slope as that would require a very detailed audit to > make sure at no time in any way did Jeff or anyone else copy > or retain any original code. One we've done dozens of times in the project's history. People rewrite things all the time. From the tty layer to things in the vm. > > > > We've done exactly the thing Jeff did hundreds if not thousands of times > > already in the project in code spanning > > at least the last 25 or so years... > > I have to call BS on that claim, the project is just barely past > Please watch the tone of your replies. This is not an acceptable tone. > 25 years old, and we certainly did not do any of this at that > time, and further the 3 clause came into existance in 1999, and > the 2 clause was that same time frame, so possibly 20 years. > We have several files with 2 clause that date to 1996 (look at many of the elf_machdep.c files have this date). Both FreeBSD and NetBSD used 2 or 3 clause licenses well in advance of the regent's letter... > Please show me the 100 to 1000's of files that this occured in. > sys/kern alone has many of them, though this sort of thing is hard to grep for. sys/arm/arm has some. sys/mips/mips has some more. Many with dates going back at least 15 years. sys/arm/arm/support.S has one that has 3 different sets of clauses, the most recent of which is 2004, the earliest 1997 ( NetBSD, Wasabi and Olivier Houchard). A grep of the kernel shows ~200 .c, ~20 .s and ~80 .h files that have multiple licenses, though grep is the wrong tool to know how many are identical and how many vary. A quick audit suggests maybe 5-10% of these are likely to vary. so not hundreds or thousands, but not zero either. I've not looked at userland at all with this quick grep. > Not sure why it's coming up now over an annotation that has a > > specific meaning that's clear and well defined. > > No one pendantically legal has been watching commits for 20 years > is probably why? > What about the many legal reviews done by companies that produce FreeBSD products over the years. Those generally flag things like the beerware license, but not this detail.... Warner From owner-svn-src-head@freebsd.org Sat Dec 28 12:16:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15FE91E6FD9; Sat, 28 Dec 2019 12:16:42 +0000 (UTC) (envelope-from melifaro@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 47lN3G0RVNz4Jwy; Sat, 28 Dec 2019 12:16:42 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0583EE33; Sat, 28 Dec 2019 12:16:42 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSCGfMi017791; Sat, 28 Dec 2019 12:16:41 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSCGf1R017785; Sat, 28 Dec 2019 12:16:41 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201912281216.xBSCGf1R017785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sat, 28 Dec 2019 12:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356146 - in head/tests/sys/net: . routing X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/tests/sys/net: . routing X-SVN-Commit-Revision: 356146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 12:16:42 -0000 Author: melifaro Date: Sat Dec 28 12:16:40 2019 New Revision: 356146 URL: https://svnweb.freebsd.org/changeset/base/356146 Log: Add userland tests for route table/lltable rtsock operations. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22860 Added: head/tests/sys/net/routing/ head/tests/sys/net/routing/Makefile (contents, props changed) head/tests/sys/net/routing/rtsock_common.h (contents, props changed) head/tests/sys/net/routing/rtsock_config.h (contents, props changed) head/tests/sys/net/routing/rtsock_print.h (contents, props changed) head/tests/sys/net/routing/test_rtsock_l3.c (contents, props changed) head/tests/sys/net/routing/test_rtsock_lladdr.c (contents, props changed) Modified: head/tests/sys/net/Makefile Modified: head/tests/sys/net/Makefile ============================================================================== --- head/tests/sys/net/Makefile Sat Dec 28 06:56:21 2019 (r356145) +++ head/tests/sys/net/Makefile Sat Dec 28 12:16:40 2019 (r356146) @@ -10,6 +10,8 @@ ATF_TESTS_SH+= if_clone_test ATF_TESTS_SH+= if_tun_test ATF_TESTS_SH+= if_vlan +TESTS_SUBDIRS+= routing + # The tests are written to be run in parallel, but doing so leads to random # panics. I think it's because the kernel's list of interfaces isn't properly # locked. Added: head/tests/sys/net/routing/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/routing/Makefile Sat Dec 28 12:16:40 2019 (r356146) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/net + +ATF_TESTS_C += test_rtsock_l3 +ATF_TESTS_C += test_rtsock_lladdr + +# Most of the tests operates on a common IPv4/IPv6 prefix, +# so running them in parallel will lead to weird results. +TEST_METADATA+= is_exclusive=true + +.include Added: head/tests/sys/net/routing/rtsock_common.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/routing/rtsock_common.h Sat Dec 28 12:16:40 2019 (r356146) @@ -0,0 +1,766 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Alexander V. Chernikov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NET_ROUTING_RTSOCK_COMMON_H_ +#define _NET_ROUTING_RTSOCK_COMMON_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include "rtsock_print.h" + +void rtsock_update_rtm_len(struct rt_msghdr *rtm); +void rtsock_validate_message(char *buffer, ssize_t len); +void rtsock_add_rtm_sa(struct rt_msghdr *rtm, int addr_type, struct sockaddr *sa); + +static int _rtm_seq = 42; + + +/* + * Checks if the interface cloner module is present for @name. + */ +static int +_check_cloner(char *name) +{ + struct if_clonereq ifcr; + char *cp, *buf; + int idx; + int s; + int found = 0; + + s = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (s == -1) + err(1, "socket(AF_LOCAL,SOCK_DGRAM)"); + + memset(&ifcr, 0, sizeof(ifcr)); + + if (ioctl(s, SIOCIFGCLONERS, &ifcr) < 0) + err(1, "SIOCIFGCLONERS for count"); + + buf = malloc(ifcr.ifcr_total * IFNAMSIZ); + if (buf == NULL) + err(1, "unable to allocate cloner name buffer"); + + ifcr.ifcr_count = ifcr.ifcr_total; + ifcr.ifcr_buffer = buf; + + if (ioctl(s, SIOCIFGCLONERS, &ifcr) < 0) + err(1, "SIOCIFGCLONERS for names"); + + /* + * In case some disappeared in the mean time, clamp it down. + */ + if (ifcr.ifcr_count > ifcr.ifcr_total) + ifcr.ifcr_count = ifcr.ifcr_total; + + for (cp = buf, idx = 0; idx < ifcr.ifcr_count; idx++, cp += IFNAMSIZ) { + if (!strcmp(cp, name)) { + found = 1; + break; + } + } + + free(buf); + close(s); + + return (found); +} + +/* + * Tries to ensure if_tap is loaded. + * Checks list of interface cloners first, then tries + * to load the module. + * + * return nonzero on success. + */ +static int +_enforce_cloner_loaded(char *cloner_name) +{ + if (_check_cloner(cloner_name)) + return (1); + /* need to load */ + RLOG("trying to load %s driver", cloner_name); + + char cmd[64]; + + snprintf(cmd, sizeof(cmd), "/sbin/kldload if_%s", cloner_name); + int ret = system(cmd); + if (ret != 0) { + RLOG("'%s' failed, error %d", cmd, ret); + return (0); + } + + return (1); +} + +static int +iface_create_cloned(char *ifname_ptr) +{ + struct ifreq ifr; + int s; + char prefix[IFNAMSIZ]; + + char *src, *dst; + for (src = ifname_ptr, dst = prefix; *src && isalpha(*src); src++) + *dst++ = *src; + *dst = '\0'; + + if (_enforce_cloner_loaded(prefix) == 0) + return (0); + + memset(&ifr, 0, sizeof(struct ifreq)); + + s = socket(AF_LOCAL, SOCK_DGRAM, 0); + strlcpy(ifr.ifr_name, ifname_ptr, sizeof(ifr.ifr_name)); + + RLOG("creating iface %s %s", prefix, ifr.ifr_name); + if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) + err(1, "SIOCIFCREATE2"); + + strlcpy(ifname_ptr, ifr.ifr_name, IFNAMSIZ); + RLOG("created interface %s", ifname_ptr); + + return (1); +} + +static int +iface_destroy(char *ifname) +{ + struct ifreq ifr; + int s; + + s = socket(AF_LOCAL, SOCK_DGRAM, 0); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + + RLOG("destroying interface %s", ifname); + if (ioctl(s, SIOCIFDESTROY, &ifr) < 0) + return (0); + + return (1); +} + +/* + * Open tunneling device such as tuntap and returns fd. + */ +int +iface_open(char *ifname) +{ + char path[256]; + + snprintf(path, sizeof(path), "/dev/%s", ifname); + + RLOG("opening interface %s", ifname); + int fd = open(path, O_RDWR|O_EXCL); + if (fd == -1) { + RLOG_ERRNO("unable to open interface %s", ifname); + return (-1); + } + + return (fd); +} + +/* + * Sets primary IPv4 addr. + * Returns 0 on success. + */ +inline int +iface_setup_addr(char *ifname, char *addr, int plen) +{ + char cmd[512]; + char *af; + + if (strchr(addr, ':')) + af = "inet6"; + else + af = "inet"; + RLOG("setting af_%s %s/%d on %s", af, addr, plen, ifname); + snprintf(cmd, sizeof(cmd), "/sbin/ifconfig %s %s %s/%d", ifname, + af, addr, plen); + + return system(cmd); +} + +/* + * Removes primary IPv4 prefix. + * Returns 0 on success. + */ +inline int +iface_delete_addr(char *ifname, char *addr) +{ + char cmd[512]; + + if (strchr(addr, ':')) { + RLOG("removing IPv6 %s from %s", addr, ifname); + snprintf(cmd, sizeof(cmd), "/sbin/ifconfig %s inet6 %s delete", ifname, addr); + } else { + RLOG("removing IPv4 %s from %s", addr, ifname); + snprintf(cmd, sizeof(cmd), "/sbin/ifconfig %s -alias %s", ifname, addr); + } + + return system(cmd); +} + +int +iface_turn_up(char *ifname) +{ + struct ifreq ifr; + int s; + + if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + RLOG_ERRNO("socket"); + return (-1); + } + memset(&ifr, 0, sizeof(struct ifreq)); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { + RLOG_ERRNO("ioctl(SIOCGIFFLAGS)"); + return (-1); + } + /* Update flags */ + if ((ifr.ifr_flags & IFF_UP) == 0) { + ifr.ifr_flags |= IFF_UP; + if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) { + RLOG_ERRNO("ioctl(SIOSGIFFLAGS)"); + return (-1); + } + RLOG("turned interface %s up", ifname); + } + + return (0); +} + +/* + * Removes ND6_IFF_IFDISABLED from IPv6 interface flags. + * Returns 0 on success. + */ +int +iface_enable_ipv6(char *ifname) +{ + struct in6_ndireq nd; + int s; + + if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + err(1, "socket"); + } + memset(&nd, 0, sizeof(nd)); + strlcpy(nd.ifname, ifname, sizeof(nd.ifname)); + if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0) { + RLOG_ERRNO("ioctl(SIOCGIFINFO_IN6)"); + return (-1); + } + /* Update flags */ + if ((nd.ndi.flags & ND6_IFF_IFDISABLED) != 0) { + nd.ndi.flags &= ~ND6_IFF_IFDISABLED; + if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd) < 0) { + RLOG_ERRNO("ioctl(SIOCSIFINFO_IN6)"); + return (-1); + } + RLOG("enabled IPv6 for %s", ifname); + } + + return (0); +} + +#define SA_F_IGNORE_IFNAME 0x01 +#define SA_F_IGNORE_IFTYPE 0x02 +#define SA_F_IGNORE_MEMCMP 0x04 +int +sa_equal_msg_flags(const struct sockaddr *a, const struct sockaddr *b, char *msg, size_t sz, int flags) +{ + char a_s[64], b_s[64]; + const struct sockaddr_in *a4, *b4; + const struct sockaddr_in6 *a6, *b6; + const struct sockaddr_dl *al, *bl; + + if (a == NULL) { + snprintf(msg, sz, "first sa is NULL"); + return 0; + } + if (b == NULL) { + snprintf(msg, sz, "second sa is NULL"); + return 0; + } + + if (a->sa_family != b->sa_family) { + snprintf(msg, sz, "family: %d vs %d", a->sa_family, b->sa_family); + return 0; + } + if (a->sa_len != b->sa_len) { + snprintf(msg, sz, "len: %d vs %d", a->sa_len, b->sa_len); + return 0; + } + + switch (a->sa_family) { + case AF_INET: + a4 = (const struct sockaddr_in *)a; + b4 = (const struct sockaddr_in *)b; + if (a4->sin_addr.s_addr != b4->sin_addr.s_addr) { + inet_ntop(AF_INET, &a4->sin_addr, a_s, sizeof(a_s)); + inet_ntop(AF_INET, &b4->sin_addr, b_s, sizeof(b_s)); + snprintf(msg, sz, "addr diff: %s vs %s", a_s, b_s); + return 0; + } + if (a4->sin_port != b4->sin_port) { + snprintf(msg, sz, "port diff: %d vs %d", + ntohs(a4->sin_port), ntohs(b4->sin_port)); + //return 0; + } + const uint32_t *a32, *b32; + a32 = (const uint32_t *)a4->sin_zero; + b32 = (const uint32_t *)b4->sin_zero; + if ((*a32 != *b32) || (*(a32 + 1) != *(b32 + 1))) { + snprintf(msg, sz, "zero diff: 0x%08X%08X vs 0x%08X%08X", + ntohl(*a32), ntohl(*(a32 + 1)), + ntohl(*b32), ntohl(*(b32 + 1))); + return 0; + } + return 1; + case AF_INET6: + a6 = (const struct sockaddr_in6 *)a; + b6 = (const struct sockaddr_in6 *)b; + if (!IN6_ARE_ADDR_EQUAL(&a6->sin6_addr, &b6->sin6_addr)) { + inet_ntop(AF_INET6, &a6->sin6_addr, a_s, sizeof(a_s)); + inet_ntop(AF_INET6, &b6->sin6_addr, a_s, sizeof(a_s)); + snprintf(msg, sz, "addr diff: %s vs %s", a_s, b_s); + return 0; + } + if (a6->sin6_scope_id != b6->sin6_scope_id) { + snprintf(msg, sz, "scope diff: %u vs %u", a6->sin6_scope_id, b6->sin6_scope_id); + return 0; + } + break; + case AF_LINK: + al = (const struct sockaddr_dl *)a; + bl = (const struct sockaddr_dl *)b; + + if (al->sdl_index != bl->sdl_index) { + snprintf(msg, sz, "sdl_index diff: %u vs %u", al->sdl_index, bl->sdl_index); + return 0; + } + + if ((al->sdl_alen != bl->sdl_alen) || (memcmp(LLADDR(al), LLADDR(bl), al->sdl_alen) != 0)) { + char abuf[64], bbuf[64]; + sa_print_hd(abuf, sizeof(abuf), LLADDR(al), al->sdl_alen); + sa_print_hd(bbuf, sizeof(bbuf), LLADDR(bl), bl->sdl_alen); + snprintf(msg, sz, "sdl_alen diff: {%s} (%d) vs {%s} (%d)", + abuf, al->sdl_alen, bbuf, bl->sdl_alen); + return 0; + } + + if (((flags & SA_F_IGNORE_IFTYPE) == 0) && (al->sdl_type != bl->sdl_type)) { + snprintf(msg, sz, "sdl_type diff: %u vs %u", al->sdl_type, bl->sdl_type); + return 0; + } + + if (((flags & SA_F_IGNORE_IFNAME) == 0) && ((al->sdl_nlen != bl->sdl_nlen) || + (memcmp(al->sdl_data, bl->sdl_data, al->sdl_nlen) != 0))) { + char abuf[64], bbuf[64]; + memcpy(abuf, al->sdl_data, al->sdl_nlen); + abuf[al->sdl_nlen] = '\0'; + memcpy(bbuf, bl->sdl_data, bl->sdl_nlen); + abuf[bl->sdl_nlen] = '\0'; + snprintf(msg, sz, "sdl_nlen diff: {%s} (%d) vs {%s} (%d)", + abuf, al->sdl_nlen, bbuf, bl->sdl_nlen); + return 0; + } + + if (flags & SA_F_IGNORE_MEMCMP) + return 1; + break; + } + + if (memcmp(a, b, a->sa_len)) { + int i; + for (i = 0; i < a->sa_len; i++) + if (((const char *)a)[i] != ((const char *)b)[i]) + break; + + sa_print(a, 1); + sa_print(b, 1); + + snprintf(msg, sz, "overall memcmp() reports diff for af %d offset %d", + a->sa_family, i); + return 0; + } + return 1; +} + +int +sa_equal_msg(const struct sockaddr *a, const struct sockaddr *b, char *msg, size_t sz) +{ + + return sa_equal_msg_flags(a, b, msg, sz, 0); +} + +void +sa_fill_mask4(struct sockaddr_in *sin, int plen) +{ + + memset(sin, 0, sizeof(struct sockaddr_in)); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(struct sockaddr_in); + sin->sin_addr.s_addr = htonl(plen ? ~((1 << (32 - plen)) - 1) : 0); +} + +void +sa_fill_mask6(struct sockaddr_in6 *sin6, uint8_t mask) +{ + uint32_t *cp; + + memset(sin6, 0, sizeof(struct sockaddr_in6)); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(struct sockaddr_in6); + + for (cp = (uint32_t *)&sin6->sin6_addr; mask >= 32; mask -= 32) + *cp++ = 0xFFFFFFFF; + if (mask > 0) + *cp = htonl(mask ? ~((1 << (32 - mask)) - 1) : 0); +} + +/* 52:54:00:14:e3:10 */ +#define ETHER_MAC_MAX_LENGTH 17 + +int +sa_convert_str_to_sa(const char *_addr, struct sockaddr *sa) +{ + int error; + + int af = AF_UNSPEC; + + char *addr = strdup(_addr); + int retcode = 0; + + /* classify AF by str */ + if (strchr(addr, ':')) { + /* inet6 or ether */ + char *k; + int delim_cnt = 0; + for (k = addr; *k; k++) + if (*k == ':') + delim_cnt++; + af = AF_INET6; + + if (delim_cnt == 5) { + k = strchr(addr, '%'); + if (k != NULL && (k - addr) <= ETHER_MAC_MAX_LENGTH) + af = AF_LINK; + } + } else if (strchr(addr, '.')) + af = AF_INET; + + /* */ + char *delimiter; + int ifindex = 0; + char *ifname = NULL; + if ((delimiter = strchr(addr, '%')) != NULL) { + *delimiter = '\0'; + ifname = delimiter + 1; + ifindex = if_nametoindex(ifname); + if (ifindex == 0) + RLOG("unable to find ifindex for '%s'", ifname); + else + RLOG("if %s mapped to %d", ifname, ifindex); + } + + if (af == AF_INET6) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; + memset(sin6, 0, sizeof(struct sockaddr_in6)); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(struct sockaddr_in6); + sin6->sin6_scope_id = ifindex; + error = inet_pton(AF_INET6, addr, &sin6->sin6_addr); + if (error != 1) + RLOG_ERRNO("inet_ntop() failed: ret=%d", error); + else + retcode = 1; + } else if (af == AF_INET) { + struct sockaddr_in *sin = (struct sockaddr_in *)sa; + memset(sin, 0, sizeof(struct sockaddr_in)); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(struct sockaddr_in); + error = inet_pton(AF_INET, addr, &sin->sin_addr); + if (error != 1) + RLOG("inet_ntop() failed: ret=%d", error); + else + retcode = 1; + } else if (af == AF_LINK) { + struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa; + memset(sdl, 0, sizeof(struct sockaddr_dl)); + sdl->sdl_family = AF_LINK; + sdl->sdl_len = sizeof(struct sockaddr_dl); + sdl->sdl_index = ifindex; + sdl->sdl_alen = 6; + struct ether_addr *ea = (struct ether_addr *)LLADDR(sdl); + if (ether_aton_r(addr, ea) == NULL) + RLOG("ether_aton() failed"); + else + retcode = 1; + } + + return (retcode); +} + + +int +rtsock_setup_socket() +{ + int fd; + int af = AF_UNSPEC; /* 0 to capture messages from all AFs */ + fd = socket(PF_ROUTE, SOCK_RAW, af); + + ATF_REQUIRE_MSG(fd != -1, "rtsock open failed: %s", strerror(errno)); + + /* Listen for our messages */ + int on = 1; + if (setsockopt(fd, SOL_SOCKET,SO_USELOOPBACK, &on, sizeof(on)) < 0) + RLOG_ERRNO("setsockopt failed"); + + return (fd); +} + +ssize_t +rtsock_send_rtm(int fd, struct rt_msghdr *rtm) +{ + int my_errno; + ssize_t len; + + rtsock_update_rtm_len(rtm); + + len = write(fd, rtm, rtm->rtm_msglen); + my_errno = errno; + RTSOCK_ATF_REQUIRE_MSG(rtm, len == rtm->rtm_msglen, + "rtsock write failed: want %d got %zd (%s)", + rtm->rtm_msglen, len, strerror(my_errno)); + + return (len); +} + +struct rt_msghdr * +rtsock_read_rtm(int fd, char *buffer, size_t buflen) +{ + ssize_t len; + + len = read(fd, buffer, buflen); + int my_errno = errno; + ATF_REQUIRE_MSG(len > 0, "rtsock read failed: %s", strerror(my_errno)); + + rtsock_validate_message(buffer, len); + return ((struct rt_msghdr *)buffer); +} + +struct rt_msghdr * +rtsock_read_rtm_reply(int fd, char *buffer, size_t buflen, int seq) +{ + struct rt_msghdr *rtm; + + while (true) { + rtm = rtsock_read_rtm(fd, buffer, buflen); + if (rtm->rtm_pid != getpid()) + continue; + if (rtm->rtm_seq != seq) + continue; + + return (rtm); + } + + /* NOTREACHED */ +} + +void +rtsock_prepare_route_message_base(struct rt_msghdr *rtm, int cmd) +{ + + memset(rtm, 0, sizeof(struct rt_msghdr)); + rtm->rtm_type = cmd; + rtm->rtm_version = RTM_VERSION; + rtm->rtm_seq = _rtm_seq++; +} + +void +rtsock_prepare_route_message(struct rt_msghdr *rtm, int cmd, struct sockaddr *dst, + struct sockaddr *mask, struct sockaddr *gw) +{ + + rtsock_prepare_route_message_base(rtm, cmd); + if (dst != NULL) + rtsock_add_rtm_sa(rtm, RTA_DST, dst); + + if (gw != NULL) { + rtsock_add_rtm_sa(rtm, RTA_GATEWAY, gw); + rtm->rtm_flags |= RTF_GATEWAY; + } + + if (mask != NULL) + rtsock_add_rtm_sa(rtm, RTA_NETMASK, mask); +} + +void +rtsock_add_rtm_sa(struct rt_msghdr *rtm, int addr_type, struct sockaddr *sa) +{ + char *ptr = (char *)(rtm + 1); + for (int i = 0; i < RTAX_MAX; i++) { + if (rtm->rtm_addrs & (1 << i)) { + /* add */ + ptr += ALIGN(((struct sockaddr *)ptr)->sa_len); + } + } + + rtm->rtm_addrs |= addr_type; + memcpy(ptr, sa, sa->sa_len); +} + +struct sockaddr * +rtsock_find_rtm_sa(struct rt_msghdr *rtm, int addr_type) +{ + char *ptr = (char *)(rtm + 1); + for (int i = 0; i < RTAX_MAX; i++) { + if (rtm->rtm_addrs & (1 << i)) { + if (addr_type == (1 << i)) + return ((struct sockaddr *)ptr); + /* add */ + ptr += ALIGN(((struct sockaddr *)ptr)->sa_len); + } + } + + return (NULL); +} + +size_t +rtsock_calc_rtm_len(struct rt_msghdr *rtm) +{ + size_t len = sizeof(struct rt_msghdr); + + char *ptr = (char *)(rtm + 1); + for (int i = 0; i < RTAX_MAX; i++) { + if (rtm->rtm_addrs & (1 << i)) { + /* add */ + int sa_len = ALIGN(((struct sockaddr *)ptr)->sa_len); + len += sa_len; + ptr += sa_len; + } + } + + return len; +} + +void +rtsock_update_rtm_len(struct rt_msghdr *rtm) +{ + + rtm->rtm_msglen = rtsock_calc_rtm_len(rtm); +} + +static void +_validate_route_message(struct rt_msghdr *rtm) +{ + struct sockaddr *sa; + size_t parsed_len = sizeof(struct rt_msghdr); + int len = rtm->rtm_msglen; + + sa = (struct sockaddr *)(rtm + 1); + + for (int i = 0; i < RTAX_MAX; i++) { + if ((rtm->rtm_addrs & (1 << i)) == 0) + continue; + parsed_len += SA_SIZE(sa); + RTSOCK_ATF_REQUIRE_MSG(rtm, parsed_len <= len, + "SA %d: len %d exceeds msg size %d", i, (int)sa->sa_len, len); + if (sa->sa_family == AF_LINK) { + struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa; + int data_len = sdl->sdl_nlen + sdl->sdl_alen; + data_len += offsetof(struct sockaddr_dl, sdl_data); + + RTSOCK_ATF_REQUIRE_MSG(rtm, data_len <= len, + "AF_LINK data size exceeds total len: %u vs %u", + data_len, len); + } + sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa)); + } + + RTSOCK_ATF_REQUIRE_MSG(rtm, parsed_len == rtm->rtm_msglen, + "message len != parsed len: expected %d parsed %d", + rtm->rtm_msglen, (int)parsed_len); +} + +/* + * Raises error if base syntax checks fails. + */ +void +rtsock_validate_message(char *buffer, ssize_t len) +{ + struct rt_msghdr *rtm; + + ATF_REQUIRE_MSG(len > 0, "read() return %zd, error: %s", len, strerror(errno)); + + rtm = (struct rt_msghdr *)buffer; + ATF_REQUIRE_MSG(rtm->rtm_version == RTM_VERSION, "unknown RTM_VERSION: expected %d got %d", + RTM_VERSION, rtm->rtm_version); + ATF_REQUIRE_MSG(rtm->rtm_msglen <= len, "wrong message length: expected %d got %d", + (int)len, (int)rtm->rtm_msglen); + + switch (rtm->rtm_type) { + case RTM_GET: + case RTM_ADD: + case RTM_DELETE: + case RTM_CHANGE: + _validate_route_message(rtm); + break; + } +} + +#endif Added: head/tests/sys/net/routing/rtsock_config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/routing/rtsock_config.h Sat Dec 28 12:16:40 2019 (r356146) @@ -0,0 +1,164 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Alexander V. Chernikov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NET_ROUTING_RTSOCK_CONFIG_H_ +#define _NET_ROUTING_RTSOCK_CONFIG_H_ + +struct rtsock_test_config { + int ifindex; + char net4_str[INET_ADDRSTRLEN]; + char addr4_str[INET_ADDRSTRLEN]; + char net6_str[INET6_ADDRSTRLEN]; + char addr6_str[INET6_ADDRSTRLEN]; + struct sockaddr_in net4; + struct sockaddr_in mask4; + struct sockaddr_in addr4; + struct sockaddr_in6 net6; + struct sockaddr_in6 mask6; + struct sockaddr_in6 addr6; + int plen4; + int plen6; + char *remote_lladdr; + char *ifname; + bool autocreated_interface; + int rtsock_fd; +}; + +struct rtsock_test_config * +config_setup_base(const atf_tc_t *tc) +{ + struct rtsock_test_config *c; + + c = calloc(1, sizeof(struct rtsock_test_config)); + c->rtsock_fd = -1; + + return c; +} + +struct rtsock_test_config * +config_setup(const atf_tc_t *tc) +{ + struct rtsock_test_config *c; + char buf[64], *s; + const char *key; + int mask; + + c = config_setup_base(tc); + + key = atf_tc_get_config_var_wd(tc, "rtsock.v4prefix", "192.0.2.0/24"); + strlcpy(buf, key, sizeof(buf)); + if ((s = strchr(buf, '/')) == NULL) + return (NULL); + *s++ = '\0'; + mask = strtol(s, NULL, 10); + if (mask < 0 || mask > 32) + return (NULL); + c->plen4 = mask; + inet_pton(AF_INET, buf, &c->net4.sin_addr); + + c->net4.sin_len = sizeof(struct sockaddr_in); + c->net4.sin_family = AF_INET; + c->addr4.sin_len = sizeof(struct sockaddr_in); + c->addr4.sin_family = AF_INET; + + sa_fill_mask4(&c->mask4, c->plen4); + + /* Fill in interface IPv4 address. Assume the first address in net */ + c->addr4.sin_addr.s_addr = htonl(ntohl(c->net4.sin_addr.s_addr) + 1); + inet_ntop(AF_INET, &c->net4.sin_addr, c->net4_str, INET_ADDRSTRLEN); + inet_ntop(AF_INET, &c->addr4.sin_addr, c->addr4_str, INET_ADDRSTRLEN); + + key = atf_tc_get_config_var_wd(tc, "rtsock.v6prefix", "2001:DB8::/32"); + strlcpy(buf, key, sizeof(buf)); + if ((s = strchr(buf, '/')) == NULL) + return (NULL); + *s++ = '\0'; + mask = strtol(s, NULL, 10); + if (mask < 0 || mask > 128) + return (NULL); + c->plen6 = mask; + + inet_pton(AF_INET6, buf, &c->net6.sin6_addr); + + c->net6.sin6_len = sizeof(struct sockaddr_in6); + c->net6.sin6_family = AF_INET6; + c->addr6.sin6_len = sizeof(struct sockaddr_in6); + c->addr6.sin6_family = AF_INET6; + + sa_fill_mask6(&c->mask6, c->plen6); + + /* Fill in interface IPv6 address. Assume the first address in net */ + memcpy(&c->addr6.sin6_addr, &c->net6.sin6_addr, sizeof(struct in6_addr)); +#define _s6_addr32 __u6_addr.__u6_addr32 + c->addr6.sin6_addr._s6_addr32[3] = htonl(ntohl(c->net6.sin6_addr._s6_addr32[3]) + 1); +#undef _s6_addr32 + inet_ntop(AF_INET6, &c->net6.sin6_addr, c->net6_str, INET6_ADDRSTRLEN); + inet_ntop(AF_INET6, &c->addr6.sin6_addr, c->addr6_str, INET6_ADDRSTRLEN); + + c->ifname = strdup(atf_tc_get_config_var_wd(tc, "rtsock.ifname", "tap4242")); + c->autocreated_interface = atf_tc_get_config_var_as_bool_wd(tc, "rtsock.create_interface", true); + + if (c->autocreated_interface && (if_nametoindex(c->ifname) == 0)) + { + /* create our own interface */ + char new_ifname[IFNAMSIZ]; + strlcpy(new_ifname, c->ifname, sizeof(new_ifname)); + int ret = iface_create_cloned(new_ifname); + ATF_REQUIRE_MSG(ret != 0, "tap interface creation failed: %s", strerror(errno)); + c->ifname = strdup(new_ifname); + } + c->ifindex = if_nametoindex(c->ifname); + ATF_REQUIRE_MSG(c->ifindex != 0, "inteface %s not found", c->ifname); + + c->remote_lladdr = strdup(atf_tc_get_config_var_wd(tc, + "rtsock.remote_lladdr", "00:00:5E:00:53:42")); + + return (c); +} + +void +config_generic_cleanup(struct rtsock_test_config *c) +{ + if (c->ifname != NULL && c->autocreated_interface) { + iface_destroy(c->ifname); + free(c->ifname); + c->ifname = NULL; + } +} + +void +config_describe_root_test(atf_tc_t *tc, char *test_descr) +{ + + atf_tc_set_md_var(tc, "descr", test_descr); + // Adding/deleting prefix requires root privileges + atf_tc_set_md_var(tc, "require.user", "root"); +} + +#endif Added: head/tests/sys/net/routing/rtsock_print.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/routing/rtsock_print.h Sat Dec 28 12:16:40 2019 (r356146) @@ -0,0 +1,280 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Alexander V. Chernikov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NET_ROUTING_RTSOCK_PRINT_H_ +#define _NET_ROUTING_RTSOCK_PRINT_H_ + + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Dec 28 13:35:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B35A71E8AE1; Sat, 28 Dec 2019 13:35:54 +0000 (UTC) (envelope-from trasz@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 47lPpf4HHMz4N4H; Sat, 28 Dec 2019 13:35:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8E25E1C8B; Sat, 28 Dec 2019 13:35:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSDZsVu065399; Sat, 28 Dec 2019 13:35:54 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSDZs9W065398; Sat, 28 Dec 2019 13:35:54 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912281335.xBSDZs9W065398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 28 Dec 2019 13:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356147 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 356147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 13:35:54 -0000 Author: trasz Date: Sat Dec 28 13:35:54 2019 New Revision: 356147 URL: https://svnweb.freebsd.org/changeset/base/356147 Log: Make linux mount(2) tolerate NULL 'from' argument, and fix flag handling. This should unbreak access04, acct01, chmod06, creat06, and fchmod06 LTP tests. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Sat Dec 28 12:16:40 2019 (r356146) +++ head/sys/compat/linux/linux_file.c Sat Dec 28 13:35:54 2019 (r356147) @@ -1016,9 +1016,13 @@ linux_mount(struct thread *td, struct linux_mount_args NULL); if (error != 0) goto out; - error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, NULL); - if (error != 0) - goto out; + if (args->specialfile != NULL) { + error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, NULL); + if (error != 0) + goto out; + } else { + mntfromname[0] = '\0'; + } error = copyinstr(args->dir, mntonname, MNAMELEN - 1, NULL); if (error != 0) goto out; @@ -1033,20 +1037,18 @@ linux_mount(struct thread *td, struct linux_mount_args fsflags = 0; - if ((args->rwflag & 0xffff0000) == 0xc0ed0000) { - /* - * Linux SYNC flag is not included; the closest equivalent - * FreeBSD has is !ASYNC, which is our default. - */ - if (args->rwflag & LINUX_MS_RDONLY) - fsflags |= MNT_RDONLY; - if (args->rwflag & LINUX_MS_NOSUID) - fsflags |= MNT_NOSUID; - if (args->rwflag & LINUX_MS_NOEXEC) - fsflags |= MNT_NOEXEC; - if (args->rwflag & LINUX_MS_REMOUNT) - fsflags |= MNT_UPDATE; - } + /* + * Linux SYNC flag is not included; the closest equivalent + * FreeBSD has is !ASYNC, which is our default. + */ + if (args->rwflag & LINUX_MS_RDONLY) + fsflags |= MNT_RDONLY; + if (args->rwflag & LINUX_MS_NOSUID) + fsflags |= MNT_NOSUID; + if (args->rwflag & LINUX_MS_NOEXEC) + fsflags |= MNT_NOEXEC; + if (args->rwflag & LINUX_MS_REMOUNT) + fsflags |= MNT_UPDATE; error = kernel_vmount(fsflags, "fstype", fstypename, From owner-svn-src-head@freebsd.org Sat Dec 28 14:41:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9636E1E9E6B; Sat, 28 Dec 2019 14:41:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lRGL3SLMz4QYd; Sat, 28 Dec 2019 14:41:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id EC8D91CBBC; Sat, 28 Dec 2019 14:41:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys To: rgrimes@FreeBSD.org Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> From: Pedro Giffuni Organization: FreeBSD Message-ID: Date: Sat, 28 Dec 2019 09:41:31 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 14:41:30 -0000 On 28/12/2019 00:27, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> On 2019-12-27 23:24, Rodney W. Grimes wrote: >>> [ Charset UTF-8 unsupported, converting... ] >>>> On 2019-12-27 22:16, Rodney W. Grimes wrote: >>>>>> Author: pfg >>>>>> Date: Sat Dec 28 02:58:30 2019 >>>>>> New Revision: 356142 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/356142 >>>>>> >>>>>> Log: >>>>>> SPDX: update some tags with two licenses. >>>>>> >>>>>> Modified: >>>>>> head/sys/dev/ofw/openfirm.h >>>>>> head/sys/sys/sched.h >>>>>> >>>>>> Modified: head/sys/dev/ofw/openfirm.h >>>>>> ============================================================================== >>>>>> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) >>>>>> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) >>>>>> @@ -1,7 +1,7 @@ >>>>>> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ >>>>>> >>>>>> /*- >>>>>> - * SPDX-License-Identifier: BSD-4-Clause >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) >>>>>> * >>>>>> * Copyright (C) 1995, 1996 Wolfgang Solfrank. >>>>>> * Copyright (C) 1995, 1996 TooLs GmbH. >>>>>> >>>>>> Modified: head/sys/sys/sched.h >>>>>> ============================================================================== >>>>>> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) >>>>>> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) >>>>>> @@ -1,5 +1,5 @@ >>>>>> /*- >>>>>> - * SPDX-License-Identifier: BSD-4-Clause >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) >>>>>> * >>>>>> * Copyright (c) 1996, 1997 >>>>>> * HD Associates, Inc. All rights reserved. >>>>>> >>>>> This situation should not of occured, and leads to an ambigous license state. >>>> It actually happens a lot (I mean two or more licenses in the same >>>> file): SPDX explicitly uses AND (not OR) for cases like this. >>>> >>>>> What code is under license 2 clause and what under 4 clause? >>>> Anyone redistributing the file has to respect both licenses. If you are >>>> lucky enough to have access to version control you may be able to >>>> discern the author and the corresponding license, otherwise you are >>>> trapped with both. >>> So the 2 clause add is null, so why have it there? >> So that eventually, when the project gets to a point where sufficient >> part of the code is rewritten they can opt to change the license to the >> simpler form. There are ways to relicense projects gradually, and its >> nothing new, in fact it is very much in the BSD spirit to gradually >> replace more restricted UNIX code. > The only changing we have done to BSD licenses as in thost cases > that the Regents requested/granted the right to change to lesser > clauses. Until you get HD & Associtates (in this one case) to > grant that right your walking on a grey edge I would rather not > walk on. As an independent developer I don't have to adopt on my code restrictions that other developers have adopted for their code. > The reference to BSD spirit and replacing more restricted UNIX (tm) > code is way off base in this context. This is not an AT & T > license we are talking about here. And again you can not just > modify the existing 4 clause licensed file by slapping a 2 clause > license into it, or the project would of done that everyplace > ages ago. We are talking about restrictions. You probably missed it, but in the late 90's the project opted for removing restrictions, even if that meant the code could eventually end up in copyleft codebases. FreeBSD has been flexible and pragmatic about it but the other BSDs made basically the same decision. > What is done here in this file is a mistake, and should be corrected. > Can you point me to other files that actually have multiple BSD > licenses in them? I have better things to do in my holidays, but there are plenty. I will note for reference that this is indeed official project policy: https://www.freebsd.org/internal/software-license.html " ... We invite and greatly appreciate the contribution of both changes and additions under the two-clause BSD license, and encourage the adoption of this license by other open source projects." >> It may be a long shot but it has happened on other projects as well: >> libdialog (in our tree) was rewritten and relicensed from GPL to LGPL. >> >> >>>>> It looks to me as if this was done by Jeff Robinson as the 2 clause is >>>>> attached to his copyright and we should probably just ask him to relax >>>>> that back to the files existing 4 clause license, and or go after Greg >>>>> Ansley of HD associtates to get them to relax the 4 clause. >>>>> >>>> No, Jeff (or anyone else, as I said there are many cases in our tree) is >>>> entitled to choose his own license as long as it is compatible with the >>>> pre-existing licensing. >>> I was specifically sighting this one file, sys/sys/sched.h. >>> >>> Actually that might be a grey area, no place does the BSD license grant >>> you rights to modify the terms of the license, and that is in effect >>> what adding this second license does. >> No one is modifying the original license: it is there and applies to the >> original code. >> >> >>> You can choose your own license for original work, sure, but obliterating >>> parts of an existing license by applying a second license which is in >>> conflict is probably a poor idea. >> >> We don't do that at all: pretty clearly there is no conflict between >> both licenses as you can comply with both. > The only way to comply with both is to comply with the full 4 > clause license. Hense the 2 clause is pointless in being there > and can never apply until all 4 clause authors agree to change > to 2 clause. Both 4 Clause and 2 Clause authors may disappear, they call it "bus factor" in other projects, and in that case leaving some evidence of the openness of changing the license by an individual is useful. Pedro. From owner-svn-src-head@freebsd.org Sat Dec 28 15:28:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03DA51EADD6; Sat, 28 Dec 2019 15:28:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lSJl6MrKz4S3Q; Sat, 28 Dec 2019 15:28:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5DBF2FFE; Sat, 28 Dec 2019 15:28:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSFSdc2031712; Sat, 28 Dec 2019 15:28:39 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSFSd24031711; Sat, 28 Dec 2019 15:28:39 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912281528.xBSFSd24031711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 28 Dec 2019 15:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356148 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 356148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 15:28:40 -0000 Author: manu Date: Sat Dec 28 15:28:39 2019 New Revision: 356148 URL: https://svnweb.freebsd.org/changeset/base/356148 Log: arm64: rockchip: rk808: Add remaining regulators The RK808 driver was missing the LDO and switch regulators. Add support for them. Reviewed by: mmel MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22852 Modified: head/sys/arm64/rockchip/rk805.c head/sys/arm64/rockchip/rk805reg.h Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Sat Dec 28 13:35:54 2019 (r356147) +++ head/sys/arm64/rockchip/rk805.c Sat Dec 28 15:28:39 2019 (r356148) @@ -221,6 +221,114 @@ static struct rk805_regdef rk808_regdefs[] = { .voltage_step = 100000, .voltage_nstep = 16, }, + { + .id = RK808_LDO1, + .name = "LDO_REG1", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x1, + .voltage_reg = RK805_LDO1_ON_VSEL, + .voltage_mask = 0x1F, + .voltage_min = 1800000, + .voltage_max = 3400000, + .voltage_step = 100000, + .voltage_nstep = 17, + }, + { + .id = RK808_LDO2, + .name = "LDO_REG2", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x2, + .voltage_reg = RK805_LDO2_ON_VSEL, + .voltage_mask = 0x1F, + .voltage_min = 1800000, + .voltage_max = 3400000, + .voltage_step = 100000, + .voltage_nstep = 17, + }, + { + .id = RK808_LDO3, + .name = "LDO_REG3", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x4, + .voltage_reg = RK805_LDO3_ON_VSEL, + .voltage_mask = 0xF, + .voltage_min = 800000, + .voltage_max = 2500000, + .voltage_step = 100000, + .voltage_nstep = 18, + }, + { + .id = RK808_LDO4, + .name = "LDO_REG4", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x8, + .voltage_reg = RK808_LDO4_ON_VSEL, + .voltage_mask = 0x1F, + .voltage_min = 1800000, + .voltage_max = 3400000, + .voltage_step = 100000, + .voltage_nstep = 17, + }, + { + .id = RK808_LDO5, + .name = "LDO_REG5", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x10, + .voltage_reg = RK808_LDO5_ON_VSEL, + .voltage_mask = 0x1F, + .voltage_min = 1800000, + .voltage_max = 3400000, + .voltage_step = 100000, + .voltage_nstep = 17, + }, + { + .id = RK808_LDO6, + .name = "LDO_REG6", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x20, + .voltage_reg = RK808_LDO6_ON_VSEL, + .voltage_mask = 0x1F, + .voltage_min = 800000, + .voltage_max = 2500000, + .voltage_step = 100000, + .voltage_nstep = 18, + }, + { + .id = RK808_LDO7, + .name = "LDO_REG7", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x40, + .voltage_reg = RK808_LDO7_ON_VSEL, + .voltage_mask = 0x1F, + .voltage_min = 800000, + .voltage_max = 2500000, + .voltage_step = 100000, + .voltage_nstep = 18, + }, + { + .id = RK808_LDO8, + .name = "LDO_REG8", + .enable_reg = RK808_LDO_EN, + .enable_mask = 0x80, + .voltage_reg = RK808_LDO8_ON_VSEL, + .voltage_mask = 0x1F, + .voltage_min = 1800000, + .voltage_max = 3400000, + .voltage_step = 100000, + .voltage_nstep = 17, + }, + { + .id = RK808_SWITCH1, + .name = "SWITCH_REG1", + .enable_reg = RK805_DCDC_EN, + .enable_mask = 0x20, + }, + { + .id = RK808_SWITCH2, + .name = "SWITCH_REG2", + .enable_reg = RK805_DCDC_EN, + .enable_mask = 0x40, + }, }; static int Modified: head/sys/arm64/rockchip/rk805reg.h ============================================================================== --- head/sys/arm64/rockchip/rk805reg.h Sat Dec 28 13:35:54 2019 (r356147) +++ head/sys/arm64/rockchip/rk805reg.h Sat Dec 28 15:28:39 2019 (r356148) @@ -58,6 +58,16 @@ #define RK805_LDO2_SLEEP_VSEL 0x3E #define RK805_LDO3_ON_VSEL 0x3F #define RK805_LDO3_SLEEP_VSEL 0x40 +#define RK808_LDO4_ON_VSEL 0x41 +#define RK808_LDO4_SLEEP_VSEL 0x42 +#define RK808_LDO5_ON_VSEL 0x43 +#define RK808_LDO5_SLEEP_VSEL 0x44 +#define RK808_LDO6_ON_VSEL 0x45 +#define RK808_LDO6_SLEEP_VSEL 0x46 +#define RK808_LDO7_ON_VSEL 0x47 +#define RK808_LDO7_SLEEP_VSEL 0x48 +#define RK808_LDO8_ON_VSEL 0x49 +#define RK808_LDO8_SLEEP_VSEL 0x4A enum rk805_regulator { RK805_DCDC1 = 0, From owner-svn-src-head@freebsd.org Sat Dec 28 15:30:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EA4A1EAEAB; Sat, 28 Dec 2019 15:30:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lSMH2sGMz4SCX; Sat, 28 Dec 2019 15:30:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D7763029; Sat, 28 Dec 2019 15:30:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSFUpTF032849; Sat, 28 Dec 2019 15:30:51 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSFUokR032840; Sat, 28 Dec 2019 15:30:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912281530.xBSFUokR032840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 28 Dec 2019 15:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356149 - in head/sys: arm64/conf arm64/rockchip conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/rockchip conf X-SVN-Commit-Revision: 356149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 15:30:51 -0000 Author: manu Date: Sat Dec 28 15:30:50 2019 New Revision: 356149 URL: https://svnweb.freebsd.org/changeset/base/356149 Log: arm64: rockchip: Add driver for the io domain This driver configure the registers in the GRF according to the value of the regulators for the platform. Some IP can run with either 3.0V or 1.8V, if we don't configure them correctly according to the external voltage used they will not work. It's only done at boot time for now and might be needed at runtime for IP like sdmmc. Reviewed by: mmel Tested On: RockPro64, Firefly-RK3399 (gonzo), AIO-3288 (mmel) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22854 Added: head/sys/arm64/rockchip/rk_iodomain.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Sat Dec 28 15:28:39 2019 (r356148) +++ head/sys/arm64/conf/GENERIC Sat Dec 28 15:30:50 2019 (r356149) @@ -331,6 +331,9 @@ device regulator device syscon device aw_syscon +# IO Domains +device rk_iodomain + # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. Added: head/sys/arm64/rockchip/rk_iodomain.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_iodomain.c Sat Dec 28 15:30:50 2019 (r356149) @@ -0,0 +1,207 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "syscon_if.h" + +#define RK3288_GRF_IO_VSEL 0x380 +#define RK3399_GRF_IO_VSEL 0xe640 +#define RK3399_PMUGRF_IO_VSEL 0x180 + +struct rk_iodomain_supply { + char *name; + uint32_t bit; +}; + +struct rk_iodomain_conf { + struct rk_iodomain_supply *supply; + int nsupply; + uint32_t grf_reg; +}; + +struct rk_iodomain_softc { + device_t dev; + struct syscon *grf; + phandle_t node; + struct rk_iodomain_conf *conf; +}; + +static struct rk_iodomain_supply rk3288_supply[] = { + {"lcdc-supply", 0}, + {"dvp-supply", 1}, + {"flash0-supply", 2}, + {"flash1-supply", 3}, + {"wifi-supply", 4}, + {"bb-supply", 5}, + {"audio-supply", 6}, + {"sdcard-supply", 7}, + {"gpio30-supply", 8}, + {"gpio1830-supply", 9}, +}; + +static struct rk_iodomain_conf rk3288_conf = { + .supply = rk3288_supply, + .nsupply = nitems(rk3288_supply), + .grf_reg = RK3288_GRF_IO_VSEL, +}; + +static struct rk_iodomain_supply rk3399_supply[] = { + {"bt656-supply", 0}, + {"audio-supply", 1}, + {"sdmmc-supply", 2}, + {"gpio1830-supply", 3}, +}; + +static struct rk_iodomain_conf rk3399_conf = { + .supply = rk3399_supply, + .nsupply = nitems(rk3399_supply), + .grf_reg = RK3399_GRF_IO_VSEL, +}; + +static struct rk_iodomain_supply rk3399_pmu_supply[] = { + {"pmu1830-supply", 9}, +}; + +static struct rk_iodomain_conf rk3399_pmu_conf = { + .supply = rk3399_pmu_supply, + .nsupply = nitems(rk3399_pmu_supply), + .grf_reg = RK3399_PMUGRF_IO_VSEL, +}; + +static struct ofw_compat_data compat_data[] = { + {"rockchip,rk3288-io-voltage-domain", (uintptr_t)&rk3288_conf}, + {"rockchip,rk3399-io-voltage-domain", (uintptr_t)&rk3399_conf}, + {"rockchip,rk3399-pmu-io-voltage-domain", (uintptr_t)&rk3399_pmu_conf}, + {NULL, 0} +}; + +static void +rk_iodomain_set(struct rk_iodomain_softc *sc) +{ + regulator_t supply; + uint32_t reg = 0; + uint32_t mask = 0; + int uvolt, i; + + for (i = 0; i < sc->conf->nsupply; i++) { + mask |= (1 << sc->conf->supply[i].bit) << 16; + if (regulator_get_by_ofw_property(sc->dev, sc->node, + sc->conf->supply[i].name, &supply) == 0) { + if (regulator_get_voltage(supply, &uvolt) == 0) { + if (uvolt == 1800000) + reg |= (1 << sc->conf->supply[i].bit); + else if (uvolt != 3000000) + device_printf(sc->dev, + "%s regulator is at %duV, ignoring\n", + sc->conf->supply[i].name, uvolt); + } else + device_printf(sc->dev, "Cannot get current " + "voltage for regulator %s\n", + sc->conf->supply[i].name); + } + } + + SYSCON_WRITE_4(sc->grf, sc->conf->grf_reg, reg | mask); +} + +static int +rk_iodomain_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "RockChip IO Voltage Domain"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_iodomain_attach(device_t dev) +{ + struct rk_iodomain_softc *sc; + int rv; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->node = ofw_bus_get_node(dev); + + rv = syscon_get_handle_default(dev, &sc->grf); + if (rv != 0) { + device_printf(dev, "Cannot get grf handle\n"); + return (ENXIO); + } + + sc->conf = (struct rk_iodomain_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + rk_iodomain_set(sc); + + return (0); +} + +static int +rk_iodomain_detach(device_t dev) +{ + + return (0); +} + +static device_method_t rk_iodomain_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rk_iodomain_probe), + DEVMETHOD(device_attach, rk_iodomain_attach), + DEVMETHOD(device_detach, rk_iodomain_detach), + + DEVMETHOD_END +}; + +static driver_t rk_iodomain_driver = { + "rk_iodomain", + rk_iodomain_methods, + sizeof(struct rk_iodomain_softc), +}; + +static devclass_t rk_iodomain_devclass; + +EARLY_DRIVER_MODULE(rk_iodomain, simplebus, rk_iodomain_driver, + rk_iodomain_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sat Dec 28 15:28:39 2019 (r356148) +++ head/sys/conf/files.arm64 Sat Dec 28 15:30:50 2019 (r356149) @@ -305,6 +305,7 @@ arm64/rockchip/rk805.c optional fdt rk805 soc_rockch arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/rk_pinctrl.c optional fdt rk_pinctrl soc_rockchip_rk3328 | fdt rk_pinctrl soc_rockchip_rk3399 arm64/rockchip/rk_gpio.c optional fdt rk_gpio soc_rockchip_rk3328 | fdt rk_gpio soc_rockchip_rk3399 +arm64/rockchip/rk_iodomain.c optional fdt rk_iodomain arm64/rockchip/rk_spi.c optional fdt rk_spi arm64/rockchip/rk_usb2phy.c optional fdt rk_usb2phy soc_rockchip_rk3328 | soc_rockchip_rk3399 arm64/rockchip/rk_typec_phy.c optional fdt rk_typec_phy soc_rockchip_rk3399 From owner-svn-src-head@freebsd.org Sat Dec 28 16:40:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9AE11EC07C; Sat, 28 Dec 2019 16:40:44 +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 47lTvw46kKz4Vc9; Sat, 28 Dec 2019 16:40:44 +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 88A504067; Sat, 28 Dec 2019 16:40:44 +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 xBSGei2W075227; Sat, 28 Dec 2019 16:40:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSGeieI075214; Sat, 28 Dec 2019 16:40:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912281640.xBSGeieI075214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 28 Dec 2019 16:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356150 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 16:40:44 -0000 Author: kib Date: Sat Dec 28 16:40:44 2019 New Revision: 356150 URL: https://svnweb.freebsd.org/changeset/base/356150 Log: vm_object_shadow(): fix object reference leak. In r355270 by me, vm_object_shadow() was changed to handle the reference counting for the shared case, but the extra reference that was done in vmspace_fork() for the shared/need_copy case was not removed. Submitted by: jeff Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat Dec 28 15:30:50 2019 (r356149) +++ head/sys/vm/vm_map.c Sat Dec 28 16:40:44 2019 (r356150) @@ -4127,8 +4127,6 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c true); old_entry->eflags &= ~MAP_ENTRY_NEEDS_COPY; old_entry->cred = NULL; - vm_object_reference( - old_entry->object.vm_object); /* * As in vm_map_merged_neighbor_dispose(), From owner-svn-src-head@freebsd.org Sat Dec 28 17:52:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D9A61ED4E9; Sat, 28 Dec 2019 17:52:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lWWB3Cn1z4YRd; Sat, 28 Dec 2019 17:52:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69BAB4DAF; Sat, 28 Dec 2019 17:52:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSHqsLK021843; Sat, 28 Dec 2019 17:52:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSHqrnB021841; Sat, 28 Dec 2019 17:52:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912281752.xBSHqrnB021841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 28 Dec 2019 17:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356151 - head/sys/geom/gate X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/gate X-SVN-Commit-Revision: 356151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 17:52:54 -0000 Author: mav Date: Sat Dec 28 17:52:53 2019 New Revision: 356151 URL: https://svnweb.freebsd.org/changeset/base/356151 Log: Fix GEOM_GATE orphanization. Previous code closed and destroyed direct read consumer even with I/O still in progress. This patch adds locking and request counting to postpone the close till the last of running requests completes. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/gate/g_gate.c head/sys/geom/gate/g_gate.h Modified: head/sys/geom/gate/g_gate.c ============================================================================== --- head/sys/geom/gate/g_gate.c Sat Dec 28 16:40:44 2019 (r356150) +++ head/sys/geom/gate/g_gate.c Sat Dec 28 17:52:53 2019 (r356151) @@ -89,6 +89,19 @@ static struct g_gate_softc **g_gate_units; static u_int g_gate_nunits; static struct mtx g_gate_units_lock; +static void +g_gate_detach(void *arg, int flags __unused) +{ + struct g_consumer *cp = arg; + + g_topology_assert(); + G_GATE_DEBUG(1, "Destroying read consumer on provider %s orphan.", + cp->provider->name); + (void)g_access(cp, -1, 0, 0); + g_detach(cp); + g_destroy_consumer(cp); +} + static int g_gate_destroy(struct g_gate_softc *sc, boolean_t force) { @@ -140,6 +153,7 @@ g_gate_destroy(struct g_gate_softc *sc, boolean_t forc g_gate_nunits--; mtx_unlock(&g_gate_units_lock); mtx_destroy(&sc->sc_queue_mtx); + mtx_destroy(&sc->sc_read_mtx); g_topology_lock(); if ((cp = sc->sc_readcons) != NULL) { sc->sc_readcons = NULL; @@ -208,8 +222,11 @@ g_gate_queue_io(struct bio *bp) static void g_gate_done(struct bio *cbp) { + struct g_gate_softc *sc; struct bio *pbp; + struct g_consumer *cp; + cp = cbp->bio_from; pbp = cbp->bio_parent; if (cbp->bio_error == 0) { pbp->bio_completed = cbp->bio_completed; @@ -222,12 +239,20 @@ g_gate_done(struct bio *cbp) pbp->bio_children--; g_gate_queue_io(pbp); } + + sc = cp->geom->softc; + mtx_lock(&sc->sc_read_mtx); + if (--cp->index == 0 && sc->sc_readcons != cp) + g_post_event(g_gate_detach, cp, M_NOWAIT, NULL); + mtx_unlock(&sc->sc_read_mtx); } static void g_gate_start(struct bio *pbp) { struct g_gate_softc *sc; + struct g_consumer *cp; + struct bio *cbp; sc = pbp->bio_to->geom->softc; if (sc == NULL || (sc->sc_flags & G_GATE_FLAG_DESTROY) != 0) { @@ -237,21 +262,26 @@ g_gate_start(struct bio *pbp) G_GATE_LOGREQ(2, pbp, "Request received."); switch (pbp->bio_cmd) { case BIO_READ: - if (sc->sc_readcons != NULL) { - struct bio *cbp; - - cbp = g_clone_bio(pbp); - if (cbp == NULL) { - g_io_deliver(pbp, ENOMEM); - return; - } - cbp->bio_done = g_gate_done; - cbp->bio_offset = pbp->bio_offset + sc->sc_readoffset; - cbp->bio_to = sc->sc_readcons->provider; - g_io_request(cbp, sc->sc_readcons); + if (sc->sc_readcons == NULL) + break; + cbp = g_clone_bio(pbp); + if (cbp == NULL) { + g_io_deliver(pbp, ENOMEM); return; } - break; + mtx_lock(&sc->sc_read_mtx); + if ((cp = sc->sc_readcons) == NULL) { + mtx_unlock(&sc->sc_read_mtx); + g_destroy_bio(cbp); + pbp->bio_children--; + break; + } + cp->index++; + cbp->bio_offset = pbp->bio_offset + sc->sc_readoffset; + mtx_unlock(&sc->sc_read_mtx); + cbp->bio_done = g_gate_done; + g_io_request(cbp, cp); + return; case BIO_DELETE: case BIO_WRITE: case BIO_FLUSH: @@ -377,20 +407,18 @@ g_gate_orphan(struct g_consumer *cp) { struct g_gate_softc *sc; struct g_geom *gp; + int done; g_topology_assert(); gp = cp->geom; sc = gp->softc; - if (sc == NULL) - return; - KASSERT(cp == sc->sc_readcons, ("cp=%p sc_readcons=%p", cp, - sc->sc_readcons)); - sc->sc_readcons = NULL; - G_GATE_DEBUG(1, "Destroying read consumer on provider %s orphan.", - cp->provider->name); - (void)g_access(cp, -1, 0, 0); - g_detach(cp); - g_destroy_consumer(cp); + mtx_lock(&sc->sc_read_mtx); + if (sc->sc_readcons == cp) + sc->sc_readcons = NULL; + done = (cp->index == 0); + mtx_unlock(&sc->sc_read_mtx); + if (done) + g_gate_detach(cp, 0); } static void @@ -483,6 +511,7 @@ g_gate_create(struct g_gate_ctl_create *ggio) bioq_init(&sc->sc_inqueue); bioq_init(&sc->sc_outqueue); mtx_init(&sc->sc_queue_mtx, "gg:queue", NULL, MTX_DEF); + mtx_init(&sc->sc_read_mtx, "gg:read", NULL, MTX_DEF); sc->sc_queue_count = 0; sc->sc_queue_size = ggio->gctl_maxcount; if (sc->sc_queue_size > G_GATE_MAX_QUEUE_SIZE) @@ -596,6 +625,7 @@ fail2: fail1: mtx_unlock(&g_gate_units_lock); mtx_destroy(&sc->sc_queue_mtx); + mtx_destroy(&sc->sc_read_mtx); free(sc, M_GATE); return (error); } @@ -605,7 +635,7 @@ g_gate_modify(struct g_gate_softc *sc, struct g_gate_c { struct g_provider *pp; struct g_consumer *cp; - int error; + int done, error; if ((ggio->gctl_modify & GG_MODIFY_MEDIASIZE) != 0) { if (ggio->gctl_mediasize <= 0) { @@ -628,13 +658,15 @@ g_gate_modify(struct g_gate_softc *sc, struct g_gate_c if ((ggio->gctl_modify & GG_MODIFY_READPROV) != 0) { g_topology_lock(); - if (sc->sc_readcons != NULL) { - cp = sc->sc_readcons; + mtx_lock(&sc->sc_read_mtx); + if ((cp = sc->sc_readcons) != NULL) { sc->sc_readcons = NULL; - (void)g_access(cp, -1, 0, 0); - g_detach(cp); - g_destroy_consumer(cp); - } + done = (cp->index == 0); + mtx_unlock(&sc->sc_read_mtx); + if (done) + g_gate_detach(cp, 0); + } else + mtx_unlock(&sc->sc_read_mtx); if (ggio->gctl_readprov[0] != '\0') { pp = g_provider_by_name(ggio->gctl_readprov); if (pp == NULL) { Modified: head/sys/geom/gate/g_gate.h ============================================================================== --- head/sys/geom/gate/g_gate.h Sat Dec 28 16:40:44 2019 (r356150) +++ head/sys/geom/gate/g_gate.h Sat Dec 28 17:52:53 2019 (r356151) @@ -91,16 +91,15 @@ struct g_gate_softc { uint32_t sc_queue_count; /* P: sc_queue_mtx */ uint32_t sc_queue_size; /* P: (read-only) */ u_int sc_timeout; /* P: (read-only) */ - struct g_consumer *sc_readcons; /* P: XXX */ - off_t sc_readoffset; /* P: XXX */ + struct g_consumer *sc_readcons; /* P: sc_read_mtx */ + off_t sc_readoffset; /* P: sc_read_mtx */ struct callout sc_callout; /* P: (modified only from callout thread) */ - uintptr_t sc_seq; /* P: (modified only - from g_down - thread) */ + uintptr_t sc_seq; /* P: sc_queue_mtx */ LIST_ENTRY(g_gate_softc) sc_next; /* P: g_gate_list_mtx */ char sc_info[G_GATE_INFOSIZE]; /* P: (read-only) */ + struct mtx sc_read_mtx; }; #define G_GATE_DEBUG(lvl, ...) \ From owner-svn-src-head@freebsd.org Sat Dec 28 19:03:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C6DF1EE756; Sat, 28 Dec 2019 19:03:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lY4P6sHbz4cjx; Sat, 28 Dec 2019 19:03: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 E69695A53; Sat, 28 Dec 2019 19:03: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 xBSJ3HPk064667; Sat, 28 Dec 2019 19:03:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSJ3HZN064666; Sat, 28 Dec 2019 19:03:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912281903.xBSJ3HZN064666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Dec 2019 19:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356154 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 19:03:18 -0000 Author: markj Date: Sat Dec 28 19:03:17 2019 New Revision: 356154 URL: https://svnweb.freebsd.org/changeset/base/356154 Log: Don't update per-page activation counts in the swapout code. This avoids duplicating the work of the page daemon's active queue scan. Moreover, this duplication was inconsistent: - PGA_REFERENCED is not counted in act_count unless pmap_ts_referenced() returned 0, but the page daemon always counts PGA_REFERENCED towards the activation count. - The swapout daemon always activates a referenced page, but the page daemon only does so when the containing object is mapped at least once. The main purpose of swapout_deactivate_pages() is to shrink the number of pages mapped into a given pmap. To do this without unmapping active pages, use the non-destructive pmap_is_referenced() instead of the destructive pmap_ts_referenced() and deactivate pages accordingly. This simplifies some future changes to the locking protocol for page queue state. Reviewed by: kib Discussed with: jeff Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22674 Modified: head/sys/vm/vm_swapout.c Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Sat Dec 28 18:08:26 2019 (r356153) +++ head/sys/vm/vm_swapout.c Sat Dec 28 19:03:17 2019 (r356154) @@ -173,51 +173,26 @@ static void vm_thread_swapout(struct thread *td); static void vm_swapout_object_deactivate_page(pmap_t pmap, vm_page_t m, bool unmap) { - int act_delta; - if (vm_page_tryxbusy(m) == 0) - return; - VM_CNT_INC(v_pdpages); - /* - * The page may acquire a wiring after this check. - * The page daemon handles wired pages, so there is - * no harm done if a wiring appears while we are - * attempting to deactivate the page. + * Ignore unreclaimable wired pages. Repeat the check after busying + * since a busy holder may wire the page. */ + if (vm_page_wired(m) || !vm_page_tryxbusy(m)) + return; + if (vm_page_wired(m) || !pmap_page_exists_quick(pmap, m)) { vm_page_xunbusy(m); return; } - act_delta = pmap_ts_referenced(m); - vm_page_lock(m); - if ((m->a.flags & PGA_REFERENCED) != 0) { - if (act_delta == 0) - act_delta = 1; - vm_page_aflag_clear(m, PGA_REFERENCED); + if (!pmap_is_referenced(m)) { + vm_page_lock(m); + if (!vm_page_active(m)) + (void)vm_page_try_remove_all(m); + else if (unmap && vm_page_try_remove_all(m)) + vm_page_deactivate(m); + vm_page_unlock(m); } - if (!vm_page_active(m) && act_delta != 0) { - vm_page_activate(m); - m->a.act_count += act_delta; - } else if (vm_page_active(m)) { - /* - * The page daemon does not requeue pages - * after modifying their activation count. - */ - if (act_delta == 0) { - m->a.act_count -= min(m->a.act_count, ACT_DECLINE); - if (unmap && m->a.act_count == 0) { - (void)vm_page_try_remove_all(m); - vm_page_deactivate(m); - } - } else { - vm_page_activate(m); - if (m->a.act_count < ACT_MAX - ACT_ADVANCE) - m->a.act_count += ACT_ADVANCE; - } - } else if (vm_page_inactive(m)) - (void)vm_page_try_remove_all(m); - vm_page_unlock(m); vm_page_xunbusy(m); } From owner-svn-src-head@freebsd.org Sat Dec 28 19:03:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B94D1EE7AF; Sat, 28 Dec 2019 19:03:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lY4j1cltz4cr2; Sat, 28 Dec 2019 19:03:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 327D65A54; Sat, 28 Dec 2019 19:03:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSJ3Xd7064723; Sat, 28 Dec 2019 19:03:33 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSJ3Wpl064720; Sat, 28 Dec 2019 19:03:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912281903.xBSJ3Wpl064720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Dec 2019 19:03:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356155 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 19:03:33 -0000 Author: markj Date: Sat Dec 28 19:03:32 2019 New Revision: 356155 URL: https://svnweb.freebsd.org/changeset/base/356155 Log: Start implementing queue state updates using fcmpset loops. This is in preparation for eliminating the use of the vm_page lock for protecting queue state operations. Introduce the vm_page_pqstate_commit_*() functions. These functions act as helpers around vm_page_astate_fcmpset() and are specialized for specific types of operations. vm_page_pqstate_commit() wraps these functions. Convert a number of routines to use these new helpers. Use vm_page_release_toq() in vm_page_unwire() and vm_page_release() to atomically release a wiring reference and release the page into a queue. This has the side effect that vm_page_unwire() will leave the page in the active queue if it is already present there. Convert the page queue scans to use the new helpers. Simplify vm_pageout_reinsert_inactive(), which requeues pages that were found to be busy during an inactive queue scan, to avoid duplicating the work of vm_pqbatch_process_page(). In particular, if PGA_REQUEUE or PGA_REQUEUE_HEAD is set, let that be handled during batch processing. Reviewed by: jeff Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22770 Differential Revision: https://reviews.freebsd.org/D22771 Differential Revision: https://reviews.freebsd.org/D22772 Differential Revision: https://reviews.freebsd.org/D22773 Differential Revision: https://reviews.freebsd.org/D22776 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Dec 28 19:03:17 2019 (r356154) +++ head/sys/vm/vm_page.c Sat Dec 28 19:03:32 2019 (r356155) @@ -134,6 +134,11 @@ static int vm_pageproc_waiters; static SYSCTL_NODE(_vm_stats, OID_AUTO, page, CTLFLAG_RD, 0, "VM page statistics"); +static counter_u64_t pqstate_commit_retries = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, pqstate_commit_retries, + CTLFLAG_RD, &pqstate_commit_retries, + "Number of failed per-page atomic queue state updates"); + static counter_u64_t queue_ops = EARLY_COUNTER; SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_ops, CTLFLAG_RD, &queue_ops, @@ -148,6 +153,7 @@ static void counter_startup(void) { + pqstate_commit_retries = counter_u64_alloc(M_WAITOK); queue_ops = counter_u64_alloc(M_WAITOK); queue_nops = counter_u64_alloc(M_WAITOK); } @@ -179,7 +185,6 @@ static void vm_page_alloc_check(vm_page_t m); static bool _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, const char *wmesg, bool nonshared, bool locked); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); -static void vm_page_dequeue_complete(vm_page_t m); static void vm_page_enqueue(vm_page_t m, uint8_t queue); static bool vm_page_free_prep(vm_page_t m); static void vm_page_free_toq(vm_page_t m); @@ -188,9 +193,11 @@ static int vm_page_insert_after(vm_page_t m, vm_object vm_pindex_t pindex, vm_page_t mpred); static void vm_page_insert_radixdone(vm_page_t m, vm_object_t object, vm_page_t mpred); -static void vm_page_mvqueue(vm_page_t m, uint8_t queue); +static void vm_page_mvqueue(vm_page_t m, const uint8_t queue, + const uint16_t nflag); static int vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, vm_paddr_t high); +static void vm_page_release_toq(vm_page_t m, uint8_t nqueue, bool noreuse); static int vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_t object, int req); static int vm_page_zone_import(void *arg, void **store, int cnt, int domain, @@ -3266,84 +3273,244 @@ vm_waitpfault(struct domainset *dset, int timo) } static struct vm_pagequeue * +_vm_page_pagequeue(vm_page_t m, uint8_t queue) +{ + + return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue]); +} + +#ifdef INVARIANTS +static struct vm_pagequeue * vm_page_pagequeue(vm_page_t m) { - uint8_t queue; + return (_vm_page_pagequeue(m, vm_page_astate_load(m).queue)); +} +#endif - if ((queue = atomic_load_8(&m->a.queue)) == PQ_NONE) - return (NULL); - return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue]); +static __always_inline bool +vm_page_pqstate_fcmpset(vm_page_t m, vm_page_astate_t *old, vm_page_astate_t new) +{ + vm_page_astate_t tmp; + + tmp = *old; + do { + if (__predict_true(vm_page_astate_fcmpset(m, old, new))) + return (true); + counter_u64_add(pqstate_commit_retries, 1); + } while (old->_bits == tmp._bits); + + return (false); } -static inline void -vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m) +/* + * Do the work of committing a queue state update that moves the page out of + * its current queue. + */ +static bool +_vm_page_pqstate_commit_dequeue(struct vm_pagequeue *pq, vm_page_t m, + vm_page_astate_t *old, vm_page_astate_t new) { - struct vm_domain *vmd; - uint16_t qflags; + vm_page_t next; - CRITICAL_ASSERT(curthread); vm_pagequeue_assert_locked(pq); + KASSERT(vm_page_pagequeue(m) == pq, + ("%s: queue %p does not match page %p", __func__, pq, m)); + KASSERT(old->queue != PQ_NONE && new.queue != old->queue, + ("%s: invalid queue indices %d %d", + __func__, old->queue, new.queue)); /* - * The page daemon is allowed to set m->a.queue = PQ_NONE without - * the page queue lock held. In this case it is about to free the page, - * which must not have any queue state. + * Once the queue index of the page changes there is nothing + * synchronizing with further updates to the page's physical + * queue state. Therefore we must speculatively remove the page + * from the queue now and be prepared to roll back if the queue + * state update fails. If the page is not physically enqueued then + * we just update its queue index. */ - qflags = atomic_load_16(&m->a.flags); - KASSERT(pq == vm_page_pagequeue(m) || - (qflags & PGA_QUEUE_STATE_MASK) == 0, - ("page %p doesn't belong to queue %p but has aflags %#x", - m, pq, qflags)); - - if ((qflags & PGA_DEQUEUE) != 0) { - if (__predict_true((qflags & PGA_ENQUEUED) != 0)) - vm_pagequeue_remove(pq, m); - vm_page_dequeue_complete(m); - counter_u64_add(queue_ops, 1); - } else if ((qflags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) { - if ((qflags & PGA_ENQUEUED) != 0) - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - else { + if ((old->flags & PGA_ENQUEUED) != 0) { + new.flags &= ~PGA_ENQUEUED; + next = TAILQ_NEXT(m, plinks.q); + TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); + vm_pagequeue_cnt_dec(pq); + if (!vm_page_pqstate_fcmpset(m, old, new)) { + if (next == NULL) + TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); + else + TAILQ_INSERT_BEFORE(next, m, plinks.q); vm_pagequeue_cnt_inc(pq); - vm_page_aflag_set(m, PGA_ENQUEUED); + return (false); + } else { + return (true); } + } else { + return (vm_page_pqstate_fcmpset(m, old, new)); + } +} - /* - * Give PGA_REQUEUE_HEAD precedence over PGA_REQUEUE. - * In particular, if both flags are set in close succession, - * only PGA_REQUEUE_HEAD will be applied, even if it was set - * first. - */ - if ((qflags & PGA_REQUEUE_HEAD) != 0) { - KASSERT(m->a.queue == PQ_INACTIVE, - ("head enqueue not supported for page %p", m)); - vmd = vm_pagequeue_domain(m); - TAILQ_INSERT_BEFORE(&vmd->vmd_inacthead, m, plinks.q); - } else - TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); +static bool +vm_page_pqstate_commit_dequeue(vm_page_t m, vm_page_astate_t *old, + vm_page_astate_t new) +{ + struct vm_pagequeue *pq; + vm_page_astate_t as; + bool ret; - vm_page_aflag_clear(m, qflags & (PGA_REQUEUE | - PGA_REQUEUE_HEAD)); - counter_u64_add(queue_ops, 1); + pq = _vm_page_pagequeue(m, old->queue); + + /* + * The queue field and PGA_ENQUEUED flag are stable only so long as the + * corresponding page queue lock is held. + */ + vm_pagequeue_lock(pq); + as = vm_page_astate_load(m); + if (__predict_false(as._bits != old->_bits)) { + *old = as; + ret = false; } else { - counter_u64_add(queue_nops, 1); + ret = _vm_page_pqstate_commit_dequeue(pq, m, old, new); } + vm_pagequeue_unlock(pq); + return (ret); } +/* + * Commit a queue state update that enqueues or requeues a page. + */ +static bool +_vm_page_pqstate_commit_requeue(struct vm_pagequeue *pq, vm_page_t m, + vm_page_astate_t *old, vm_page_astate_t new) +{ + struct vm_domain *vmd; + + vm_pagequeue_assert_locked(pq); + KASSERT(old->queue != PQ_NONE && new.queue == old->queue, + ("%s: invalid queue indices %d %d", + __func__, old->queue, new.queue)); + + new.flags |= PGA_ENQUEUED; + if (!vm_page_pqstate_fcmpset(m, old, new)) + return (false); + + if ((old->flags & PGA_ENQUEUED) != 0) + TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); + else + vm_pagequeue_cnt_inc(pq); + + /* + * Give PGA_REQUEUE_HEAD precedence over PGA_REQUEUE. In particular, if + * both flags are set in close succession, only PGA_REQUEUE_HEAD will be + * applied, even if it was set first. + */ + if ((old->flags & PGA_REQUEUE_HEAD) != 0) { + vmd = vm_pagequeue_domain(m); + KASSERT(pq == &vmd->vmd_pagequeues[PQ_INACTIVE], + ("%s: invalid page queue for page %p", __func__, m)); + TAILQ_INSERT_BEFORE(&vmd->vmd_inacthead, m, plinks.q); + } else { + TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); + } + return (true); +} + +/* + * Commit a queue state update that encodes a request for a deferred queue + * operation. + */ +static bool +vm_page_pqstate_commit_request(vm_page_t m, vm_page_astate_t *old, + vm_page_astate_t new) +{ + + KASSERT(old->queue == new.queue || new.queue != PQ_NONE, + ("%s: invalid state, queue %d flags %x", + __func__, new.queue, new.flags)); + + if (old->_bits != new._bits && + !vm_page_pqstate_fcmpset(m, old, new)) + return (false); + vm_page_pqbatch_submit(m, new.queue); + return (true); +} + +/* + * A generic queue state update function. This handles more cases than the + * specialized functions above. + */ +bool +vm_page_pqstate_commit(vm_page_t m, vm_page_astate_t *old, vm_page_astate_t new) +{ + + if (old->_bits == new._bits) + return (true); + + if (old->queue != PQ_NONE && new.queue != old->queue) { + if (!vm_page_pqstate_commit_dequeue(m, old, new)) + return (false); + if (new.queue != PQ_NONE) + vm_page_pqbatch_submit(m, new.queue); + } else { + if (!vm_page_pqstate_fcmpset(m, old, new)) + return (false); + if (new.queue != PQ_NONE && + ((new.flags & ~old->flags) & PGA_QUEUE_OP_MASK) != 0) + vm_page_pqbatch_submit(m, new.queue); + } + return (true); +} + +/* + * Apply deferred queue state updates to a page. + */ +static inline void +vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m, uint8_t queue) +{ + vm_page_astate_t new, old; + + CRITICAL_ASSERT(curthread); + vm_pagequeue_assert_locked(pq); + KASSERT(queue < PQ_COUNT, + ("%s: invalid queue index %d", __func__, queue)); + KASSERT(pq == _vm_page_pagequeue(m, queue), + ("%s: page %p does not belong to queue %p", __func__, m, pq)); + + for (old = vm_page_astate_load(m);;) { + if (__predict_false(old.queue != queue || + (old.flags & PGA_QUEUE_OP_MASK) == 0)) { + counter_u64_add(queue_nops, 1); + break; + } + KASSERT(old.queue != PQ_NONE || (old.flags & PGA_QUEUE_STATE_MASK) == 0, + ("%s: page %p has unexpected queue state", __func__, m)); + + new = old; + if ((old.flags & PGA_DEQUEUE) != 0) { + new.flags &= ~PGA_QUEUE_OP_MASK; + new.queue = PQ_NONE; + if (__predict_true(_vm_page_pqstate_commit_dequeue(pq, + m, &old, new))) { + counter_u64_add(queue_ops, 1); + break; + } + } else { + new.flags &= ~(PGA_REQUEUE | PGA_REQUEUE_HEAD); + if (__predict_true(_vm_page_pqstate_commit_requeue(pq, + m, &old, new))) { + counter_u64_add(queue_ops, 1); + break; + } + } + } +} + static void vm_pqbatch_process(struct vm_pagequeue *pq, struct vm_batchqueue *bq, uint8_t queue) { - vm_page_t m; int i; - for (i = 0; i < bq->bq_cnt; i++) { - m = bq->bq_pa[i]; - if (__predict_false(m->a.queue != queue)) - continue; - vm_pqbatch_process_page(pq, m); - } + for (i = 0; i < bq->bq_cnt; i++) + vm_pqbatch_process_page(pq, bq->bq_pa[i], queue); vm_batchqueue_init(bq); } @@ -3381,21 +3548,7 @@ vm_page_pqbatch_submit(vm_page_t m, uint8_t queue) critical_enter(); bq = DPCPU_PTR(pqbatch[domain][queue]); vm_pqbatch_process(pq, bq, queue); - - /* - * The page may have been logically dequeued before we acquired the - * page queue lock. In this case, since we either hold the page lock - * or the page is being freed, a different thread cannot be concurrently - * enqueuing the page. - */ - if (__predict_true(m->a.queue == queue)) - vm_pqbatch_process_page(pq, m); - else { - KASSERT(m->a.queue == PQ_NONE, - ("invalid queue transition for page %p", m)); - KASSERT((m->a.flags & PGA_ENQUEUED) == 0, - ("page %p is enqueued with invalid queue index", m)); - } + vm_pqbatch_process_page(pq, m, queue); vm_pagequeue_unlock(pq); critical_exit(); } @@ -3440,21 +3593,6 @@ vm_page_pqbatch_drain(void) } /* - * Complete the logical removal of a page from a page queue. We must be - * careful to synchronize with the page daemon, which may be concurrently - * examining the page with only the page lock held. The page must not be - * in a state where it appears to be logically enqueued. - */ -static void -vm_page_dequeue_complete(vm_page_t m) -{ - - m->a.queue = PQ_NONE; - atomic_thread_fence_rel(); - vm_page_aflag_clear(m, PGA_QUEUE_STATE_MASK); -} - -/* * vm_page_dequeue_deferred: [ internal use only ] * * Request removal of the given page from its current page @@ -3466,109 +3604,45 @@ vm_page_dequeue_complete(vm_page_t m) void vm_page_dequeue_deferred(vm_page_t m) { - uint8_t queue; + vm_page_astate_t new, old; - vm_page_assert_locked(m); - - if ((queue = vm_page_queue(m)) == PQ_NONE) - return; - - /* - * Set PGA_DEQUEUE if it is not already set to handle a concurrent call - * to vm_page_dequeue_deferred_free(). In particular, avoid modifying - * the page's queue state once vm_page_dequeue_deferred_free() has been - * called. In the event of a race, two batch queue entries for the page - * will be created, but the second will have no effect. - */ - if (vm_page_pqstate_cmpset(m, queue, queue, PGA_DEQUEUE, PGA_DEQUEUE)) - vm_page_pqbatch_submit(m, queue); -} - -/* - * A variant of vm_page_dequeue_deferred() that does not assert the page - * lock and is only to be called from vm_page_free_prep(). Because the - * page is being freed, we can assume that nothing other than the page - * daemon is scheduling queue operations on this page, so we get for - * free the mutual exclusion that is otherwise provided by the page lock. - * To handle races, the page daemon must take care to atomically check - * for PGA_DEQUEUE when updating queue state. - */ -static void -vm_page_dequeue_deferred_free(vm_page_t m) -{ - uint8_t queue; - - KASSERT(m->ref_count == 0, ("page %p has references", m)); - - for (;;) { - if ((m->a.flags & PGA_DEQUEUE) != 0) - return; - atomic_thread_fence_acq(); - if ((queue = atomic_load_8(&m->a.queue)) == PQ_NONE) - return; - if (vm_page_pqstate_cmpset(m, queue, queue, PGA_DEQUEUE, - PGA_DEQUEUE)) { - vm_page_pqbatch_submit(m, queue); + old = vm_page_astate_load(m); + do { + if (old.queue == PQ_NONE) { + KASSERT((old.flags & PGA_QUEUE_STATE_MASK) == 0, + ("%s: page %p has unexpected queue state", + __func__, m)); break; } - } + new = old; + new.flags |= PGA_DEQUEUE; + } while (!vm_page_pqstate_commit_request(m, &old, new)); } /* * vm_page_dequeue: * - * Remove the page from whichever page queue it's in, if any. - * The page must either be locked or unallocated. This constraint - * ensures that the queue state of the page will remain consistent - * after this function returns. + * Remove the page from whichever page queue it's in, if any, before + * returning. */ void vm_page_dequeue(vm_page_t m) { - struct vm_pagequeue *pq, *pq1; - uint16_t aflags; + vm_page_astate_t new, old; - KASSERT(mtx_owned(vm_page_lockptr(m)) || m->ref_count == 0, - ("page %p is allocated and unlocked", m)); - - for (pq = vm_page_pagequeue(m);; pq = pq1) { - if (pq == NULL) { - /* - * A thread may be concurrently executing - * vm_page_dequeue_complete(). Ensure that all queue - * state is cleared before we return. - */ - aflags = atomic_load_16(&m->a.flags); - if ((aflags & PGA_QUEUE_STATE_MASK) == 0) - return; - KASSERT((aflags & PGA_DEQUEUE) != 0, - ("page %p has unexpected queue state flags %#x", - m, aflags)); - - /* - * Busy wait until the thread updating queue state is - * finished. Such a thread must be executing in a - * critical section. - */ - cpu_spinwait(); - pq1 = vm_page_pagequeue(m); - continue; - } - vm_pagequeue_lock(pq); - if ((pq1 = vm_page_pagequeue(m)) == pq) + old = vm_page_astate_load(m); + do { + if (old.queue == PQ_NONE) { + KASSERT((old.flags & PGA_QUEUE_STATE_MASK) == 0, + ("%s: page %p has unexpected queue state", + __func__, m)); break; - vm_pagequeue_unlock(pq); - } - KASSERT(pq == vm_page_pagequeue(m), - ("%s: page %p migrated directly between queues", __func__, m)); - KASSERT((m->a.flags & PGA_DEQUEUE) != 0 || - mtx_owned(vm_page_lockptr(m)), - ("%s: queued unlocked page %p", __func__, m)); + } + new = old; + new.flags &= ~PGA_QUEUE_OP_MASK; + new.queue = PQ_NONE; + } while (!vm_page_pqstate_commit_dequeue(m, &old, new)); - if ((m->a.flags & PGA_ENQUEUED) != 0) - vm_pagequeue_remove(pq, m); - vm_page_dequeue_complete(m); - vm_pagequeue_unlock(pq); } /* @@ -3618,66 +3692,23 @@ vm_page_requeue(vm_page_t m) * vm_page_swapqueue: [ internal use only ] * * Move the page from one queue to another, or to the tail of its - * current queue, in the face of a possible concurrent call to - * vm_page_dequeue_deferred_free(). + * current queue, in the face of a possible concurrent free of the + * page. */ void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq) { - struct vm_pagequeue *pq; - vm_page_t next; - bool queued; + vm_page_astate_t new, old; - KASSERT(oldq < PQ_COUNT && newq < PQ_COUNT && oldq != newq, - ("vm_page_swapqueue: invalid queues (%d, %d)", oldq, newq)); - vm_page_assert_locked(m); + old = vm_page_astate_load(m); + do { + if (old.queue != oldq || (old.flags & PGA_DEQUEUE) != 0) + return; + new = old; + new.flags |= PGA_REQUEUE; + new.queue = newq; + } while (!vm_page_pqstate_commit_dequeue(m, &old, new)); - pq = &vm_pagequeue_domain(m)->vmd_pagequeues[oldq]; - vm_pagequeue_lock(pq); - - /* - * The physical queue state might change at any point before the page - * queue lock is acquired, so we must verify that we hold the correct - * lock before proceeding. - */ - if (__predict_false(m->a.queue != oldq)) { - vm_pagequeue_unlock(pq); - return; - } - - /* - * Once the queue index of the page changes, there is nothing - * synchronizing with further updates to the physical queue state. - * Therefore we must remove the page from the queue now in anticipation - * of a successful commit, and be prepared to roll back. - */ - if (__predict_true((m->a.flags & PGA_ENQUEUED) != 0)) { - next = TAILQ_NEXT(m, plinks.q); - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - vm_page_aflag_clear(m, PGA_ENQUEUED); - queued = true; - } else { - queued = false; - } - - /* - * Atomically update the queue field and set PGA_REQUEUE while - * ensuring that PGA_DEQUEUE has not been set. - */ - if (__predict_false(!vm_page_pqstate_cmpset(m, oldq, newq, PGA_DEQUEUE, - PGA_REQUEUE))) { - if (queued) { - vm_page_aflag_set(m, PGA_ENQUEUED); - if (next != NULL) - TAILQ_INSERT_BEFORE(next, m, plinks.q); - else - TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); - } - vm_pagequeue_unlock(pq); - return; - } - vm_pagequeue_cnt_dec(pq); - vm_pagequeue_unlock(pq); vm_page_pqbatch_submit(m, newq); } @@ -3766,7 +3797,7 @@ vm_page_free_prep(vm_page_t m) * dequeue. */ if ((m->oflags & VPO_UNMANAGED) == 0) - vm_page_dequeue_deferred_free(m); + vm_page_dequeue_deferred(m); m->valid = 0; vm_page_undirty(m); @@ -3903,31 +3934,19 @@ vm_page_wire_mapped(vm_page_t m) } /* - * Release one wiring of the specified page, potentially allowing it to be - * paged out. - * - * Only managed pages belonging to an object can be paged out. If the number - * of wirings transitions to zero and the page is eligible for page out, then - * the page is added to the specified paging queue. If the released wiring - * represented the last reference to the page, the page is freed. - * - * A managed page must be locked. + * Release a wiring reference to a managed page. If the page still belongs to + * an object, update its position in the page queues to reflect the reference. + * If the wiring was the last reference to the page, free the page. */ -void -vm_page_unwire(vm_page_t m, uint8_t queue) +static void +vm_page_unwire_managed(vm_page_t m, uint8_t nqueue, bool noreuse) { u_int old; bool locked; - KASSERT(queue < PQ_COUNT, - ("vm_page_unwire: invalid queue %u request for page %p", queue, m)); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, + ("%s: page %p is unmanaged", __func__, m)); - if ((m->oflags & VPO_UNMANAGED) != 0) { - if (vm_page_unwire_noq(m) && m->ref_count == 0) - vm_page_free(m); - return; - } - /* * Update LRU state before releasing the wiring reference. * We only need to do this once since we hold the page lock. @@ -3942,10 +3961,7 @@ vm_page_unwire(vm_page_t m, uint8_t queue) if (!locked && VPRC_WIRE_COUNT(old) == 1) { vm_page_lock(m); locked = true; - if (queue == PQ_ACTIVE && vm_page_queue(m) == PQ_ACTIVE) - vm_page_reference(m); - else - vm_page_mvqueue(m, queue); + vm_page_release_toq(m, nqueue, false); } } while (!atomic_fcmpset_rel_int(&m->ref_count, &old, old - 1)); @@ -3965,6 +3981,33 @@ vm_page_unwire(vm_page_t m, uint8_t queue) } /* + * Release one wiring of the specified page, potentially allowing it to be + * paged out. + * + * Only managed pages belonging to an object can be paged out. If the number + * of wirings transitions to zero and the page is eligible for page out, then + * the page is added to the specified paging queue. If the released wiring + * represented the last reference to the page, the page is freed. + * + * A managed page must be locked. + */ +void +vm_page_unwire(vm_page_t m, uint8_t nqueue) +{ + + KASSERT(nqueue < PQ_COUNT, + ("vm_page_unwire: invalid queue %u request for page %p", + nqueue, m)); + + if ((m->oflags & VPO_UNMANAGED) != 0) { + if (vm_page_unwire_noq(m) && m->ref_count == 0) + vm_page_free(m); + return; + } + vm_page_unwire_managed(m, nqueue, false); +} + +/* * Unwire a page without (re-)inserting it into a page queue. It is up * to the caller to enqueue, requeue, or free the page as appropriate. * In most cases involving managed pages, vm_page_unwire() should be used @@ -3988,10 +4031,9 @@ vm_page_unwire_noq(vm_page_t m) } /* - * Ensure that the page is in the specified page queue. If the page is + * Ensure that the page ends up in the specified page queue. If the page is * active or being moved to the active queue, ensure that its act_count is - * at least ACT_INIT but do not otherwise mess with it. Otherwise, ensure that - * the page is at the tail of its page queue. + * at least ACT_INIT but do not otherwise mess with it. * * The page may be wired. The caller should release its wiring reference * before releasing the page lock, otherwise the page daemon may immediately @@ -4000,24 +4042,31 @@ vm_page_unwire_noq(vm_page_t m) * A managed page must be locked. */ static __always_inline void -vm_page_mvqueue(vm_page_t m, const uint8_t nqueue) +vm_page_mvqueue(vm_page_t m, const uint8_t nqueue, const uint16_t nflag) { + vm_page_astate_t old, new; vm_page_assert_locked(m); KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("vm_page_mvqueue: page %p is unmanaged", m)); + ("%s: page %p is unmanaged", __func__, m)); KASSERT(m->ref_count > 0, ("%s: page %p does not carry any references", __func__, m)); + KASSERT(nflag == PGA_REQUEUE || nflag == PGA_REQUEUE_HEAD, + ("%s: invalid flags %x", __func__, nflag)); - if (vm_page_queue(m) != nqueue) { - vm_page_dequeue(m); - vm_page_enqueue(m, nqueue); - } else if (nqueue != PQ_ACTIVE) { - vm_page_requeue(m); - } - - if (nqueue == PQ_ACTIVE && m->a.act_count < ACT_INIT) - m->a.act_count = ACT_INIT; + old = vm_page_astate_load(m); + do { + new = old; + if (nqueue == PQ_ACTIVE) + new.act_count = max(old.act_count, ACT_INIT); + if (old.queue == nqueue) { + if (nqueue != PQ_ACTIVE) + new.flags |= nflag; + } else { + new.flags |= nflag; + new.queue = nqueue; + } + } while (!vm_page_pqstate_commit(m, &old, new)); } /* @@ -4029,7 +4078,7 @@ vm_page_activate(vm_page_t m) if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) return; - vm_page_mvqueue(m, PQ_ACTIVE); + vm_page_mvqueue(m, PQ_ACTIVE, PGA_REQUEUE); } /* @@ -4042,30 +4091,9 @@ vm_page_deactivate(vm_page_t m) if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) return; - vm_page_mvqueue(m, PQ_INACTIVE); + vm_page_mvqueue(m, PQ_INACTIVE, PGA_REQUEUE); } -/* - * Move the specified page close to the head of the inactive queue, - * bypassing LRU. A marker page is used to maintain FIFO ordering. - * As with regular enqueues, we use a per-CPU batch queue to reduce - * contention on the page queue lock. - */ -static void -_vm_page_deactivate_noreuse(vm_page_t m) -{ - - vm_page_assert_locked(m); - - if (!vm_page_inactive(m)) { - vm_page_dequeue(m); - m->a.queue = PQ_INACTIVE; - } - if ((m->a.flags & PGA_REQUEUE_HEAD) == 0) - vm_page_aflag_set(m, PGA_REQUEUE_HEAD); - vm_page_pqbatch_submit(m, PQ_INACTIVE); -} - void vm_page_deactivate_noreuse(vm_page_t m) { @@ -4073,8 +4101,9 @@ vm_page_deactivate_noreuse(vm_page_t m) KASSERT(m->object != NULL, ("vm_page_deactivate_noreuse: page %p has no object", m)); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_wired(m)) - _vm_page_deactivate_noreuse(m); + if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) + return; + vm_page_mvqueue(m, PQ_INACTIVE, PGA_REQUEUE_HEAD); } /* @@ -4086,7 +4115,7 @@ vm_page_launder(vm_page_t m) if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) return; - vm_page_mvqueue(m, PQ_LAUNDRY); + vm_page_mvqueue(m, PQ_LAUNDRY, PGA_REQUEUE); } /* @@ -4104,9 +4133,14 @@ vm_page_unswappable(vm_page_t m) vm_page_enqueue(m, PQ_UNSWAPPABLE); } +/* + * Release a page back to the page queues in preparation for unwiring. + */ static void -vm_page_release_toq(vm_page_t m, int flags) +vm_page_release_toq(vm_page_t m, uint8_t nqueue, const bool noreuse) { + vm_page_astate_t old, new; + uint16_t nflag; vm_page_assert_locked(m); @@ -4120,12 +4154,30 @@ vm_page_release_toq(vm_page_t m, int flags) * If we were asked to not cache the page, place it near the head of the * inactive queue so that is reclaimed sooner. */ - if ((flags & (VPR_TRYFREE | VPR_NOREUSE)) != 0 || m->valid == 0) - _vm_page_deactivate_noreuse(m); - else if (vm_page_active(m)) - vm_page_reference(m); - else - vm_page_mvqueue(m, PQ_INACTIVE); + if (noreuse || m->valid == 0) { + nqueue = PQ_INACTIVE; + nflag = PGA_REQUEUE_HEAD; + } else { + nflag = PGA_REQUEUE; + } + + old = vm_page_astate_load(m); + do { + new = old; + + /* + * If the page is already in the active queue and we are not + * trying to accelerate reclamation, simply mark it as + * referenced and avoid any queue operations. + */ + new.flags &= ~PGA_QUEUE_OP_MASK; + if (nflag != PGA_REQUEUE_HEAD && old.queue == PQ_ACTIVE) + new.flags |= PGA_REFERENCED; + else { + new.flags |= nflag; + new.queue = nqueue; + } + } while (!vm_page_pqstate_commit(m, &old, new)); } /* @@ -4135,8 +4187,6 @@ void vm_page_release(vm_page_t m, int flags) { vm_object_t object; - u_int old; - bool locked; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("vm_page_release: page %p is unmanaged", m)); @@ -4157,37 +4207,7 @@ vm_page_release(vm_page_t m, int flags) VM_OBJECT_WUNLOCK(object); } } - - /* - * Update LRU state before releasing the wiring reference. - * Use a release store when updating the reference count to - * synchronize with vm_page_free_prep(). - */ - old = m->ref_count; - locked = false; - do { - KASSERT(VPRC_WIRE_COUNT(old) > 0, - ("vm_page_unwire: wire count underflow for page %p", m)); - if (!locked && VPRC_WIRE_COUNT(old) == 1) { - vm_page_lock(m); - locked = true; - vm_page_release_toq(m, flags); - } - } while (!atomic_fcmpset_rel_int(&m->ref_count, &old, old - 1)); - - /* - * Release the lock only after the wiring is released, to ensure that - * the page daemon does not encounter and dequeue the page while it is - * still wired. - */ - if (locked) - vm_page_unlock(m); - - if (VPRC_WIRE_COUNT(old) == 1) { - vm_wire_sub(1); - if (old == 1) - vm_page_free(m); - } + vm_page_unwire_managed(m, PQ_INACTIVE, flags != 0); } /* See vm_page_release(). */ @@ -4206,7 +4226,7 @@ vm_page_release_locked(vm_page_t m, int flags) vm_page_free(m); } else { vm_page_lock(m); - vm_page_release_toq(m, flags); + vm_page_release_toq(m, PQ_INACTIVE, flags != 0); vm_page_unlock(m); } } Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Dec 28 19:03:17 2019 (r356154) +++ head/sys/vm/vm_page.h Sat Dec 28 19:03:32 2019 (r356155) @@ -631,6 +631,8 @@ vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); vm_page_t vm_page_next(vm_page_t m); void vm_page_pqbatch_drain(void); void vm_page_pqbatch_submit(vm_page_t m, uint8_t queue); +bool vm_page_pqstate_commit(vm_page_t m, vm_page_astate_t *old, + vm_page_astate_t new); vm_page_t vm_page_prev(vm_page_t m); bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m); void vm_page_putfake(vm_page_t m); @@ -901,11 +903,19 @@ vm_page_undirty(vm_page_t m) m->dirty = 0; } +static inline uint8_t +_vm_page_queue(vm_page_astate_t as) +{ + + if ((as.flags & PGA_DEQUEUE) != 0) + return (PQ_NONE); + return (as.queue); +} + /* * vm_page_queue: * - * Return the index of the queue containing m. This index is guaranteed - * not to change while the page lock is held. + * Return the index of the queue containing m. */ static inline uint8_t vm_page_queue(vm_page_t m) @@ -913,10 +923,7 @@ vm_page_queue(vm_page_t m) vm_page_assert_locked(m); - if ((m->a.flags & PGA_DEQUEUE) != 0) - return (PQ_NONE); - atomic_thread_fence_acq(); - return (m->a.queue); + return (_vm_page_queue(vm_page_astate_load(m))); } static inline bool Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Dec 28 19:03:17 2019 (r356154) +++ head/sys/vm/vm_pageout.c Sat Dec 28 19:03:32 2019 (r356155) @@ -718,7 +718,8 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, struct mtx *mtx; vm_object_t object; vm_page_t m, marker; - int act_delta, error, numpagedout, queue, starting_target; + vm_page_astate_t new, old; + int act_delta, error, numpagedout, queue, refs, starting_target; int vnodes_skipped; bool pageout_ok; @@ -820,9 +821,8 @@ recheck: * wire count is guaranteed not to increase. */ if (__predict_false(vm_page_wired(m))) { - vm_page_xunbusy(m); vm_page_dequeue_deferred(m); - continue; + goto skip_page; } /* @@ -832,41 +832,43 @@ recheck: if (vm_page_none_valid(m)) goto free_page; - /* - * If the page has been referenced and the object is not dead, - * reactivate or requeue the page depending on whether the - * object is mapped. - * - * Test PGA_REFERENCED after calling pmap_ts_referenced() so - * that a reference from a concurrently destroyed mapping is - * observed here and now. - */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Dec 28 19:03:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B0421EE82D; Sat, 28 Dec 2019 19:03:47 +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 47lY4z00yzz4d00; Sat, 28 Dec 2019 19:03:47 +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 EF01D5A5A; Sat, 28 Dec 2019 19:03:46 +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 xBSJ3k4n064775; Sat, 28 Dec 2019 19:03:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSJ3kB2064774; Sat, 28 Dec 2019 19:03:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912281903.xBSJ3kB2064774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Dec 2019 19:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356156 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 19:03:47 -0000 Author: markj Date: Sat Dec 28 19:03:46 2019 New Revision: 356156 URL: https://svnweb.freebsd.org/changeset/base/356156 Log: Generalize lazy dequeue logic for wired pages. Some recent work aims to remove the use of the page lock for synchronizing updates to page queue state. This change adds a mechanism to preserve the existing behaviour of lazily dequeuing wired pages, which was previously synchronized using the page lock. Handle this by setting PGA_DEQUEUE when a managed page's wire count transitions from 0 to 1. When the page daemon encounters a page with a flag in PGA_QUEUE_OP_MASK set, it creates a batch queue entry for that page, but in so doing it does not modify the page itself and thus racing with a concurrent free of the page is harmless. The flag is advisory; the page daemon still checks for wirings after acquiring the object and page xbusy locks. vm_page_unwire_managed() now clears PGA_DEQUEUE on a 1->0 transition. It must do this before dropping the reference to avoid a use-after-free but also handles races with concurrent wirings to ensure that PGA_DEQUEUE is not left unset on a wired page. Reviewed by: jeff Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22882 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Dec 28 19:03:32 2019 (r356155) +++ head/sys/vm/vm_page.c Sat Dec 28 19:03:46 2019 (r356156) @@ -3530,8 +3530,6 @@ vm_page_pqbatch_submit(vm_page_t m, uint8_t queue) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("page %p is unmanaged", m)); - KASSERT(mtx_owned(vm_page_lockptr(m)) || m->object == NULL, - ("missing synchronization for page %p", m)); KASSERT(queue < PQ_COUNT, ("invalid queue %d", queue)); domain = vm_phys_domain(m); @@ -3904,8 +3902,11 @@ vm_page_wire(vm_page_t m) old = atomic_fetchadd_int(&m->ref_count, 1); KASSERT(VPRC_WIRE_COUNT(old) != VPRC_WIRE_COUNT_MAX, ("vm_page_wire: counter overflow for page %p", m)); - if (VPRC_WIRE_COUNT(old) == 0) + if (VPRC_WIRE_COUNT(old) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) + vm_page_aflag_set(m, PGA_DEQUEUE); vm_wire_add(1); + } } /* @@ -3928,8 +3929,11 @@ vm_page_wire_mapped(vm_page_t m) return (false); } while (!atomic_fcmpset_int(&m->ref_count, &old, old + 1)); - if (VPRC_WIRE_COUNT(old) == 0) + if (VPRC_WIRE_COUNT(old) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) + vm_page_aflag_set(m, PGA_DEQUEUE); vm_wire_add(1); + } return (true); } @@ -3942,37 +3946,43 @@ static void vm_page_unwire_managed(vm_page_t m, uint8_t nqueue, bool noreuse) { u_int old; - bool locked; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("%s: page %p is unmanaged", __func__, m)); /* * Update LRU state before releasing the wiring reference. - * We only need to do this once since we hold the page lock. * Use a release store when updating the reference count to * synchronize with vm_page_free_prep(). */ old = m->ref_count; - locked = false; do { KASSERT(VPRC_WIRE_COUNT(old) > 0, ("vm_page_unwire: wire count underflow for page %p", m)); - if (!locked && VPRC_WIRE_COUNT(old) == 1) { - vm_page_lock(m); - locked = true; + + if (old > VPRC_OBJREF + 1) { + /* + * The page has at least one other wiring reference. An + * earlier iteration of this loop may have called + * vm_page_release_toq() and cleared PGA_DEQUEUE, so + * re-set it if necessary. + */ + if ((vm_page_astate_load(m).flags & PGA_DEQUEUE) == 0) + vm_page_aflag_set(m, PGA_DEQUEUE); + } else if (old == VPRC_OBJREF + 1) { + /* + * This is the last wiring. Clear PGA_DEQUEUE and + * update the page's queue state to reflect the + * reference. If the page does not belong to an object + * (i.e., the VPRC_OBJREF bit is clear), we only need to + * clear leftover queue state. + */ vm_page_release_toq(m, nqueue, false); + } else if (old == 1) { + vm_page_aflag_clear(m, PGA_DEQUEUE); } } while (!atomic_fcmpset_rel_int(&m->ref_count, &old, old - 1)); - /* - * Release the lock only after the wiring is released, to ensure that - * the page daemon does not encounter and dequeue the page while it is - * still wired. - */ - if (locked) - vm_page_unlock(m); - if (VPRC_WIRE_COUNT(old) == 1) { vm_wire_sub(1); if (old == 1) @@ -4026,6 +4036,8 @@ vm_page_unwire_noq(vm_page_t m) if (VPRC_WIRE_COUNT(old) > 1) return (false); + if ((m->oflags & VPO_UNMANAGED) == 0) + vm_page_aflag_clear(m, PGA_DEQUEUE); vm_wire_sub(1); return (true); } @@ -4035,10 +4047,6 @@ vm_page_unwire_noq(vm_page_t m) * active or being moved to the active queue, ensure that its act_count is * at least ACT_INIT but do not otherwise mess with it. * - * The page may be wired. The caller should release its wiring reference - * before releasing the page lock, otherwise the page daemon may immediately - * dequeue the page. - * * A managed page must be locked. */ static __always_inline void @@ -4046,16 +4054,18 @@ vm_page_mvqueue(vm_page_t m, const uint8_t nqueue, con { vm_page_astate_t old, new; - vm_page_assert_locked(m); - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("%s: page %p is unmanaged", __func__, m)); KASSERT(m->ref_count > 0, ("%s: page %p does not carry any references", __func__, m)); KASSERT(nflag == PGA_REQUEUE || nflag == PGA_REQUEUE_HEAD, ("%s: invalid flags %x", __func__, nflag)); + if ((m->oflags & VPO_UNMANAGED) != 0) + return; + old = vm_page_astate_load(m); do { + if ((old.flags & PGA_DEQUEUE) != 0) + break; new = old; if (nqueue == PQ_ACTIVE) new.act_count = max(old.act_count, ACT_INIT); @@ -4076,8 +4086,6 @@ void vm_page_activate(vm_page_t m) { - if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) - return; vm_page_mvqueue(m, PQ_ACTIVE, PGA_REQUEUE); } @@ -4089,8 +4097,6 @@ void vm_page_deactivate(vm_page_t m) { - if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) - return; vm_page_mvqueue(m, PQ_INACTIVE, PGA_REQUEUE); } @@ -4098,11 +4104,6 @@ void vm_page_deactivate_noreuse(vm_page_t m) { - KASSERT(m->object != NULL, - ("vm_page_deactivate_noreuse: page %p has no object", m)); - - if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) - return; vm_page_mvqueue(m, PQ_INACTIVE, PGA_REQUEUE_HEAD); } @@ -4113,8 +4114,6 @@ void vm_page_launder(vm_page_t m) { - if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) - return; vm_page_mvqueue(m, PQ_LAUNDRY, PGA_REQUEUE); } @@ -4141,8 +4140,6 @@ vm_page_release_toq(vm_page_t m, uint8_t nqueue, const { vm_page_astate_t old, new; uint16_t nflag; - - vm_page_assert_locked(m); /* * Use a check of the valid bits to determine whether we should Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Dec 28 19:03:32 2019 (r356155) +++ head/sys/vm/vm_pageout.c Sat Dec 28 19:03:46 2019 (r356156) @@ -318,6 +318,26 @@ vm_pageout_next(struct scan_state *ss, const bool dequ } /* + * Determine whether processing of a page should be deferred and ensure that any + * outstanding queue operations are processed. + */ +static __always_inline bool +vm_pageout_defer(vm_page_t m, const uint8_t queue, const bool enqueued) +{ + vm_page_astate_t as; + + as = vm_page_astate_load(m); + if (__predict_false(as.queue != queue || + ((as.flags & PGA_ENQUEUED) != 0) != enqueued)) + return (true); + if ((as.flags & PGA_QUEUE_OP_MASK) != 0) { + vm_page_pqbatch_submit(m, queue); + return (true); + } + return (false); +} + +/* * Scan for pages at adjacent offsets within the given page's object that are * eligible for laundering, form a cluster of these pages and the given page, * and launder that cluster. @@ -755,35 +775,14 @@ scan: recheck: /* - * The page may have been disassociated from the queue - * or even freed while locks were dropped. We thus must be - * careful whenever modifying page state. Once the object lock - * has been acquired, we have a stable reference to the page. + * Don't touch a page that was removed from the queue after the + * page queue lock was released. Otherwise, ensure that any + * pending queue operations, such as dequeues for wired pages, + * are handled. */ - if (vm_page_queue(m) != queue) + if (vm_pageout_defer(m, queue, true)) continue; - /* - * A requeue was requested, so this page gets a second - * chance. - */ - if ((m->a.flags & PGA_REQUEUE) != 0) { - vm_page_pqbatch_submit(m, queue); - continue; - } - - /* - * Wired pages may not be freed. Complete their removal - * from the queue now to avoid needless revisits during - * future scans. This check is racy and must be reverified once - * we hold the object lock and have verified that the page - * is not busy. - */ - if (vm_page_wired(m)) { - vm_page_dequeue_deferred(m); - continue; - } - if (object != m->object) { if (object != NULL) VM_OBJECT_WUNLOCK(object); @@ -813,9 +812,9 @@ recheck: continue; /* - * Re-check for wirings now that we hold the object lock and - * have verified that the page is unbusied. If the page is - * mapped, it may still be wired by pmap lookups. The call to + * Check for wirings now that we hold the object lock and have + * verified that the page is unbusied. If the page is mapped, + * it may still be wired by pmap lookups. The call to * vm_page_try_remove_all() below atomically checks for such * wirings and removes mappings. If the page is unmapped, the * wire count is guaranteed not to increase. @@ -1259,23 +1258,15 @@ act_scan: vm_page_change_lock(m, &mtx); /* - * The page may have been disassociated from the queue - * or even freed while locks were dropped. We thus must be - * careful whenever modifying page state. Once the object lock - * has been acquired, we have a stable reference to the page. + * Don't touch a page that was removed from the queue after the + * page queue lock was released. Otherwise, ensure that any + * pending queue operations, such as dequeues for wired pages, + * are handled. */ - if (vm_page_queue(m) != PQ_ACTIVE) + if (vm_pageout_defer(m, PQ_ACTIVE, true)) continue; /* - * Wired pages are dequeued lazily. - */ - if (vm_page_wired(m)) { - vm_page_dequeue_deferred(m); - continue; - } - - /* * A page's object pointer may be set to NULL before * the object lock is acquired. */ @@ -1515,27 +1506,13 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh recheck: /* - * The page may have been disassociated from the queue - * or even freed while locks were dropped. We thus must be - * careful whenever modifying page state. Once the object lock - * has been acquired, we have a stable reference to the page. + * Don't touch a page that was removed from the queue after the + * page queue lock was released. Otherwise, ensure that any + * pending queue operations, such as dequeues for wired pages, + * are handled. */ - old = vm_page_astate_load(m); - if (old.queue != PQ_INACTIVE || - (old.flags & PGA_QUEUE_STATE_MASK) != 0) + if (vm_pageout_defer(m, PQ_INACTIVE, false)) continue; - - /* - * Wired pages may not be freed. Complete their removal - * from the queue now to avoid needless revisits during - * future scans. This check is racy and must be reverified once - * we hold the object lock and have verified that the page - * is not busy. - */ - if (vm_page_wired(m)) { - vm_page_dequeue_deferred(m); - continue; - } if (object != m->object) { if (object != NULL) From owner-svn-src-head@freebsd.org Sat Dec 28 19:04:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26CD61EE8A5; Sat, 28 Dec 2019 19:04:03 +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 47lY5H106Rz4d6l; Sat, 28 Dec 2019 19:04:03 +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 044505A5F; Sat, 28 Dec 2019 19:04:03 +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 xBSJ42Xg064844; Sat, 28 Dec 2019 19:04:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSJ40MJ064832; Sat, 28 Dec 2019 19:04:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912281904.xBSJ40MJ064832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Dec 2019 19:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356157 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/md fs/tmpfs kern vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/md fs/tmpfs kern vm X-SVN-Commit-Revision: 356157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 19:04:03 -0000 Author: markj Date: Sat Dec 28 19:04:00 2019 New Revision: 356157 URL: https://svnweb.freebsd.org/changeset/base/356157 Log: Remove page locking for queue operations. With the previous reviews, the page lock is no longer required in order to perform queue operations on a page. It is also no longer needed in the page queue scans. This change effectively eliminates remaining uses of the page lock and also the false sharing caused by multiple pages sharing a page lock. Reviewed by: jeff Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22885 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/dev/md/md.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/uipc_shm.c head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_swapout.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Dec 28 19:04:00 2019 (r356157) @@ -1761,12 +1761,10 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ bcopy((char *)db->db_data + bufoff, va, PAGESIZE); zfs_unmap_page(sf); vm_page_valid(m); - vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); - vm_page_unlock(m); vm_page_sunbusy(m); } *rbehind = i; @@ -1884,12 +1882,10 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ } zfs_unmap_page(sf); vm_page_valid(m); - vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); - vm_page_unlock(m); vm_page_sunbusy(m); } *rahead = i; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 28 19:04:00 2019 (r356157) @@ -545,9 +545,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) zfs_vmobject_wlock(obj); if (error == 0) { vm_page_valid(pp); - vm_page_lock(pp); vm_page_activate(pp); - vm_page_unlock(pp); } vm_page_sunbusy(pp); if (error != 0 && !vm_page_wired(pp) && Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/dev/md/md.c Sat Dec 28 19:04:00 2019 (r356157) @@ -1145,12 +1145,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) } if (m != NULL) { vm_page_xunbusy(m); - vm_page_lock(m); - if (vm_page_active(m)) - vm_page_reference(m); - else - vm_page_activate(m); - vm_page_unlock(m); + vm_page_reference(m); } /* Actions on further pages start at offset 0 */ Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sat Dec 28 19:04:00 2019 (r356157) @@ -1490,9 +1490,7 @@ retry: * current operation is not regarded * as an access. */ - vm_page_lock(m); vm_page_launder(m); - vm_page_unlock(m); } else { vm_page_free(m); if (ignerr) Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/kern/uipc_shm.c Sat Dec 28 19:04:00 2019 (r356157) @@ -209,9 +209,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc error = uiomove_fromphys(&m, offset, tlen, uio); if (uio->uio_rw == UIO_WRITE && error == 0) vm_page_set_dirty(m); - vm_page_lock(m); vm_page_activate(m); - vm_page_unlock(m); vm_page_sunbusy(m); return (error); Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/vm/swap_pager.c Sat Dec 28 19:04:00 2019 (r356157) @@ -1630,10 +1630,9 @@ swp_pager_async_iodone(struct buf *bp) * then finish the I/O. */ MPASS(m->dirty == VM_PAGE_BITS_ALL); + /* PQ_UNSWAPPABLE? */ - vm_page_lock(m); vm_page_activate(m); - vm_page_unlock(m); vm_page_sunbusy(m); } } else if (bp->b_iocmd == BIO_READ) { @@ -1668,9 +1667,7 @@ swp_pager_async_iodone(struct buf *bp) ("swp_pager_async_iodone: page %p is not write" " protected", m)); vm_page_undirty(m); - vm_page_lock(m); vm_page_deactivate_noreuse(m); - vm_page_unlock(m); vm_page_sunbusy(m); } } @@ -1718,10 +1715,8 @@ swp_pager_force_dirty(vm_page_t m) vm_page_dirty(m); #ifdef INVARIANTS - vm_page_lock(m); if (!vm_page_wired(m) && m->a.queue == PQ_NONE) panic("page %p is neither wired nor queued", m); - vm_page_unlock(m); #endif vm_page_xunbusy(m); swap_pager_unswapped(m); @@ -1732,9 +1727,7 @@ swp_pager_force_launder(vm_page_t m) { vm_page_dirty(m); - vm_page_lock(m); vm_page_launder(m); - vm_page_unlock(m); vm_page_xunbusy(m); swap_pager_unswapped(m); } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/vm/vm_fault.c Sat Dec 28 19:04:00 2019 (r356157) @@ -162,9 +162,7 @@ fault_page_release(vm_page_t *mp) * this page. Deactivating it leaves it available for * pageout while optimizing fault restarts. */ - vm_page_lock(m); vm_page_deactivate(m); - vm_page_unlock(m); vm_page_xunbusy(m); *mp = NULL; } @@ -395,9 +393,7 @@ vm_fault_populate_cleanup(vm_object_t object, vm_pinde for (pidx = first, m = vm_page_lookup(object, pidx); pidx <= last; pidx++, m = vm_page_next(m)) { vm_fault_populate_check_page(m); - vm_page_lock(m); vm_page_deactivate(m); - vm_page_unlock(m); vm_page_xunbusy(m); } } @@ -406,7 +402,6 @@ static int vm_fault_populate(struct faultstate *fs, vm_prot_t prot, int fault_type, int fault_flags, boolean_t wired, vm_page_t *m_hold) { - struct mtx *m_mtx; vm_offset_t vaddr; vm_page_t m; vm_pindex_t map_first, map_last, pager_first, pager_last, pidx; @@ -518,22 +513,17 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro MPASS(rv == KERN_SUCCESS); #endif VM_OBJECT_WLOCK(fs->first_object); - m_mtx = NULL; for (i = 0; i < npages; i++) { - if ((fault_flags & VM_FAULT_WIRE) != 0) { + if ((fault_flags & VM_FAULT_WIRE) != 0) vm_page_wire(&m[i]); - } else { - vm_page_change_lock(&m[i], &m_mtx); + else vm_page_activate(&m[i]); - } if (m_hold != NULL && m[i].pindex == fs->first_pindex) { *m_hold = &m[i]; vm_page_wire(&m[i]); } vm_page_xunbusy(&m[i]); } - if (m_mtx != NULL) - mtx_unlock(m_mtx); } curthread->td_ru.ru_majflt++; return (KERN_SUCCESS); @@ -1393,13 +1383,10 @@ readrest: * If the page is not wired down, then put it where the pageout daemon * can find it. */ - if ((fault_flags & VM_FAULT_WIRE) != 0) { + if ((fault_flags & VM_FAULT_WIRE) != 0) vm_page_wire(fs.m); - } else { - vm_page_lock(fs.m); + else vm_page_activate(fs.m); - vm_page_unlock(fs.m); - } if (m_hold != NULL) { *m_hold = fs.m; vm_page_wire(fs.m); @@ -1499,12 +1486,13 @@ vm_fault_dontneed(const struct faultstate *fs, vm_offs * Typically, at this point, prefetched pages * are still in the inactive queue. Only * pages that triggered page faults are in the - * active queue. + * active queue. The test for whether the page + * is in the inactive queue is racy; in the + * worst case we will requeue the page + * unnecessarily. */ - vm_page_lock(m); if (!vm_page_inactive(m)) vm_page_deactivate(m); - vm_page_unlock(m); } } } @@ -1879,9 +1867,7 @@ again: ("dst_m %p is not wired", dst_m)); } } else { - vm_page_lock(dst_m); vm_page_activate(dst_m); - vm_page_unlock(dst_m); } vm_page_xunbusy(dst_m); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/vm/vm_object.c Sat Dec 28 19:04:00 2019 (r356157) @@ -1293,9 +1293,7 @@ next_page: vm_page_busy_sleep(tm, "madvpo", false); goto relookup; } - vm_page_lock(tm); vm_page_advise(tm, advice); - vm_page_unlock(tm); vm_page_xunbusy(tm); vm_object_madvise_freespace(tobject, advice, tm->pindex, 1); next_pindex: @@ -2059,7 +2057,6 @@ wired: void vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, vm_pindex_t end) { - struct mtx *mtx; vm_page_t p, next; VM_OBJECT_ASSERT_LOCKED(object); @@ -2073,14 +2070,10 @@ vm_object_page_noreuse(vm_object_t object, vm_pindex_t * Here, the variable "p" is either (1) the page with the least pindex * greater than or equal to the parameter "start" or (2) NULL. */ - mtx = NULL; for (; p != NULL && (p->pindex < end || end == 0); p = next) { next = TAILQ_NEXT(p, listq); - vm_page_change_lock(p, &mtx); vm_page_deactivate_noreuse(p); } - if (mtx != NULL) - mtx_unlock(mtx); } /* Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/vm/vm_page.c Sat Dec 28 19:04:00 2019 (r356157) @@ -1371,12 +1371,10 @@ vm_page_readahead_finish(vm_page_t m) * have shown that deactivating the page is usually the best choice, * unless the page is wanted by another thread. */ - vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); - vm_page_unlock(m); vm_page_xunbusy_unchecked(m); } @@ -3651,7 +3649,6 @@ static void vm_page_enqueue(vm_page_t m, uint8_t queue) { - vm_page_assert_locked(m); KASSERT(m->a.queue == PQ_NONE && (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, ("%s: page %p is already enqueued", __func__, m)); @@ -4124,7 +4121,6 @@ void vm_page_unswappable(vm_page_t m) { - vm_page_assert_locked(m); KASSERT(!vm_page_wired(m) && (m->oflags & VPO_UNMANAGED) == 0, ("page %p already unswappable", m)); @@ -4222,9 +4218,7 @@ vm_page_release_locked(vm_page_t m, int flags) m->dirty == 0 && vm_page_tryxbusy(m)) { vm_page_free(m); } else { - vm_page_lock(m); vm_page_release_toq(m, PQ_INACTIVE, flags != 0); - vm_page_unlock(m); } } } @@ -4293,7 +4287,6 @@ void vm_page_advise(vm_page_t m, int advice) { - vm_page_assert_locked(m); VM_OBJECT_ASSERT_WLOCKED(m->object); if (advice == MADV_FREE) /* @@ -4309,14 +4302,14 @@ vm_page_advise(vm_page_t m, int advice) return; } + if (advice != MADV_FREE && m->dirty == 0 && pmap_is_modified(m)) + vm_page_dirty(m); + /* * Clear any references to the page. Otherwise, the page daemon will * immediately reactivate the page. */ vm_page_aflag_clear(m, PGA_REFERENCED); - - if (advice != MADV_FREE && m->dirty == 0 && pmap_is_modified(m)) - vm_page_dirty(m); /* * Place clean pages near the head of the inactive queue rather than Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/vm/vm_page.h Sat Dec 28 19:04:00 2019 (r356157) @@ -808,12 +808,6 @@ vm_page_aflag_clear(vm_page_t m, uint16_t bits) uint32_t *addr, val; /* - * The PGA_REFERENCED flag can only be cleared if the page is locked. - */ - if ((bits & PGA_REFERENCED) != 0) - vm_page_assert_locked(m); - - /* * Access the whole 32-bit word containing the aflags field with an * atomic update. Parallel non-atomic updates to the other fields * within this word are handled properly by the atomic update. @@ -920,8 +914,6 @@ _vm_page_queue(vm_page_astate_t as) static inline uint8_t vm_page_queue(vm_page_t m) { - - vm_page_assert_locked(m); return (_vm_page_queue(vm_page_astate_load(m))); } Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/vm/vm_pageout.c Sat Dec 28 19:04:00 2019 (r356157) @@ -396,14 +396,11 @@ more: vm_page_xunbusy(p); break; } - vm_page_lock(p); if (!vm_page_in_laundry(p) || !vm_page_try_remove_write(p)) { - vm_page_unlock(p); vm_page_xunbusy(p); ib = 0; break; } - vm_page_unlock(p); mc[--page_base] = pb = p; ++pageout_count; ++ib; @@ -429,13 +426,10 @@ more: vm_page_xunbusy(p); break; } - vm_page_lock(p); if (!vm_page_in_laundry(p) || !vm_page_try_remove_write(p)) { - vm_page_unlock(p); vm_page_xunbusy(p); break; } - vm_page_unlock(p); mc[page_base + pageout_count] = ps = p; ++pageout_count; ++is; @@ -511,10 +505,12 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, ("vm_pageout_flush: page %p is not write protected", mt)); switch (pageout_status[i]) { case VM_PAGER_OK: - vm_page_lock(mt); + /* + * The page may have moved since laundering started, in + * which case it should be left alone. + */ if (vm_page_in_laundry(mt)) vm_page_deactivate_noreuse(mt); - vm_page_unlock(mt); /* FALLTHROUGH */ case VM_PAGER_PEND: numpagedout++; @@ -527,10 +523,8 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, * the page daemon. */ vm_page_undirty(mt); - vm_page_lock(mt); if (vm_page_in_laundry(mt)) vm_page_deactivate_noreuse(mt); - vm_page_unlock(mt); break; case VM_PAGER_ERROR: case VM_PAGER_FAIL: @@ -546,14 +540,12 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, * clog the laundry and inactive queues. (We will try * paging it out again later.) */ - vm_page_lock(mt); if (object->type == OBJT_SWAP && pageout_status[i] == VM_PAGER_FAIL) { vm_page_unswappable(mt); numpagedout++; } else vm_page_activate(mt); - vm_page_unlock(mt); if (eio != NULL && i >= mreq && i - mreq < runlen) *eio = TRUE; break; @@ -611,7 +603,6 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) vm_pindex_t pindex; int error, lockmode; - vm_page_assert_locked(m); object = m->object; VM_OBJECT_ASSERT_WLOCKED(object); error = 0; @@ -631,7 +622,6 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) * of time. */ if (object->type == OBJT_VNODE) { - vm_page_unlock(m); vm_page_xunbusy(m); vp = object->handle; if (vp->v_type == VREG && @@ -662,11 +652,9 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) error = ENOENT; goto unlock_all; } - vm_page_lock(m); /* - * While the object and page were unlocked, the page - * may have been: + * While the object was unlocked, the page may have been: * (1) moved to a different queue, * (2) reallocated to a different object, * (3) reallocated to a different offset, or @@ -674,17 +662,15 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) */ if (!vm_page_in_laundry(m) || m->object != object || m->pindex != pindex || m->dirty == 0) { - vm_page_unlock(m); error = ENXIO; goto unlock_all; } /* - * The page may have been busied while the object and page - * locks were released. + * The page may have been busied while the object lock was + * released. */ if (vm_page_tryxbusy(m) == 0) { - vm_page_unlock(m); error = EBUSY; goto unlock_all; } @@ -695,11 +681,9 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) */ if (!vm_page_try_remove_write(m)) { vm_page_xunbusy(m); - vm_page_unlock(m); error = EBUSY; goto unlock_all; } - vm_page_unlock(m); /* * If a page is dirty, then it is either being washed @@ -714,7 +698,6 @@ unlock_all: VM_OBJECT_WUNLOCK(object); unlock_mp: - vm_page_lock_assert(m, MA_NOTOWNED); if (mp != NULL) { if (vp != NULL) vput(vp); @@ -735,7 +718,6 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, { struct scan_state ss; struct vm_pagequeue *pq; - struct mtx *mtx; vm_object_t object; vm_page_t m, marker; vm_page_astate_t new, old; @@ -743,7 +725,6 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, int vnodes_skipped; bool pageout_ok; - mtx = NULL; object = NULL; starting_target = launder; vnodes_skipped = 0; @@ -771,9 +752,6 @@ scan: if (__predict_false((m->flags & PG_MARKER) != 0)) continue; - vm_page_change_lock(m, &mtx); - -recheck: /* * Don't touch a page that was removed from the queue after the * page queue lock was released. Otherwise, ensure that any @@ -783,46 +761,39 @@ recheck: if (vm_pageout_defer(m, queue, true)) continue; - if (object != m->object) { + /* + * Lock the page's object. + */ + if (object == NULL || object != m->object) { if (object != NULL) VM_OBJECT_WUNLOCK(object); - - /* - * A page's object pointer may be set to NULL before - * the object lock is acquired. - */ object = (vm_object_t)atomic_load_ptr(&m->object); - if (object != NULL && !VM_OBJECT_TRYWLOCK(object)) { - mtx_unlock(mtx); - /* Depends on type-stability. */ - VM_OBJECT_WLOCK(object); - mtx_lock(mtx); - goto recheck; + if (__predict_false(object == NULL)) + /* The page is being freed by another thread. */ + continue; + + /* Depends on type-stability. */ + VM_OBJECT_WLOCK(object); + if (__predict_false(m->object != object)) { + VM_OBJECT_WUNLOCK(object); + object = NULL; + continue; } } - if (__predict_false(m->object == NULL)) - /* - * The page has been removed from its object. - */ - continue; - KASSERT(m->object == object, ("page %p does not belong to %p", - m, object)); if (vm_page_tryxbusy(m) == 0) continue; /* * Check for wirings now that we hold the object lock and have - * verified that the page is unbusied. If the page is mapped, - * it may still be wired by pmap lookups. The call to + * exclusively busied the page. If the page is mapped, it may + * still be wired by pmap lookups. The call to * vm_page_try_remove_all() below atomically checks for such * wirings and removes mappings. If the page is unmapped, the - * wire count is guaranteed not to increase. + * wire count is guaranteed not to increase after this check. */ - if (__predict_false(vm_page_wired(m))) { - vm_page_dequeue_deferred(m); + if (__predict_false(vm_page_wired(m))) goto skip_page; - } /* * Invalid pages can be easily freed. They cannot be @@ -898,10 +869,8 @@ recheck: */ if (object->ref_count != 0) { vm_page_test_dirty(m); - if (m->dirty == 0 && !vm_page_try_remove_all(m)) { - vm_page_dequeue_deferred(m); + if (m->dirty == 0 && !vm_page_try_remove_all(m)) goto skip_page; - } } /* @@ -912,6 +881,13 @@ recheck: */ if (m->dirty == 0) { free_page: + /* + * Now we are guaranteed that no other threads are + * manipulating the page, check for a last-second + * reference. + */ + if (vm_pageout_defer(m, queue, true)) + goto skip_page; vm_page_free(m); VM_CNT_INC(v_dfree); } else if ((object->flags & OBJ_DEAD) == 0) { @@ -948,17 +924,12 @@ free_page: pageout_lock_miss++; vnodes_skipped++; } - mtx = NULL; object = NULL; } else { skip_page: vm_page_xunbusy(m); } } - if (mtx != NULL) { - mtx_unlock(mtx); - mtx = NULL; - } if (object != NULL) { VM_OBJECT_WUNLOCK(object); object = NULL; @@ -1195,7 +1166,6 @@ static void vm_pageout_scan_active(struct vm_domain *vmd, int page_shortage) { struct scan_state ss; - struct mtx *mtx; vm_object_t object; vm_page_t m, marker; struct vm_pagequeue *pq; @@ -1236,7 +1206,6 @@ vm_pageout_scan_active(struct vm_domain *vmd, int page * and scanning resumes. */ max_scan = page_shortage > 0 ? pq->pq_cnt : min_scan; - mtx = NULL; act_scan: vm_pageout_init_scan(&ss, pq, marker, &vmd->vmd_clock[0], max_scan); while ((m = vm_pageout_next(&ss, false)) != NULL) { @@ -1255,8 +1224,6 @@ act_scan: if (__predict_false((m->flags & PG_MARKER) != 0)) continue; - vm_page_change_lock(m, &mtx); - /* * Don't touch a page that was removed from the queue after the * page queue lock was released. Otherwise, ensure that any @@ -1390,10 +1357,6 @@ act_scan: page_shortage -= ps_delta; } - if (mtx != NULL) { - mtx_unlock(mtx); - mtx = NULL; - } vm_pagequeue_lock(pq); TAILQ_REMOVE(&pq->pq_pl, &vmd->vmd_clock[0], plinks.q); TAILQ_INSERT_AFTER(&pq->pq_pl, marker, &vmd->vmd_clock[0], plinks.q); @@ -1459,7 +1422,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh { struct scan_state ss; struct vm_batchqueue rq; - struct mtx *mtx; vm_page_t m, marker; struct vm_pagequeue *pq; vm_object_t object; @@ -1484,7 +1446,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); starting_page_shortage = page_shortage = shortage + deficit; - mtx = NULL; object = NULL; vm_batchqueue_init(&rq); @@ -1502,9 +1463,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh KASSERT((m->flags & PG_MARKER) == 0, ("marker page %p was dequeued", m)); - vm_page_change_lock(m, &mtx); - -recheck: /* * Don't touch a page that was removed from the queue after the * page queue lock was released. Otherwise, ensure that any @@ -1514,30 +1472,25 @@ recheck: if (vm_pageout_defer(m, PQ_INACTIVE, false)) continue; - if (object != m->object) { + /* + * Lock the page's object. + */ + if (object == NULL || object != m->object) { if (object != NULL) VM_OBJECT_WUNLOCK(object); - - /* - * A page's object pointer may be set to NULL before - * the object lock is acquired. - */ object = (vm_object_t)atomic_load_ptr(&m->object); - if (object != NULL && !VM_OBJECT_TRYWLOCK(object)) { - mtx_unlock(mtx); - /* Depends on type-stability. */ - VM_OBJECT_WLOCK(object); - mtx_lock(mtx); - goto recheck; + if (__predict_false(object == NULL)) + /* The page is being freed by another thread. */ + continue; + + /* Depends on type-stability. */ + VM_OBJECT_WLOCK(object); + if (__predict_false(m->object != object)) { + VM_OBJECT_WUNLOCK(object); + object = NULL; + goto reinsert; } } - if (__predict_false(m->object == NULL)) - /* - * The page has been removed from its object. - */ - continue; - KASSERT(m->object == object, ("page %p does not belong to %p", - m, object)); if (vm_page_tryxbusy(m) == 0) { /* @@ -1557,17 +1510,15 @@ recheck: vm_pager_page_unswapped(m); /* - * Re-check for wirings now that we hold the object lock and - * have verified that the page is unbusied. If the page is - * mapped, it may still be wired by pmap lookups. The call to + * Check for wirings now that we hold the object lock and have + * exclusively busied the page. If the page is mapped, it may + * still be wired by pmap lookups. The call to * vm_page_try_remove_all() below atomically checks for such * wirings and removes mappings. If the page is unmapped, the - * wire count is guaranteed not to increase. + * wire count is guaranteed not to increase after this check. */ - if (__predict_false(vm_page_wired(m))) { - vm_page_dequeue_deferred(m); + if (__predict_false(vm_page_wired(m))) goto skip_page; - } /* * Invalid pages can be easily freed. They cannot be @@ -1635,10 +1586,8 @@ recheck: */ if (object->ref_count != 0) { vm_page_test_dirty(m); - if (m->dirty == 0 && !vm_page_try_remove_all(m)) { - vm_page_dequeue_deferred(m); + if (m->dirty == 0 && !vm_page_try_remove_all(m)) goto skip_page; - } } /* @@ -1651,13 +1600,19 @@ recheck: if (m->dirty == 0) { free_page: /* - * Because we dequeued the page and have already - * checked for concurrent dequeue and enqueue - * requests, we can safely disassociate the page - * from the inactive queue. + * Now we are guaranteed that no other threads are + * manipulating the page, check for a last-second + * reference that would save it from doom. */ - KASSERT((m->a.flags & PGA_QUEUE_STATE_MASK) == 0, - ("page %p has queue state", m)); + if (vm_pageout_defer(m, PQ_INACTIVE, false)) + goto skip_page; + + /* + * Because we dequeued the page and have already checked + * for pending dequeue and enqueue requests, we can + * safely disassociate the page from the inactive queue + * without holding the queue lock. + */ m->a.queue = PQ_NONE; vm_page_free(m); page_shortage--; @@ -1671,8 +1626,6 @@ skip_page: reinsert: vm_pageout_reinsert_inactive(&ss, &rq, m); } - if (mtx != NULL) - mtx_unlock(mtx); if (object != NULL) VM_OBJECT_WUNLOCK(object); vm_pageout_reinsert_inactive(&ss, &rq, NULL); Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Sat Dec 28 19:03:46 2019 (r356156) +++ head/sys/vm/vm_swapout.c Sat Dec 28 19:04:00 2019 (r356157) @@ -186,12 +186,10 @@ vm_swapout_object_deactivate_page(pmap_t pmap, vm_page return; } if (!pmap_is_referenced(m)) { - vm_page_lock(m); if (!vm_page_active(m)) (void)vm_page_try_remove_all(m); else if (unmap && vm_page_try_remove_all(m)) vm_page_deactivate(m); - vm_page_unlock(m); } vm_page_xunbusy(m); } From owner-svn-src-head@freebsd.org Sat Dec 28 19:04:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 653951EE928; Sat, 28 Dec 2019 19:04:16 +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 47lY5X25kMz4dFX; Sat, 28 Dec 2019 19:04:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2979D5A65; Sat, 28 Dec 2019 19:04:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSJ4Gh7064895; Sat, 28 Dec 2019 19:04:16 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSJ4G4Y064894; Sat, 28 Dec 2019 19:04:16 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912281904.xBSJ4G4Y064894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Dec 2019 19:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356158 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356158 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 19:04:16 -0000 Author: markj Date: Sat Dec 28 19:04:15 2019 New Revision: 356158 URL: https://svnweb.freebsd.org/changeset/base/356158 Log: Update the vm_page.h block comment to reflect recent changes. Explain the new locking rules for per-page queue state updates. Reviewed by: jeff, kib Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22884 Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Dec 28 19:04:00 2019 (r356157) +++ head/sys/vm/vm_page.h Sat Dec 28 19:04:15 2019 (r356158) @@ -171,34 +171,32 @@ * The page daemon must therefore handle the possibility of a concurrent * free of the page. * - * The queue field is the index of the page queue containing the page, - * or PQ_NONE if the page is not enqueued. The queue lock of a page is - * the page queue lock corresponding to the page queue index, or the - * page lock (P) for the page if it is not enqueued. To modify the - * queue field, the queue lock for the old value of the field must be - * held. There is one exception to this rule: the page daemon may - * transition the queue field from PQ_INACTIVE to PQ_NONE immediately - * prior to freeing a page during an inactive queue scan. At that - * point the page has already been physically dequeued and no other - * references to that vm_page structure exist. + * The queue state of a page consists of the queue and act_count fields of + * its atomically updated state, and the subset of atomic flags specified + * by PGA_QUEUE_STATE_MASK. The queue field contains the page's page queue + * index, or PQ_NONE if it does not belong to a page queue. To modify the + * queue field, the page queue lock corresponding to the old value must be + * held, unless that value is PQ_NONE, in which case the queue index must + * be updated using an atomic RMW operation. There is one exception to + * this rule: the page daemon may transition the queue field from + * PQ_INACTIVE to PQ_NONE immediately prior to freeing the page during an + * inactive queue scan. At that point the page is already dequeued and no + * other references to that vm_page structure can exist. The PGA_ENQUEUED + * flag, when set, indicates that the page structure is physically inserted + * into the queue corresponding to the page's queue index, and may only be + * set or cleared with the corresponding page queue lock held. * - * To avoid contention on page queue locks, page queue operations - * (enqueue, dequeue, requeue) are batched using per-CPU queues. A - * deferred operation is requested by inserting an entry into a batch - * queue; the entry is simply a pointer to the page, and the request - * type is encoded in the page's aflags field using the values in - * PGA_QUEUE_STATE_MASK. The type-stability of struct vm_pages is - * crucial to this scheme since the processing of entries in a given - * batch queue may be deferred indefinitely. In particular, a page may - * be freed before its pending batch queue entries have been processed. - * The page lock (P) must be held to schedule a batched queue - * operation, and the page queue lock must be held in order to process - * batch queue entries for the page queue. There is one exception to - * this rule: the thread freeing a page may schedule a dequeue without - * holding the page lock. In this scenario the only other thread which - * may hold a reference to the page is the page daemon, which is - * careful to avoid modifying the page's queue state once the dequeue - * has been requested by setting PGA_DEQUEUE. + * To avoid contention on page queue locks, page queue operations (enqueue, + * dequeue, requeue) are batched using fixed-size per-CPU queues. A + * deferred operation is requested by setting one of the flags in + * PGA_QUEUE_OP_MASK and inserting an entry into a batch queue. When a + * queue is full, an attempt to insert a new entry will lock the page + * queues and trigger processing of the pending entries. The + * type-stability of vm_page structures is crucial to this scheme since the + * processing of entries in a given batch queue may be deferred + * indefinitely. In particular, a page may be freed with pending batch + * queue entries. The page queue operation flags must be set using atomic + * RWM operations. */ #if PAGE_SIZE == 4096 From owner-svn-src-head@freebsd.org Sat Dec 28 19:04:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD2451EE9A7; Sat, 28 Dec 2019 19:04:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lY5n56znz4dNK; Sat, 28 Dec 2019 19:04:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB4245A6C; Sat, 28 Dec 2019 19:04:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSJ4T4A064950; Sat, 28 Dec 2019 19:04:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSJ4T19064948; Sat, 28 Dec 2019 19:04:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912281904.xBSJ4T19064948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Dec 2019 19:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356159 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 19:04:29 -0000 Author: markj Date: Sat Dec 28 19:04:29 2019 New Revision: 356159 URL: https://svnweb.freebsd.org/changeset/base/356159 Log: Remove some unused functions. The previous series of patches orphaned some vm_page functions, so remove them. Reviewed by: dougm, kib Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22886 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Dec 28 19:04:15 2019 (r356158) +++ head/sys/vm/vm_page.c Sat Dec 28 19:04:29 2019 (r356159) @@ -3662,52 +3662,6 @@ vm_page_enqueue(vm_page_t m, uint8_t queue) } /* - * vm_page_requeue: [ internal use only ] - * - * Schedule a requeue of the given page. - * - * The page must be locked. - */ -void -vm_page_requeue(vm_page_t m) -{ - - vm_page_assert_locked(m); - KASSERT(vm_page_queue(m) != PQ_NONE, - ("%s: page %p is not logically enqueued", __func__, m)); - KASSERT(m->ref_count > 0, - ("%s: page %p does not carry any references", __func__, m)); - - if ((m->a.flags & PGA_REQUEUE) == 0) - vm_page_aflag_set(m, PGA_REQUEUE); - vm_page_pqbatch_submit(m, atomic_load_8(&m->a.queue)); -} - -/* - * vm_page_swapqueue: [ internal use only ] - * - * Move the page from one queue to another, or to the tail of its - * current queue, in the face of a possible concurrent free of the - * page. - */ -void -vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq) -{ - vm_page_astate_t new, old; - - old = vm_page_astate_load(m); - do { - if (old.queue != oldq || (old.flags & PGA_DEQUEUE) != 0) - return; - new = old; - new.flags |= PGA_REQUEUE; - new.queue = newq; - } while (!vm_page_pqstate_commit_dequeue(m, &old, new)); - - vm_page_pqbatch_submit(m, newq); -} - -/* * vm_page_free_prep: * * Prepares the given page to be put on the free list, Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Dec 28 19:04:15 2019 (r356158) +++ head/sys/vm/vm_page.h Sat Dec 28 19:04:29 2019 (r356159) @@ -649,7 +649,6 @@ bool vm_page_remove_xbusy(vm_page_t); int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t); void vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex, vm_page_t mold); -void vm_page_requeue(vm_page_t m); int vm_page_sbusied(vm_page_t m); vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start, vm_page_t m_end, u_long alignment, vm_paddr_t boundary, int options); @@ -659,7 +658,6 @@ int vm_page_sleep_if_busy(vm_page_t m, const char *msg int vm_page_sleep_if_xbusy(vm_page_t m, const char *msg); vm_offset_t vm_page_startup(vm_offset_t vaddr); void vm_page_sunbusy(vm_page_t m); -void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq); bool vm_page_try_remove_all(vm_page_t m); bool vm_page_try_remove_write(vm_page_t m); int vm_page_trysbusy(vm_page_t m); @@ -833,31 +831,6 @@ vm_page_aflag_set(vm_page_t m, uint16_t bits) addr = (void *)&m->a; val = bits << VM_PAGE_AFLAG_SHIFT; atomic_set_32(addr, val); -} - -/* - * Atomically update the queue state of the page. The operation fails if - * any of the queue flags in "fflags" are set or if the "queue" field of - * the page does not match the expected value; if the operation is - * successful, the flags in "nflags" are set and all other queue state - * flags are cleared. - */ -static inline bool -vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uint32_t newq, - uint32_t fflags, uint32_t nflags) -{ - vm_page_astate_t new, old; - - old = vm_page_astate_load(m); - do { - if ((old.flags & fflags) != 0 || old.queue != oldq) - return (false); - new = old; - new.flags = (new.flags & ~PGA_QUEUE_OP_MASK) | nflags; - new.queue = newq; - } while (!vm_page_astate_fcmpset(m, &old, new)); - - return (true); } /* From owner-svn-src-head@freebsd.org Sat Dec 28 19:22:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64F0E1EEFB9 for ; Sat, 28 Dec 2019 19:22:44 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (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 47lYVq2PSbz4fBk for ; Sat, 28 Dec 2019 19:22:42 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pf1-x430.google.com with SMTP id x185so16369747pfc.5 for ; Sat, 28 Dec 2019 11:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=DHDerCatWOjQRbOnQNX93ulqAGUjEz12Z+9JCd1ffTY=; b=jC7kQDrV5HjNMIbtGISN33reNlr1s36aG2Pg9J7j27P5n5oWC6F1VoL7nlOojPd6dw 1zt9okYl/q41RVZhGDQ9cMkf/6M8JkMtkISW/lSA1+uNV0E2iCZh1zzz0gPqUHviPO+D 879CnnNLyMkpuPIiVjKsPgW1UYBMpjUTL8+HNXEt3Sof/mSON6iCqD0alzUAkWj2mO/k FAslN/zsGnKpi2qT2e9oaIAB+d6N2Hk3r0GVJ5i1xuU9pysoqmT0J5bIAQqrs2vP65Zj 0JlKK59iPDmKUmGBCJntMlf+eZjW30j1dZQwoS7KihJp87SF5RQRmlpahI5IBwvN0q5i jBwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=DHDerCatWOjQRbOnQNX93ulqAGUjEz12Z+9JCd1ffTY=; b=dbOdFLgz1ac0XsESyTL3qTvDTg0q/CT3H2DUweyIQqfEyv9sN9j7zKilmPx3WIg5Ia c7IIXI9rAKpiakF3kxNEpoERCbUx58CEHXwXUsB5E+SpU1isty20OP2CkcXcoCOXv4sG TYV2JuVwowqotUwwjLi7VaU/PtBDYoZuoQjK8LZ81rg8PCbKvMLFZ8FnxRODHuYFDTqF uKBan+oItTYdSvmSviJrk7KFWdn41Onqs9rfNlfMotQP9GXHAm5znJZ4Y4lDitvHbEpw 4YpfLe/pJwFX/cW2F1zlEr2aQ7vIzoQgGy3lj7CdvtbuCKD8cjqmMjs/SYqukR9S6Ner bPwg== X-Gm-Message-State: APjAAAW0Jad+dEotL5ndZhnvy6s1zyKwKu7XElQ3il+fEmAaLVs0AmWX wATAjU0tjHqEAwh/HfZrNwN7Tw== X-Google-Smtp-Source: APXvYqy7Hko218rb+GWvhHQABLCbPbDfTrrGy2/CH3UQbQSIugc/gHU7G3yxcp6Jx3iuDSj5BnnXJA== X-Received: by 2002:a63:946:: with SMTP id 67mr60994903pgj.277.1577560961333; Sat, 28 Dec 2019 11:22:41 -0800 (PST) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id y62sm47039227pfg.45.2019.12.28.11.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Dec 2019 11:22:40 -0800 (PST) Date: Sat, 28 Dec 2019 09:22:38 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Mark Johnston cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356159 - head/sys/vm In-Reply-To: <201912281904.xBSJ4T19064948@repo.freebsd.org> Message-ID: References: <201912281904.xBSJ4T19064948@repo.freebsd.org> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 47lYVq2PSbz4fBk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=jC7kQDrV; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::430) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-4.42 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[jroberson.net]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[0.3.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-2.62)[ip: (-9.02), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.88), country: US(-0.05)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 19:22:44 -0000 Fantastic! On Sat, 28 Dec 2019, Mark Johnston wrote: > Author: markj > Date: Sat Dec 28 19:04:29 2019 > New Revision: 356159 > URL: https://svnweb.freebsd.org/changeset/base/356159 > > Log: > Remove some unused functions. > > The previous series of patches orphaned some vm_page functions, so > remove them. > > Reviewed by: dougm, kib > Sponsored by: Netflix, Intel > Differential Revision: https://reviews.freebsd.org/D22886 > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Sat Dec 28 19:04:15 2019 (r356158) > +++ head/sys/vm/vm_page.c Sat Dec 28 19:04:29 2019 (r356159) > @@ -3662,52 +3662,6 @@ vm_page_enqueue(vm_page_t m, uint8_t queue) > } > > /* > - * vm_page_requeue: [ internal use only ] > - * > - * Schedule a requeue of the given page. > - * > - * The page must be locked. > - */ > -void > -vm_page_requeue(vm_page_t m) > -{ > - > - vm_page_assert_locked(m); > - KASSERT(vm_page_queue(m) != PQ_NONE, > - ("%s: page %p is not logically enqueued", __func__, m)); > - KASSERT(m->ref_count > 0, > - ("%s: page %p does not carry any references", __func__, m)); > - > - if ((m->a.flags & PGA_REQUEUE) == 0) > - vm_page_aflag_set(m, PGA_REQUEUE); > - vm_page_pqbatch_submit(m, atomic_load_8(&m->a.queue)); > -} > - > -/* > - * vm_page_swapqueue: [ internal use only ] > - * > - * Move the page from one queue to another, or to the tail of its > - * current queue, in the face of a possible concurrent free of the > - * page. > - */ > -void > -vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq) > -{ > - vm_page_astate_t new, old; > - > - old = vm_page_astate_load(m); > - do { > - if (old.queue != oldq || (old.flags & PGA_DEQUEUE) != 0) > - return; > - new = old; > - new.flags |= PGA_REQUEUE; > - new.queue = newq; > - } while (!vm_page_pqstate_commit_dequeue(m, &old, new)); > - > - vm_page_pqbatch_submit(m, newq); > -} > - > -/* > * vm_page_free_prep: > * > * Prepares the given page to be put on the free list, > > Modified: head/sys/vm/vm_page.h > ============================================================================== > --- head/sys/vm/vm_page.h Sat Dec 28 19:04:15 2019 (r356158) > +++ head/sys/vm/vm_page.h Sat Dec 28 19:04:29 2019 (r356159) > @@ -649,7 +649,6 @@ bool vm_page_remove_xbusy(vm_page_t); > int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t); > void vm_page_replace(vm_page_t mnew, vm_object_t object, > vm_pindex_t pindex, vm_page_t mold); > -void vm_page_requeue(vm_page_t m); > int vm_page_sbusied(vm_page_t m); > vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start, > vm_page_t m_end, u_long alignment, vm_paddr_t boundary, int options); > @@ -659,7 +658,6 @@ int vm_page_sleep_if_busy(vm_page_t m, const char *msg > int vm_page_sleep_if_xbusy(vm_page_t m, const char *msg); > vm_offset_t vm_page_startup(vm_offset_t vaddr); > void vm_page_sunbusy(vm_page_t m); > -void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq); > bool vm_page_try_remove_all(vm_page_t m); > bool vm_page_try_remove_write(vm_page_t m); > int vm_page_trysbusy(vm_page_t m); > @@ -833,31 +831,6 @@ vm_page_aflag_set(vm_page_t m, uint16_t bits) > addr = (void *)&m->a; > val = bits << VM_PAGE_AFLAG_SHIFT; > atomic_set_32(addr, val); > -} > - > -/* > - * Atomically update the queue state of the page. The operation fails if > - * any of the queue flags in "fflags" are set or if the "queue" field of > - * the page does not match the expected value; if the operation is > - * successful, the flags in "nflags" are set and all other queue state > - * flags are cleared. > - */ > -static inline bool > -vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uint32_t newq, > - uint32_t fflags, uint32_t nflags) > -{ > - vm_page_astate_t new, old; > - > - old = vm_page_astate_load(m); > - do { > - if ((old.flags & fflags) != 0 || old.queue != oldq) > - return (false); > - new = old; > - new.flags = (new.flags & ~PGA_QUEUE_OP_MASK) | nflags; > - new.queue = newq; > - } while (!vm_page_astate_fcmpset(m, &old, new)); > - > - return (true); > } > > /* > From owner-svn-src-head@freebsd.org Sat Dec 28 20:11:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 533981EFA90 for ; Sat, 28 Dec 2019 20:11:53 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 47lZbX2Klqz3Cbf for ; Sat, 28 Dec 2019 20:11:52 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pf1-x442.google.com with SMTP id p14so16400691pfn.4 for ; Sat, 28 Dec 2019 12:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=W07Uho2NWYTmamCy+ISZuKm/t5YLUy2RDu4r0UD3XOA=; b=T5SYCoJsU+gd9AuUpPBdgk6B462DfS+3292cQAyGF//1btm2gK6UzYIQF7AhxdbnrK ei32K2y+qW46Ianz90+RpnmQy8boxmAbaebRS7tCoBSkVjnSdVKMiZAyt3LpUDAhZc26 yfQNGQ1NZemlst5rHog7Vqux0+a58dp17wfIsV7bS65g813ya8FKdqb24SaXme+BrZrv PFAPqfH190CY4QfOD+hx7mhaBiKY6/WMVPDJA5A2Wa8j81FP1zinqBEvdsUhgODN8BIK o0NHe27NO+pU0MDBEdiwEjCgHGA3G7cwZfUT6NHkEXy/w3gQVQ0nZu83OusYcS7cUAEr 7XPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=W07Uho2NWYTmamCy+ISZuKm/t5YLUy2RDu4r0UD3XOA=; b=jyPIv/C7B9OvpX4+FiQx76R0PTbXOitD8kvlAb6TUHR9YYyLUq08iC4F4ogH1/7j8e szfwA+AFMFcjrJCi+1e5pqu3zzU+rwSqe++6U4ZBO8j6WtWmrHp+ayxmLRXxm+k/6Ll8 rytPSebiaOPlvI8Hod5IyLK1Uzpjy7PPIbzXvDC3eg3xD3jgacWvxCrHwbOfWCmagyaf FdZveVNX1eInM9TNNe8qG86RO4g8gmHYXfYlw0JuUArdvEzJVtREDQDTl2vV1L6AQPrT MEKWwM59diUezxFyqqy4XCQWvxbEE3TSDz0kFtmn28mQ/R1VSyGgcgNz2CtrQlObdOmv xRYg== X-Gm-Message-State: APjAAAUiz7wDoZ7Htz8UJXRZm5FyiQQTCn+5ppw1rhHFrRqWWn/wINm/ dcis8ccEiPByFHZkdlV5ngOhWA== X-Google-Smtp-Source: APXvYqyke911Iip8tmWukL7TQUGvPmCVyxo1lrTFaLCVD9tF1rojUCGP8s6Ze5oC9cm9n7IrivMhfw== X-Received: by 2002:a62:1783:: with SMTP id 125mr43128740pfx.189.1577563910835; Sat, 28 Dec 2019 12:11:50 -0800 (PST) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id b185sm28520843pfa.102.2019.12.28.12.11.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Dec 2019 12:11:50 -0800 (PST) Date: Sat, 28 Dec 2019 10:11:48 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: rgrimes@FreeBSD.org cc: Pedro Giffuni , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys In-Reply-To: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> Message-ID: References: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Rspamd-Queue-Id: 47lZbX2Klqz3Cbf X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=T5SYCoJs; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::442) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-2.75 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[jroberson.net]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.95)[ip: (-0.65), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.88), country: US(-0.05)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 20:11:53 -0000 On Fri, 27 Dec 2019, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> >> On 2019-12-27 23:24, Rodney W. Grimes wrote: >>> [ Charset UTF-8 unsupported, converting... ] >>>> On 2019-12-27 22:16, Rodney W. Grimes wrote: >>>>>> Author: pfg >>>>>> Date: Sat Dec 28 02:58:30 2019 >>>>>> New Revision: 356142 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/356142 >>>>>> >>>>>> Log: >>>>>> SPDX: update some tags with two licenses. >>>>>> >>>>>> Modified: >>>>>> head/sys/dev/ofw/openfirm.h >>>>>> head/sys/sys/sched.h >>>>>> >>>>>> Modified: head/sys/dev/ofw/openfirm.h >>>>>> ============================================================================== >>>>>> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) >>>>>> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) >>>>>> @@ -1,7 +1,7 @@ >>>>>> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ >>>>>> >>>>>> /*- >>>>>> - * SPDX-License-Identifier: BSD-4-Clause >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) >>>>>> * >>>>>> * Copyright (C) 1995, 1996 Wolfgang Solfrank. >>>>>> * Copyright (C) 1995, 1996 TooLs GmbH. >>>>>> >>>>>> Modified: head/sys/sys/sched.h >>>>>> ============================================================================== >>>>>> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) >>>>>> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) >>>>>> @@ -1,5 +1,5 @@ >>>>>> /*- >>>>>> - * SPDX-License-Identifier: BSD-4-Clause >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) >>>>>> * >>>>>> * Copyright (c) 1996, 1997 >>>>>> * HD Associates, Inc. All rights reserved. >>>>>> >>>>> This situation should not of occured, and leads to an ambigous license state. >>>> It actually happens a lot (I mean two or more licenses in the same >>>> file): SPDX explicitly uses AND (not OR) for cases like this. >>>> >>>>> What code is under license 2 clause and what under 4 clause? >>>> Anyone redistributing the file has to respect both licenses. If you are >>>> lucky enough to have access to version control you may be able to >>>> discern the author and the corresponding license, otherwise you are >>>> trapped with both. >>> So the 2 clause add is null, so why have it there? >> >> So that eventually, when the project gets to a point where sufficient >> part of the code is rewritten they can opt to change the license to the >> simpler form. There are ways to relicense projects gradually, and its >> nothing new, in fact it is very much in the BSD spirit to gradually >> replace more restricted UNIX code. > > The only changing we have done to BSD licenses as in thost cases > that the Regents requested/granted the right to change to lesser > clauses. Until you get HD & Associtates (in this one case) to > grant that right your walking on a grey edge I would rather not > walk on. > > The reference to BSD spirit and replacing more restricted UNIX (tm) > code is way off base in this context. This is not an AT & T > license we are talking about here. And again you can not just > modify the existing 4 clause licensed file by slapping a 2 clause > license into it, or the project would of done that everyplace > ages ago. > > What is done here in this file is a mistake, and should be corrected. > Can you point me to other files that actually have multiple BSD > licenses in them? It seems to be the prevailing theory that headers are not even really copyrightable. This has even been tested in court a few times (bsd, java). http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html The original definitions from this file were part of posix.1b and so it's hard to argue they are anything but public. Coincidentally I know Greg and I'm sure he would not object to reducing the whole file to a two clause license. However, I'm not so certain as you are that it is not possible to have two copyrights in the same file so long as they are compatible. In many cases we have multiple authors attributed to an individual file. There are cases where software is purposefully licensed under multiple licenses. https://en.wikipedia.org/wiki/Multi-licensing This is not an identical situation but it is a common one. I called my brother who is an IP lawyer and spoke with him about it today. He believes this is sufficiently nuanced that we would need a proper legal opinion to determine that. I wrote the original file 17 years ago and placed a two clause copyright in it. trhodes combined sys/posix4/sched.h with sys/sched.h 13 years ago in the following commit: https://svnweb.freebsd.org/base/head/sys/sys/sched.h?revision=164185&view=markup So the original license was in fact two clause. If a mistake was made, it was made 13 years ago and it is almost guaranteed to be legally harmless. It has nothing to do with what Pedro committed today. I don't trust the armchair lawyering of software engineers and so to resolve this we would need to ask the foundation to pay their lawyers to pursue it. In my opinion, this has already wasted everyone's time with an irrelevant nit-picking argument. The onus is not on Pedro to chase this down just so he can add SPDX tags. If this is important to you then you are welcome to go sort out the details and then post patches for review. I'm sure myself and greg would be happy to do so. However it seems that this wasn't even worth reading the revision history for you to begin lecturing. Jeff > >> >> It may be a long shot but it has happened on other projects as well: >> libdialog (in our tree) was rewritten and relicensed from GPL to LGPL. >> >> >>>>> It looks to me as if this was done by Jeff Robinson as the 2 clause is >>>>> attached to his copyright and we should probably just ask him to relax >>>>> that back to the files existing 4 clause license, and or go after Greg >>>>> Ansley of HD associtates to get them to relax the 4 clause. >>>>> >>>> No, Jeff (or anyone else, as I said there are many cases in our tree) is >>>> entitled to choose his own license as long as it is compatible with the >>>> pre-existing licensing. >>> I was specifically sighting this one file, sys/sys/sched.h. >>> >>> Actually that might be a grey area, no place does the BSD license grant >>> you rights to modify the terms of the license, and that is in effect >>> what adding this second license does. >> >> No one is modifying the original license: it is there and applies to the >> original code. >> >> >>> You can choose your own license for original work, sure, but obliterating >>> parts of an existing license by applying a second license which is in >>> conflict is probably a poor idea. >> >> >> We don't do that at all: pretty clearly there is no conflict between >> both licenses as you can comply with both. > > The only way to comply with both is to comply with the full 4 > clause license. Hense the 2 clause is pointless in being there > and can never apply until all 4 clause authors agree to change > to 2 clause. > >> Pedro. > > -- > Rod Grimes rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Sat Dec 28 21:38:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FCFE1C92C0; Sat, 28 Dec 2019 21:38:02 +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 47lcVx14hPz3HMP; Sat, 28 Dec 2019 21:38:00 +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 xBSLbpbE044621; Sat, 28 Dec 2019 13:37:51 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xBSLbpGT044620; Sat, 28 Dec 2019 13:37:51 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912282137.xBSLbpGT044620@gndrsh.dnsmgr.net> Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys In-Reply-To: To: Jeff Roberson Date: Sat, 28 Dec 2019 13:37:51 -0800 (PST) CC: rgrimes@freebsd.org, Pedro Giffuni , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47lcVx14hPz3HMP 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.67 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.35)[-0.352,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(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)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.09)[0.086,0]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; 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.02), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 21:38:02 -0000 > > On Fri, 27 Dec 2019, Rodney W. Grimes wrote: > > > [ Charset UTF-8 unsupported, converting... ] > >> > >> On 2019-12-27 23:24, Rodney W. Grimes wrote: > >>> [ Charset UTF-8 unsupported, converting... ] > >>>> On 2019-12-27 22:16, Rodney W. Grimes wrote: > >>>>>> Author: pfg > >>>>>> Date: Sat Dec 28 02:58:30 2019 > >>>>>> New Revision: 356142 > >>>>>> URL: https://svnweb.freebsd.org/changeset/base/356142 > >>>>>> > >>>>>> Log: > >>>>>> SPDX: update some tags with two licenses. > >>>>>> > >>>>>> Modified: > >>>>>> head/sys/dev/ofw/openfirm.h > >>>>>> head/sys/sys/sched.h > >>>>>> > >>>>>> Modified: head/sys/dev/ofw/openfirm.h > >>>>>> ============================================================================== > >>>>>> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 (r356141) > >>>>>> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 (r356142) > >>>>>> @@ -1,7 +1,7 @@ > >>>>>> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ > >>>>>> > >>>>>> /*- > >>>>>> - * SPDX-License-Identifier: BSD-4-Clause > >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > >>>>>> * > >>>>>> * Copyright (C) 1995, 1996 Wolfgang Solfrank. > >>>>>> * Copyright (C) 1995, 1996 TooLs GmbH. > >>>>>> > >>>>>> Modified: head/sys/sys/sched.h > >>>>>> ============================================================================== > >>>>>> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 (r356141) > >>>>>> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 (r356142) > >>>>>> @@ -1,5 +1,5 @@ > >>>>>> /*- > >>>>>> - * SPDX-License-Identifier: BSD-4-Clause > >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) > >>>>>> * > >>>>>> * Copyright (c) 1996, 1997 > >>>>>> * HD Associates, Inc. All rights reserved. > >>>>>> > >>>>> This situation should not of occured, and leads to an ambigous license state. > >>>> It actually happens a lot (I mean two or more licenses in the same > >>>> file): SPDX explicitly uses AND (not OR) for cases like this. > >>>> > >>>>> What code is under license 2 clause and what under 4 clause? > >>>> Anyone redistributing the file has to respect both licenses. If you are > >>>> lucky enough to have access to version control you may be able to > >>>> discern the author and the corresponding license, otherwise you are > >>>> trapped with both. > >>> So the 2 clause add is null, so why have it there? > >> > >> So that eventually, when the project gets to a point where sufficient > >> part of the code is rewritten they can opt to change the license to the > >> simpler form. There are ways to relicense projects gradually, and its > >> nothing new, in fact it is very much in the BSD spirit to gradually > >> replace more restricted UNIX code. > > > > The only changing we have done to BSD licenses as in thost cases > > that the Regents requested/granted the right to change to lesser > > clauses. Until you get HD & Associtates (in this one case) to > > grant that right your walking on a grey edge I would rather not > > walk on. > > > > The reference to BSD spirit and replacing more restricted UNIX (tm) > > code is way off base in this context. This is not an AT & T > > license we are talking about here. And again you can not just > > modify the existing 4 clause licensed file by slapping a 2 clause > > license into it, or the project would of done that everyplace > > ages ago. > > > > What is done here in this file is a mistake, and should be corrected. > > Can you point me to other files that actually have multiple BSD > > licenses in them? > > It seems to be the prevailing theory that headers are not even > really copyrightable. This has even been tested in court a few times > (bsd, java). Yes, also true of scripts and Makefiles, which are generally considered under the recipts concept, yet we still have many which people are claiming copyright to. > > http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html > > The original definitions from this file were part of posix.1b and so it's > hard to argue they are anything but public. Coincidentally I know Greg > and I'm sure he would not object to reducing the whole file to a two > clause license. Then lets make life very simple in this one case, and I agree with your intuition about Greg, shoot an email off to him and ask to drop his licence to 2 clause. > However, I'm not so certain as you are that it is not possible to have two > copyrights in the same file so long as they are compatible. In many cases > we have multiple authors attributed to an individual file. There are > cases where software is purposefully licensed under multiple licenses. Ok, first off understand that Copyrights and Licenses are 2 very different things. You can have N Copyrights in a file, having 2 or more licenses in a file without stating when which applies is frought with legal nightmares. If you clearly state that you can use EITHER license, then it is ok, if you state that both licenses apply your in legal limbo if in anyway the joint set is ambigous or in conflict. Copyright != License. > > https://en.wikipedia.org/wiki/Multi-licensing > > This is not an identical situation but it is a common one. Agreed, what is in that is not this situation, though it does clearly state there that the ONLY the copyright holder(s) can alter the license. One could argue that adding a second license is infact altering the license, and hence legally a risky thing to do. > I called my > brother who is an IP lawyer and spoke with him about it today. He > believes this is sufficiently nuanced that we would need a proper legal > opinion to determine that. So he seems to agree to me that this is legally a grey area, Im happy for that. > > I wrote the original file 17 years ago and placed a two clause copyright > in it. trhodes combined sys/posix4/sched.h with sys/sched.h 13 years ago > in the following commit: > https://svnweb.freebsd.org/base/head/sys/sys/sched.h?revision=164185&view=markup > > So the original license was in fact two clause. That I did not know, thanks for the aditional information. > > If a mistake was made, it was made 13 years ago and it is almost > guaranteed to be legally harmless. > It has nothing to do with what Pedro > committed today. Agreed, what he did was just correct the SPDX to reflect what is present. > I don't trust the armchair lawyering of software > engineers and so to resolve this we would need to ask the foundation to > pay their lawyers to pursue it. As some software engineer did the commit that lead to this state, which I do not trust either. It is simply something that I did not realize existed in the FreeBSD source code. It was put out for review with a commit stating "silence from -arch -standards. > > In my opinion, this has already wasted everyone's time with an irrelevant > nit-picking argument. Legal stance of copyright and licenses should NEVER be considered nit-picking arguments, they are the fundemantal premise that allow the project to do what it does and is infact the prima face mission of the foundation to preserve. It saddens me that a core team member would consider such issues as irrelevant. > The onus is not on Pedro to chase this down just so > he can add SPDX tags. If this is important to you then you are welcome to > go sort out the details and then post patches for review. I'm sure myself > and greg would be happy to do so. However it seems that this wasn't even > worth reading the revision history for you to begin lecturing. I pointed it out as an issue, some tried to defend it as not an issue, I responded to there assertions, call it as you wish. > Jeff > > > > >> > >> It may be a long shot but it has happened on other projects as well: > >> libdialog (in our tree) was rewritten and relicensed from GPL to LGPL. > >> > >> > >>>>> It looks to me as if this was done by Jeff Robinson as the 2 clause is > >>>>> attached to his copyright and we should probably just ask him to relax > >>>>> that back to the files existing 4 clause license, and or go after Greg > >>>>> Ansley of HD associtates to get them to relax the 4 clause. > >>>>> > >>>> No, Jeff (or anyone else, as I said there are many cases in our tree) is > >>>> entitled to choose his own license as long as it is compatible with the > >>>> pre-existing licensing. > >>> I was specifically sighting this one file, sys/sys/sched.h. > >>> > >>> Actually that might be a grey area, no place does the BSD license grant > >>> you rights to modify the terms of the license, and that is in effect > >>> what adding this second license does. > >> > >> No one is modifying the original license: it is there and applies to the > >> original code. > >> > >> > >>> You can choose your own license for original work, sure, but obliterating > >>> parts of an existing license by applying a second license which is in > >>> conflict is probably a poor idea. > >> > >> > >> We don't do that at all: pretty clearly there is no conflict between > >> both licenses as you can comply with both. > > > > The only way to comply with both is to comply with the full 4 > > clause license. Hense the 2 clause is pointless in being there > > and can never apply until all 4 clause authors agree to change > > to 2 clause. > > > >> Pedro. > > Rod Grimes rgrimes@freebsd.org -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Dec 28 22:41:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B7831CA863 for ; Sat, 28 Dec 2019 22:41:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (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 47ldwh5NSQz3KyH for ; Sat, 28 Dec 2019 22:41:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id t129so23963610qke.10 for ; Sat, 28 Dec 2019 14:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yZhXXl2h6wR985mqZqD7oxevZtLndfrdybx0Ro+zbR0=; b=HPtwsIWlY7Fps5ZEC4IHeSECbYR6GvWGqv3YOOD0SmIYnLn9DwAeUJhwVzaoBU+xZj nDWnpSyjPnO3deoR7YiVxZ3JlqWImUVt0qmDP1iBnvml0engNj7KbHUB97kQQaAkhkaB g3mEoAnkU6M0Nal090p3y0LnLf5QzWYS+ektuk1TXMf6uGs1qvcM0ygs3xEDYWtIbW+9 4a+m6sHE+V9mEYnc7yD6cNa9nKavSH4xTJ68AqahGPLy3i/On/1mN9Fsbc0i+qK4FEND u66TmWwqO3Al1B3CweaeWwFeIhRhcWs95US2+vkavJfVjewVMP1MOtB45M3ArJQap90a swBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yZhXXl2h6wR985mqZqD7oxevZtLndfrdybx0Ro+zbR0=; b=OIaQrdmmcQVl1fO2INDvf8BBzcn0DUCHURxgT/jxgztb/l8orIdLz4rCgPLM5HZW8C q/8g1mQwuwZApAeT8D0/j6EAoZrx8eQrEtaPlBjNW46EPvJauVRWpRda8Y4k2YuB8HmS LYQ8bRjquuEtbA4xmXS5k5z0fctnAV4WElzXUBG3+QKP2/dlpyjAcUUmxEWubaiqzHNi qVMkKxOBWXpVSLrKIq7MaguqPafeQ6FoxZrl8Usdmox4cwB4O6SQKgi6tu2FcZjhXTqV xYPm6nZo7CFTmCfhpqT3bYbw1ts7Di0EJQdOvdJDeFiCOc1Qq3o9uSh0cNSodpR1icqH n54Q== X-Gm-Message-State: APjAAAWA2qSNiY1k1dRS04LJCnKveCdOegmGMoDOLSAIkPGdHM0R7eAP DfbRcSx0juMvpveUf0PRa0kQy55Vou9aOLm+WVnjHA== X-Google-Smtp-Source: APXvYqwqltBIp1Ac0YSU/7evTZOijXt9Cc4DJdICr+NR118wwAobMe7OXTDJw353wp/nl1mkrcFyPQqW66bnOhU9d2k= X-Received: by 2002:a37:52d5:: with SMTP id g204mr50325882qkb.215.1577572914337; Sat, 28 Dec 2019 14:41:54 -0800 (PST) MIME-Version: 1.0 References: <201912282137.xBSLbpGT044620@gndrsh.dnsmgr.net> In-Reply-To: <201912282137.xBSLbpGT044620@gndrsh.dnsmgr.net> From: Warner Losh Date: Sat, 28 Dec 2019 15:41:42 -0700 Message-ID: Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys To: "Rodney W. Grimes" Cc: Jeff Roberson , Pedro Giffuni , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 47ldwh5NSQz3KyH X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=HPtwsIWl; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.67 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[c.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.67)[ip: (-9.27), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.88), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 22:41:57 -0000 On Sat, Dec 28, 2019, 3:38 PM Rodney W. Grimes wrote: > > > > On Fri, 27 Dec 2019, Rodney W. Grimes wrote: > > > > > [ Charset UTF-8 unsupported, converting... ] > > >> > > >> On 2019-12-27 23:24, Rodney W. Grimes wrote: > > >>> [ Charset UTF-8 unsupported, converting... ] > > >>>> On 2019-12-27 22:16, Rodney W. Grimes wrote: > > >>>>>> Author: pfg > > >>>>>> Date: Sat Dec 28 02:58:30 2019 > > >>>>>> New Revision: 356142 > > >>>>>> URL: https://svnweb.freebsd.org/changeset/base/356142 > > >>>>>> > > >>>>>> Log: > > >>>>>> SPDX: update some tags with two licenses. > > >>>>>> > > >>>>>> Modified: > > >>>>>> head/sys/dev/ofw/openfirm.h > > >>>>>> head/sys/sys/sched.h > > >>>>>> > > >>>>>> Modified: head/sys/dev/ofw/openfirm.h > > >>>>>> > ============================================================================== > > >>>>>> --- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019 > (r356141) > > >>>>>> +++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019 > (r356142) > > >>>>>> @@ -1,7 +1,7 @@ > > >>>>>> /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp > $ */ > > >>>>>> > > >>>>>> /*- > > >>>>>> - * SPDX-License-Identifier: BSD-4-Clause > > >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND > BSD-2-Clause-FreeBSD) > > >>>>>> * > > >>>>>> * Copyright (C) 1995, 1996 Wolfgang Solfrank. > > >>>>>> * Copyright (C) 1995, 1996 TooLs GmbH. > > >>>>>> > > >>>>>> Modified: head/sys/sys/sched.h > > >>>>>> > ============================================================================== > > >>>>>> --- head/sys/sys/sched.h Sat Dec 28 02:11:41 2019 > (r356141) > > >>>>>> +++ head/sys/sys/sched.h Sat Dec 28 02:58:30 2019 > (r356142) > > >>>>>> @@ -1,5 +1,5 @@ > > >>>>>> /*- > > >>>>>> - * SPDX-License-Identifier: BSD-4-Clause > > >>>>>> + * SPDX-License-Identifier: (BSD-4-Clause AND > BSD-2-Clause-FreeBSD) > > >>>>>> * > > >>>>>> * Copyright (c) 1996, 1997 > > >>>>>> * HD Associates, Inc. All rights reserved. > > >>>>>> > > >>>>> This situation should not of occured, and leads to an ambigous > license state. > > >>>> It actually happens a lot (I mean two or more licenses in the same > > >>>> file): SPDX explicitly uses AND (not OR) for cases like this. > > >>>> > > >>>>> What code is under license 2 clause and what under 4 clause? > > >>>> Anyone redistributing the file has to respect both licenses. If you > are > > >>>> lucky enough to have access to version control you may be able to > > >>>> discern the author and the corresponding license, otherwise you are > > >>>> trapped with both. > > >>> So the 2 clause add is null, so why have it there? > > >> > > >> So that eventually, when the project gets to a point where sufficient > > >> part of the code is rewritten they can opt to change the license to > the > > >> simpler form. There are ways to relicense projects gradually, and its > > >> nothing new, in fact it is very much in the BSD spirit to gradually > > >> replace more restricted UNIX code. > > > > > > The only changing we have done to BSD licenses as in thost cases > > > that the Regents requested/granted the right to change to lesser > > > clauses. Until you get HD & Associtates (in this one case) to > > > grant that right your walking on a grey edge I would rather not > > > walk on. > > > > > > The reference to BSD spirit and replacing more restricted UNIX (tm) > > > code is way off base in this context. This is not an AT & T > > > license we are talking about here. And again you can not just > > > modify the existing 4 clause licensed file by slapping a 2 clause > > > license into it, or the project would of done that everyplace > > > ages ago. > > > > > > What is done here in this file is a mistake, and should be corrected. > > > Can you point me to other files that actually have multiple BSD > > > licenses in them? > > > > It seems to be the prevailing theory that headers are not even > > really copyrightable. This has even been tested in court a few times > > (bsd, java). > > Yes, also true of scripts and Makefiles, which are generally > considered under the recipts concept, yet we still have many > which people are claiming copyright to. > > > > > http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html > > > > The original definitions from this file were part of posix.1b and so > it's > > hard to argue they are anything but public. Coincidentally I know Greg > > and I'm sure he would not object to reducing the whole file to a two > > clause license. > > Then lets make life very simple in this one case, and I agree with > your intuition about Greg, shoot an email off to him and ask to > drop his licence to 2 clause. > > > However, I'm not so certain as you are that it is not possible to have > two > > copyrights in the same file so long as they are compatible. In many > cases > > we have multiple authors attributed to an individual file. There are > > cases where software is purposefully licensed under multiple licenses. > > Ok, first off understand that Copyrights and Licenses are 2 very different > things. You can have N Copyrights in a file, having 2 or more licenses > in a file without stating when which applies is frought with legal > nightmares. If you clearly state that you can use EITHER license, > then it is ok, if you state that both licenses apply your in legal > limbo if in anyway the joint set is ambigous or in conflict. > > Copyright != License. > > > > > https://en.wikipedia.org/wiki/Multi-licensing > > > > This is not an identical situation but it is a common one. > > Agreed, what is in that is not this situation, though it does > clearly state there that the ONLY the copyright holder(s) can alter > the license. One could argue that adding a second license is infact > altering the license, and hence legally a risky thing to do. > > > I called my > > brother who is an IP lawyer and spoke with him about it today. He > > believes this is sufficiently nuanced that we would need a proper legal > > opinion to determine that. > So he seems to agree to me that this is legally a grey area, > Im happy for that. > > > > > I wrote the original file 17 years ago and placed a two clause copyright > > in it. trhodes combined sys/posix4/sched.h with sys/sched.h 13 years > ago > > in the following commit: > > > https://svnweb.freebsd.org/base/head/sys/sys/sched.h?revision=164185&view=markup > > > > So the original license was in fact two clause. > > That I did not know, thanks for the aditional information. > > > > > If a mistake was made, it was made 13 years ago and it is almost > > guaranteed to be legally harmless. > > It has nothing to do with what Pedro > > committed today. > Agreed, what he did was just correct the SPDX to reflect what is present. > > > I don't trust the armchair lawyering of software > > engineers and so to resolve this we would need to ask the foundation to > > pay their lawyers to pursue it. > > As some software engineer did the commit that lead to this state, > which I do not trust either. It is simply something that I did > not realize existed in the FreeBSD source code. > It was put out for review with a commit stating "silence from -arch > -standards. > > > > > In my opinion, this has already wasted everyone's time with an > irrelevant > > nit-picking argument. > > Legal stance of copyright and licenses should NEVER be considered > nit-picking arguments, they are the fundemantal premise that allow > the project to do what it does and is infact the prima face mission > of the foundation to preserve. > > It saddens me that a core team member would consider such issues > as irrelevant. > > > The onus is not on Pedro to chase this down just so > > he can add SPDX tags. If this is important to you then you are welcome > to > > go sort out the details and then post patches for review. I'm sure > myself > > and greg would be happy to do so. However it seems that this wasn't > even > > worth reading the revision history for you to begin lecturing. > > I pointed it out as an issue, some tried to defend it as not an issue, > I responded to there assertions, call it as you wish. > You did no research before wasting our time. I call that disrespectful and not helpful. Warner > Jeff > > > > > > > >> > > >> It may be a long shot but it has happened on other projects as well: > > >> libdialog (in our tree) was rewritten and relicensed from GPL to LGPL. > > >> > > >> > > >>>>> It looks to me as if this was done by Jeff Robinson as the 2 > clause is > > >>>>> attached to his copyright and we should probably just ask him to > relax > > >>>>> that back to the files existing 4 clause license, and or go after > Greg > > >>>>> Ansley of HD associtates to get them to relax the 4 clause. > > >>>>> > > >>>> No, Jeff (or anyone else, as I said there are many cases in our > tree) is > > >>>> entitled to choose his own license as long as it is compatible with > the > > >>>> pre-existing licensing. > > >>> I was specifically sighting this one file, sys/sys/sched.h. > > >>> > > >>> Actually that might be a grey area, no place does the BSD license > grant > > >>> you rights to modify the terms of the license, and that is in effect > > >>> what adding this second license does. > > >> > > >> No one is modifying the original license: it is there and applies to > the > > >> original code. > > >> > > >> > > >>> You can choose your own license for original work, sure, but > obliterating > > >>> parts of an existing license by applying a second license which is in > > >>> conflict is probably a poor idea. > > >> > > >> > > >> We don't do that at all: pretty clearly there is no conflict between > > >> both licenses as you can comply with both. > > > > > > The only way to comply with both is to comply with the full 4 > > > clause license. Hense the 2 clause is pointless in being there > > > and can never apply until all 4 clause authors agree to change > > > to 2 clause. > > > > > >> Pedro. > > > Rod Grimes > rgrimes@freebsd.org > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Sat Dec 28 23:21:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AC271CB426; Sat, 28 Dec 2019 23:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lfpp2FQRz3M9T; Sat, 28 Dec 2019 23:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4876688E5; Sat, 28 Dec 2019 23:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBSNLsiW015569; Sat, 28 Dec 2019 23:21:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBSNLs7q015568; Sat, 28 Dec 2019 23:21:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912282321.xBSNLs7q015568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 28 Dec 2019 23:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356162 - head/sys/geom/shsec X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/shsec X-SVN-Commit-Revision: 356162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2019 23:21:54 -0000 Author: mav Date: Sat Dec 28 23:21:53 2019 New Revision: 356162 URL: https://svnweb.freebsd.org/changeset/base/356162 Log: Fix GEOM_SHSEC orphanization. Previous code closed and destroyed consumer even with I/O in progress. This patch postpones the destruction till the last close, identical to GEOM_STRIPE, since they seem to have common origin. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/shsec/g_shsec.c Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Sat Dec 28 22:32:14 2019 (r356161) +++ head/sys/geom/shsec/g_shsec.c Sat Dec 28 23:21:53 2019 (r356162) @@ -165,7 +165,7 @@ g_shsec_remove_disk(struct g_consumer *cp) } if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) - g_access(cp, -cp->acr, -cp->acw, -cp->ace); + return; g_detach(cp); g_destroy_consumer(cp); } @@ -191,7 +191,7 @@ g_shsec_orphan(struct g_consumer *cp) static int g_shsec_access(struct g_provider *pp, int dr, int dw, int de) { - struct g_consumer *cp1, *cp2; + struct g_consumer *cp1, *cp2, *tmp; struct g_shsec_softc *sc; struct g_geom *gp; int error; @@ -222,21 +222,25 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, de--; error = ENXIO; - LIST_FOREACH(cp1, &gp->consumer, consumer) { + LIST_FOREACH_SAFE(cp1, &gp->consumer, consumer, tmp) { error = g_access(cp1, dr, dw, de); - if (error == 0) - continue; - /* - * If we fail here, backout all previous changes. - */ - LIST_FOREACH(cp2, &gp->consumer, consumer) { - if (cp1 == cp2) - return (error); - g_access(cp2, -dr, -dw, -de); + if (error != 0) + goto fail; + if (cp1->acr == 0 && cp1->acw == 0 && cp1->ace == 0 && + cp1->flags & G_CF_ORPHAN) { + g_detach(cp1); + g_destroy_consumer(cp1); } - /* NOTREACHED */ } + return (error); +fail: + /* If we fail here, backout all previous changes. */ + LIST_FOREACH(cp2, &gp->consumer, consumer) { + if (cp1 == cp2) + break; + g_access(cp2, -dr, -dw, -de); + } return (error); }