From owner-svn-src-all@freebsd.org Sun Mar 18 02:59:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD3F1F59492; Sun, 18 Mar 2018 02:59:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D89D7A3B0; Sun, 18 Mar 2018 02:59:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 774591ADA5; Sun, 18 Mar 2018 02:59:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2I2xEwf049035; Sun, 18 Mar 2018 02:59:14 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2I2xEvV049034; Sun, 18 Mar 2018 02:59:14 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803180259.w2I2xEvV049034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 02:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331114 - stable/11/sys/dev/efidev X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/efidev X-SVN-Commit-Revision: 331114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 02:59:15 -0000 Author: eadler Date: Sun Mar 18 02:59:14 2018 New Revision: 331114 URL: https://svnweb.freebsd.org/changeset/base/331114 Log: MFC r330843: efirtc: Pass a dummy tmcap pointer to efi_get_time_locked As noted in the comment, UEFI spec claims the capabilities pointer is optional, but some implementations will choke and attempt to dereference it without checking. This specific problem was found on a Lenovo Thinkpad X220 that would panic in efirtc_identify. Requested by: kevans Modified: stable/11/sys/dev/efidev/efirt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/efidev/efirt.c ============================================================================== --- stable/11/sys/dev/efidev/efirt.c Sat Mar 17 21:58:41 2018 (r331113) +++ stable/11/sys/dev/efidev/efirt.c Sun Mar 18 02:59:14 2018 (r331114) @@ -260,12 +260,19 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmca int efi_get_time(struct efi_tm *tm) { + struct efi_tmcap dummy; int error; if (efi_runtime == NULL) return (ENXIO); EFI_TIME_LOCK() - error = efi_get_time_locked(tm, NULL); + /* + * UEFI spec states that the Capabilities argument to GetTime is + * optional, but some UEFI implementations choke when passed a NULL + * pointer. Pass a dummy efi_dmcap, even though we won't use it, + * to workaround such implementations. + */ + error = efi_get_time_locked(tm, &dummy); EFI_TIME_UNLOCK() return (error); } From owner-svn-src-all@freebsd.org Sun Mar 18 03:42:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A8B5F5B500; Sun, 18 Mar 2018 03:42:58 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3309D7C598; Sun, 18 Mar 2018 03:42:58 +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 2DE731B64A; Sun, 18 Mar 2018 03:42:58 +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 w2I3gwc9075658; Sun, 18 Mar 2018 03:42:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2I3gvlQ075656; Sun, 18 Mar 2018 03:42:57 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803180342.w2I3gvlQ075656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Mar 2018 03:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331115 - in head: lib/libzstd sys/contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: lib/libzstd sys/contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 331115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 03:42:58 -0000 Author: cem Date: Sun Mar 18 03:42:57 2018 New Revision: 331115 URL: https://svnweb.freebsd.org/changeset/base/331115 Log: lib(private)zstd: Fix riscv build Link __bswap[ds]i2() intrinsics in to libzstd for riscv, where the C runtime apparently lacks such intrinsics. Broken in r330894. Reported by: asomers Sponsored by: Dell EMC Isilon Modified: head/lib/libzstd/Makefile head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Modified: head/lib/libzstd/Makefile ============================================================================== --- head/lib/libzstd/Makefile Sun Mar 18 02:59:14 2018 (r331114) +++ head/lib/libzstd/Makefile Sun Mar 18 03:42:57 2018 (r331115) @@ -43,4 +43,11 @@ ZSTDDIR= ${SRCTOP}/sys/contrib/zstd CFLAGS.zstd_compress.c+= -O0 .endif +# Work around lack of __bswap[sd]i2() intrinsics on riscv. Probably should be +# added to one of the runtime C libraries instead. +.if ${MACHINE_CPUARCH} == "riscv" +.PATH: ${ZSTDDIR}/lib/freebsd +SRCS+= zstd_kfreebsd.c +.endif + .include Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c ============================================================================== --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Sun Mar 18 02:59:14 2018 (r331114) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Sun Mar 18 03:42:57 2018 (r331115) @@ -27,7 +27,12 @@ */ #include "zstd_kfreebsd.h" +#include #include + +#ifndef _KERNEL +#include +#endif /* * The kernel as a standalone target does not link against libgcc or From owner-svn-src-all@freebsd.org Sun Mar 18 11:26:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AD03F4A5F8; Sun, 18 Mar 2018 11:26:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF11F6BB59; Sun, 18 Mar 2018 11:26:07 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA0841FE5A; Sun, 18 Mar 2018 11:26:07 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IBQ7wb006069; Sun, 18 Mar 2018 11:26:07 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IBQ70S006067; Sun, 18 Mar 2018 11:26:07 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803181126.w2IBQ70S006067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 18 Mar 2018 11:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331117 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in stable/10/sys: net netpfil/pf X-SVN-Commit-Revision: 331117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 11:26:08 -0000 Author: kp Date: Sun Mar 18 11:26:07 2018 New Revision: 331117 URL: https://svnweb.freebsd.org/changeset/base/331117 Log: MFC r329950: pf: Cope with overly large net.pf.states_hashsize If the user configures a states_hashsize or source_nodes_hashsize value we may not have enough memory to allocate this. This used to lock up pf, because these allocations used M_WAITOK. Cope with this by attempting the allocation with M_NOWAIT and falling back to the default sizes (with M_WAITOK) if these fail. PR: 209475 Submitted by: Fehmi Noyan Isi Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Sun Mar 18 11:25:39 2018 (r331116) +++ stable/10/sys/net/pfvar.h Sun Mar 18 11:26:07 2018 (r331117) @@ -1458,6 +1458,7 @@ struct pf_idhash { extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (32768) +#define PF_SRCHASHSIZ (PF_HASHSIZ/4) VNET_DECLARE(struct pf_keyhash *, pf_keyhash); VNET_DECLARE(struct pf_idhash *, pf_idhash); #define V_pf_keyhash VNET(pf_keyhash) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Sun Mar 18 11:25:39 2018 (r331116) +++ stable/10/sys/netpfil/pf/pf.c Sun Mar 18 11:26:07 2018 (r331117) @@ -781,7 +781,7 @@ pf_initialize() pf_hashsize = PF_HASHSIZ; TUNABLE_ULONG_FETCH("net.pf.source_nodes_hashsize", &pf_srchashsize); if (pf_srchashsize == 0 || !powerof2(pf_srchashsize)) - pf_srchashsize = PF_HASHSIZ / 4; + pf_srchashsize = PF_SRCHASHSIZ; V_pf_hashseed = arc4random(); @@ -795,10 +795,25 @@ pf_initialize() V_pf_state_key_z = uma_zcreate("pf state keys", sizeof(struct pf_state_key), pf_state_key_ctor, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_keyhash = malloc(pf_hashsize * sizeof(struct pf_keyhash), - M_PFHASH, M_WAITOK | M_ZERO); - V_pf_idhash = malloc(pf_hashsize * sizeof(struct pf_idhash), - M_PFHASH, M_WAITOK | M_ZERO); + + V_pf_keyhash = mallocarray(pf_hashsize, sizeof(struct pf_keyhash), + M_PFHASH, M_NOWAIT | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, sizeof(struct pf_idhash), + M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_keyhash == NULL || V_pf_idhash == NULL) { + printf("pf: Unable to allocate memory for " + "state_hashsize %lu.\n", pf_hashsize); + + free(V_pf_keyhash, M_PFHASH); + free(V_pf_idhash, M_PFHASH); + + pf_hashsize = PF_HASHSIZ; + V_pf_keyhash = mallocarray(pf_hashsize, + sizeof(struct pf_keyhash), M_PFHASH, M_WAITOK | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, + sizeof(struct pf_idhash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_hashmask = pf_hashsize - 1; for (i = 0, kh = V_pf_keyhash, ih = V_pf_idhash; i <= pf_hashmask; i++, kh++, ih++) { @@ -813,8 +828,18 @@ pf_initialize() V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z; uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT); uma_zone_set_warning(V_pf_sources_z, "PF source nodes limit reached"); - V_pf_srchash = malloc(pf_srchashsize * sizeof(struct pf_srchash), - M_PFHASH, M_WAITOK|M_ZERO); + + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_srchash == NULL) { + printf("pf: Unable to allocate memory for " + "source_hashsize %lu.\n", pf_srchashsize); + + pf_srchashsize = PF_SRCHASHSIZ; + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_srchashmask = pf_srchashsize - 1; for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; i++, sh++) mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF); From owner-svn-src-all@freebsd.org Sun Mar 18 11:25:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E998F4A5D6; Sun, 18 Mar 2018 11:25:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 415A26BA65; Sun, 18 Mar 2018 11:25:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C2241FE58; Sun, 18 Mar 2018 11:25:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IBPeRO005991; Sun, 18 Mar 2018 11:25:40 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IBPed4005989; Sun, 18 Mar 2018 11:25:40 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803181125.w2IBPed4005989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 18 Mar 2018 11:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331116 - in stable/11/sys: net netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in stable/11/sys: net netpfil/pf X-SVN-Commit-Revision: 331116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 11:25:40 -0000 Author: kp Date: Sun Mar 18 11:25:39 2018 New Revision: 331116 URL: https://svnweb.freebsd.org/changeset/base/331116 Log: MFC r329950: pf: Cope with overly large net.pf.states_hashsize If the user configures a states_hashsize or source_nodes_hashsize value we may not have enough memory to allocate this. This used to lock up pf, because these allocations used M_WAITOK. Cope with this by attempting the allocation with M_NOWAIT and falling back to the default sizes (with M_WAITOK) if these fail. PR: 209475 Submitted by: Fehmi Noyan Isi Modified: stable/11/sys/net/pfvar.h stable/11/sys/netpfil/pf/pf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/pfvar.h ============================================================================== --- stable/11/sys/net/pfvar.h Sun Mar 18 03:42:57 2018 (r331115) +++ stable/11/sys/net/pfvar.h Sun Mar 18 11:25:39 2018 (r331116) @@ -1463,6 +1463,7 @@ struct pf_idhash { extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (32768) +#define PF_SRCHASHSIZ (PF_HASHSIZ/4) VNET_DECLARE(struct pf_keyhash *, pf_keyhash); VNET_DECLARE(struct pf_idhash *, pf_idhash); #define V_pf_keyhash VNET(pf_keyhash) Modified: stable/11/sys/netpfil/pf/pf.c ============================================================================== --- stable/11/sys/netpfil/pf/pf.c Sun Mar 18 03:42:57 2018 (r331115) +++ stable/11/sys/netpfil/pf/pf.c Sun Mar 18 11:25:39 2018 (r331116) @@ -784,7 +784,7 @@ pf_initialize() if (pf_hashsize == 0 || !powerof2(pf_hashsize)) pf_hashsize = PF_HASHSIZ; if (pf_srchashsize == 0 || !powerof2(pf_srchashsize)) - pf_srchashsize = PF_HASHSIZ / 4; + pf_srchashsize = PF_SRCHASHSIZ; V_pf_hashseed = arc4random(); @@ -798,10 +798,25 @@ pf_initialize() V_pf_state_key_z = uma_zcreate("pf state keys", sizeof(struct pf_state_key), pf_state_key_ctor, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_keyhash = malloc(pf_hashsize * sizeof(struct pf_keyhash), - M_PFHASH, M_WAITOK | M_ZERO); - V_pf_idhash = malloc(pf_hashsize * sizeof(struct pf_idhash), - M_PFHASH, M_WAITOK | M_ZERO); + + V_pf_keyhash = mallocarray(pf_hashsize, sizeof(struct pf_keyhash), + M_PFHASH, M_NOWAIT | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, sizeof(struct pf_idhash), + M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_keyhash == NULL || V_pf_idhash == NULL) { + printf("pf: Unable to allocate memory for " + "state_hashsize %lu.\n", pf_hashsize); + + free(V_pf_keyhash, M_PFHASH); + free(V_pf_idhash, M_PFHASH); + + pf_hashsize = PF_HASHSIZ; + V_pf_keyhash = mallocarray(pf_hashsize, + sizeof(struct pf_keyhash), M_PFHASH, M_WAITOK | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, + sizeof(struct pf_idhash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_hashmask = pf_hashsize - 1; for (i = 0, kh = V_pf_keyhash, ih = V_pf_idhash; i <= pf_hashmask; i++, kh++, ih++) { @@ -816,8 +831,18 @@ pf_initialize() V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z; uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT); uma_zone_set_warning(V_pf_sources_z, "PF source nodes limit reached"); - V_pf_srchash = malloc(pf_srchashsize * sizeof(struct pf_srchash), - M_PFHASH, M_WAITOK|M_ZERO); + + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_srchash == NULL) { + printf("pf: Unable to allocate memory for " + "source_hashsize %lu.\n", pf_srchashsize); + + pf_srchashsize = PF_SRCHASHSIZ; + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_srchashmask = pf_srchashsize - 1; for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; i++, sh++) mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF); From owner-svn-src-all@freebsd.org Sun Mar 18 14:20:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB47AF57587; Sun, 18 Mar 2018 14:20:41 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com [IPv6:2a00:1450:4010:c07::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D32773215; Sun, 18 Mar 2018 14:20:41 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: by mail-lf0-x22f.google.com with SMTP id e5-v6so17680655lfb.7; Sun, 18 Mar 2018 07:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=J51dShppaTHJetKK6xQ5wP33teFQEbNbPnFHUxZsujY=; b=dtM9+5H3W86VyRD/K/TzFQz7ROmzH8QET50Tyfm8dUzhEJCkUahTiTApErS7C8OgJk tm6Db381VuG1bxC+APBcjsO8lHctu4/OiEFLia8SFJhkV6kCpjxCNRBqspWQHoaM/UVk MDszBPwT1ZfolP/kjDX9XTViAl0KWn6NMpDxD+TzuyaO6ofPIIIELD6jqaCDXDIrK4Y5 63CuoBl6sl6NxWimo1aYlrsPm8npNTNOnqukQGnswflf6DD8MDSHklT4xaufHvqd0mq2 /zOYP96Y5DzfCnKyzmjb/TOcS0Hrnm+y8Ds/IGej6c1Zi95xFd+NMHxfVDpqF/JWoStj l9Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=J51dShppaTHJetKK6xQ5wP33teFQEbNbPnFHUxZsujY=; b=P8kSq0fJhLw2t80VmfFZAC32LbppETsGeer3YMo4uCHCM8WFsHQHUAZEhqGFe9xyk9 owMHa+NKQHz7JgqgrvegZ+F8Txs3MIP2APtPzxzwKJnYgtxGClGyrH8oxKSh+9Dgpe2l 3/lUsOOtee5CzHlCJyUtmIW2f5HahtpMqvmIJifG8RIaeUyDtAvq0C9OKYZMHk9FgLFz fuluaa+DHLDlPbxEBH8Wur8WQdUnpId667zGpn00ET4XyvA8Nrg4/wDboqZazZRxJ7Js p3T8mBNommRbhNHl/lSbSKvHrVhVWEG/4Cl7eMCRQJDSJvzptjkPFdYzz39o40fh6fCJ Fogg== X-Gm-Message-State: AElRT7ExKXyodNbafhpyE9vuACWFLanmRgnMp3ywwSUCENKcxWx66XQC ICWF2gV10Jkj5q/BMTpf7eEpsuvX X-Google-Smtp-Source: AG47ELudQnhPyRT80Ri5ckYGd9ox/fHXKYBSIqME5nvTN/cZGitKMtKBqjXbnogGOPhAekrmTaMdiQ== X-Received: by 10.46.146.84 with SMTP id v20mr6030821ljg.128.1521382839745; Sun, 18 Mar 2018 07:20:39 -0700 (PDT) Received: from x-wing (87-206-170-77.dynamic.chello.pl. [87.206.170.77]) by smtp.gmail.com with ESMTPSA id 93-v6sm2898652lfy.5.2018.03.18.07.20.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Mar 2018 07:20:38 -0700 (PDT) Sender: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:20:39 +0100 From: Mariusz Zaborski To: Mark Linimon Cc: Mark Johnston , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r325739 - in head: lib/libcasper/services lib/libcasper/services/cap_syslog share/mk Message-ID: <20180318142039.GA81224@x-wing> References: <201711120834.vAC8YQUq006611@repo.freebsd.org> <20180305161358.GA704@raichu> <20180305171916.GA2359@lonesome.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: <20180305171916.GA2359@lonesome.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 14:20:42 -0000 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 05, 2018 at 11:19:16AM -0600, Mark Linimon wrote: > On Mon, Mar 05, 2018 at 11:13:58AM -0500, Mark Johnston wrote: > > The growing divergence with stable/11 makes it rather painful to > > maintain a port, depending on libcasper, that aims to work on both 11 > > and head. >=20 > Even an MFC won't help you, in the medium-term. >=20 > e.g. via https://www.freebsd.org/security/#sup, even if the MFC made it > into 11.2, you would still have several months of supporting the old > one. (The FreeBSD package builds are based on the oldest supported > point release from a branch.) The current estimate for 11.2 is late June. >=20 > mcl Hi, Sorry for delay I just get back. Yes I can integrate all my changes in libcasper and I guess libcapsicum. I'm did do a lot of integrations to stable so I have one question - if I understand correctly all changes which change API/ABI but are pointed as SHLIB_MAJOR I can safety integrate. Mark what else can I do? Thanks, --=20 Mariusz Zaborski oshogbo//vx | http://oshogbo.vexillium.org FreeBSD commiter | https://freebsd.org Software developer | http://wheelsystems.com If it's not broken, let's fix it till it is!!1 --liOOAslEiF7prFVr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkD1x0xkJXVVY1Gwf38KEGuLGxWQFAlqudbMACgkQ38KEGuLG xWQXhhAArTM4AppzMSMMFl2laqtWmeeQEXHD2pm82ElVM1KOqFipC1Kek4V7/E2p BR9YmYuCvhLq+CprX+mZBdxCD7IdFZRqj962IF+Gh5e/7fTlXQ6BI2YVTwe0dgJh DU6WawMciGZwgX1ZjmZNWrySh2kLeGgjlUeYqnFI6JClb80Eo+CrMiXgw9WLA6wt 4FZPbRewUwTxz0kWxAEPBZkqsdiwVWrw+SUhdtNaiA3YnUkAT6ZkTzevg7/ZUI30 X6YPJHWF/Js3xlnEoxGS7SYakkNMg7ppqApfmgxXuSrfr1gsGuw1H7lcywFDAdO4 QtkdCOKvs/vQ/SAqUClUIqv73HsXlmS0zY435ye42XfDTMhzQFQk0z0vu+RwkeVp yNU2yeFVNLOSbdE9pVH6VvB9HcH5eXDEOZ5MEdOuCw+jbmQbr/fETI4V+0bUpfzZ 4Mj0FPmFnSZGMORADu8cFdCj/3KCAsk4solaQG6kShQZyxeG+YKRA3uZSjpi+fLY hVWCEdevu92Xo8tknHC9zu6rp094X0uKkadraGCGzr/j7zuJDpxhe7XBEmwmfDTU lEY+IK1WgrRc1lV3z5UYB0Zd8dPEwRn3W5oBA3+M4NgOkaV5ZSS5SCIqP5jmssUs qrq/PH+Q95kBnJheesCE5dIocXiWPOiYDErLeRdCjkVr9GGIWkk= =GbBu -----END PGP SIGNATURE----- --liOOAslEiF7prFVr-- From owner-svn-src-all@freebsd.org Sun Mar 18 15:09:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC15CF5B23A; Sun, 18 Mar 2018 15:09:55 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71C247562D; Sun, 18 Mar 2018 15:09:55 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AE252202F; Sun, 18 Mar 2018 15:09:55 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IF9tNN019996; Sun, 18 Mar 2018 15:09:55 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IF9tIv019995; Sun, 18 Mar 2018 15:09:55 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181509.w2IF9tIv019995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331118 - head/sys/geom/label X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/geom/label X-SVN-Commit-Revision: 331118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:09:55 -0000 Author: oshogbo Date: Sun Mar 18 15:09:55 2018 New Revision: 331118 URL: https://svnweb.freebsd.org/changeset/base/331118 Log: Remove unneeded variable which was introduced in r328472. Pointed out by: pjd@ Modified: head/sys/geom/label/g_label.c Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Sun Mar 18 11:26:07 2018 (r331117) +++ head/sys/geom/label/g_label.c Sun Mar 18 15:09:55 2018 (r331118) @@ -200,7 +200,6 @@ g_label_create(struct gctl_req *req, struct g_class *m struct g_provider *pp2; struct g_consumer *cp; char name[64]; - int n; g_topology_assert(); @@ -214,8 +213,7 @@ g_label_create(struct gctl_req *req, struct g_class *m } gp = NULL; cp = NULL; - n = snprintf(name, sizeof(name), "%s/%s", dir, label); - if (n >= sizeof(name)) { + if (snprintf(name, sizeof(name), "%s/%s", dir, label) >= sizeof(name)) { if (req != NULL) gctl_error(req, "Label name %s is too long.", label); return (NULL); From owner-svn-src-all@freebsd.org Sun Mar 18 15:13:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39F78F5B888; Sun, 18 Mar 2018 15:13:38 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB53275C7D; Sun, 18 Mar 2018 15:13:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B08EF221AA; Sun, 18 Mar 2018 15:13:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFDb39024928; Sun, 18 Mar 2018 15:13:37 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFDbUM024926; Sun, 18 Mar 2018 15:13:37 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181513.w2IFDbUM024926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331119 - head/lib/libcasper/services/cap_pwd X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_pwd X-SVN-Commit-Revision: 331119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:13:38 -0000 Author: oshogbo Date: Sun Mar 18 15:13:37 2018 New Revision: 331119 URL: https://svnweb.freebsd.org/changeset/base/331119 Log: Document the pwd Casper service. PR: 226102 Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14605 Added: head/lib/libcasper/services/cap_pwd/cap_pwd.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_pwd/Makefile Modified: head/lib/libcasper/services/cap_pwd/Makefile ============================================================================== --- head/lib/libcasper/services/cap_pwd/Makefile Sun Mar 18 15:09:55 2018 (r331118) +++ head/lib/libcasper/services/cap_pwd/Makefile Sun Mar 18 15:13:37 2018 (r331119) @@ -24,4 +24,20 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +MAN+= cap_pwd.3 + +MLINKS+=cap_pwd.3 libcap_pwd.3 +MLINKS+=cap_pwd.3 cap_getpwent.3 +MLINKS+=cap_pwd.3 cap_getpwnam.3 +MLINKS+=cap_pwd.3 cap_getpwuid.3 +MLINKS+=cap_pwd.3 cap_getpwent_r.3 +MLINKS+=cap_pwd.3 cap_getpwnam_r.3 +MLINKS+=cap_pwd.3 cap_getpwuid_r.3 +MLINKS+=cap_pwd.3 cap_setpassent.3 +MLINKS+=cap_pwd.3 cap_setpwent.3 +MLINKS+=cap_pwd.3 cap_endpwent.3 +MLINKS+=cap_pwd.3 cap_pwd_limit_cmds.3 +MLINKS+=cap_pwd.3 cap_pwd_limit_fields.3 +MLINKS+=cap_pwd.3 cap_pwd_limit_users.3 + .include Added: head/lib/libcasper/services/cap_pwd/cap_pwd.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_pwd/cap_pwd.3 Sun Mar 18 15:13:37 2018 (r331119) @@ -0,0 +1,234 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" 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 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. +.\" +.\" $FreeBSD$ +.\" +.Dd March 18, 2018 +.Dt CAP_PWD 3 +.Os +.Sh NAME +.Nm cap_getpwent , +.Nm cap_getpwnam , +.Nm cap_getpwuid , +.Nm cap_getpwent_r , +.Nm cap_getpwnam_r , +.Nm cap_getpwuid_r , +.Nm cap_setpassent , +.Nm cap_setpwent , +.Nm cap_endpwent , +.Nm cap_pwd_limit_cmds , +.Nm cap_pwd_limit_fields , +.Nm cap_pwd_limit_users +.Nd "library for password database operations in capability mode" +.Sh LIBRARY +.Lb libcap_grp +.Sh SYNOPSIS +.In libcasper.h +.In casper/cap_pwd.h +.Ft struct passwd * +.Fn cap_getpwent "cap_channel_t *chan" +.Ft struct passwd * +.Fn cap_getpwnam "cap_channel_t *chan" "const char *login" +.Ft struct passwd * +.Fn cap_getpwuid "cap_channel_t *chan" "uid_t uid" +.Ft int +.Fn cap_getpwent_r "cap_channel_t *chan" "struct passwd *pwd" "char *buffer" "size_t bufsize" "struct passwd **result" +.Ft int +.Fn cap_getpwnam_r "cap_channel_t *chan" "const char *name" "struct passwd *pwd" "char *buffer" "size_t bufsize" "struct passwd **result" +.Ft int +.Fn cap_getpwuid_r "cap_channel_t *chan" "uid_t uid" "struct passwd *pwd" "char *buffer" "size_t bufsize" "struct passwd **result" +.Ft int +.Fn cap_setpassent "cap_channel_t *chan" "int stayopen" +.Ft void +.Fn cap_setpwent "cap_channel_t *chan" +.Ft void +.Fn cap_endpwent "cap_channel_t *chan" +.Ft int +.Fn cap_pwd_limit_cmds "cap_channel_t *chan" "const char * const *cmds" "size_t ncmds" +.Ft int +.Fn cap_pwd_limit_fields "cap_channel_t *chan" "const char * const *fields" "size_t nfields" +.Ft int +.Fn cap_pwd_limit_users "cap_channel_t *chan" "const char * const *names" "size_t nnames" "uid_t *uids" "size_t nuids" +.Sh DESCRIPTION +The functions +.Fn cap_getpwent , +.Fn cap_getpwnam , +.Fn cap_getpwuid , +.Fn cap_getpwent_r , +.Fn cap_getpwnam_r , +.Fn cap_getpwuid_r , +.Fn cap_setpassent , +.Fn cap_setpwent , +and +.Fn cap_endpwent +are respectively equivalent to +.Xr getpwent 3 , +.Xr getpwnam 3 , +.Xr getpwuid 3 , +.Xr getpwent_r 3 , +.Xr getpwnam_r 3 , +.Xr getpwuid_r 3 , +.Xr setpassent 3 , +.Xr setpwent 3 , +and +.Xr cap_endpwent 3 +except that the connection to the +.Nm system.pwd +service needs to be provided. +.Pp +The +.Fn cap_pwd_limit_cmds +function limits the functions allowed in the service. +The +.Fa cmds +variable can be set to +.Dv getpwent , +.Dv getpwnam , +.Dv getpwuid , +.Dv getpwent_r , +.Dv getpwnam_r , +.Dv getpwuid_r , +.Dv setpassent , +.Dv setpwent , +or +.Dv endpwent +which will allow to use the function associated with the name. +The +.Fa ncmds +variable contains the number of +.Fa cmds +provided. +.Pp +The +.Fn cap_pwd_limit_fields +function allows limit fields returned in the structure +.Vt passwd . +The +.Fa fields +variable can be set to +.Dv pw_name , +.Dv pw_passwd , +.Dv pw_uid , +.Dv pw_gid , +.Dv pw_change , +.Dv pw_class , +.Dv pw_gecos , +.Dv pw_dir , +.Dv pw_shell , +.Dv pw_expire +or +.Dv pw_fields +The field which was set as the limit will be returned, while the rest of the +values not set this way will have default values. +The +.Fa nfields +variable contains the number of +.Fa fields +provided. +.Pp +The +.Fn cap_pwd_limit_users +function allows to limit access to users. +The +.Fa names +variable allows to limit users by name and the +.Fa uids +variable by the user number. +The +.Fa nnames +and +.Fa nuids +variables provide numbers of limited names and uids. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.pwd +casper service and uses it to get a user name. +.Bd -literal +cap_channel_t *capcas, *cappwd; +const char *cmds[] = { "getpwuid" }; +const char *fields[] = { "pw_name" }; +uid_t uid[] = { 1 }; +struct passwd *passwd; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.pwd service. */ +cappwd = cap_service_open(capcas, "system.pwd"); +if (cappwd == NULL) + err(1, "Unable to open system.pwd service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Limit service to one single function. */ +if (cap_pwd_limit_cmds(cappwd, cmds, nitems(cmds))) + err(1, "Unable to limit access to system.pwd service"); + +/* Limit service to one field as we only need name of the user. */ +if (cap_pwd_limit_fields(cappwd, fields, nitems(fields))) + err(1, "Unable to limit access to system.pwd service"); + +/* Limit service to one uid. */ +if (cap_pwd_limit_users(cappwd, NULL, 0, uid, nitems(uid))) + err(1, "Unable to limit access to system.pwd service"); + +passwd = cap_getpwuid(cappwd, uid[0]); +if (passwd == NULL) + err(1, "Unable to get name of user"); + +printf("UID %d is associated with name %s.\\n", uid[0], passwd->pw_name); + +cap_close(cappwd); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr endpwent 3 , +.Xr err 3 , +.Xr getpwent 3 , +.Xr getpwent_r 3 , +.Xr getpwnam 3 , +.Xr getpwnam_r 3 , +.Xr getpwuid 3 , +.Xr getpwuid_r 3 , +.Xr setpassent 3 , +.Xr setpwent 3 , +.Xr capsicum 4, +.Xr nv 9 +.Sh AUTHORS +The +.Nm cap_pwd +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org . From owner-svn-src-all@freebsd.org Sun Mar 18 15:16:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B50CF5BC93; Sun, 18 Mar 2018 15:16:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE99975F2C; Sun, 18 Mar 2018 15:16:47 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A95AF221BF; Sun, 18 Mar 2018 15:16:47 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFGlxf025124; Sun, 18 Mar 2018 15:16:47 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFGlIZ025122; Sun, 18 Mar 2018 15:16:47 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181516.w2IFGlIZ025122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331120 - head/lib/libcasper/services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_sysctl X-SVN-Commit-Revision: 331120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:16:48 -0000 Author: oshogbo Date: Sun Mar 18 15:16:47 2018 New Revision: 331120 URL: https://svnweb.freebsd.org/changeset/base/331120 Log: Document the sysctl Casper service. PR: 226102 Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14606 Added: head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_sysctl/Makefile Modified: head/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 15:13:37 2018 (r331119) +++ head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 15:16:47 2018 (r331120) @@ -24,4 +24,9 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +MAN+= cap_sysctl + +MLINKS+=cap_sysctl.3 libcap_sysctl.3 +MLINKS+=cap_sysctl.3 cap_sysctlbyname.3 + .include Added: head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Sun Mar 18 15:16:47 2018 (r331120) @@ -0,0 +1,143 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" 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 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. +.\" +.\" $FreeBSD$ +.\" +.Dd March 18, 2018 +.Dt CAP_SYSCTL 3 +.Os +.Sh NAME +.Nm cap_sysctlbyname +.Nd "library for getting or setting system information in capability mode" +.Sh LIBRARY +.Lb libcap_sysctl +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_sysctl.h +.Ft int +.Fn cap_sysctlbyname "cap_channel_t *chan" " const char *name" " void *oldp" " size_t *oldlenp" " const void *newp" " size_t newlen" +.Sh DESCRIPTION +The function +.Fn cap_sysctlbyname +is equivalent to +.Xr sysctlbyname 3 +except that the connection to the +.Nm system.sysctl +service needs to be provided. +.Sh LIMITS +The service can be limited using +.Xr cap_limit_set 3 +function. +The +.Xr nvlist 9 +for that function can contain the following values and types: +.Bl -ohang -offset indent +.It ( NV_TYPE_NUMBER ) +The name of the element with type number will be treated as the limited sysctl. +The value of the element will describe the access rights for given sysctl. +There are four different rights +.Dv CAP_SYSCTL_READ , +.Dv CAP_SYSCTL_WRITE , +.Dv CAP_SYSCTL_RDWR , +and +.Dv CAP_SYSCTL_RECURSIVE . +The +.Dv CAP_SYSCTL_READ +flag allows to fetch the value of a given sysctl. +The +.Dv CAP_SYSCTL_WIRTE +flag allows to override the value of a given sysctl. +The +.Dv CAP_SYSCTL_RDWR +is combination of the +.Dv CAP_SYSCTL_WIRTE +and +.Dv CAP_SYSCTL_READ +and allows to read and write the value of a given sysctl. +The +.Dv CAP_SYSCTL_RECURSIVE +allows access to all children of a given sysctl. +This right must be combined with at least one other right. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.sysctl +casper service and uses it to get the value of +.Dv kern.trap_enotcap . +.Bd -literal +cap_channel_t *capcas, *capsysctl; +const char *name = "kern.trap_enotcap"; +nvlist_t *limits; +int value; +size_t size; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.sysctl service. */ +capsysctl = cap_service_open(capcas, "system.sysctl"); +if (capsysctl == NULL) + err(1, "Unable to open system.sysctl service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Create limit for one MIB with read access only. */ +limits = nvlist_create(0); +nvlist_add_number(limits, name, CAP_SYSCTL_READ); + +/* Limit system.sysctl. */ +if (cap_limit_set(capsysctl, limits) < 0) + err(1, "Unable to set limits"); + +/* Fetch value. */ +if (cap_sysctlbyname(capsysctl, name, &value, &size, NULL, 0) < 0) + err(1, "Unable to get value of sysctl"); + +printf("The value of %s is %d.\\n", name, value); + +cap_close(capsysctl); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr err 3 , +.Xr sysctlbyname 3, +.Xr capsicum 4 , +.Xr nv 9 +.Sh AUTHORS +The +.Nm cap_sysctl +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org . From owner-svn-src-all@freebsd.org Sun Mar 18 15:24:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77438F5C699; Sun, 18 Mar 2018 15:24:46 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18A17766B4; Sun, 18 Mar 2018 15:24:46 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE18822365; Sun, 18 Mar 2018 15:24:45 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFOjBk030379; Sun, 18 Mar 2018 15:24:45 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFOj9O030378; Sun, 18 Mar 2018 15:24:45 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181524.w2IFOj9O030378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:24:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331121 - head/lib/libcasper/libcasper X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/libcasper X-SVN-Commit-Revision: 331121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:24:46 -0000 Author: oshogbo Date: Sun Mar 18 15:24:45 2018 New Revision: 331121 URL: https://svnweb.freebsd.org/changeset/base/331121 Log: Update libcasper references to all new man pages. Remove obsolete example. All services has they own example. This example also show old type of limiting method which is not recommended to use. Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14607 Modified: head/lib/libcasper/libcasper/libcasper.3 Modified: head/lib/libcasper/libcasper/libcasper.3 ============================================================================== --- head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 15:16:47 2018 (r331120) +++ head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 15:24:45 2018 (r331121) @@ -1,4 +1,5 @@ .\" Copyright (c) 2013 The FreeBSD Foundation +.\" Copyright (c) 2018 Mariusz Zaborski .\" All rights reserved. .\" .\" This documentation was written by Pawel Jakub Dawidek under sponsorship @@ -27,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2018 +.Dd March 6, 2018 .Dt LIBCASPER 3 .Os .Sh NAME @@ -252,63 +253,18 @@ The and .Fn cap_unwrap functions always succeed. -.Sh EXAMPLES -The following example first opens capability to the casper then using this -capability creates new capability to the -.Nm system.dns -casper service and uses the latter capability to resolve IP address. -.Bd -literal -cap_channel_t *capcas, *capdns; -nvlist_t *limits; -const char *ipstr = "127.0.0.1"; -struct in_addr ip; -struct hostent *hp; - -/* Open capability to the Casper. */ -capcas = cap_init(); -if (capcas == NULL) - err(1, "Unable to contact Casper"); - -/* Enter capability mode sandbox. */ -if (cap_enter() < 0 && errno != ENOSYS) - err(1, "Unable to enter capability mode"); - -/* Use Casper capability to create capability to the system.dns service. */ -capdns = cap_service_open(capcas, "system.dns"); -if (capdns == NULL) - err(1, "Unable to open system.dns service"); - -/* Close Casper capability, we don't need it anymore. */ -cap_close(capcas); - -/* Limit system.dns to reverse DNS lookups and IPv4 addresses. */ -limits = nvlist_create(0); -nvlist_add_string(limits, "type", "ADDR"); -nvlist_add_number(limits, "family", (uint64_t)AF_INET); -if (cap_limit_set(capdns, limits) < 0) - err(1, "Unable to limit access to the system.dns service"); - -/* Convert IP address in C-string to in_addr. */ -if (!inet_aton(ipstr, &ip)) - errx(1, "Unable to parse IP address %s.", ipstr); - -/* Find hostname for the given IP address. */ -hp = cap_gethostbyaddr(capdns, (const void *)&ip, sizeof(ip), AF_INET); -if (hp == NULL) - errx(1, "No name associated with %s.", ipstr); - -printf("Name associated with %s is %s.\\n", ipstr, hp->h_name); -.Ed .Sh SEE ALSO -.Xr cap_enter 2 , +.Xr errno 2 , .Xr execve 2 , .Xr kevent 2 , .Xr poll 2 , .Xr select 2 , -.Xr cap_gethostbyaddr 3 , -.Xr err 3 , -.Xr gethostbyaddr 3 , -.Xr inet_aton 3 , +.Xr cap_dns 3 , +.Xr cap_grp 3 , +.Xr cap_pwd 3 , +.Xr cap_ranodm 3 , +.Xr cap_sysctl 3 , +.Xr cap_syslog 3 , .Xr capsicum 4 , .Xr unix 4 , .Xr nv 9 From owner-svn-src-all@freebsd.org Sun Mar 18 15:44:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21E5EF5DDC4; Sun, 18 Mar 2018 15:44:08 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBF51777F2; Sun, 18 Mar 2018 15:44:07 +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 C6BCF22684; Sun, 18 Mar 2018 15:44:07 +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 w2IFi7u2040684; Sun, 18 Mar 2018 15:44:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFi773040683; Sun, 18 Mar 2018 15:44:07 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201803181544.w2IFi773040683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Mar 2018 15:44:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331122 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 331122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:44:08 -0000 Author: trasz Date: Sun Mar 18 15:44:07 2018 New Revision: 331122 URL: https://svnweb.freebsd.org/changeset/base/331122 Log: Here's the new development(7), which removes information that's no longer relevant (read: most of what was there) and adds some quick links to point newcomers in the right direction. Reviewed by: imp@ MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14680 Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Sun Mar 18 15:24:45 2018 (r331121) +++ head/share/man/man7/development.7 Sun Mar 18 15:44:07 2018 (r331122) @@ -1,4 +1,5 @@ -.\" Copyright (C) 1998 Matthew Dillon. All rights reserved. +.\" Copyright (c) 2018 Edward Tomasz Napierala +.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -9,10 +10,10 @@ .\" 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" 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 AUTHOR OR CONTRIBUTORS BE LIABLE +.\" 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) @@ -23,446 +24,91 @@ .\" .\" $FreeBSD$ .\" -.Dd March 7, 2013 +.Dd March 13, 2018 .Dt DEVELOPMENT 7 .Os .Sh NAME .Nm development -.Nd "introduction to development with the FreeBSD codebase" +.Nd introduction to FreeBSD development process .Sh DESCRIPTION -This manual page describes how an ordinary system operator, -.Ux -administrator, or developer -can, without any special permission, obtain, maintain, and modify the .Fx -codebase as well as how to maintain a master build which can -then be exported to other machines in your network. -This manual page -is targeted to system operators, programmers, and developers. +development is split into three major suprojects: doc, ports, and src. +Doc is the documentation, such as the FreeBSD Handbook. +To read more, see: .Pp -Please note that what is being described here is based on a complete -.Fx -environment, not just the -.Fx -kernel. -The methods described -here are as applicable to production installations as it is to development -environments. -.Sh SETTING UP THE ENVIRONMENT ON THE MASTER SERVER -Your master server should always run a stable, production version of the -.Fx -operating system. -This does not prevent you from doing -CURRENT -builds or development. -The last thing you want to do is to run an -unstable environment on your master server which could lead to a situation -where you lose the environment and/or cannot recover from a mistake. +.Lk https://www.FreeBSD.org/doc/en/books/fdp-primer/ .Pp -Create a partition called -.Pa /FreeBSD . -Approximately 20GB is recommended. -This partition will contain nearly all the development environment, -including the subversion tree, broken-out source, and possibly even object files. -You are going to export this partition to your other machines via a -READ-ONLY NFS export so do not mix it with other more security-sensitive -partitions. +Ports, described further in +.Xr ports 7 , +are the way to build, package, and install third party software. +To read more, see: .Pp -You have to make a choice in regards to -.Pa /usr/obj . -You can put -.Pa /usr/obj -in -.Pa /FreeBSD -or you can make -.Pa /usr/obj -its own partition. -I recommend making it a separate partition for several reasons. -First, -as a safety measure since this partition is written to a great deal. -Second, because you typically do not have to back it up. -Third, because it makes it far easier to mix and match the development -environments which are described later in this document. -I recommend a -.Pa /usr/obj -partition of at least 12GB. +.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/ .Pp -On the master server, use -.Xr svn 1 -to pull down and maintain -the -.Fx -source. -The first pull will take a long time, -it is several gigabytes, but once you have it, -the updates will be quite small. -Run all -.Xr svn 1 -operations as -.Dq Li root +The last one, src, revolves around the source code for the base system, +consisting of the kernel, and the libraries and utilities commonly called +the world. .Pp -Keeping the broken-out source and ports in -.Pa /FreeBSD -allows you to export -it to other machines via read-only NFS. -This also means you only need to edit/maintain files in one place and all -your clients automatically pick up the changes. -.Bd -literal -offset 4n -mkdir /FreeBSD -cd /FreeBSD -svn co https://svn.freebsd.org/ports/head ports -svn co https://svn.freebsd.org/doc/head doc -svn co https://svn.freebsd.org/base/head src -cd /usr -rm -rf src -ln -s /FreeBSD/src src -.Ed +The Committer's Guide, describing topics relevant to all committers, +can be found at: .Pp -Note that exporting -.Pa /usr/obj -via read-only NFS to your other boxes will -allow you to build on your main server and install from your other boxes. -If you also want to do builds on some or all of the clients you can simply -have -.Pa /usr/obj -be a local directory on those clients. -You should never export -.Pa /usr/obj -read-write, it will lead to all sorts of -problems and issues down the line and presents a security problem as well. -It is far easier to do builds on the master server and then only do installs -on the clients. +.Lk https://www.FreeBSD.org/doc/en/articles/committers-guide/ .Pp -I usually maintain my ports tree via svn or portsnap. -With some fancy softlinks you can make the ports tree available both on your -master server and on all of your other machines. -Note that the ports tree exists only on the HEAD ports branch, so its always -usable even on a -STABLE box. -This is what you do: -.Bd -literal -offset 4n -(THESE COMMANDS ON THE MASTER SERVER AND ON ALL CLIENTS) -cd /usr -rm -rf ports -ln -s /FreeBSD/ports ports - -cd /usr/ports (this pushes into the softlink) -rm -rf distfiles (ON MASTER SERVER ONLY) -ln -s /usr/ports.distfiles distfiles (ON MASTER SERVER ONLY) - -mkdir /usr/ports.distfiles -mkdir /usr/ports.workdir -.Ed +FreeBSD src development takes place in the CURRENT branch in Subversion, +located at: .Pp -Since -.Pa /usr/ports -is softlinked into what will be read-only on all of your -clients, you have to tell the ports system to use a different working -directory to hold ports builds. -You want to add a line to your -.Xr make.conf 5 -file on the master server -and on all your clients: -.Bd -literal -offset 4n -WRKDIRPREFIX=/usr/ports.workdir -.Ed +.Lk http://svn.FreeBSD.org/base/head .Pp -You should try to make the directory you use for the ports working directory -as well as the directory used to hold distfiles consistent across all of your -machines. -If there is not enough room in -.Pa /usr/ports.distfiles -and -.Pa /usr/ports.workdir -I usually make those softlinks (since this is on -.Pa /usr -these are per-machine) to -where the distfiles and working space really are. -.Sh EXPORTING VIA NFS FROM THE MASTER SERVER -The master server needs to export -.Pa /FreeBSD -and -.Pa /usr/obj -via NFS so all the -rest of your machines can get at them. -I strongly recommend using a read-only export for both security and safety. -The environment I am describing in this manual page is designed primarily -around read-only NFS exports. -Your exports file on the master server should contain the following lines: -.Bd -literal -offset 4n -/FreeBSD -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK -/usr/obj -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK -.Ed +There is also a read-only GitHub mirror at: .Pp -Of course, NFS server operations must also be configured on that machine. -This is typically done via your -.Pa /etc/rc.conf : -.Bd -literal -offset 4n -nfs_server_enable="YES" -nfs_server_flags="-u -t -n 4" -.Ed -.Sh THE CLIENT ENVIRONMENT -All of your client machines can import the development/build environment -directory simply by NFS mounting -.Pa /FreeBSD -and -.Pa /usr/obj -from the master server. -A typical -.Pa /etc/fstab -entry on your client machines will be something like this: -.Bd -literal -offset 4n -masterserver:/FreeBSD /FreeBSD nfs ro,bg 0 0 -masterserver:/usr/obj /usr/obj nfs ro,bg 0 0 -.Ed +.Lk https://github.com/freebsd/freebsd .Pp -And, of course, you should configure the client for NFS client operations -via -.Pa /etc/rc.conf . -In particular, this will turn on -.Xr nfsiod 8 -which will improve client-side NFS -performance: -.Bd -literal -offset 4n -nfs_client_enable="YES" -.Ed +Changes are first committed to CURRENT and then usually merged back +to STABLE. +Every few years the CURRENT branch is renamed to STABLE, and a new +CURRENT is branched, with an incremented major version number. +Releases are then branched off STABLE and numbered with consecutive minor numbers. .Pp -Each client should create softlinks for -.Pa /usr/ports +Layout of the source tree is described in +.Xr hier 7 . +Build Instructions can be found in +.Xr build 7 and -.Pa /usr/src -that point -into the NFS-mounted environment. -If a particular client is running -CURRENT, -.Pa /usr/src -should be a softlink to -.Pa /FreeBSD/src . -If it is running -STABLE, -.Pa /usr/src -should be a softlink to -.Pa /FreeBSD/FreeBSD-4.x/src . -I do not usually create a -.Pa /usr/src2 -softlink on -clients, that is used as a convenient shortcut when working on the source -code on the master server only and could create massive confusion (of the -human variety) on a client. -.Bd -literal -offset 4n -(ON EACH CLIENT) -cd /usr -rm -rf ports src -ln -s /FreeBSD/ports ports -ln -s /FreeBSD/src src -.Ed +.Xr release 7 . +For coding conventions, see +.Xr style 9 . .Pp -Do not forget to create the working directories so you can build ports, as -previously described. -If these are not good locations, make them softlinks to the correct location. -Remember that -.Pa /usr/ports/distfiles -is exported by -the master server and is therefore going to point to the same place -(typically -.Pa /usr/ports.distfiles ) -on every machine. -.Bd -literal -offset 4n -mkdir /usr/ports.distfiles -mkdir /usr/ports.workdir -.Ed -.Sh BUILDING KERNELS -Here is how you build a -STABLE kernel (on your main development box). -If you want to create a custom kernel, copy -.Pa GENERIC -to -.Pa KERNELNAME -and then edit it before configuring and building. -The kernel configuration file lives in -.Pa /usr/src/sys/i386/conf/KERNELNAME . -.Bd -literal -offset 4n -cd /usr/src -make buildkernel KERNCONF=KERNELNAME -.Ed +To ask questions regarding development, use the mailing lists, +such as freebsd-arch@ and freebsd-hackers@: .Pp -.Sy WARNING! -If you are familiar with the old config/cd/make method of building -a -STABLE kernel, note that the -.Xr config 8 -method will put the build environment in -.Pa /usr/src/sys/i386/compile/KERNELNAME -instead of in -.Pa /usr/obj . +.Lk https://lists.FreeBSD.org/ .Pp -Building a -CURRENT kernel -.Bd -literal -offset 4n -cd /usr/src2 (on the master server) -make buildkernel KERNCONF=KERNELNAME -.Ed -.Sh INSTALLING KERNELS -Installing a -STABLE kernel (typically done on a client, -only do this on your main development server if you want to install a new -kernel for your main development server): -.Bd -literal -offset 4n -cd /usr/src -make installkernel KERNCONF=KERNELNAME -.Ed +To get your patches integrated into the main freebsd repository use Phabricator; +it is a code review tool that allows other developers to review the changes, +suggest improvements, and, eventually, allows them to pick up the change and +commit it: .Pp -If you are using the older config/cd/make build mechanism for -STABLE, you -would install using: -.Bd -literal -offset 4n -cd /usr/src/sys/i386/compile/KERNELNAME -make install -.Ed +.Lk https://reviews.FreeBSD.org .Pp -Installing a -CURRENT kernel (typically done only on a client) -.Bd -literal -offset 4n -(remember /usr/src is pointing to the client's specific environment) -cd /usr/src -make installkernel KERNCONF=KERNELNAME -.Ed -.Sh BUILDING THE WORLD -This environment is designed such that you do all builds on the master server, -and then install from each client. -You can do builds on a client only if -.Pa /usr/obj -is local to that client. -Building the world is easy: -.Bd -literal -offset 4n -cd /usr/src -make buildworld -.Ed +.Sh EXAMPLES +Check out the CURRENT branch, build it, and install, overwriting the current +system: +.Dl svnlite co https://svn.FreeBSD.org/base/head src +.Dl cd src +.Dl make -j8 buildworld buildkernel installkernel +.Dl reboot .Pp -If you are on the master server you are running in a -STABLE environment, but -that does not prevent you from building the -CURRENT world. -Just -.Xr cd 1 -into the appropriate source directory and you are set. -Do not -accidentally install it on your master server though! -.Bd -literal -offset 4n -cd /usr/src2 -make buildworld -.Ed -.Sh INSTALLING THE WORLD -You can build on your main development server and install on clients. -The main development server must export -.Pa /FreeBSD -and -.Pa /usr/obj -via read-only NFS to the clients. +After reboot: +.Dl cd src +.Dl make -j8 installworld .Pp -.Em NOTE!!! -If -.Pa /usr/obj -is a softlink on the master server, it must also be the EXACT -SAME softlink on each client. -If -.Pa /usr/obj -is a directory in -.Pa /usr -or a mount point on the master server, -then it must be (interchangeably) a directory in -.Pa /usr -or a mount point on -each client. -This is because the -absolute paths are expected to be the same when building the world as when -installing it, and you generally build it on your main development box -and install it from a client. -If you do not set up -.Pa /usr/obj -properly you will not be able to build on -machine and install on another. -.Bd -literal -offset 4n -(ON THE CLIENT) -(remember /usr/src is pointing to the client's specific environment) -cd /usr/src -make installworld -.Ed -.Pp -.Sy WARNING! -If builds work on the master server but installs do not work from the -clients, for example you try to install and the client complains that -the install tried to write into the read-only -.Pa /usr/obj , -then it is likely -that the -.Xr make.conf 5 -file on the client does not match the one on the -master server closely enough and the install is trying to install something -that was not built. -.Sh DOING DEVELOPMENT ON A CLIENT (NOT JUST INSTALLING) -Developers often want to run buildkernel's or buildworld's on client -boxes simply to life-test the box. -You do this in the same manner that you buildkernel and buildworld on your -master server. -All you have to do is make sure that -.Pa /usr/obj -is pointing to local storage. -If you followed my advise and made -.Pa /usr/obj -its own partition on the master -server, -then it is typically going to be an NFS mount on the client. -Simply unmounting -.Pa /usr/obj -will leave you with a -.Pa /usr/obj -that is a -subdirectory in -.Pa /usr -which is typically local to the client. -You can then do builds to your heart's content! -.Sh MAINTAINING A LOCAL BRANCH -There is absolutely nothing preventing you -from breaking out other versions of the source tree -into -.Pa /FreeBSD/XXX . -In fact, my -.Pa /FreeBSD -partition also contains -.Ox , -.Nx , -and various flavors of -.Tn Linux . -You may not necessarily be able to build -.Pf non- Fx -operating systems on -your master server, but being able -to collect and manage source distributions from a central server is a very -useful thing to be able to do and you can certainly export to machines -which can build those other operating systems. -.Pp -Many developers choose to maintain a local branch of -.Fx -to test patches or build a custom distribution. -This can be done with svn or another source code management system -(git, mercurial, Perforce, BitKeeper) with its own repository. -.Sh "UPDATING VIA SVN" -By using a -.Xr cron 8 -job to maintain an updated svn repository, -the source tree can be -updated at any time as follows: -.Bd -literal -offset 4n -(on the main development server) -cd /usr -svn update src doc ports -.Ed -.Pp -It is that simple, and since you are exporting the whole lot to your -clients, your clients have immediate visibility into the updated -source. -This is a good time to also remind you that most of the -.Xr svn 1 -operations you do will be done as -.Dq Li root . .Sh SEE ALSO -.Xr crontab 1 , -.Xr crontab 5 , -.Xr make.conf 5 , +.Xr witness 4 , .Xr build 7 , -.Xr firewall 7 , +.Xr hier 7 , .Xr release 7 , -.Xr tuning 7 , -.Xr diskless 8 +.Xr locking 9 , +.Xr style 9 .Sh HISTORY The .Nm @@ -478,3 +124,7 @@ to reflect the repository conversion from .Xr cvs 1 to .Xr svn 1 . +It was rewritten from scratch by +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org +for +.Fx 12.0 . From owner-svn-src-all@freebsd.org Sun Mar 18 15:56:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5B93F5E938; Sun, 18 Mar 2018 15:56:10 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7944A77F54; Sun, 18 Mar 2018 15:56:10 +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 7413622820; Sun, 18 Mar 2018 15:56:10 +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 w2IFuAXb046017; Sun, 18 Mar 2018 15:56:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFuA9d046016; Sun, 18 Mar 2018 15:56:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181556.w2IFuA9d046016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 15:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331123 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:56:10 -0000 Author: ian Date: Sun Mar 18 15:56:10 2018 New Revision: 331123 URL: https://svnweb.freebsd.org/changeset/base/331123 Log: Do not overwrite the contents of BIO_WRITE buffers. SPI inherently transfers data in both directions at once. When writing to the device, use a dummy buffer for the incoming data, not the same buffer as the outgoing data. Writes are done in FLASH_PAGE_SIZE chunks, which is only 256 bytes, so just put the dummy buffer into the softc. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 15:44:07 2018 (r331122) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 15:56:10 2018 (r331123) @@ -90,6 +90,7 @@ struct mx25l_softc struct bio_queue_head sc_bio_queue; unsigned int sc_flags; unsigned int sc_taskstate; + uint8_t sc_dummybuf[FLASH_PAGE_SIZE]; }; #define TSTATE_STOPPED 0 @@ -344,7 +345,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, cmd.rx_cmd = rxBuf; cmd.tx_data = data + bytes_writen; cmd.tx_data_sz = bytes_to_write; - cmd.rx_data = data + bytes_writen; + cmd.rx_data = sc->sc_dummybuf; cmd.rx_data_sz = bytes_to_write; /* From owner-svn-src-all@freebsd.org Sun Mar 18 16:02:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D92C7F5F08B; Sun, 18 Mar 2018 16:02:41 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83A207848B; Sun, 18 Mar 2018 16:02:41 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E034229B4; Sun, 18 Mar 2018 16:02:41 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IG2fIV050931; Sun, 18 Mar 2018 16:02:41 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IG2fOD050930; Sun, 18 Mar 2018 16:02:41 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181602.w2IG2fOD050930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 16:02:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331124 - head/lib/libcasper/services/cap_pwd X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_pwd X-SVN-Commit-Revision: 331124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:02:42 -0000 Author: oshogbo Date: Sun Mar 18 16:02:41 2018 New Revision: 331124 URL: https://svnweb.freebsd.org/changeset/base/331124 Log: Fix typo. Submitted by: Trond Endrestøl Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.3 Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.3 ============================================================================== --- head/lib/libcasper/services/cap_pwd/cap_pwd.3 Sun Mar 18 15:56:10 2018 (r331123) +++ head/lib/libcasper/services/cap_pwd/cap_pwd.3 Sun Mar 18 16:02:41 2018 (r331124) @@ -221,7 +221,7 @@ cap_close(cappwd); .Xr getpwuid_r 3 , .Xr setpassent 3 , .Xr setpwent 3 , -.Xr capsicum 4, +.Xr capsicum 4 , .Xr nv 9 .Sh AUTHORS The From owner-svn-src-all@freebsd.org Sun Mar 18 16:06:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E733F5F4DD; Sun, 18 Mar 2018 16:06:36 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 289D1786DC; Sun, 18 Mar 2018 16:06:36 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F83D229B9; Sun, 18 Mar 2018 16:06:36 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IG6ZiY051145; Sun, 18 Mar 2018 16:06:35 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IG6ZRa051142; Sun, 18 Mar 2018 16:06:35 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181606.w2IG6ZRa051142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 16:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331125 - in head/lib/libcasper: libcasper services/cap_dns services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head/lib/libcasper: libcasper services/cap_dns services/cap_sysctl X-SVN-Commit-Revision: 331125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:06:36 -0000 Author: oshogbo Date: Sun Mar 18 16:06:35 2018 New Revision: 331125 URL: https://svnweb.freebsd.org/changeset/base/331125 Log: Fix similar typos to r331124. Modified: head/lib/libcasper/libcasper/libcasper.3 head/lib/libcasper/services/cap_dns/cap_dns.3 head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Modified: head/lib/libcasper/libcasper/libcasper.3 ============================================================================== --- head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 16:02:41 2018 (r331124) +++ head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 16:06:35 2018 (r331125) @@ -182,7 +182,7 @@ over the given capability. The .Fn cap_xfer_nvlist function sends the given -.Xr nvlist 9, +.Xr nvlist 9 , destroys it and receives new .Xr nvlist 9 in response over the given capability. Modified: head/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- head/lib/libcasper/services/cap_dns/cap_dns.3 Sun Mar 18 16:02:41 2018 (r331124) +++ head/lib/libcasper/services/cap_dns/cap_dns.3 Sun Mar 18 16:06:35 2018 (r331125) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2018 +.Dd March 18, 2018 .Dt CAP_DNS 3 .Os .Sh NAME @@ -193,7 +193,7 @@ printf("Name associated with %s is %s.\\n", ipstr, hp- .Xr gethostbyaddr 3 , .Xr gethostbyname 3 , .Xr gethostbyname2 3 , -.Xr getnameinfo 3, +.Xr getnameinfo 3 , .Xr capsicum 4 , .Xr nv 9 .Sh AUTHORS Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 ============================================================================== --- head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Sun Mar 18 16:02:41 2018 (r331124) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Sun Mar 18 16:06:35 2018 (r331125) @@ -129,7 +129,7 @@ cap_close(capsysctl); .Sh SEE ALSO .Xr cap_enter 2 , .Xr err 3 , -.Xr sysctlbyname 3, +.Xr sysctlbyname 3 , .Xr capsicum 4 , .Xr nv 9 .Sh AUTHORS From owner-svn-src-all@freebsd.org Sun Mar 18 16:10:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 279BEF5F823; Sun, 18 Mar 2018 16:10:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB61C7893D; Sun, 18 Mar 2018 16:10:14 +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 B63D1229D8; Sun, 18 Mar 2018 16:10:14 +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 w2IGAEVG051427; Sun, 18 Mar 2018 16:10:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGAEpn051426; Sun, 18 Mar 2018 16:10:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181610.w2IGAEpn051426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 16:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331126 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:10:15 -0000 Author: ian Date: Sun Mar 18 16:10:14 2018 New Revision: 331126 URL: https://svnweb.freebsd.org/changeset/base/331126 Log: Remove a pointless KASSERT and reword a comment a bit. The KASSERT tested for the same condition that the preceeding lines checked for and would have returned EIO, so the assert could never possibly trigger (sc_sectorsize must inherently be an integer multiple of FLASH_PAGE_SIZE). Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 16:06:35 2018 (r331125) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 16:10:14 2018 (r331126) @@ -300,19 +300,11 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, write_offset = offset; /* - * Use the erase sectorsize here since blocks are fully erased - * first before they're written to. + * Writes must be aligned to the erase sectorsize, since blocks are + * fully erased before they're written to. */ if (count % sc->sc_sectorsize != 0 || offset % sc->sc_sectorsize != 0) return (EIO); - - /* - * Assume here that we write per-sector only - * and sector size should be 256 bytes aligned - */ - KASSERT(write_offset % FLASH_PAGE_SIZE == 0, - ("offset for BIO_WRITE is not page size (%d bytes) aligned", - FLASH_PAGE_SIZE)); /* * Maximum write size for CMD_PAGE_PROGRAM is From owner-svn-src-all@freebsd.org Sun Mar 18 16:24:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 838E3F60B34; Sun, 18 Mar 2018 16:24:12 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CBE4796E6; Sun, 18 Mar 2018 16:24:12 +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 2695F22CE2; Sun, 18 Mar 2018 16:24:12 +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 w2IGOBYX061355; Sun, 18 Mar 2018 16:24:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGOBLn061354; Sun, 18 Mar 2018 16:24:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201803181624.w2IGOBLn061354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Mar 2018 16:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331127 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 331127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:24:12 -0000 Author: trasz Date: Sun Mar 18 16:24:11 2018 New Revision: 331127 URL: https://svnweb.freebsd.org/changeset/base/331127 Log: Fix typo. MFC after: 2 weeks Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Sun Mar 18 16:10:14 2018 (r331126) +++ head/share/man/man7/development.7 Sun Mar 18 16:24:11 2018 (r331127) @@ -71,7 +71,7 @@ Releases are then branched off STABLE and numbered wit .Pp Layout of the source tree is described in .Xr hier 7 . -Build Instructions can be found in +Build instructions can be found in .Xr build 7 and .Xr release 7 . From owner-svn-src-all@freebsd.org Sun Mar 18 16:35:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF461F61890; Sun, 18 Mar 2018 16:35:40 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C5BB79F69; Sun, 18 Mar 2018 16:35:40 +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 609EA22EBB; Sun, 18 Mar 2018 16:35:40 +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 w2IGZe6J066495; Sun, 18 Mar 2018 16:35:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGZe3b066494; Sun, 18 Mar 2018 16:35:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181635.w2IGZe3b066494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331128 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:35:40 -0000 Author: markj Date: Sun Mar 18 16:35:40 2018 New Revision: 331128 URL: https://svnweb.freebsd.org/changeset/base/331128 Log: Have vm_page_replace() assert that the new page is not enqueued. The new page does not belong to a VM object, but the page daemon does not expect to encounter such pages. Reviewed by: alc, kib Tested by: pho MFC after: 1 week X-Differential Revision: https://reviews.freebsd.org/D14625 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Mar 18 16:24:11 2018 (r331127) +++ head/sys/vm/vm_page.c Sun Mar 18 16:35:40 2018 (r331128) @@ -1505,7 +1505,9 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(mnew->object == NULL, - ("vm_page_replace: page already in object")); + ("vm_page_replace: page %p already in object", mnew)); + KASSERT(mnew->queue == PQ_NONE, + ("vm_page_replace: new page %p is on a paging queue", mnew)); /* * This function mostly follows vm_page_insert() and @@ -1517,7 +1519,7 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm mnew->pindex = pindex; mold = vm_radix_replace(&object->rtree, mnew); KASSERT(mold->queue == PQ_NONE, - ("vm_page_replace: mold is on a paging queue")); + ("vm_page_replace: old page %p is on a paging queue", mold)); /* Keep the resident page list in sorted order. */ TAILQ_INSERT_AFTER(&object->memq, mold, mnew, listq); From owner-svn-src-all@freebsd.org Sun Mar 18 16:36:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14DFCF61989; Sun, 18 Mar 2018 16:36:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B97BD7A0D9; Sun, 18 Mar 2018 16:36:14 +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 B473422EC5; Sun, 18 Mar 2018 16:36:14 +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 w2IGaEDK066563; Sun, 18 Mar 2018 16:36:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGaErq066562; Sun, 18 Mar 2018 16:36:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181636.w2IGaErq066562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 16:36:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331129 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:36:15 -0000 Author: ian Date: Sun Mar 18 16:36:14 2018 New Revision: 331129 URL: https://svnweb.freebsd.org/changeset/base/331129 Log: Eliminate some unneeded intermediate variables. Eliminate some redundant parens in shift-and-mask expressions. Reword and reflow some comments. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 16:35:40 2018 (r331128) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 16:36:14 2018 (r331129) @@ -280,8 +280,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, struct mx25l_softc *sc; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; - off_t write_offset; - long bytes_to_write, bytes_writen; + off_t bytes_to_write; device_t pdev; int err = 0; @@ -296,9 +295,6 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, cmd.rx_cmd_sz = 4; } - bytes_writen = 0; - write_offset = offset; - /* * Writes must be aligned to the erase sectorsize, since blocks are * fully erased before they're written to. @@ -307,43 +303,37 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, return (EIO); /* - * Maximum write size for CMD_PAGE_PROGRAM is - * FLASH_PAGE_SIZE, so split data to chunks - * FLASH_PAGE_SIZE bytes eash and write them - * one by one + * Maximum write size for CMD_PAGE_PROGRAM is FLASH_PAGE_SIZE, so loop + * to write chunks of FLASH_PAGE_SIZE bytes each. */ - while (bytes_writen < count) { - /* - * If we crossed sector boundary - erase next sector - */ - if (((offset + bytes_writen) % sc->sc_sectorsize) == 0) - mx25l_erase_cmd(dev, offset + bytes_writen, CMD_SECTOR_ERASE); + while (count != 0) { + /* If we crossed a sector boundary, erase the next sector. */ + if (((offset) % sc->sc_sectorsize) == 0) + mx25l_erase_cmd(dev, offset, CMD_SECTOR_ERASE); txBuf[0] = CMD_PAGE_PROGRAM; if (sc->sc_flags & FL_ENABLE_4B_ADDR) { - txBuf[1] = ((write_offset >> 24) & 0xff); - txBuf[2] = ((write_offset >> 16) & 0xff); - txBuf[3] = ((write_offset >> 8) & 0xff); - txBuf[4] = (write_offset & 0xff); + txBuf[1] = (offset >> 24) & 0xff; + txBuf[2] = (offset >> 16) & 0xff; + txBuf[3] = (offset >> 8) & 0xff; + txBuf[4] = offset & 0xff; } else { - txBuf[1] = ((write_offset >> 16) & 0xff); - txBuf[2] = ((write_offset >> 8) & 0xff); - txBuf[3] = (write_offset & 0xff); + txBuf[1] = (offset >> 16) & 0xff; + txBuf[2] = (offset >> 8) & 0xff; + txBuf[3] = offset & 0xff; } - bytes_to_write = MIN(FLASH_PAGE_SIZE, - count - bytes_writen); + bytes_to_write = MIN(FLASH_PAGE_SIZE, count); cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; - cmd.tx_data = data + bytes_writen; - cmd.tx_data_sz = bytes_to_write; + cmd.tx_data = data; cmd.rx_data = sc->sc_dummybuf; - cmd.rx_data_sz = bytes_to_write; + cmd.tx_data_sz = (uint32_t)bytes_to_write; + cmd.rx_data_sz = (uint32_t)bytes_to_write; /* - * Eash completed write operation resets WEL - * (write enable latch) to disabled state, - * so we re-enable it here + * Each completed write operation resets WEL (write enable + * latch) to disabled state, so we re-enable it here. */ mx25l_wait_for_device_ready(dev); mx25l_set_writable(dev, 1); @@ -352,8 +342,9 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, if (err) break; - bytes_writen += bytes_to_write; - write_offset += bytes_to_write; + data += bytes_to_write; + offset += bytes_to_write; + count -= bytes_to_write; } return (err); @@ -372,12 +363,12 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o sc = device_get_softc(dev); /* - * Enforce the disk read sectorsize not the erase sectorsize. - * In this way, smaller read IO is possible,dramatically - * speeding up filesystem/geom_compress access. + * Enforce that reads are aligned to the disk sectorsize, not the + * erase sectorsize. In this way, smaller read IO is possible, + * dramatically speeding up filesystem/geom_compress access. */ - if (count % sc->sc_disk->d_sectorsize != 0 - || offset % sc->sc_disk->d_sectorsize != 0) + if (count % sc->sc_disk->d_sectorsize != 0 || + offset % sc->sc_disk->d_sectorsize != 0) return (EIO); txBuf[0] = CMD_FAST_READ; @@ -385,19 +376,19 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o cmd.tx_cmd_sz = 6; cmd.rx_cmd_sz = 6; - txBuf[1] = ((offset >> 24) & 0xff); - txBuf[2] = ((offset >> 16) & 0xff); - txBuf[3] = ((offset >> 8) & 0xff); - txBuf[4] = (offset & 0xff); + txBuf[1] = (offset >> 24) & 0xff; + txBuf[2] = (offset >> 16) & 0xff; + txBuf[3] = (offset >> 8) & 0xff; + txBuf[4] = offset & 0xff; /* Dummy byte */ txBuf[5] = 0; } else { cmd.tx_cmd_sz = 5; cmd.rx_cmd_sz = 5; - txBuf[1] = ((offset >> 16) & 0xff); - txBuf[2] = ((offset >> 8) & 0xff); - txBuf[3] = (offset & 0xff); + txBuf[1] = (offset >> 16) & 0xff; + txBuf[2] = (offset >> 8) & 0xff; + txBuf[3] = offset & 0xff; /* Dummy byte */ txBuf[4] = 0; } @@ -405,8 +396,8 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; cmd.tx_data = data; - cmd.tx_data_sz = count; cmd.rx_data = data; + cmd.tx_data_sz = count; cmd.rx_data_sz = count; err = SPIBUS_TRANSFER(pdev, dev, &cmd); From owner-svn-src-all@freebsd.org Sun Mar 18 16:40:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECE67F62013; Sun, 18 Mar 2018 16:40:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9906C7A478; Sun, 18 Mar 2018 16:40:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93E3C22EF7; Sun, 18 Mar 2018 16:40:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IGevwO066825; Sun, 18 Mar 2018 16:40:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGevY0066821; Sun, 18 Mar 2018 16:40:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181640.w2IGevY0066821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331130 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 331130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:40:58 -0000 Author: markj Date: Sun Mar 18 16:40:56 2018 New Revision: 331130 URL: https://svnweb.freebsd.org/changeset/base/331130 Log: Have vm_page_{deactivate,launder}() requeue already-queued pages. In many cases the page is not enqueued so the change will have no effect. However, the change is needed to support an optimization in the fault handler and in some cases (sendfile, the buffer cache) it was being emulated by the caller anyway. Reviewed by: alc Tested by: pho MFC after: 2 weeks X-Differential Revision: https://reviews.freebsd.org/D14625 Modified: head/sys/kern/kern_sendfile.c head/sys/kern/vfs_bio.c head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/kern/kern_sendfile.c Sun Mar 18 16:40:56 2018 (r331130) @@ -167,10 +167,8 @@ sendfile_free_page(vm_page_t pg, bool nocache) vm_page_deactivate_noreuse(pg); else if (pg->queue == PQ_ACTIVE) vm_page_reference(pg); - else if (pg->queue != PQ_INACTIVE) - vm_page_deactivate(pg); else - vm_page_requeue(pg); + vm_page_deactivate(pg); } } } Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/kern/vfs_bio.c Sun Mar 18 16:40:56 2018 (r331130) @@ -2936,10 +2936,8 @@ vfs_vmio_unwire(struct buf *bp, vm_page_t m) vm_page_deactivate_noreuse(m); else if (m->queue == PQ_ACTIVE) vm_page_reference(m); - else if (m->queue != PQ_INACTIVE) - vm_page_deactivate(m); else - vm_page_requeue(m); + vm_page_deactivate(m); } } vm_page_unlock(m); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/vm/vm_fault.c Sun Mar 18 16:40:56 2018 (r331130) @@ -1379,7 +1379,8 @@ vm_fault_dontneed(const struct faultstate *fs, vm_offs * active queue. */ vm_page_lock(m); - vm_page_deactivate(m); + if (!vm_page_inactive(m)) + vm_page_deactivate(m); vm_page_unlock(m); } } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/vm/vm_page.c Sun Mar 18 16:40:56 2018 (r331130) @@ -3363,7 +3363,8 @@ vm_page_unwire_noq(vm_page_t m) } /* - * Move the specified page to the inactive queue. + * Move the specified page to the inactive queue, or requeue the page if it is + * already in the inactive queue. * * Normally, "noreuse" is FALSE, resulting in LRU ordering of the inactive * queue. However, setting "noreuse" to TRUE will accelerate the specified @@ -3381,15 +3382,10 @@ _vm_page_deactivate(vm_page_t m, boolean_t noreuse) vm_page_assert_locked(m); - /* - * Ignore if the page is already inactive, unless it is unlikely to be - * reactivated. - */ - if ((queue = m->queue) == PQ_INACTIVE && !noreuse) - return; if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) { pq = &vm_pagequeue_domain(m)->vmd_pagequeues[PQ_INACTIVE]; /* Avoid multiple acquisitions of the inactive queue lock. */ + queue = m->queue; if (queue == PQ_INACTIVE) { vm_pagequeue_lock(pq); vm_page_dequeue_locked(m); @@ -3411,7 +3407,8 @@ _vm_page_deactivate(vm_page_t m, boolean_t noreuse) } /* - * Move the specified page to the inactive queue. + * Move the specified page to the inactive queue, or requeue the page if it is + * already in the inactive queue. * * The page must be locked. */ @@ -3438,19 +3435,20 @@ vm_page_deactivate_noreuse(vm_page_t m) /* * vm_page_launder * - * Put a page in the laundry. + * Put a page in the laundry, or requeue it if it is already there. */ void vm_page_launder(vm_page_t m) { - int queue; vm_page_assert_locked(m); - if ((queue = m->queue) != PQ_LAUNDRY && m->wire_count == 0 && - (m->oflags & VPO_UNMANAGED) == 0) { - if (queue != PQ_NONE) - vm_page_dequeue(m); - vm_page_enqueue(PQ_LAUNDRY, m); + if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) { + if (m->queue == PQ_LAUNDRY) + vm_page_requeue(m); + else { + vm_page_remque(m); + vm_page_enqueue(PQ_LAUNDRY, m); + } } } @@ -3540,7 +3538,7 @@ vm_page_advise(vm_page_t m, int advice) */ if (m->dirty == 0) vm_page_deactivate_noreuse(m); - else + else if (!vm_page_in_laundry(m)) vm_page_launder(m); } From owner-svn-src-all@freebsd.org Sun Mar 18 16:49:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 062EAF628C7; Sun, 18 Mar 2018 16:49:31 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 986817A9AB; Sun, 18 Mar 2018 16:49:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 900F82306C; Sun, 18 Mar 2018 16:49:30 +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 w2IGnUNv071780; Sun, 18 Mar 2018 16:49:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGnULZ071778; Sun, 18 Mar 2018 16:49:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181649.w2IGnULZ071778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:49:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331131 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:49:31 -0000 Author: markj Date: Sun Mar 18 16:49:30 2018 New Revision: 331131 URL: https://svnweb.freebsd.org/changeset/base/331131 Log: Avoid dequeuing the fault page during a soft fault. Such pages are re-enqueued at the end of the fault handler, preserving LRU. Rather than performing two separate operations per fault, simply requeue the page at the end of the fault (or bump its activation count if it resides in PQ_ACTIVE, avoiding the page queue lock entirely). This elides some page lock and page queue lock operations in common cases, e.g., CoW faults. Note that we must still dequeue the source page for "optimized" CoW faults since the page may not remain enqueued while it is moved to another object. Reviewed by: alc, kib Tested by: pho MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14625 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Mar 18 16:40:56 2018 (r331130) +++ head/sys/vm/vm_fault.c Sun Mar 18 16:49:30 2018 (r331131) @@ -682,7 +682,7 @@ RetryFault:; /* * Reference the page before unlocking and * sleeping so that the page daemon is less - * likely to reclaim it. + * likely to reclaim it. */ vm_page_aflag_set(fs.m, PGA_REFERENCED); if (fs.object != fs.first_object) { @@ -710,9 +710,6 @@ RetryFault:; vm_object_deallocate(fs.first_object); goto RetryFault; } - vm_page_lock(fs.m); - vm_page_remque(fs.m); - vm_page_unlock(fs.m); /* * Mark page busy for other processes, and the @@ -723,7 +720,7 @@ RetryFault:; vm_page_xbusy(fs.m); if (fs.m->valid != VM_PAGE_BITS_ALL) goto readrest; - break; + break; /* break to PAGE HAS BEEN FOUND */ } KASSERT(fs.m == NULL, ("fs.m should be NULL, not %p", fs.m)); @@ -1105,6 +1102,7 @@ readrest: */ fs.object == fs.first_object->backing_object) { vm_page_lock(fs.m); + vm_page_remque(fs.m); vm_page_remove(fs.m); vm_page_unlock(fs.m); vm_page_lock(fs.first_m); From owner-svn-src-all@freebsd.org Sun Mar 18 16:52:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27730F62D05; Sun, 18 Mar 2018 16:52:32 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2B5B7AE84; Sun, 18 Mar 2018 16:52:31 +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 9D473231EE; Sun, 18 Mar 2018 16:52:31 +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 w2IGqVUn076646; Sun, 18 Mar 2018 16:52:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGqVve076645; Sun, 18 Mar 2018 16:52:31 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181652.w2IGqVve076645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 16:52:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331132 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:52:32 -0000 Author: ian Date: Sun Mar 18 16:52:31 2018 New Revision: 331132 URL: https://svnweb.freebsd.org/changeset/base/331132 Log: Bugfix: wait for writes/erases to complete after starting them, instead of before starting them. Using the wait-before logic would make sense if there was useful time- consuming work that could be done between the end of one write and the beginning of the next, but it also requires doing the wait-for-ready before reading, because a prior write or erase could still be in progress. Reading is the far more common case, so adding a whole extra bus transaction to check for ready before each read would soak up any small gains that might be had from doing async writes. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 16:49:30 2018 (r331131) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 16:52:31 2018 (r331132) @@ -247,7 +247,6 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ec sc = device_get_softc(dev); - mx25l_wait_for_device_ready(dev); mx25l_set_writable(dev, 1); memset(&cmd, 0, sizeof(cmd)); @@ -272,6 +271,7 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ec txBuf[3] = (sector & 0xff); } err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + mx25l_wait_for_device_ready(dev); } static int @@ -339,6 +339,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, mx25l_set_writable(dev, 1); err = SPIBUS_TRANSFER(pdev, dev, &cmd); + mx25l_wait_for_device_ready(dev); if (err) break; From owner-svn-src-all@freebsd.org Sun Mar 18 16:57:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C587BF6322D; Sun, 18 Mar 2018 16:57:40 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 76F047B10F; Sun, 18 Mar 2018 16:57:40 +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 71ADC231FA; Sun, 18 Mar 2018 16:57:40 +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 w2IGve67076909; Sun, 18 Mar 2018 16:57:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGveqY076908; Sun, 18 Mar 2018 16:57:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181657.w2IGveqY076908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331133 - stable/11/lib/libc/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/lib/libc/sys X-SVN-Commit-Revision: 331133 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:57:41 -0000 Author: markj Date: Sun Mar 18 16:57:40 2018 New Revision: 331133 URL: https://svnweb.freebsd.org/changeset/base/331133 Log: MFC r331016: Add a space between a section number and a following comma. Modified: stable/11/lib/libc/sys/sendfile.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/sendfile.2 ============================================================================== --- stable/11/lib/libc/sys/sendfile.2 Sun Mar 18 16:52:31 2018 (r331132) +++ stable/11/lib/libc/sys/sendfile.2 Sun Mar 18 16:57:40 2018 (r331133) @@ -129,8 +129,8 @@ Starting with .Nm sending files off the .Xr ffs 7 -filesystem doesn't block on I/O -(see +filesystem does not block on I/O +(see .Sx IMPLEMENTATION NOTES ), so the condition no longer applies. However, it is safe if an application utilizes @@ -140,8 +140,8 @@ and on performs the same action as it did in older .Fx -versions, e.g. -.Xr aio_read 2, +versions, e.g., +.Xr aio_read 2 , .Xr read 2 or .Nm @@ -188,7 +188,7 @@ The .Fx implementation of .Fn sendfile -doesn't block on disk I/O when it sends a file off the +does not block on disk I/O when it sends a file off the .Xr ffs 7 filesystem. The syscall returns success before the actual I/O completes, and data From owner-svn-src-all@freebsd.org Sun Mar 18 17:01:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E6C9F638A3; Sun, 18 Mar 2018 17:01: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FF9C7B61E; Sun, 18 Mar 2018 17:01: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 2B0EB23264; Sun, 18 Mar 2018 17:01: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 w2IH1pd6080399; Sun, 18 Mar 2018 17:01:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IH1pY2080398; Sun, 18 Mar 2018 17:01:51 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181701.w2IH1pY2080398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 17:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331134 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Commit-Revision: 331134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:01:51 -0000 Author: markj Date: Sun Mar 18 17:01:50 2018 New Revision: 331134 URL: https://svnweb.freebsd.org/changeset/base/331134 Log: Fix an access of an uninitialized variable in dtrace_probe(). Reported by: Coverity, via cem MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun Mar 18 16:57:40 2018 (r331133) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun Mar 18 17:01:50 2018 (r331134) @@ -7318,7 +7318,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t } now = mstate.dtms_timestamp = dtrace_gethrtime(); - mstate.dtms_present |= DTRACE_MSTATE_TIMESTAMP; + mstate.dtms_present = DTRACE_MSTATE_TIMESTAMP; vtime = dtrace_vtime_references != 0; if (vtime && curthread->t_dtrace_start) From owner-svn-src-all@freebsd.org Sun Mar 18 17:03:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB4F3F63A98; Sun, 18 Mar 2018 17:03:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 959357B951; Sun, 18 Mar 2018 17:03:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9083C23387; Sun, 18 Mar 2018 17:03:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IH3Q5U082087; Sun, 18 Mar 2018 17:03:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IH3QgB082086; Sun, 18 Mar 2018 17:03:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181703.w2IH3QgB082086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 17:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331135 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall X-SVN-Commit-Revision: 331135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:03:27 -0000 Author: markj Date: Sun Mar 18 17:03:26 2018 New Revision: 331135 URL: https://svnweb.freebsd.org/changeset/base/331135 Log: Use __syscall(2) rather than syscall(2) in syscall/tst.args.c. Some of mmap(2)'s arguments are 64 bits wide. MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Sun Mar 18 17:01:50 2018 (r331134) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Sun Mar 18 17:03:26 2018 (r331135) @@ -35,7 +35,7 @@ int main(int argc, char **argv) { for (;;) { - (void) syscall(SYS_mmap, NULL, 1, 2, 3, -1, 0x12345678); + (void) __syscall(SYS_mmap, NULL, 1, 2, 3, -1, 0x12345678); } return (0); From owner-svn-src-all@freebsd.org Sun Mar 18 17:07:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62288F63F4C; Sun, 18 Mar 2018 17:07:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pl0-x234.google.com (mail-pl0-x234.google.com [IPv6:2607:f8b0:400e:c01::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 585297BBE3; Sun, 18 Mar 2018 17:07:44 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pl0-x234.google.com with SMTP id b7-v6so4746296plr.8; Sun, 18 Mar 2018 10:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vkexWCvhXOJqY6qQ4TOZi/ES5aTwML9BqgL7SoMys/U=; b=EmkbCVLmVMBwd/BUTqeBY0Wkp+qqSbo71+i7n7mgoRUqW6DWt3HM+O97OfjpYHnXKm R+wl2r+lXAxneoh/MNCuIIn0Q5m96Vll/8UCFKiOh+8ZjT8Mx2rjX2i9N4C0qv8lCksB 1h5JU2r7zuMlTRJuHk4n5do4efFuwbsf1WitbWxvrPUGPdR5BmXxVoPuAZwxGUL6a0wk d/nd+e/9Vt15RuYgKnGi+AmdjWBv2+cKpKqhmJ5hZdYKN4NSetvH8yg5gKJtdPx04zT/ t64R8XUri/g/eja5MzfF1Xc/30GbQA03i3F9pwuMCwnbgtjwnDhiTHLVE7x7IDFPJyUw VrFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=vkexWCvhXOJqY6qQ4TOZi/ES5aTwML9BqgL7SoMys/U=; b=OhpphuUZq+l2qDxx/XW1If6ftSB9WIG3kc5OCQ98OgNunRQdBJqGE1rGq5gB+pUFsi XO0wPavyhsoao7Tj7U94UYJFtPiq3iiq7kicOkm3w+jgxN3UEWdqjuhnyGd9QHnpoOWb CQgewjsH6zYKn/4+SmsJK+xUjj3BCRqI4PoNYiUVVclANyj7a3bKhYUktsxV8tjMG/2J uMSvK2dcFVL+3sPXiROhXW49hiN4t03yLX1e40Hvu9EkX2msDFsqRxPD2PRbAE2oQfou x9Oxtck8gwt7TYRe1UOAT3cgvimaxJDh3bj/R6zx/kUbG0PHNN67uqsbepeMK3S1QMZ+ KM1A== X-Gm-Message-State: AElRT7GQqc5i0xVN5FJdHZN7s8HeynHIOaJ53XnmgXeUZ2rSF5somPbA /FB0zRcCcmrbXc46j7P3GFb8Og== X-Google-Smtp-Source: AG47ELvZMiVfIB0MEcpEI0LAK1MUy5G6E5DUnz3WySAnkqfU8KVD1jGBSKvJDwT0J8dxvUwqgQyW8Q== X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr9468788pla.328.1521392862804; Sun, 18 Mar 2018 10:07:42 -0700 (PDT) Received: from raichu (toroon0560w-lp130-01-174-88-76-226.dsl.bell.ca. [174.88.76.226]) by smtp.gmail.com with ESMTPSA id o86sm27065601pfi.87.2018.03.18.10.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Mar 2018 10:07:41 -0700 (PDT) Sender: Mark Johnston Date: Sun, 18 Mar 2018 13:07:38 -0400 From: Mark Johnston To: Mariusz Zaborski Cc: Mark Linimon , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r325739 - in head: lib/libcasper/services lib/libcasper/services/cap_syslog share/mk Message-ID: <20180318170738.GB35894@raichu> References: <201711120834.vAC8YQUq006611@repo.freebsd.org> <20180305161358.GA704@raichu> <20180305171916.GA2359@lonesome.com> <20180318142039.GA81224@x-wing> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180318142039.GA81224@x-wing> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:07:47 -0000 On Sun, Mar 18, 2018 at 03:20:39PM +0100, Mariusz Zaborski wrote: > On Mon, Mar 05, 2018 at 11:19:16AM -0600, Mark Linimon wrote: > > On Mon, Mar 05, 2018 at 11:13:58AM -0500, Mark Johnston wrote: > > > The growing divergence with stable/11 makes it rather painful to > > > maintain a port, depending on libcasper, that aims to work on both 11 > > > and head. > > > > Even an MFC won't help you, in the medium-term. > > > > e.g. via https://www.freebsd.org/security/#sup, even if the MFC made it > > into 11.2, you would still have several months of supporting the old > > one. (The FreeBSD package builds are based on the oldest supported > > point release from a branch.) The current estimate for 11.2 is late June. > > > > mcl > > Hi, > > Sorry for delay I just get back. > > Yes I can integrate all my changes in libcasper and I guess libcapsicum. > I'm did do a lot of integrations to stable so I have one question - > if I understand correctly all changes which change API/ABI but are > pointed as SHLIB_MAJOR I can safety integrate. > > Mark what else can I do? Sorry, I don't quite follow. I don't think SHLIB_MAJOR bumps can be MFCed: what happens if an SA is later released for the library in question? From owner-svn-src-all@freebsd.org Sun Mar 18 17:25:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D478F65286; Sun, 18 Mar 2018 17:25:24 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F0D17CA48; Sun, 18 Mar 2018 17:25:24 +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 2A02C236A9; Sun, 18 Mar 2018 17:25:24 +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 w2IHPOwJ092438; Sun, 18 Mar 2018 17:25:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IHPOVc092437; Sun, 18 Mar 2018 17:25:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181725.w2IHPOVc092437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 17:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331136 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:25:24 -0000 Author: ian Date: Sun Mar 18 17:25:23 2018 New Revision: 331136 URL: https://svnweb.freebsd.org/changeset/base/331136 Log: Add sc_parent to the softc and use it in place of device_get_parent() calls all over the place. Also pass the softc as the arg to all the internal functions instead of passing a device_t and calling device_get_softc() in each function. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 17:03:26 2018 (r331135) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 17:25:23 2018 (r331136) @@ -81,6 +81,7 @@ struct mx25l_flash_ident struct mx25l_softc { device_t sc_dev; + device_t sc_parent; uint8_t sc_manufacturer_id; uint16_t sc_device_id; unsigned int sc_sectorsize; @@ -150,7 +151,7 @@ struct mx25l_flash_ident flash_devices[] = { }; static uint8_t -mx25l_get_status(device_t dev) +mx25l_get_status(struct mx25l_softc *sc) { uint8_t txBuf[2], rxBuf[2]; struct spi_command cmd; @@ -165,21 +166,20 @@ mx25l_get_status(device_t dev) cmd.rx_cmd = rxBuf; cmd.rx_cmd_sz = 2; cmd.tx_cmd_sz = 2; - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); return (rxBuf[1]); } static void -mx25l_wait_for_device_ready(device_t dev) +mx25l_wait_for_device_ready(struct mx25l_softc *sc) { - while ((mx25l_get_status(dev) & STATUS_WIP)) + while ((mx25l_get_status(sc) & STATUS_WIP)) continue; } static struct mx25l_flash_ident* mx25l_get_device_ident(struct mx25l_softc *sc) { - device_t dev = sc->sc_dev; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; uint8_t manufacturer_id; @@ -199,7 +199,7 @@ mx25l_get_device_ident(struct mx25l_softc *sc) */ cmd.tx_cmd_sz = 4; cmd.rx_cmd_sz = 4; - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); if (err) return (NULL); @@ -213,13 +213,14 @@ mx25l_get_device_ident(struct mx25l_softc *sc) return &flash_devices[i]; } - printf("Unknown SPI flash device. Vendor: %02x, device id: %04x\n", + device_printf(sc->sc_dev, + "Unknown SPI flash device. Vendor: %02x, device id: %04x\n", manufacturer_id, dev_id); return (NULL); } static void -mx25l_set_writable(device_t dev, int writable) +mx25l_set_writable(struct mx25l_softc *sc, int writable) { uint8_t txBuf[1], rxBuf[1]; struct spi_command cmd; @@ -234,21 +235,18 @@ mx25l_set_writable(device_t dev, int writable) cmd.rx_cmd = rxBuf; cmd.rx_cmd_sz = 1; cmd.tx_cmd_sz = 1; - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); } static void -mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ecmd) +mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, uint8_t ecmd) { - struct mx25l_softc *sc; uint8_t txBuf[5], rxBuf[5]; struct spi_command cmd; int err; - sc = device_get_softc(dev); + mx25l_set_writable(sc, 1); - mx25l_set_writable(dev, 1); - memset(&cmd, 0, sizeof(cmd)); memset(txBuf, 0, sizeof(txBuf)); memset(rxBuf, 0, sizeof(rxBuf)); @@ -270,23 +268,18 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ec txBuf[2] = ((sector >> 8) & 0xff); txBuf[3] = (sector & 0xff); } - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); - mx25l_wait_for_device_ready(dev); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + mx25l_wait_for_device_ready(sc); } static int -mx25l_write(device_t dev, off_t offset, caddr_t data, off_t count) +mx25l_write(struct mx25l_softc *sc, off_t offset, caddr_t data, off_t count) { - struct mx25l_softc *sc; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; off_t bytes_to_write; - device_t pdev; int err = 0; - pdev = device_get_parent(dev); - sc = device_get_softc(dev); - if (sc->sc_flags & FL_ENABLE_4B_ADDR) { cmd.tx_cmd_sz = 5; cmd.rx_cmd_sz = 5; @@ -309,7 +302,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, while (count != 0) { /* If we crossed a sector boundary, erase the next sector. */ if (((offset) % sc->sc_sectorsize) == 0) - mx25l_erase_cmd(dev, offset, CMD_SECTOR_ERASE); + mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); txBuf[0] = CMD_PAGE_PROGRAM; if (sc->sc_flags & FL_ENABLE_4B_ADDR) { @@ -335,11 +328,11 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, * Each completed write operation resets WEL (write enable * latch) to disabled state, so we re-enable it here. */ - mx25l_wait_for_device_ready(dev); - mx25l_set_writable(dev, 1); + mx25l_wait_for_device_ready(sc); + mx25l_set_writable(sc, 1); - err = SPIBUS_TRANSFER(pdev, dev, &cmd); - mx25l_wait_for_device_ready(dev); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + mx25l_wait_for_device_ready(sc); if (err) break; @@ -352,17 +345,12 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, } static int -mx25l_read(device_t dev, off_t offset, caddr_t data, off_t count) +mx25l_read(struct mx25l_softc *sc, off_t offset, caddr_t data, off_t count) { - struct mx25l_softc *sc; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; - device_t pdev; int err = 0; - pdev = device_get_parent(dev); - sc = device_get_softc(dev); - /* * Enforce that reads are aligned to the disk sectorsize, not the * erase sectorsize. In this way, smaller read IO is possible, @@ -401,25 +389,22 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o cmd.tx_data_sz = count; cmd.rx_data_sz = count; - err = SPIBUS_TRANSFER(pdev, dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); return (err); } static int -mx25l_set_4b_mode(device_t dev, uint8_t command) +mx25l_set_4b_mode(struct mx25l_softc *sc, uint8_t command) { uint8_t txBuf[1], rxBuf[1]; struct spi_command cmd; - device_t pdev; int err; memset(&cmd, 0, sizeof(cmd)); memset(txBuf, 0, sizeof(txBuf)); memset(rxBuf, 0, sizeof(rxBuf)); - pdev = device_get_parent(dev); - cmd.tx_cmd_sz = cmd.rx_cmd_sz = 1; cmd.tx_cmd = txBuf; @@ -427,9 +412,9 @@ mx25l_set_4b_mode(device_t dev, uint8_t command) txBuf[0] = command; - err = SPIBUS_TRANSFER(pdev, dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - mx25l_wait_for_device_ready(dev); + mx25l_wait_for_device_ready(sc); return (err); } @@ -479,13 +464,15 @@ mx25l_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; + sc->sc_parent = device_get_parent(sc->sc_dev); + M25PXX_LOCK_INIT(sc); ident = mx25l_get_device_ident(sc); if (ident == NULL) return (ENXIO); - mx25l_wait_for_device_ready(sc->sc_dev); + mx25l_wait_for_device_ready(sc); sc->sc_disk = disk_alloc(); sc->sc_disk->d_open = mx25l_open; @@ -505,10 +492,10 @@ mx25l_attach(device_t dev) sc->sc_flags = ident->flags; if (sc->sc_flags & FL_ENABLE_4B_ADDR) - mx25l_set_4b_mode(dev, CMD_ENTER_4B_MODE); + mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE); if (sc->sc_flags & FL_DISABLE_4B_ADDR) - mx25l_set_4b_mode(dev, CMD_EXIT_4B_MODE); + mx25l_set_4b_mode(sc, CMD_EXIT_4B_MODE); /* NB: use stripesize to hold the erase/region size for RedBoot */ sc->sc_disk->d_stripesize = ident->sectorsize; @@ -542,7 +529,7 @@ mx25l_detach(device_t dev) err = msleep(sc, &sc->sc_mtx, 0, "mx25dt", hz * 3); if (err != 0) { sc->sc_taskstate = TSTATE_RUNNING; - device_printf(dev, + device_printf(sc->sc_dev, "Failed to stop queue task\n"); } } @@ -637,11 +624,11 @@ mx25l_task(void *arg) switch (bp->bio_cmd) { case BIO_READ: - bp->bio_error = mx25l_read(dev, bp->bio_offset, + bp->bio_error = mx25l_read(sc, bp->bio_offset, bp->bio_data, bp->bio_bcount); break; case BIO_WRITE: - bp->bio_error = mx25l_write(dev, bp->bio_offset, + bp->bio_error = mx25l_write(sc, bp->bio_offset, bp->bio_data, bp->bio_bcount); break; default: From owner-svn-src-all@freebsd.org Sun Mar 18 17:27:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBF10F654A8; Sun, 18 Mar 2018 17:27:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D59B7CC2F; Sun, 18 Mar 2018 17:27:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71B0E236AB; Sun, 18 Mar 2018 17:27:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IHRbSU092554; Sun, 18 Mar 2018 17:27:37 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IHRbwm092553; Sun, 18 Mar 2018 17:27:37 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181727.w2IHRbwm092553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 17:27:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331137 - head/lib/libcasper/services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_sysctl X-SVN-Commit-Revision: 331137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:27:38 -0000 Author: oshogbo Date: Sun Mar 18 17:27:37 2018 New Revision: 331137 URL: https://svnweb.freebsd.org/changeset/base/331137 Log: Fix reference to man page in Makefile. I broke it in r331120. Modified: head/lib/libcasper/services/cap_sysctl/Makefile Modified: head/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 17:25:23 2018 (r331136) +++ head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 17:27:37 2018 (r331137) @@ -24,7 +24,7 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests -MAN+= cap_sysctl +MAN+= cap_sysctl.3 MLINKS+=cap_sysctl.3 libcap_sysctl.3 MLINKS+=cap_sysctl.3 cap_sysctlbyname.3 From owner-svn-src-all@freebsd.org Sun Mar 18 17:47:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B726F670E3; Sun, 18 Mar 2018 17:47:58 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A30527DFEC; Sun, 18 Mar 2018 17:47:57 +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 9D028239E2; Sun, 18 Mar 2018 17:47:57 +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 w2IHlveq003012; Sun, 18 Mar 2018 17:47:57 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IHlvBW003011; Sun, 18 Mar 2018 17:47:57 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181747.w2IHlvBW003011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 17:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331138 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:47:58 -0000 Author: ian Date: Sun Mar 18 17:47:57 2018 New Revision: 331138 URL: https://svnweb.freebsd.org/changeset/base/331138 Log: Make all internal routines return an int error status, and check the status at all call points. Combine the get_status and wait_for_ready routines, since waiting for ready is the only reason to ever get status. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 17:27:37 2018 (r331137) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 17:47:57 2018 (r331138) @@ -150,31 +150,25 @@ struct mx25l_flash_ident flash_devices[] = { { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, }; -static uint8_t -mx25l_get_status(struct mx25l_softc *sc) +static int +mx25l_wait_for_device_ready(struct mx25l_softc *sc) { uint8_t txBuf[2], rxBuf[2]; struct spi_command cmd; int err; memset(&cmd, 0, sizeof(cmd)); - memset(txBuf, 0, sizeof(txBuf)); - memset(rxBuf, 0, sizeof(rxBuf)); - txBuf[0] = CMD_READ_STATUS; - cmd.tx_cmd = txBuf; - cmd.rx_cmd = rxBuf; - cmd.rx_cmd_sz = 2; - cmd.tx_cmd_sz = 2; - err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - return (rxBuf[1]); -} + do { + txBuf[0] = CMD_READ_STATUS; + cmd.tx_cmd = txBuf; + cmd.rx_cmd = rxBuf; + cmd.rx_cmd_sz = 2; + cmd.tx_cmd_sz = 2; + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + } while (err == 0 && (rxBuf[1] & STATUS_WIP)); -static void -mx25l_wait_for_device_ready(struct mx25l_softc *sc) -{ - while ((mx25l_get_status(sc) & STATUS_WIP)) - continue; + return (err); } static struct mx25l_flash_ident* @@ -206,8 +200,7 @@ mx25l_get_device_ident(struct mx25l_softc *sc) manufacturer_id = rxBuf[1]; dev_id = (rxBuf[2] << 8) | (rxBuf[3]); - for (i = 0; - i < nitems(flash_devices); i++) { + for (i = 0; i < nitems(flash_devices); i++) { if ((flash_devices[i].manufacturer_id == manufacturer_id) && (flash_devices[i].device_id == dev_id)) return &flash_devices[i]; @@ -219,7 +212,7 @@ mx25l_get_device_ident(struct mx25l_softc *sc) return (NULL); } -static void +static int mx25l_set_writable(struct mx25l_softc *sc, int writable) { uint8_t txBuf[1], rxBuf[1]; @@ -236,16 +229,18 @@ mx25l_set_writable(struct mx25l_softc *sc, int writabl cmd.rx_cmd_sz = 1; cmd.tx_cmd_sz = 1; err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + return (err); } -static void +static int mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, uint8_t ecmd) { uint8_t txBuf[5], rxBuf[5]; struct spi_command cmd; int err; - mx25l_set_writable(sc, 1); + if ((err = mx25l_set_writable(sc, 1)) != 0) + return (err); memset(&cmd, 0, sizeof(cmd)); memset(txBuf, 0, sizeof(txBuf)); @@ -268,8 +263,10 @@ mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, txBuf[2] = ((sector >> 8) & 0xff); txBuf[3] = (sector & 0xff); } - err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - mx25l_wait_for_device_ready(sc); + if ((err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd)) != 0) + return (err); + err = mx25l_wait_for_device_ready(sc); + return (err); } static int @@ -301,8 +298,11 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd */ while (count != 0) { /* If we crossed a sector boundary, erase the next sector. */ - if (((offset) % sc->sc_sectorsize) == 0) - mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); + if (((offset) % sc->sc_sectorsize) == 0) { + err = mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); + if (err) + break; + } txBuf[0] = CMD_PAGE_PROGRAM; if (sc->sc_flags & FL_ENABLE_4B_ADDR) { @@ -328,11 +328,15 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd * Each completed write operation resets WEL (write enable * latch) to disabled state, so we re-enable it here. */ - mx25l_wait_for_device_ready(sc); - mx25l_set_writable(sc, 1); + if ((err = mx25l_wait_for_device_ready(sc)) != 0) + break; + if ((err = mx25l_set_writable(sc, 1)) != 0) + break; err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - mx25l_wait_for_device_ready(sc); + if (err != 0) + break; + err = mx25l_wait_for_device_ready(sc); if (err) break; @@ -390,7 +394,6 @@ mx25l_read(struct mx25l_softc *sc, off_t offset, caddr cmd.rx_data_sz = count; err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - return (err); } @@ -412,10 +415,9 @@ mx25l_set_4b_mode(struct mx25l_softc *sc, uint8_t comm txBuf[0] = command; - err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + if ((err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd)) == 0) + err = mx25l_wait_for_device_ready(sc); - mx25l_wait_for_device_ready(sc); - return (err); } @@ -461,6 +463,7 @@ mx25l_attach(device_t dev) { struct mx25l_softc *sc; struct mx25l_flash_ident *ident; + int err; sc = device_get_softc(dev); sc->sc_dev = dev; @@ -472,8 +475,17 @@ mx25l_attach(device_t dev) if (ident == NULL) return (ENXIO); - mx25l_wait_for_device_ready(sc); + if ((err = mx25l_wait_for_device_ready(sc)) != 0) + return (err); + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { + if ((err = mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE)) != 0) + return (err); + } else if (sc->sc_flags & FL_DISABLE_4B_ADDR) { + if ((err = mx25l_set_4b_mode(sc, CMD_EXIT_4B_MODE)) != 0) + return (err); + } + sc->sc_disk = disk_alloc(); sc->sc_disk->d_open = mx25l_open; sc->sc_disk->d_close = mx25l_close; @@ -491,13 +503,7 @@ mx25l_attach(device_t dev) sc->sc_sectorsize = ident->sectorsize; sc->sc_flags = ident->flags; - if (sc->sc_flags & FL_ENABLE_4B_ADDR) - mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE); - - if (sc->sc_flags & FL_DISABLE_4B_ADDR) - mx25l_set_4b_mode(sc, CMD_EXIT_4B_MODE); - - /* NB: use stripesize to hold the erase/region size for RedBoot */ + /* NB: use stripesize to hold the erase/region size for RedBoot */ sc->sc_disk->d_stripesize = ident->sectorsize; disk_create(sc->sc_disk, DISK_VERSION); From owner-svn-src-all@freebsd.org Sun Mar 18 18:37:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB4CFF423AD; Sun, 18 Mar 2018 18:37:47 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F74E801AC; Sun, 18 Mar 2018 18:37:47 +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 79E672421F; Sun, 18 Mar 2018 18:37:47 +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 w2IIblJM027803; Sun, 18 Mar 2018 18:37:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IIblcd027802; Sun, 18 Mar 2018 18:37:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181837.w2IIblcd027802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 18:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331139 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 18:37:48 -0000 Author: ian Date: Sun Mar 18 18:37:47 2018 New Revision: 331139 URL: https://svnweb.freebsd.org/changeset/base/331139 Log: Add support for 4K and 32K erase block sizes. Many of the supported chips have these flags set in the ident table, but there was no code to support using the smaller erase sizes. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 17:47:57 2018 (r331138) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 18:37:47 2018 (r331139) @@ -84,7 +84,7 @@ struct mx25l_softc device_t sc_parent; uint8_t sc_manufacturer_id; uint16_t sc_device_id; - unsigned int sc_sectorsize; + unsigned int sc_erasesize; struct mtx sc_mtx; struct disk *sc_disk; struct proc *sc_p; @@ -233,7 +233,7 @@ mx25l_set_writable(struct mx25l_softc *sc, int writabl } static int -mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, uint8_t ecmd) +mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector) { uint8_t txBuf[5], rxBuf[5]; struct spi_command cmd; @@ -246,9 +246,16 @@ mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, memset(txBuf, 0, sizeof(txBuf)); memset(rxBuf, 0, sizeof(rxBuf)); - txBuf[0] = ecmd; cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; + + if (sc->sc_flags & FL_ERASE_4K) + txBuf[0] = CMD_BLOCK_4K_ERASE; + else if (sc->sc_flags & FL_ERASE_32K) + txBuf[0] = CMD_BLOCK_32K_ERASE; + else + txBuf[0] = CMD_SECTOR_ERASE; + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { cmd.rx_cmd_sz = 5; cmd.tx_cmd_sz = 5; @@ -289,7 +296,7 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd * Writes must be aligned to the erase sectorsize, since blocks are * fully erased before they're written to. */ - if (count % sc->sc_sectorsize != 0 || offset % sc->sc_sectorsize != 0) + if (count % sc->sc_erasesize != 0 || offset % sc->sc_erasesize != 0) return (EIO); /* @@ -298,8 +305,8 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd */ while (count != 0) { /* If we crossed a sector boundary, erase the next sector. */ - if (((offset) % sc->sc_sectorsize) == 0) { - err = mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); + if (((offset) % sc->sc_erasesize) == 0) { + err = mx25l_erase_cmd(sc, offset); if (err) break; } @@ -478,6 +485,15 @@ mx25l_attach(device_t dev) if ((err = mx25l_wait_for_device_ready(sc)) != 0) return (err); + sc->sc_flags = ident->flags; + + if (sc->sc_flags & FL_ERASE_4K) + sc->sc_erasesize = 4 * 1024; + else if (sc->sc_flags & FL_ERASE_32K) + sc->sc_erasesize = 32 * 1024; + else + sc->sc_erasesize = ident->sectorsize; + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { if ((err = mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE)) != 0) return (err); @@ -497,14 +513,9 @@ mx25l_attach(device_t dev) sc->sc_disk->d_maxsize = DFLTPHYS; sc->sc_disk->d_sectorsize = MX25L_SECTORSIZE; sc->sc_disk->d_mediasize = ident->sectorsize * ident->sectorcount; + sc->sc_disk->d_stripesize = sc->sc_erasesize; sc->sc_disk->d_unit = device_get_unit(sc->sc_dev); sc->sc_disk->d_dump = NULL; /* NB: no dumps */ - /* Sectorsize for erase operations */ - sc->sc_sectorsize = ident->sectorsize; - sc->sc_flags = ident->flags; - - /* NB: use stripesize to hold the erase/region size for RedBoot */ - sc->sc_disk->d_stripesize = ident->sectorsize; disk_create(sc->sc_disk, DISK_VERSION); bioq_init(&sc->sc_bio_queue); From owner-svn-src-all@freebsd.org Sun Mar 18 18:50:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21DA1F46635; Sun, 18 Mar 2018 18:50:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF71780A11; Sun, 18 Mar 2018 18:50:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6D9A244B7; Sun, 18 Mar 2018 18:50:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IIomfa033163; Sun, 18 Mar 2018 18:50:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IIom80033162; Sun, 18 Mar 2018 18:50:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803181850.w2IIom80033162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 18 Mar 2018 18:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331140 - head/stand X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand X-SVN-Commit-Revision: 331140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 18:50:49 -0000 Author: imp Date: Sun Mar 18 18:50:48 2018 New Revision: 331140 URL: https://svnweb.freebsd.org/changeset/base/331140 Log: Don't add links or cleanfiles for NO_OBJ case, in addition to not creating them. Move them under the if after the all: target. They are just defines, so it doesn't really matter where we have them. MFC After: 3 days Modified: head/stand/defs.mk Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Sun Mar 18 18:37:47 2018 (r331139) +++ head/stand/defs.mk Sun Mar 18 18:50:48 2018 (r331140) @@ -152,6 +152,9 @@ CFLAGS+= -mlittle-endian # Make sure we use the machine link we're about to create CFLAGS+=-I. +all: ${PROG} + +.if !defined(NO_OBJ) _ILINKS=machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=${MACHINE_CPUARCH} @@ -161,9 +164,6 @@ _ILINKS+=x86 .endif CLEANFILES+=${_ILINKS} -all: ${PROG} - -.if !defined(NO_OBJ) beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} @@ -172,7 +172,7 @@ beforebuild: ${_ILINKS} .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) ${OBJS}: ${_link} -.endif +.endif # _link exists .endfor .NOPATH: ${_ILINKS} @@ -191,5 +191,5 @@ ${_ILINKS}: path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET:T} "->" $$path ; \ ln -fhs $$path ${.TARGET:T} -.endif +.endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ From owner-svn-src-all@freebsd.org Sun Mar 18 18:58:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AD1DF4A3C6; Sun, 18 Mar 2018 18:58: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE72D811EC; Sun, 18 Mar 2018 18:58:47 +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 C969124538; Sun, 18 Mar 2018 18:58:47 +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 w2IIwl5Y037830; Sun, 18 Mar 2018 18:58:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IIwlg8037829; Sun, 18 Mar 2018 18:58:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181858.w2IIwlg8037829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 18:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331141 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 18:58:48 -0000 Author: ian Date: Sun Mar 18 18:58:47 2018 New Revision: 331141 URL: https://svnweb.freebsd.org/changeset/base/331141 Log: Add the device/chip type to the disk d_descr field, and print more info about the chip including the erase block size at attach time. Also add myself to the copyrights since at this point svn blame would point to me as the culprit for much of this. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 18:50:48 2018 (r331140) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 18:58:47 2018 (r331141) @@ -3,6 +3,7 @@ * * Copyright (c) 2006 M. Warner Losh. All rights reserved. * Copyright (c) 2009 Oleksandr Tymoshenko. All rights reserved. + * Copyright (c) 2018 Ian Lepore. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -516,6 +517,8 @@ mx25l_attach(device_t dev) sc->sc_disk->d_stripesize = sc->sc_erasesize; sc->sc_disk->d_unit = device_get_unit(sc->sc_dev); sc->sc_disk->d_dump = NULL; /* NB: no dumps */ + strlcpy(sc->sc_disk->d_descr, ident->name, + sizeof(sc->sc_disk->d_descr)); disk_create(sc->sc_disk, DISK_VERSION); bioq_init(&sc->sc_bio_queue); @@ -523,8 +526,12 @@ mx25l_attach(device_t dev) kproc_create(&mx25l_task, sc, &sc->sc_p, 0, 0, "task: mx25l flash"); sc->sc_taskstate = TSTATE_RUNNING; - device_printf(sc->sc_dev, "%s, sector %d bytes, %d sectors\n", - ident->name, ident->sectorsize, ident->sectorcount); + device_printf(sc->sc_dev, + "device type %s, size %dK in %d sectors of %dK, erase size %dK\n", + ident->name, + ident->sectorcount * ident->sectorsize / 1024, + ident->sectorcount, ident->sectorsize / 1024, + sc->sc_erasesize / 1024); return (0); } From owner-svn-src-all@freebsd.org Sun Mar 18 19:05:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D0DCF4ADC9; Sun, 18 Mar 2018 19:05:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B70C2817D4; Sun, 18 Mar 2018 19:05:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1FF7246BF; Sun, 18 Mar 2018 19:05:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IJ56UR042686; Sun, 18 Mar 2018 19:05:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IJ567l042685; Sun, 18 Mar 2018 19:05:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803181905.w2IJ567l042685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 18 Mar 2018 19:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331142 - stable/11/stand X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11/stand X-SVN-Commit-Revision: 331142 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 19:05:07 -0000 Author: imp Date: Sun Mar 18 19:05:06 2018 New Revision: 331142 URL: https://svnweb.freebsd.org/changeset/base/331142 Log: Direct commit to stable Remove libstand32 here. pc98 is a 32-bit platform, so it shouldn't compile the extra 32-bit copy of libsa. The copy built in libstand is already 32-bit. Add a comment saying we need an empty Makefile.pc98 since otherwise it would pull in Makefile.i386 and there is no EFI on pc98, and the machines are too old to have ZFS or GELI be a viable option (and besides, those don't compile). Note: We also need r331140 to be MFC'd for pc98 build to work in all cases. Modified: stable/11/stand/Makefile.pc98 Modified: stable/11/stand/Makefile.pc98 ============================================================================== --- stable/11/stand/Makefile.pc98 Sun Mar 18 18:58:47 2018 (r331141) +++ stable/11/stand/Makefile.pc98 Sun Mar 18 19:05:06 2018 (r331142) @@ -1,3 +1,4 @@ # $FreeBSD$ -SUBDIR+= libstand32 +# Need an empty file here so Makefile.i386 isn't used (which contains options +# that don't work on pc98). From owner-svn-src-all@freebsd.org Sun Mar 18 19:07:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04EE6F4B14C; Sun, 18 Mar 2018 19:07:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D78481A3A; Sun, 18 Mar 2018 19:07:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 881C9246D5; Sun, 18 Mar 2018 19:07:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IJ77N7042809; Sun, 18 Mar 2018 19:07:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IJ77ZI042808; Sun, 18 Mar 2018 19:07:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803181907.w2IJ77ZI042808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 18 Mar 2018 19:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331143 - stable/11/stand X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11/stand X-SVN-Commit-Revision: 331143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 19:07:08 -0000 Author: imp Date: Sun Mar 18 19:07:07 2018 New Revision: 331143 URL: https://svnweb.freebsd.org/changeset/base/331143 Log: MFC: r331140 Merge ahead of schedule to fix pc98 build issues. Modified: stable/11/stand/defs.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Sun Mar 18 19:05:06 2018 (r331142) +++ stable/11/stand/defs.mk Sun Mar 18 19:07:07 2018 (r331143) @@ -138,6 +138,9 @@ CFLAGS+= -mlittle-endian # Make sure we use the machine link we're about to create CFLAGS+=-I. +all: ${PROG} + +.if !defined(NO_OBJ) _ILINKS=machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=${MACHINE_CPUARCH} @@ -147,9 +150,6 @@ _ILINKS+=x86 .endif CLEANFILES+=${_ILINKS} -all: ${PROG} - -.if !defined(NO_OBJ) beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} @@ -158,7 +158,7 @@ beforebuild: ${_ILINKS} .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) ${OBJS}: ${_link} -.endif +.endif # _link exists .endfor .NOPATH: ${_ILINKS} @@ -177,5 +177,5 @@ ${_ILINKS}: path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET:T} "->" $$path ; \ ln -fhs $$path ${.TARGET:T} -.endif +.endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ From owner-svn-src-all@freebsd.org Sun Mar 18 19:50:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00C1AF4E865; Sun, 18 Mar 2018 19:50:34 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0595837AB; Sun, 18 Mar 2018 19:50:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 981C024D36; Sun, 18 Mar 2018 19:50:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IJoXh4063015; Sun, 18 Mar 2018 19:50:33 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IJoXRT063012; Sun, 18 Mar 2018 19:50:33 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181950.w2IJoXRT063012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 19:50:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331146 - head/lib/libcasper/services/cap_grp X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_grp X-SVN-Commit-Revision: 331146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 19:50:34 -0000 Author: oshogbo Date: Sun Mar 18 19:50:32 2018 New Revision: 331146 URL: https://svnweb.freebsd.org/changeset/base/331146 Log: The gids argument can be declared as const. We don't modified it in this function. Modified: head/lib/libcasper/services/cap_grp/cap_grp.3 head/lib/libcasper/services/cap_grp/cap_grp.c head/lib/libcasper/services/cap_grp/cap_grp.h Modified: head/lib/libcasper/services/cap_grp/cap_grp.3 ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.3 Sun Mar 18 19:34:30 2018 (r331145) +++ head/lib/libcasper/services/cap_grp/cap_grp.3 Sun Mar 18 19:50:32 2018 (r331146) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2018 +.Dd March 18, 2018 .Dt CAP_GRP 3 .Os .Sh NAME @@ -70,7 +70,7 @@ .Ft int .Fn cap_grp_limit_fields "cap_channel_t *chan" "const char * const *fields" "size_t nfields" .Ft int -.Fn cap_grp_limit_groups "cap_channel_t *chan" "const char * const *names" "size_t nnames" "gid_t *gids" "size_t ngids" +.Fn cap_grp_limit_groups "cap_channel_t *chan" "const char * const *names" "size_t nnames" "const gid_t *gids" "size_t ngids" .Sh DESCRIPTION The functions .Fn cap_getgrent , @@ -163,7 +163,7 @@ casper service and uses it to get a group name. cap_channel_t *capcas, *capgrp; const char *cmds[] = { "getgrgid" }; const char *fields[] = { "gr_name" }; -gid_t gid[] = { 1 }; +const gid_t gid[] = { 1 }; struct group *group; /* Open capability to Casper. */ Modified: head/lib/libcasper/services/cap_grp/cap_grp.c ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.c Sun Mar 18 19:34:30 2018 (r331145) +++ head/lib/libcasper/services/cap_grp/cap_grp.c Sun Mar 18 19:50:32 2018 (r331146) @@ -410,7 +410,7 @@ cap_grp_limit_fields(cap_channel_t *chan, const char * int cap_grp_limit_groups(cap_channel_t *chan, const char * const *names, - size_t nnames, gid_t *gids, size_t ngids) + size_t nnames, const gid_t *gids, size_t ngids) { nvlist_t *limits, *groups; unsigned int i; Modified: head/lib/libcasper/services/cap_grp/cap_grp.h ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.h Sun Mar 18 19:34:30 2018 (r331145) +++ head/lib/libcasper/services/cap_grp/cap_grp.h Sun Mar 18 19:50:32 2018 (r331146) @@ -57,7 +57,7 @@ int cap_grp_limit_cmds(cap_channel_t *chan, const char int cap_grp_limit_fields(cap_channel_t *chan, const char * const *fields, size_t nfields); int cap_grp_limit_groups(cap_channel_t *chan, const char * const *names, - size_t nnames, gid_t *gids, size_t ngids); + size_t nnames, const gid_t *gids, size_t ngids); #else #define cap_getgrent(chan) getgrent() #define cap_getgrnam(chan, name) getgrnam(name) From owner-svn-src-all@freebsd.org Sun Mar 18 22:19:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 930B0F58D41; Sun, 18 Mar 2018 22:19:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 444AF69A5E; Sun, 18 Mar 2018 22:19:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 206A32645F; Sun, 18 Mar 2018 22:19:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMJriU038488; Sun, 18 Mar 2018 22:19:53 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMJrXH038478; Sun, 18 Mar 2018 22:19:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182219.w2IMJrXH038478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331147 - in stable/11: etc/mtree usr.bin/indent usr.bin/indent/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11: etc/mtree usr.bin/indent usr.bin/indent/tests X-SVN-Commit-Revision: 331147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:19:54 -0000 Author: eadler Date: Sun Mar 18 22:19:52 2018 New Revision: 331147 URL: https://svnweb.freebsd.org/changeset/base/331147 Log: MFC r303452,r303482,r303483,r303484,r303485,r303487,r303489,r303498,r303499,r303502,r303523,r303525,r303570,r303571,r303588,r303596,r303597,r303598,r303599,r303600,r303601,r303625,r303629,r303718,r304651,r304684,r304686,r305983,r309217,r309219,r309341,r309342,r309343,r309382,r309415,r309417,r309418,r309419,r310863,r311141,r314613,r318471,r321382,r321383,r321396: indent(1): avoid calling write(2) with a negative second parameter. indent(1): Avoid out of bound access of array codebuf. indent(1): Avoid potential use-after-free. indent(1): Fix breakage caused by single comment following "else". indent(1) simply wasn't taught that "else" may be followed by a comment without any opening brace anywhere on the line, so it was very confused in such cases. indent(1): fix struct termination detection. indent(1): fix struct termination detection. indent(1): Removed whitespace shouldn't be considered in column calculations. indent(1): Support "f" and "F" floating constant suffixes. indent(1): Use NULL instead of zero for pointers. indent(1): Attempt to preserve some consistent style. indent(1): Yet more style issues. indent(1): Consistently indent declarations. indent(1): Bail out if there's no more space on the parser stack. indent(1): Remove dead code relating to unix-style comments. indent(1): Simplify pr_comment(). indent(1): Fix wrapping of some lines in comments. indent(1): Untangle the connection between pr_comment.c and io.c. indent(1): Don't newline on cpp lines like #endif unless -bacc is on. indent(1): replace function call to bzero with memset. indent(1): Rearrange option parsing code to squelch clang's static analyzer. indent(1): Use a dash in the license headers. indent(1): accept offsetof(3) as a keyword. indent(1): add some comments to quiet down Coverity. indent(1): remove dead assignments. indent(1): have the memset invocation somewhat more canonical. indent(1): Capsicumify indent(1): minor off-by-one error. indent(1): fix regression introduced in r303596. indent(1): Avoid out of bound access of array in_buffer indent(1): Don't ignore newlines after comments that follow braces. indent(1): Don't unnecessarily add a blank before a comment ends. indent(1): Do not define opchar unless it will be used. indent(1): Optimize parser stack usage. indent(1): Remove an extra newline added in a previous commit. indent(1): Avoid out-of-bound accesses of arrays. indent(1): Avoid out-of-bound accesses of array ps.p_stack. indent(1): Avoid out of bounds access of array ps.paren_indents indent(1): add a piece missed in r311138. indent(1): Support binary integer literals. indent(1): don't produce unnecessary blank lines. indent(1): rename the profile file. indent(1): better alignment of comments on code. Added: stable/11/usr.bin/indent/tests/Makefile - copied, changed from r314613, head/usr.bin/indent/tests/Makefile stable/11/usr.bin/indent/tests/binary.0 - copied unchanged from r318471, head/usr.bin/indent/tests/binary.0 stable/11/usr.bin/indent/tests/binary.0.stdout - copied unchanged from r318471, head/usr.bin/indent/tests/binary.0.stdout stable/11/usr.bin/indent/tests/comments.0.pro - copied unchanged from r321383, head/usr.bin/indent/tests/comments.0.pro stable/11/usr.bin/indent/tests/elsecomment.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/elsecomment.0.pro stable/11/usr.bin/indent/tests/functional_test.sh - copied unchanged from r314613, head/usr.bin/indent/tests/functional_test.sh stable/11/usr.bin/indent/tests/label.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/label.0.pro stable/11/usr.bin/indent/tests/nsac.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/nsac.0.pro stable/11/usr.bin/indent/tests/sac.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/sac.0.pro stable/11/usr.bin/indent/tests/surplusbad.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/surplusbad.0.pro stable/11/usr.bin/indent/tests/types_from_file.0.list - copied unchanged from r314613, head/usr.bin/indent/tests/types_from_file.0.list stable/11/usr.bin/indent/tests/types_from_file.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/types_from_file.0.pro Deleted: stable/11/usr.bin/indent/tests/elsecomment.pro stable/11/usr.bin/indent/tests/label.pro stable/11/usr.bin/indent/tests/nsac.pro stable/11/usr.bin/indent/tests/sac.pro stable/11/usr.bin/indent/tests/surplusbad.pro stable/11/usr.bin/indent/tests/types_from_file.list stable/11/usr.bin/indent/tests/types_from_file.pro Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/indent/Makefile stable/11/usr.bin/indent/args.c stable/11/usr.bin/indent/indent.c stable/11/usr.bin/indent/indent.h stable/11/usr.bin/indent/indent_codes.h stable/11/usr.bin/indent/indent_globs.h stable/11/usr.bin/indent/io.c stable/11/usr.bin/indent/lexi.c stable/11/usr.bin/indent/parse.c stable/11/usr.bin/indent/pr_comment.c stable/11/usr.bin/indent/tests/comments.0 stable/11/usr.bin/indent/tests/comments.0.stdout Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/etc/mtree/BSD.tests.dist Sun Mar 18 22:19:52 2018 (r331147) @@ -658,6 +658,8 @@ .. ident .. + indent + .. join .. jot Modified: stable/11/usr.bin/indent/Makefile ============================================================================== --- stable/11/usr.bin/indent/Makefile Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/Makefile Sun Mar 18 22:19:52 2018 (r331147) @@ -1,9 +1,15 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= indent SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c NO_WMISSING_VARIABLE_DECLARATIONS= + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/usr.bin/indent/args.c ============================================================================== --- stable/11/usr.bin/indent/args.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/args.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -93,6 +93,7 @@ struct pro { } pro[] = { {"T", PRO_SPECIAL, 0, KEY, 0}, + {"P", PRO_SPECIAL, 0, IGN, 0}, {"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation}, {"badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop}, {"bad", PRO_BOOL, false, ON, &blanklines_after_declarations}, @@ -225,17 +226,14 @@ scan_profile(FILE *f) } } -const char *param_start; - -static int +static const char * eqin(const char *s1, const char *s2) { while (*s1) { if (*s1++ != *s2++) - return (false); + return (NULL); } - param_start = s2; - return (true); + return (s2); } /* @@ -259,11 +257,12 @@ set_defaults(void) void set_option(char *arg) { - struct pro *p; + struct pro *p; + const char *param_start; arg++; /* ignore leading "-" */ for (p = pro; p->p_name; p++) - if (*p->p_name == *arg && eqin(p->p_name, arg)) + if (*p->p_name == *arg && (param_start = eqin(p->p_name, arg)) != NULL) goto found; errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1); found: @@ -282,9 +281,9 @@ found: break; case STDIN: - if (input == 0) + if (input == NULL) input = stdin; - if (output == 0) + if (output == NULL) output = stdout; break; Modified: stable/11/usr.bin/indent/indent.c ============================================================================== --- stable/11/usr.bin/indent/indent.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -52,8 +52,10 @@ static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6 #include __FBSDID("$FreeBSD$"); +#include #include #include +#include #include #include #include @@ -65,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include "indent.h" static void bakcopy(void); +static void indent_declaration(int, int); const char *in_name = "Standard Input"; /* will always point to name of input * file */ @@ -77,6 +80,7 @@ char bakfile[MAXPATHLEN] = ""; int main(int argc, char **argv) { + cap_rights_t rights; int dec_ind; /* current indentation for declarations */ int di_stack[20]; /* a stack of structure indentation levels */ @@ -151,11 +155,11 @@ main(int argc, char **argv) scase = ps.pcase = false; squest = 0; - sc_end = 0; - bp_save = 0; - be_save = 0; + sc_end = NULL; + bp_save = NULL; + be_save = NULL; - output = 0; + output = NULL; tabs_to_var = 0; envval = getenv("SIMPLE_BACKUP_SUFFIX"); @@ -240,6 +244,17 @@ main(int argc, char **argv) bakcopy(); } } + + /* Restrict input/output descriptors and enter Capsicum sandbox. */ + cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); + if (cap_rights_limit(fileno(output), &rights) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit rights for %s", out_name); + cap_rights_init(&rights, CAP_FSTAT, CAP_READ); + if (cap_rights_limit(fileno(input), &rights) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit rights for %s", in_name); + if (cap_enter() < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to enter capability mode"); + if (ps.com_ind <= 1) ps.com_ind = 2; /* dont put normal comments before column 2 */ if (troff) { @@ -327,6 +342,10 @@ main(int argc, char **argv) switch (type_code) { case newline: ++line_no; + if (sc_end != NULL) { /* dump comment, if any */ + *sc_end++ = '\n'; /* newlines are needed in this case */ + goto sw_buffer; + } flushed_nl = true; case form_feed: break; /* form feeds and newlines found here will be @@ -334,7 +353,7 @@ main(int argc, char **argv) case lbrace: /* this is a brace that starts the compound * stmt */ - if (sc_end == 0) { /* ignore buffering if a comment wasn't + if (sc_end == NULL) { /* ignore buffering if a comment wasn't * stored up */ ps.search_brace = false; goto check_type; @@ -347,9 +366,9 @@ main(int argc, char **argv) } case comment: /* we have a comment, so we must copy it into * the buffer */ - if (!flushed_nl || sc_end != 0) { - if (sc_end == 0) { /* if this is the first comment, we - * must set up the buffer */ + if (!flushed_nl || sc_end != NULL) { + if (sc_end == NULL) { /* if this is the first comment, we + * must set up the buffer */ save_com[0] = save_com[1] = ' '; sc_end = &(save_com[2]); } @@ -392,7 +411,7 @@ main(int argc, char **argv) && e_code != s_code && e_code[-1] == '}')) force_nl = false; - if (sc_end == 0) { /* ignore buffering if comment wasn't + if (sc_end == NULL) { /* ignore buffering if comment wasn't * saved up */ ps.search_brace = false; goto check_type; @@ -423,7 +442,7 @@ main(int argc, char **argv) * save_com */ *sc_end++ = ' ';/* add trailing blank, just in case */ buf_end = sc_end; - sc_end = 0; + sc_end = NULL; break; } /* end of switch */ if (type_code != 0) /* we must make this check, just in case there @@ -513,31 +532,38 @@ check_type: break; case lparen: /* got a '(' or '[' */ - ++ps.p_l_follow; /* count parens to make Healy happy */ + /* count parens to make Healy happy */ + if (++ps.p_l_follow == nitems(ps.paren_indents)) { + diag3(0, "Reached internal limit of %d unclosed parens", + nitems(ps.paren_indents)); + ps.p_l_follow--; + } if (ps.want_blank && *token != '[' && - (ps.last_token != ident || proc_calls_space - || (ps.its_a_keyword && (!ps.sizeof_keyword || Bill_Shannon)))) + (ps.last_token != ident || proc_calls_space || + /* offsetof (1) is never allowed a space; sizeof (2) gets + * one iff -bs; all other keywords (>2) always get a space + * before lparen */ + (ps.keyword + Bill_Shannon > 2))) *e_code++ = ' '; - if (ps.in_decl && !ps.block_init) - if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) { - ps.dumped_decl_indent = 1; + ps.want_blank = false; + if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && + !is_procname) { + /* function pointer declarations */ + if (troff) { sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); e_code += strlen(e_code); } else { - while ((e_code - s_code) < dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } - *e_code++ = token[0]; + indent_declaration(dec_ind, tabs_to_var); } - else + ps.dumped_decl_indent = true; + } + if (!troff) *e_code++ = token[0]; ps.paren_indents[ps.p_l_follow - 1] = e_code - s_code; if (sp_sw && ps.p_l_follow == 1 && extra_expression_indent && ps.paren_indents[0] < 2 * ps.ind_size) ps.paren_indents[0] = 2 * ps.ind_size; - ps.want_blank = false; if (ps.in_or_st && *token == '(' && ps.tos <= 2) { /* * this is a kluge to make sure that declarations will be @@ -548,19 +574,20 @@ check_type: ps.in_or_st = false; /* turn off flag for structure decl or * initialization */ } - if (ps.sizeof_keyword) - ps.sizeof_mask |= 1 << ps.p_l_follow; + /* parenthesized type following sizeof or offsetof is not a cast */ + if (ps.keyword == 1 || ps.keyword == 2) + ps.not_cast_mask |= 1 << ps.p_l_follow; break; case rparen: /* got a ')' or ']' */ rparen_count--; - if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.sizeof_mask) { + if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.not_cast_mask) { ps.last_u_d = true; ps.cast_mask &= (1 << ps.p_l_follow) - 1; ps.want_blank = false; } else ps.want_blank = true; - ps.sizeof_mask &= (1 << ps.p_l_follow) - 1; + ps.not_cast_mask &= (1 << ps.p_l_follow) - 1; if (--ps.p_l_follow < 0) { ps.p_l_follow = 0; diag3(0, "Extra %c", *token); @@ -588,27 +615,30 @@ check_type: break; case unary_op: /* this could be any unary operation */ - if (ps.want_blank) - *e_code++ = ' '; - - if (troff && !ps.dumped_decl_indent && ps.in_decl && !is_procname) { - sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); - ps.dumped_decl_indent = 1; - e_code += strlen(e_code); + if (!ps.dumped_decl_indent && ps.in_decl && !is_procname && + !ps.block_init) { + /* pointer declarations */ + if (troff) { + if (ps.want_blank) + *e_code++ = ' '; + sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, + token); + e_code += strlen(e_code); + } + else { + /* if this is a unary op in a declaration, we should + * indent this token */ + for (i = 0; token[i]; ++i) + /* find length of token */; + indent_declaration(dec_ind - i, tabs_to_var); + } + ps.dumped_decl_indent = true; } - else { + else if (ps.want_blank) + *e_code++ = ' '; + { const char *res = token; - if (ps.in_decl && !ps.block_init) { /* if this is a unary op - * in a declaration, we - * should indent this - * token */ - for (i = 0; token[i]; ++i); /* find length of token */ - while ((e_code - s_code) < (dec_ind - i)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; /* pad it */ - } - } if (troff && token[0] == '-' && token[1] == '>') res = "\\(->"; for (t_ptr = res; *t_ptr; ++t_ptr) { @@ -707,23 +737,25 @@ check_type: break; case semicolon: /* got a ';' */ - ps.in_or_st = false;/* we are not in an initialization or - * structure declaration */ + if (ps.dec_nest == 0) + ps.in_or_st = false;/* we are not in an initialization or + * structure declaration */ scase = false; /* these will only need resetting in an error */ squest = 0; if (ps.last_token == rparen && rparen_count == 0) ps.in_parameter_declaration = 0; ps.cast_mask = 0; - ps.sizeof_mask = 0; + ps.not_cast_mask = 0; ps.block_init = 0; ps.block_init_level = 0; ps.just_saw_decl--; - if (ps.in_decl && s_code == e_code && !ps.block_init) - while ((e_code - s_code) < (dec_ind - 1)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } + if (ps.in_decl && s_code == e_code && !ps.block_init && + !ps.dumped_decl_indent) { + /* indent stray semicolons in declarations */ + indent_declaration(dec_ind - 1, tabs_to_var); + ps.dumped_decl_indent = true; + } ps.in_decl = (ps.dec_nest > 0); /* if we were in a first level * structure declaration, we @@ -937,58 +969,25 @@ check_type: if (ps.in_decl) { /* if we are in a declaration, we must indent * identifier */ if (is_procname == 0 || !procnames_start_line) { - if (!ps.block_init) { - if (troff && !ps.dumped_decl_indent) { + if (!ps.block_init && !ps.dumped_decl_indent) { + if (troff) { if (ps.want_blank) *e_code++ = ' '; - ps.want_blank = false; sprintf(e_code, "\n.De %dp+\200p\n", dec_ind * 7); - ps.dumped_decl_indent = 1; e_code += strlen(e_code); - } else { - int cur_dec_ind; - int pos, startpos; - - /* - * in order to get the tab math right for - * indentations that are not multiples of 8 we - * need to modify both startpos and dec_ind - * (cur_dec_ind) here by eight minus the - * remainder of the current starting column - * divided by eight. This seems to be a - * properly working fix - */ - startpos = e_code - s_code; - cur_dec_ind = dec_ind; - pos = startpos; - if ((ps.ind_level * ps.ind_size) % 8 != 0) { - pos += (ps.ind_level * ps.ind_size) % 8; - cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; - } - - if (tabs_to_var) { - while ((pos & ~7) + 8 <= cur_dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = '\t'; - pos = (pos & ~7) + 8; - } - } - while (pos < cur_dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - pos++; - } - if (ps.want_blank && e_code - s_code == startpos) - *e_code++ = ' '; - ps.want_blank = false; - } + } else + indent_declaration(dec_ind, tabs_to_var); + ps.dumped_decl_indent = true; + ps.want_blank = false; } } else { if (ps.want_blank) *e_code++ = ' '; ps.want_blank = false; - if (dec_ind && s_code != e_code) + if (dec_ind && s_code != e_code) { + *e_code = '\0'; dump_line(); + } dec_ind = 0; } } @@ -1002,7 +1001,7 @@ check_type: copy_id: if (ps.want_blank) *e_code++ = ' '; - if (troff && ps.its_a_keyword) { + if (troff && ps.keyword) { e_code = chfont(&bodyf, &keywordf, e_code); for (t_ptr = token; *t_ptr; ++t_ptr) { CHECK_SIZE_CODE; @@ -1039,12 +1038,12 @@ check_type: ps.want_blank = (s_code != e_code); /* only put blank after comma * if comma does not start the * line */ - if (ps.in_decl && is_procname == 0 && !ps.block_init) - while ((e_code - s_code) < (dec_ind - 1)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } - + if (ps.in_decl && is_procname == 0 && !ps.block_init && + !ps.dumped_decl_indent) { + /* indent leading commas and not the actual identifiers */ + indent_declaration(dec_ind - 1, tabs_to_var); + ps.dumped_decl_indent = true; + } *e_code++ = ','; if (ps.p_l_follow == 0) { if (ps.block_init_level <= 0) @@ -1113,9 +1112,9 @@ check_type: while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; - if (e_lab - s_lab == com_end && bp_save == 0) { /* comment on - * preprocessor line */ - if (sc_end == 0) /* if this is the first comment, we + if (e_lab - s_lab == com_end && bp_save == NULL) { + /* comment on preprocessor line */ + if (sc_end == NULL) /* if this is the first comment, we * must set up the buffer */ sc_end = &(save_com[0]); else { @@ -1138,19 +1137,13 @@ check_type: * save_com */ *sc_end++ = ' '; /* add trailing blank, just in case */ buf_end = sc_end; - sc_end = 0; + sc_end = NULL; } *e_lab = '\0'; /* null terminate line */ ps.pcase = false; } - if (strncmp(s_lab, "#if", 3) == 0) { - if (blanklines_around_conditional_compilation) { - int c; - prefix_blankline_requested++; - while ((c = getc(input)) == '\n'); - ungetc(c, input); - } + if (strncmp(s_lab, "#if", 3) == 0) { /* also ifdef, ifndef */ if ((size_t)ifdef_level < nitems(state_stack)) { match_state[ifdef_level].tos = -1; state_stack[ifdef_level++] = ps; @@ -1158,40 +1151,54 @@ check_type: else diag2(1, "#if stack overflow"); } - else if (strncmp(s_lab, "#else", 5) == 0) + else if (strncmp(s_lab, "#el", 3) == 0) { /* else, elif */ if (ifdef_level <= 0) - diag2(1, "Unmatched #else"); + diag2(1, s_lab[3] == 'i' ? "Unmatched #elif" : "Unmatched #else"); else { match_state[ifdef_level - 1] = ps; ps = state_stack[ifdef_level - 1]; } + } else if (strncmp(s_lab, "#endif", 6) == 0) { if (ifdef_level <= 0) diag2(1, "Unmatched #endif"); - else { + else ifdef_level--; - -#ifdef undef - /* - * This match needs to be more intelligent before the - * message is useful - */ - if (match_state[ifdef_level].tos >= 0 - && bcmp(&ps, &match_state[ifdef_level], sizeof ps)) - diag2(0, "Syntactically inconsistent #ifdef alternatives"); -#endif + } else { + struct directives { + int size; + const char *string; } - if (blanklines_around_conditional_compilation) { - postfix_blankline_requested++; - n_real_blanklines = 0; + recognized[] = { + {7, "include"}, + {6, "define"}, + {5, "undef"}, + {4, "line"}, + {5, "error"}, + {6, "pragma"} + }; + int d = nitems(recognized); + while (--d >= 0) + if (strncmp(s_lab + 1, recognized[d].string, recognized[d].size) == 0) + break; + if (d < 0) { + diag2(1, "Unrecognized cpp directive"); + break; } } + if (blanklines_around_conditional_compilation) { + postfix_blankline_requested++; + n_real_blanklines = 0; + } + else { + postfix_blankline_requested = 0; + prefix_blankline_requested = 0; + } break; /* subsequent processing of the newline * character will cause the line to be printed */ case comment: /* we have gotten a / followed by * this is a biggie */ if (flushed_nl) { /* we should force a broken line here */ - flushed_nl = false; dump_line(); ps.want_blank = false; /* dont insert blank at line start */ force_nl = false; @@ -1231,7 +1238,7 @@ bakcopy(void) bakchn = creat(bakfile, 0600); if (bakchn < 0) err(1, "%s", bakfile); - while ((n = read(fileno(input), buff, sizeof buff)) != 0) + while ((n = read(fileno(input), buff, sizeof(buff))) > 0) if (write(bakchn, buff, n) != n) err(1, "%s", bakfile); if (n < 0) @@ -1248,5 +1255,35 @@ bakcopy(void) if (output == NULL) { unlink(bakfile); err(1, "%s", in_name); + } +} + +static void +indent_declaration(int cur_dec_ind, int tabs_to_var) +{ + int pos = e_code - s_code; + char *startpos = e_code; + + /* + * get the tab math right for indentations that are not multiples of 8 + */ + if ((ps.ind_level * ps.ind_size) % 8 != 0) { + pos += (ps.ind_level * ps.ind_size) % 8; + cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; + } + if (tabs_to_var) + while ((pos & ~7) + 8 <= cur_dec_ind) { + CHECK_SIZE_CODE; + *e_code++ = '\t'; + pos = (pos & ~7) + 8; + } + while (pos < cur_dec_ind) { + CHECK_SIZE_CODE; + *e_code++ = ' '; + pos++; + } + if (e_code == startpos && ps.want_blank) { + *e_code++ = ' '; + ps.want_blank = false; } } Modified: stable/11/usr.bin/indent/indent.h ============================================================================== --- stable/11/usr.bin/indent/indent.h Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent.h Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 Jens Schweikhardt @@ -34,6 +34,7 @@ void addkey(char *, int); int compute_code_target(void); int compute_label_target(void); int count_spaces(int, char *); +int count_spaces_until(int, char *, char *); int lexi(void); void diag2(int, const char *); void diag3(int, const char *, int); Modified: stable/11/usr.bin/indent/indent_codes.h ============================================================================== --- stable/11/usr.bin/indent/indent_codes.h Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent_codes.h Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. Modified: stable/11/usr.bin/indent/indent_globs.h ============================================================================== --- stable/11/usr.bin/indent/indent_globs.h Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent_globs.h Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -59,40 +59,46 @@ FILE *output; /* the output file */ #define CHECK_SIZE_CODE \ if (e_code >= l_code) { \ int nsize = l_code-s_code+400; \ + int code_len = e_code-s_code; \ codebuf = (char *) realloc(codebuf, nsize); \ if (codebuf == NULL) \ err(1, NULL); \ - e_code = codebuf + (e_code-s_code) + 1; \ + e_code = codebuf + code_len + 1; \ l_code = codebuf + nsize - 5; \ s_code = codebuf + 1; \ } #define CHECK_SIZE_COM \ if (e_com >= l_com) { \ int nsize = l_com-s_com+400; \ + int com_len = e_com - s_com; \ + int blank_pos = last_bl - s_com; \ combuf = (char *) realloc(combuf, nsize); \ if (combuf == NULL) \ err(1, NULL); \ - e_com = combuf + (e_com-s_com) + 1; \ + e_com = combuf + com_len + 1; \ + last_bl = combuf + blank_pos + 1; \ l_com = combuf + nsize - 5; \ s_com = combuf + 1; \ } #define CHECK_SIZE_LAB \ if (e_lab >= l_lab) { \ int nsize = l_lab-s_lab+400; \ + int label_len = e_lab - s_lab; \ labbuf = (char *) realloc(labbuf, nsize); \ if (labbuf == NULL) \ err(1, NULL); \ - e_lab = labbuf + (e_lab-s_lab) + 1; \ + e_lab = labbuf + label_len + 1; \ l_lab = labbuf + nsize - 5; \ s_lab = labbuf + 1; \ } #define CHECK_SIZE_TOKEN \ if (e_token >= l_token) { \ int nsize = l_token-s_token+400; \ + int token_len = e_token - s_token; \ tokenbuf = (char *) realloc(tokenbuf, nsize); \ if (tokenbuf == NULL) \ err(1, NULL); \ - e_token = tokenbuf + (e_token-s_token) + 1; \ + e_token = tokenbuf + token_len + 1; \ l_token = tokenbuf + nsize - 5; \ s_token = tokenbuf + 1; \ } @@ -227,7 +233,7 @@ struct fstate bodyf; /* major body font */ -#define STACKSIZE 150 +#define STACKSIZE 256 struct parser_state { int last_token; @@ -240,10 +246,10 @@ struct parser_state { * char should be lined up with the / in / followed by * */ int comment_delta, n_comment_delta; - int cast_mask; /* indicates which close parens close off - * casts */ - int sizeof_mask; /* indicates which close parens close off - * sizeof''s */ + int cast_mask; /* indicates which close parens potentially + * close off casts */ + int not_cast_mask; /* indicates which close parens definitely + * close off something else than casts */ int block_init; /* true iff inside a block initialization */ int block_init_level; /* The level of brace nesting in an * initialization */ @@ -313,8 +319,7 @@ struct parser_state { * specially */ int decl_indent; /* column to indent declared identifiers to */ int local_decl_indent; /* like decl_indent but for locals */ - int its_a_keyword; - int sizeof_keyword; + int keyword; /* the type of a keyword or 0 */ int dumped_decl_indent; float case_indent; /* The distance to indent case labels from the * switch statement */ Modified: stable/11/usr.bin/indent/io.c ============================================================================== --- stable/11/usr.bin/indent/io.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/io.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -118,6 +118,7 @@ dump_line(void) } while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; + *e_lab = '\0'; cur_col = pad_output(1, compute_label_target()); if (s_lab[0] == '#' && (strncmp(s_lab, "#else", 5) == 0 || strncmp(s_lab, "#endif", 6) == 0)) { @@ -201,6 +202,7 @@ dump_line(void) break; case '\\': putc('\\', output); + /* add a backslash to escape the '\' */ default: putc(*follow, output); } @@ -225,8 +227,9 @@ dump_line(void) char *com_st = s_com; target += ps.comment_delta; - while (*com_st == '\t') - com_st++, target += 8; /* ? */ + while (*com_st == '\t') /* consider original indentation in + * case this is a box comment */ + com_st++, target += 8; while (target <= 0) if (*com_st == ' ') target++, com_st++; @@ -242,18 +245,9 @@ dump_line(void) } while (e_com > com_st && isspace(e_com[-1])) e_com--; - cur_col = pad_output(cur_col, target); - if (!ps.box_com) { - if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) { - if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1) - com_st[1] = '*'; - else - fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output); - } - } + (void)pad_output(cur_col, target); fwrite(com_st, e_com - com_st, 1, output); ps.comment_delta = ps.n_comment_delta; - cur_col = count_spaces(cur_col, com_st); ++ps.com_lines; /* count lines with comments */ } } @@ -283,10 +277,11 @@ inhibit_newline: ps.dumped_decl_indent = 0; *(e_lab = s_lab) = '\0'; /* reset buffers */ *(e_code = s_code) = '\0'; - *(e_com = s_com) = '\0'; + *(e_com = s_com = combuf + 1) = '\0'; ps.ind_level = ps.i_l_follow; ps.paren_level = ps.p_l_follow; - paren_target = -ps.paren_indents[ps.paren_level - 1]; + if (ps.paren_level > 0) + paren_target = -ps.paren_indents[ps.paren_level - 1]; not_first_line = 1; } @@ -349,10 +344,10 @@ fill_buffer(void) int i; FILE *f = input; - if (bp_save != 0) { /* there is a partly filled input buffer left */ - buf_ptr = bp_save; /* dont read anything, just switch buffers */ + if (bp_save != NULL) { /* there is a partly filled input buffer left */ + buf_ptr = bp_save; /* do not read anything, just switch buffers */ buf_end = be_save; - bp_save = be_save = 0; + bp_save = be_save = NULL; if (buf_ptr < buf_end) return; /* only return if there is really something in * this buffer */ @@ -379,7 +374,7 @@ fill_buffer(void) } buf_ptr = in_buffer; buf_end = p; - if (p[-2] == '/' && p[-3] == '*') { + if (p - in_buffer > 2 && p[-2] == '/' && p[-3] == '*') { if (in_buffer[3] == 'I' && strncmp(in_buffer, "/**INDENT**", 11) == 0) fill_buffer(); /* flush indent error message */ else { @@ -507,18 +502,15 @@ pad_output(int current, int target) * */ int -count_spaces(int current, char *buffer) +count_spaces_until(int cur, char *buffer, char *end) /* * this routine figures out where the character position will be after * printing the text in buffer starting at column "current" */ { char *buf; /* used to look thru buffer */ - int cur; /* current character counter */ - cur = current; - - for (buf = buffer; *buf != '\0'; ++buf) { + for (buf = buffer; *buf != '\0' && buf != end; ++buf) { switch (*buf) { case '\n': @@ -542,6 +534,12 @@ count_spaces(int current, char *buffer) return (cur); } +int +count_spaces(int cur, char *buffer) +{ + return (count_spaces_until(cur, buffer, NULL)); +} + void diag4(int level, const char *msg, int a, int b) { @@ -636,7 +634,7 @@ parsefont(struct fstate *f, const char *s0) const char *s = s0; int sizedelta = 0; - bzero(f, sizeof *f); + memset(f, '\0', sizeof(*f)); while (*s) { if (isdigit(*s)) f->size = f->size * 10 + *s - '0'; Modified: stable/11/usr.bin/indent/lexi.c ============================================================================== --- stable/11/usr.bin/indent/lexi.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/lexi.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -59,7 +59,9 @@ __FBSDID("$FreeBSD$"); #include "indent.h" #define alphanum 1 +#ifdef undef #define opchar 3 +#endif struct templ { const char *rwd; @@ -68,13 +70,13 @@ struct templ { struct templ specials[1000] = { - {"switch", 1}, - {"case", 2}, - {"break", 0}, + {"switch", 7}, + {"case", 8}, + {"break", 9}, {"struct", 3}, {"union", 3}, {"enum", 3}, - {"default", 2}, + {"default", 8}, {"int", 4}, {"char", 4}, {"float", 4}, @@ -90,14 +92,15 @@ struct templ specials[1000] = {"void", 4}, {"const", 4}, {"volatile", 4}, - {"goto", 0}, - {"return", 0}, + {"goto", 9}, + {"return", 9}, {"if", 5}, {"while", 5}, {"for", 5}, {"else", 6}, {"do", 6}, - {"sizeof", 7}, + {"sizeof", 2}, + {"offsetof", 1}, {0, 0} }; @@ -157,19 +160,47 @@ lexi(void) struct templ *p; if (isdigit(*buf_ptr) || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) { + enum base { + BASE_2, BASE_8, BASE_10, BASE_16 + }; int seendot = 0, seenexp = 0, seensfx = 0; - if (*buf_ptr == '0' && - (buf_ptr[1] == 'x' || buf_ptr[1] == 'X')) { + enum base in_base = BASE_10; + + if (*buf_ptr == '0') { + if (buf_ptr[1] == 'b' || buf_ptr[1] == 'B') + in_base = BASE_2; + else if (buf_ptr[1] == 'x' || buf_ptr[1] == 'X') + in_base = BASE_16; + else if (isdigit(buf_ptr[1])) + in_base = BASE_8; + } + switch (in_base) { + case BASE_2: *e_token++ = *buf_ptr++; *e_token++ = *buf_ptr++; + while (*buf_ptr == '0' || *buf_ptr == '1') { + CHECK_SIZE_TOKEN; + *e_token++ = *buf_ptr++; + } + break; + case BASE_8: + *e_token++ = *buf_ptr++; + while (*buf_ptr >= '0' && *buf_ptr <= '8') { + CHECK_SIZE_TOKEN; + *e_token++ = *buf_ptr++; + } + break; + case BASE_16: + *e_token++ = *buf_ptr++; + *e_token++ = *buf_ptr++; while (isxdigit(*buf_ptr)) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; } - } - else + break; + case BASE_10: while (1) { if (*buf_ptr == '.') { if (seendot) @@ -192,16 +223,16 @@ lexi(void) } } } + break; + } while (1) { - if (!(seensfx & 1) && - (*buf_ptr == 'U' || *buf_ptr == 'u')) { + if (!(seensfx & 1) && (*buf_ptr == 'U' || *buf_ptr == 'u')) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; seensfx |= 1; continue; } - if (!(seensfx & 2) && - (*buf_ptr == 'L' || *buf_ptr == 'l')) { + if (!(seensfx & 2) && (strchr("fFlL", *buf_ptr) != NULL)) { CHECK_SIZE_TOKEN; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Mar 18 22:24:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA0A2F592D9; Sun, 18 Mar 2018 22:24:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF4B69ED1; Sun, 18 Mar 2018 22:24:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BE26265EA; Sun, 18 Mar 2018 22:24:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMOUlG043259; Sun, 18 Mar 2018 22:24:30 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMOUIt043258; Sun, 18 Mar 2018 22:24:30 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182224.w2IMOUIt043258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331148 - stable/11/usr.bin/uname X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/uname X-SVN-Commit-Revision: 331148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:24:30 -0000 Author: eadler Date: Sun Mar 18 22:24:29 2018 New Revision: 331148 URL: https://svnweb.freebsd.org/changeset/base/331148 Log: MFC r319274: - Add a simple example to uname(1) manual page to show how the hardware platform (returned by -m) can be different from the machine's processor architecture (-p) - Document that make(1) sets universal MACHINE and MACHINE_ARCH variables based on these values Modified: stable/11/usr.bin/uname/uname.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/uname/uname.1 ============================================================================== --- stable/11/usr.bin/uname/uname.1 Sun Mar 18 22:19:52 2018 (r331147) +++ stable/11/usr.bin/uname/uname.1 Sun Mar 18 22:24:29 2018 (r331148) @@ -28,7 +28,7 @@ .\" @(#)uname.1 8.3 (Berkeley) 4/8/94 .\" $FreeBSD$ .\" -.Dd November 20, 2013 +.Dd May 31, 2017 .Dt UNAME 1 .Os .Sh NAME @@ -61,6 +61,11 @@ Write the version of the kernel. .It Fl m Write the type of the current hardware platform to standard output. +.Po Xr make 1 +uses it to set the +.Va MACHINE +variable. +.Pc .It Fl n Write the name of the system to standard output. .It Fl o @@ -69,6 +74,11 @@ This is a synonym for the option, for compatibility with other systems. .It Fl p Write the type of the machine processor architecture to standard output. +.Po Xr make 1 +uses it to set the +.Va MACHINE_ARCH +variable. +.Pc .It Fl r Write the current release level of the operating system to standard output. @@ -106,6 +116,19 @@ will allow the corresponding data to be set to the con of the environment variable. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +The hardware platform +.Pq Fl m +can be different from the machine's processor architecture +.Pq Fl p , +e.g., on 64-bit PowerPC, +.Fl m +would return +.Va powerpc +and +.Fl p +would return +.Va powerpc64 . .Sh SEE ALSO .Xr feature_present 3 , .Xr getosreldate 3 , From owner-svn-src-all@freebsd.org Sun Mar 18 22:26:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFEA6F594FB for ; Sun, 18 Mar 2018 22:26:08 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yw0-x22e.google.com (mail-yw0-x22e.google.com [IPv6:2607:f8b0:4002:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F6946A159 for ; Sun, 18 Mar 2018 22:26:08 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yw0-x22e.google.com with SMTP id l200so10373075ywb.0 for ; Sun, 18 Mar 2018 15:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+Onsl0hVrIPTrfE4dLw25PSVHTaYW0ApRfEYzLBieFc=; b=K+k6uVtDExOq4v5CZ+IMbol+BkMDCQu0+O9L7bX73yKVj/SF3P/2YPOUOM7aRnOWg4 U7QQQUjgRA5JMAiCClAIbVhL48hgCzd0KOKkhLdDjwWrmKGb/+sLI0KOimyAXypYWI4Q norD6zXAdVp45I9iDNjhoQ5W2rsMkYxDjthDU= 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=+Onsl0hVrIPTrfE4dLw25PSVHTaYW0ApRfEYzLBieFc=; b=iGBiFDj0v3M065rGGSY0r6ztrMz3SKblSFrbqdw4W991aZ/s6pQtTCvVFR16GG7Iy+ X75Q5X/+79pYNkP+d6NVSBd0U1lV+UqYnM8Z04H5qE2VFjZKO7umDBn0wMaxBLndOBPI dP+OQJizRsFX2QfXB8inVR5tXzcaHFwGTu8kT+R6TmJIQ7up34B1RbiJASAzVcF4hCGp DMF01Uh0XjlOcgO54U7b2T8gnwC/l921kPSMBRWhAREa3b5xR3+96QZT8HYJsp+WDFEJ RZtLGThJsB+aJZSRUK469y7Axn3WsXQWxgpH/W3DpjbFt2ceKLPMhH861kWH05+6MHoH DaaQ== X-Gm-Message-State: AElRT7GChSTsTrHmRQbgBUqBGmdH+w/AKLepR6VXVEj4aPzVfYUF6VJr DUIcwpsn3LjAVvJkLgtULnnwMPIb9UV1gUoNCUf4qw== X-Google-Smtp-Source: AG47ELtImSRWypBKJCLrMvKUBRX/g+rPfMSQUfiWjsznPtD89pu9QmdIFeyFqQzaqSW95EjHQQEXnAZmmcmN92MKkw8= X-Received: by 10.129.120.130 with SMTP id t124mr5624721ywc.37.1521411967455; Sun, 18 Mar 2018 15:26:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:23d2:0:0:0:0:0 with HTTP; Sun, 18 Mar 2018 15:25:37 -0700 (PDT) In-Reply-To: <201706030242.v532gni4072040@repo.freebsd.org> References: <201706030242.v532gni4072040@repo.freebsd.org> From: Eitan Adler Date: Sun, 18 Mar 2018 15:25:37 -0700 Message-ID: Subject: Re: svn commit: r319510 - head/contrib/xz/src/liblzma/check To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:26:09 -0000 On 2 June 2017 at 19:42, Ed Maste wrote: > Author: emaste > Date: Sat Jun 3 02:42:49 2017 > New Revision: 319510 > URL: https://svnweb.freebsd.org/changeset/base/319510 > > Log: > xz: set noexec stack flag on FreeBSD Heya. Is this one safe to MFC ? -- Eitan Adler From owner-svn-src-all@freebsd.org Sun Mar 18 22:29:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1A1EF59902; Sun, 18 Mar 2018 22:29:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63B7E6A38B; Sun, 18 Mar 2018 22:29:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59BF2265EF; Sun, 18 Mar 2018 22:29:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMTgrR043611; Sun, 18 Mar 2018 22:29:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMTgj3043609; Sun, 18 Mar 2018 22:29:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182229.w2IMTgj3043609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331149 - in stable/11: sys/dev/pci usr.sbin/pciconf X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11: sys/dev/pci usr.sbin/pciconf X-SVN-Commit-Revision: 331149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:29:42 -0000 Author: eadler Date: Sun Mar 18 22:29:41 2018 New Revision: 331149 URL: https://svnweb.freebsd.org/changeset/base/331149 Log: MFC r315190: Add constants and descriptions for some new PCI class definitions Modified: stable/11/sys/dev/pci/pcireg.h stable/11/usr.sbin/pciconf/pciconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pci/pcireg.h ============================================================================== --- stable/11/sys/dev/pci/pcireg.h Sun Mar 18 22:24:29 2018 (r331148) +++ stable/11/sys/dev/pci/pcireg.h Sun Mar 18 22:29:41 2018 (r331149) @@ -480,6 +480,11 @@ #define PCIS_DASP_MGMT_CARD 0x20 #define PCIS_DASP_OTHER 0x80 +#define PCIC_ACCEL 0x12 +#define PCIS_ACCEL_PROCESSING 0x00 + +#define PCIC_INSTRUMENT 0x13 + #define PCIC_OTHER 0xff /* Bridge Control Values. */ Modified: stable/11/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/11/usr.sbin/pciconf/pciconf.c Sun Mar 18 22:24:29 2018 (r331148) +++ stable/11/usr.sbin/pciconf/pciconf.c Sun Mar 18 22:29:41 2018 (r331149) @@ -700,6 +700,9 @@ static struct {PCIC_DASP, PCIS_DASP_PERFCNTRS, "performance counters"}, {PCIC_DASP, PCIS_DASP_COMM_SYNC, "communication synchronizer"}, {PCIC_DASP, PCIS_DASP_MGMT_CARD, "signal processing management"}, + {PCIC_ACCEL, -1, "processing accelerators"}, + {PCIC_ACCEL, PCIS_ACCEL_PROCESSING, "processing accelerators"}, + {PCIC_INSTRUMENT, -1, "non-essential instrumentation"}, {0, 0, NULL} }; From owner-svn-src-all@freebsd.org Sun Mar 18 22:36:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1329F5A0BC; Sun, 18 Mar 2018 22:36:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 650366AAA6; Sun, 18 Mar 2018 22:36:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FD712678F; Sun, 18 Mar 2018 22:36:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMaLDB048521; Sun, 18 Mar 2018 22:36:21 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMaLpF048520; Sun, 18 Mar 2018 22:36:21 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182236.w2IMaLpF048520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331150 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 331150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:36:21 -0000 Author: eadler Date: Sun Mar 18 22:36:21 2018 New Revision: 331150 URL: https://svnweb.freebsd.org/changeset/base/331150 Log: MFC r325215,r325216: Update tuning(7) some more At this point its unclear how much help tuning(7) is whatsoever but leave it around in case someone decides to spend some time on it. Modified: stable/11/share/man/man7/tuning.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/tuning.7 ============================================================================== --- stable/11/share/man/man7/tuning.7 Sun Mar 18 22:29:41 2018 (r331149) +++ stable/11/share/man/man7/tuning.7 Sun Mar 18 22:36:21 2018 (r331150) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd October 30, 2017 .Dt TUNING 7 .Os .Sh NAME @@ -41,8 +41,7 @@ Configuring too little swap can lead to inefficiencies in the VM page scanning code as well as create issues later on if you add more memory to your machine. On larger systems -with multiple SCSI disks (or multiple IDE disks operating on different -controllers), configure swap on each drive. +with multiple disks, configure swap on each drive. The swap partitions on the drives should be approximately the same size. The kernel can handle arbitrary sizes but internal data structures scale to 4 times the largest swap partition. @@ -176,11 +175,6 @@ This means you want to use a large off-center stripe size such as 1152 sectors so sequential I/O does not seek both disks and so meta-data is distributed across both disks rather than concentrated on a single disk. -If -you really need to get sophisticated, we recommend using a real hardware -RAID controller from the list of -.Fx -supported controllers. .Sh SYSCTL TUNING .Xr sysctl 8 variables permit system behavior to be monitored and controlled at @@ -347,9 +341,6 @@ is adhered to. .Pp There are various other buffer-cache and VM page cache related sysctls. We do not recommend modifying these values. -As of -.Fx 4.3 , -the VM system does an extremely good job tuning itself. .Pp The .Va net.inet.tcp.sendspace @@ -547,30 +538,12 @@ and reboot the system. .Va kern.maxusers controls the scaling of a number of static system tables, including defaults for the maximum number of open files, sizing of network memory resources, etc. -As of -.Fx 4.5 , .Va kern.maxusers is automatically sized at boot based on the amount of memory available in the system, and may be determined at run-time by inspecting the value of the read-only .Va kern.maxusers sysctl. -Some sites will require larger or smaller values of -.Va kern.maxusers -and may set it as a loader tunable; values of 64, 128, and 256 are not -uncommon. -We do not recommend going above 256 unless you need a huge number -of file descriptors; many of the tunable values set to their defaults by -.Va kern.maxusers -may be individually overridden at boot-time or run-time as described -elsewhere in this document. -Systems older than -.Fx 4.4 -must set this value via the kernel -.Xr config 8 -option -.Cd maxusers -instead. .Pp The .Va kern.dfldsiz @@ -619,14 +592,6 @@ The option to .Xr netstat 1 may be used to observe network cluster use. -Older versions of -.Fx -do not have this tunable and require that the -kernel -.Xr config 8 -option -.Dv NMBCLUSTERS -be set instead. .Pp More and more programs are using the .Xr sendfile 2 @@ -705,11 +670,6 @@ can be used to monitor this. There are many solutions to saturated disks: increasing memory for caching, mirroring disks, distributing operations across several machines, and so forth. -If disk performance is an issue and you -are using IDE drives, switching to SCSI can help a great deal. -While modern -IDE drives compare with SCSI in raw sequential bandwidth, the moment you -start seeking around the disk SCSI drives usually win. .Pp Finally, you might run out of network suds. Optimize the network path @@ -718,10 +678,7 @@ For example, in .Xr firewall 7 we describe a firewall protecting internal hosts with a topology where the externally visible hosts are not routed through it. -Use 1000BaseT rather -than 100BaseT, depending on your needs. -Most bottlenecks occur at the WAN link (e.g.,\& -modem, T1, DSL, whatever). +Most bottlenecks occur at the WAN link. If expanding the link is not an option it may be possible to use the .Xr dummynet 4 feature to implement peak shaving or other forms of traffic shaping to From owner-svn-src-all@freebsd.org Sun Mar 18 22:42:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE298F5A92A; Sun, 18 Mar 2018 22:42:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 500076B408; Sun, 18 Mar 2018 22:42:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AFC126908; Sun, 18 Mar 2018 22:42:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMgXCl054051; Sun, 18 Mar 2018 22:42:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMgXx9054050; Sun, 18 Mar 2018 22:42:33 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182242.w2IMgXx9054050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331151 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/netpfil/ipfw X-SVN-Commit-Revision: 331151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:42:33 -0000 Author: eadler Date: Sun Mar 18 22:42:32 2018 New Revision: 331151 URL: https://svnweb.freebsd.org/changeset/base/331151 Log: MFC r314955: o Typo in the comment fixed. Modified: stable/11/sys/netpfil/ipfw/ip_fw_table.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_table.c Sun Mar 18 22:36:21 2018 (r331150) +++ stable/11/sys/netpfil/ipfw/ip_fw_table.c Sun Mar 18 22:42:32 2018 (r331151) @@ -406,7 +406,7 @@ prepare_batch_buffer(struct ip_fw_chain *ch, struct ta error = 0; ta_buf_sz = ta->ta_buf_size; if (count == 1) { - /* Sigle add/delete, use on-stack buffer */ + /* Single add/delete, use on-stack buffer */ memset(*ta_buf, 0, TA_BUF_SZ); ta_buf_m = *ta_buf; } else { From owner-svn-src-all@freebsd.org Sun Mar 18 22:55:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A708F5B63B; Sun, 18 Mar 2018 22:55:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D94F06BB47; Sun, 18 Mar 2018 22:55:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D444B26A80; Sun, 18 Mar 2018 22:55:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMt7Au059014; Sun, 18 Mar 2018 22:55:07 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMt7Va059013; Sun, 18 Mar 2018 22:55:07 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182255.w2IMt7Va059013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331152 - stable/11/sys/dev/flash X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/flash X-SVN-Commit-Revision: 331152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:55:08 -0000 Author: eadler Date: Sun Mar 18 22:55:07 2018 New Revision: 331152 URL: https://svnweb.freebsd.org/changeset/base/331152 Log: MFC r303150: [mx25l] add new device id. Modified: stable/11/sys/dev/flash/mx25l.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/flash/mx25l.c ============================================================================== --- stable/11/sys/dev/flash/mx25l.c Sun Mar 18 22:42:32 2018 (r331151) +++ stable/11/sys/dev/flash/mx25l.c Sun Mar 18 22:55:07 2018 (r331152) @@ -137,6 +137,9 @@ struct mx25l_flash_ident flash_devices[] = { /* Atmel */ { "at25df641", 0x1f, 0x4800, 64 * 1024, 128, FL_ERASE_4K }, + + /* GigaDevice */ + { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, }; static uint8_t From owner-svn-src-all@freebsd.org Mon Mar 19 00:25:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB300F61254; Mon, 19 Mar 2018 00:25:11 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E3CB6F2F0; Mon, 19 Mar 2018 00:25:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CA1727829; Mon, 19 Mar 2018 00:25:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J0PBmj004539; Mon, 19 Mar 2018 00:25:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J0PBqV004538; Mon, 19 Mar 2018 00:25:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201803190025.w2J0PBqV004538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 19 Mar 2018 00:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331153 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 331153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 00:25:11 -0000 Author: mjg Date: Mon Mar 19 00:25:10 2018 New Revision: 331153 URL: https://svnweb.freebsd.org/changeset/base/331153 Log: Update my calendar entry to be more specific now that UTF8 turns out to be fine Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Mar 18 22:55:07 2018 (r331152) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Mar 19 00:25:10 2018 (r331153) @@ -251,7 +251,7 @@ 06/30 Guido van Rooij born in Best, Noord-Brabant, the Netherlands, 1965 06/30 Second quarter status reports are due on 07/15 07/01 Matthew Dillon born in San Francisco, California, United States, 1966 -07/01 Mateusz Guzik born in Nowy Targ, Poland, 1986 +07/01 Mateusz Guzik born in DoÅ‚ki Górne, Poland, 1986 07/02 Mark Christopher Ovens born in Preston, Lancashire, United Kingdom, 1958 07/02 Vasil Venelinov Dimov born in Shumen, Bulgaria, 1982 07/04 Motoyuki Konno born in Musashino, Tokyo, Japan, 1969 From owner-svn-src-all@freebsd.org Mon Mar 19 01:05:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B654AF63C19; Mon, 19 Mar 2018 01:05:09 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 553547097C; Mon, 19 Mar 2018 01:05:08 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 59FC6DF72; Mon, 19 Mar 2018 01:05:02 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id 2B60760D6C; Mon, 19 Mar 2018 01:05:02 +0000 (UTC) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331049 - in head/sys: conf crypto/chacha20 modules modules/chacha20 References: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> Date: Mon, 19 Mar 2018 02:05:02 +0100 In-Reply-To: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> (Conrad Meyer's message of "Fri, 16 Mar 2018 07:11:54 +0000 (UTC)") Message-ID: <86woy87u4h.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 01:05:09 -0000 Conrad Meyer writes: > Log: > Garbage collect unused chacha20 code This is wrong. You should have asked me before committing. Please revert and contact me off-list. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@freebsd.org Mon Mar 19 01:24:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2781AF64CF3; Mon, 19 Mar 2018 01:24:16 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f46.google.com (mail-it0-f46.google.com [209.85.214.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA5A971371; Mon, 19 Mar 2018 01:24:15 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f46.google.com with SMTP id e195-v6so8348483ita.5; Sun, 18 Mar 2018 18:24:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=cQtlQ+pNXSCyD9cTYW2gjud+zlJPLHmqK/a2dlgZsL0=; b=VZyknKFC5zmNfAgwf6Nb45hvsXYVpDmIgrgzZLCgz7JgMZS0Zm3vWvqKP0yrkBUX1v mBb3S9uV33LKnpcnFkotvTWDB3ZuFfULVg2WWN32t46X1yrkaWaqgmgT8LzGbbfucAaX pw6W0zysOV5/QR2ZMSNbsr+lpTLYjTUSEG52j3yfW2GEAVFpei7oXhB6X/mEZR72csV1 3fD2atn1SyNbhJHdG5tDG3Vtua2aX0Atxys4L2uevRdWsleBgVtUQ4LKHCFuOlM0O5ex TnodIcGtmHcsTnAgFWnzHwRMxTy9X6sJol0QVJIP39Chu5XyFLCIplRzkcje2pRHGO// 6JZA== X-Gm-Message-State: AElRT7HmIIDSqlldAHwj9XHD14F/0t2FG5MpNjLSX3s83X2Lz4qv+HOd Wv+YrWrl3sSrTVg9gu7Y0S/T4zEI X-Google-Smtp-Source: AG47ELv5Ywlug8Dqmk6UbtGoWLbBukDJI0tx26nptXK/EQfkJF8Jz+QFLHblL7tDGAmQjitch9X/ng== X-Received: by 2002:a24:aa06:: with SMTP id b6-v6mr10196179itf.148.1521422649369; Sun, 18 Mar 2018 18:24:09 -0700 (PDT) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com. [209.85.214.53]) by smtp.gmail.com with ESMTPSA id 202sm7381091iti.19.2018.03.18.18.24.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Mar 2018 18:24:09 -0700 (PDT) Received: by mail-it0-f53.google.com with SMTP id y20-v6so8257925itc.5; Sun, 18 Mar 2018 18:24:09 -0700 (PDT) X-Received: by 2002:a24:82c1:: with SMTP id t184-v6mr10616860itd.61.1521422649096; Sun, 18 Mar 2018 18:24:09 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Sun, 18 Mar 2018 18:24:08 -0700 (PDT) In-Reply-To: <86woy87u4h.fsf@desk.des.no> References: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> <86woy87u4h.fsf@desk.des.no> From: Conrad Meyer Date: Sun, 18 Mar 2018 18:24:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331049 - in head/sys: conf crypto/chacha20 modules modules/chacha20 To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 01:24:16 -0000 On Sun, Mar 18, 2018 at 6:05 PM, Dag-Erling Sm=C3=B8rgrav wrot= e: > Conrad Meyer writes: >> Log: >> Garbage collect unused chacha20 code > > This is wrong. Please elaborate a little bit on why you think so. Conrad From owner-svn-src-all@freebsd.org Mon Mar 19 01:57:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4791EF66AC9; Mon, 19 Mar 2018 01:57:32 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id D067A72324; Mon, 19 Mar 2018 01:57:31 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id CDFECDFC7; Mon, 19 Mar 2018 01:57:30 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id B3AE360D79; Mon, 19 Mar 2018 01:57:30 +0000 (UTC) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331049 - in head/sys: conf crypto/chacha20 modules modules/chacha20 References: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> <86woy87u4h.fsf@desk.des.no> Date: Mon, 19 Mar 2018 02:57:30 +0100 In-Reply-To: (Conrad Meyer's message of "Sun, 18 Mar 2018 18:24:08 -0700") Message-ID: <86o9jk7rp1.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 01:57:32 -0000 Conrad Meyer writes: > Dag-Erling Sm=C3=B8rgrav writes: > > This is wrong. > Please elaborate a little bit on why you think so. Answered off-list. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@freebsd.org Mon Mar 19 02:38:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 127E4F6900B; Mon, 19 Mar 2018 02:38:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4E9F736EC; Mon, 19 Mar 2018 02:38:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB24CBDF; Mon, 19 Mar 2018 02:38:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2c7v9068968; Mon, 19 Mar 2018 02:38:07 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2c72e068967; Mon, 19 Mar 2018 02:38:07 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190238.w2J2c72e068967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331154 - stable/11/contrib/tnftp/src X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/contrib/tnftp/src X-SVN-Commit-Revision: 331154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 02:38:08 -0000 Author: eadler Date: Mon Mar 19 02:38:07 2018 New Revision: 331154 URL: https://svnweb.freebsd.org/changeset/base/331154 Log: MFC r328525: ftp(1): Use closefrom() instead of individual close()s. Modified: stable/11/contrib/tnftp/src/cmds.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tnftp/src/cmds.c ============================================================================== --- stable/11/contrib/tnftp/src/cmds.c Mon Mar 19 00:25:10 2018 (r331153) +++ stable/11/contrib/tnftp/src/cmds.c Mon Mar 19 02:38:07 2018 (r331154) @@ -1438,8 +1438,7 @@ shell(int argc, char *argv[]) } oldintr = xsignal(SIGINT, SIG_IGN); if ((pid = fork()) == 0) { - for (pid = 3; pid < 20; pid++) - (void)close(pid); + (void)closefrom(3); (void)xsignal(SIGINT, SIG_DFL); shellp = getenv("SHELL"); if (shellp == NULL) From owner-svn-src-all@freebsd.org Mon Mar 19 02:43:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D869F6964E; Mon, 19 Mar 2018 02:43:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0818873B9D; Mon, 19 Mar 2018 02:43:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01A57D6C; Mon, 19 Mar 2018 02:43:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2hKuV073761; Mon, 19 Mar 2018 02:43:20 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2hKZs073759; Mon, 19 Mar 2018 02:43:20 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190243.w2J2hKZs073759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:43:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331155 - stable/11/contrib/mdocml X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/contrib/mdocml X-SVN-Commit-Revision: 331155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 02:43:21 -0000 Author: eadler Date: Mon Mar 19 02:43:20 2018 New Revision: 331155 URL: https://svnweb.freebsd.org/changeset/base/331155 Log: MFC r326601: mdocml: Add IEEE Std 1003.1-2008, 2016 edition Also document IEEE Std 1003.1-2008, 2013 edition in mdoc(7) (as well as the 2016 edition). Modified: stable/11/contrib/mdocml/mdoc.7 stable/11/contrib/mdocml/st.in Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/mdocml/mdoc.7 ============================================================================== --- stable/11/contrib/mdocml/mdoc.7 Mon Mar 19 02:38:07 2018 (r331154) +++ stable/11/contrib/mdocml/mdoc.7 Mon Mar 19 02:43:20 2018 (r331155) @@ -2575,6 +2575,17 @@ The second and last Technical Corrigendum. .br This standard is also called X/Open Portability Guide version 7. +.Pp +.It \-p1003.1-2013 +.St -p1003.1-2013 +.br +The 2013 edition incorporates Technical Corrigendum 1. +.Pp +.It \-p1003.1-2016 +.St -p1003.1-2016 +.br +The 2016 edition incorporates Technical Corrigendum 1 and +Technical Corrigendum 2. .El .It Other standards .Pp Modified: stable/11/contrib/mdocml/st.in ============================================================================== --- stable/11/contrib/mdocml/st.in Mon Mar 19 02:38:07 2018 (r331154) +++ stable/11/contrib/mdocml/st.in Mon Mar 19 02:43:20 2018 (r331155) @@ -35,6 +35,7 @@ LINE("-p1003.1-2001", "IEEE Std 1003.1-2001 (\\(LqPOSI LINE("-p1003.1-2004", "IEEE Std 1003.1-2004 (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1-2008", "IEEE Std 1003.1-2008 (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1-2013", "IEEE Std 1003.1-2008, 2013 Edition (\\(LqPOSIX.1\\(Rq)") +LINE("-p1003.1-2016", "IEEE Std 1003.1-2008, 2016 Edition (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1", "IEEE Std 1003.1 (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1b", "IEEE Std 1003.1b (\\(LqPOSIX.1b\\(Rq)") LINE("-p1003.1b-93", "IEEE Std 1003.1b-1993 (\\(LqPOSIX.1b\\(Rq)") From owner-svn-src-all@freebsd.org Mon Mar 19 02:44:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D17AF69755; Mon, 19 Mar 2018 02:44:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 42B2373CF8; Mon, 19 Mar 2018 02:44:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B8F6D6D; Mon, 19 Mar 2018 02:44:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2ihrf073871; Mon, 19 Mar 2018 02:44:43 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2ihO4073870; Mon, 19 Mar 2018 02:44:43 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190244.w2J2ihO4073870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331156 - stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Commit-Revision: 331156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 02:44:43 -0000 Author: eadler Date: Mon Mar 19 02:44:42 2018 New Revision: 331156 URL: https://svnweb.freebsd.org/changeset/base/331156 Log: MFC r323135: Spelling. Modified: stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte ============================================================================== --- stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Mon Mar 19 02:43:20 2018 (r331155) +++ stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Mon Mar 19 02:44:42 2018 (r331156) @@ -84,7 +84,7 @@ LANG=de_DE.ISO8859-1 03/15 Einmarsch deutscher Truppen in die Tschechoslowakei, 1939 03/23 Rückgabe des Memelgebietes an Deutschland, 1939 08/23 Abschluß des Hitler-Stalin-Paktes, 1939 -09/03 Kriegserklärung Großbritaniens und Frankreichs an Deutschland, 1939 +09/03 Kriegserklärung Großbritanniens und Frankreichs an Deutschland, 1939 04/09 Deutsche Besetzung Dänemarks, Invasion in Norwegen, 1940 05/10 Deutscher Angriff auf Belgien, die Niederlande, Luxemburg und Frankreich, 1940 From owner-svn-src-all@freebsd.org Mon Mar 19 02:46:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7A42F698EB; Mon, 19 Mar 2018 02:46:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75AF673E69; Mon, 19 Mar 2018 02:46:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 704FBD6E; Mon, 19 Mar 2018 02:46:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2kHId073988; Mon, 19 Mar 2018 02:46:17 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2kHvu073987; Mon, 19 Mar 2018 02:46:17 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190246.w2J2kHvu073987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331157 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 02:46:18 -0000 Author: eadler Date: Mon Mar 19 02:46:17 2018 New Revision: 331157 URL: https://svnweb.freebsd.org/changeset/base/331157 Log: MFC r322991: Fix a day-one typo in tty.4 - the sysctls in question are "tty", not "tk" Modified: stable/11/share/man/man4/tty.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/tty.4 ============================================================================== --- stable/11/share/man/man4/tty.4 Mon Mar 19 02:44:42 2018 (r331156) +++ stable/11/share/man/man4/tty.4 Mon Mar 19 02:46:17 2018 (r331157) @@ -360,9 +360,9 @@ is cleared in the terminal. The total number of input and output bytes through all terminal devices are available via the -.Va kern.tk_nin +.Va kern.tty_nin and -.Va kern.tk_nout +.Va kern.tty_nout read-only .Xr sysctl 8 variables. From owner-svn-src-all@freebsd.org Mon Mar 19 03:04:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4B1EF6AE0A; Mon, 19 Mar 2018 03:04:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EF6874F37; Mon, 19 Mar 2018 03:04:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 894D210EC; Mon, 19 Mar 2018 03:04:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J34JZt084740; Mon, 19 Mar 2018 03:04:19 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J34J8Z084739; Mon, 19 Mar 2018 03:04:19 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190304.w2J34J8Z084739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331158 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 331158 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:04:20 -0000 Author: eadler Date: Mon Mar 19 03:04:19 2018 New Revision: 331158 URL: https://svnweb.freebsd.org/changeset/base/331158 Log: MFC r314052: Document what the different flags mean for locking. Modified: stable/11/sys/sys/bufobj.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/bufobj.h ============================================================================== --- stable/11/sys/sys/bufobj.h Mon Mar 19 02:46:17 2018 (r331157) +++ stable/11/sys/sys/bufobj.h Mon Mar 19 03:04:19 2018 (r331158) @@ -90,6 +90,12 @@ struct buf_ops { #define BO_WRITE(bo, bp) ((bo)->bo_ops->bop_write((bp))) #define BO_BDFLUSH(bo, bp) ((bo)->bo_ops->bop_bdflush((bo), (bp))) +/* + * Locking notes: + * 'S' is sync_mtx + * 'v' is the vnode lock which embeds the bufobj. + * '-' Constant and unchanging after initialization. + */ struct bufobj { struct rwlock bo_lock; /* Lock which protects "i" things */ struct buf_ops *bo_ops; /* - Buffer operations */ From owner-svn-src-all@freebsd.org Mon Mar 19 03:06:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 914285A; Mon, 19 Mar 2018 03:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 297C5750E3; Mon, 19 Mar 2018 03:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E20E10ED; Mon, 19 Mar 2018 03:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J36REN084859; Mon, 19 Mar 2018 03:06:27 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J36Rfa084858; Mon, 19 Mar 2018 03:06:27 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190306.w2J36Rfa084858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331159 - stable/11/sys/dev/usb/input X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/usb/input X-SVN-Commit-Revision: 331159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:06:28 -0000 Author: eadler Date: Mon Mar 19 03:06:27 2018 New Revision: 331159 URL: https://svnweb.freebsd.org/changeset/base/331159 Log: MFC r304725: Bring datasheet URL up to date. Modified: stable/11/sys/dev/usb/input/uep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/uep.c ============================================================================== --- stable/11/sys/dev/usb/input/uep.c Mon Mar 19 03:04:19 2018 (r331158) +++ stable/11/sys/dev/usb/input/uep.c Mon Mar 19 03:06:27 2018 (r331159) @@ -29,7 +29,7 @@ */ /* - * http://home.eeti.com.tw/web20/drivers/Software%20Programming%20Guide_v2.0.pdf + * http://www.eeti.com.tw/pdf/Software%20Programming%20Guide_v2.0.pdf */ #include From owner-svn-src-all@freebsd.org Mon Mar 19 03:13:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 431C07B0; Mon, 19 Mar 2018 03:13:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE69D7559B; Mon, 19 Mar 2018 03:13:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5B6E1293; Mon, 19 Mar 2018 03:13:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3DgQ4090038; Mon, 19 Mar 2018 03:13:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3Dg1h090037; Mon, 19 Mar 2018 03:13:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190313.w2J3Dg1h090037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331160 - stable/11/lib/libedit X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libedit X-SVN-Commit-Revision: 331160 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:13:43 -0000 Author: eadler Date: Mon Mar 19 03:13:42 2018 New Revision: 331160 URL: https://svnweb.freebsd.org/changeset/base/331160 Log: MFC r317570: editline.3: Add missing argument to H_SET description The H_SET operation of the history() function takes an int argument which is the position of the item to which the cursor should be moved to. Modified: stable/11/lib/libedit/editline.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libedit/editline.3 ============================================================================== --- stable/11/lib/libedit/editline.3 Mon Mar 19 03:06:27 2018 (r331159) +++ stable/11/lib/libedit/editline.3 Mon Mar 19 03:13:42 2018 (r331160) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 24, 2016 +.Dd April 28, 2017 .Dt EDITLINE 3 .Os .Sh NAME @@ -767,7 +767,7 @@ Return the previous element in the history. Return the next element in the history. .It Dv H_CURR Return the current element in the history. -.It Dv H_SET +.It Dv H_SET , Fa "int position" Set the cursor to point to the requested element. .It Dv H_ADD , Fa "const char *str" Append From owner-svn-src-all@freebsd.org Mon Mar 19 03:15:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6334CA9C; Mon, 19 Mar 2018 03:15:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 164637574A; Mon, 19 Mar 2018 03:15:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10A441297; Mon, 19 Mar 2018 03:15:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3FXg8090150; Mon, 19 Mar 2018 03:15:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3FXIT090148; Mon, 19 Mar 2018 03:15:33 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190315.w2J3FXIT090148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:15:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331161 - stable/11/sys/dev/bnxt X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/bnxt X-SVN-Commit-Revision: 331161 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:15:34 -0000 Author: eadler Date: Mon Mar 19 03:15:33 2018 New Revision: 331161 URL: https://svnweb.freebsd.org/changeset/base/331161 Log: MFC r317798: bnxt: Add support for new Broadcom 100Gb adapter BCM57454 Modified: stable/11/sys/dev/bnxt/bnxt.h stable/11/sys/dev/bnxt/if_bnxt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bnxt/bnxt.h ============================================================================== --- stable/11/sys/dev/bnxt/bnxt.h Mon Mar 19 03:13:42 2018 (r331160) +++ stable/11/sys/dev/bnxt/bnxt.h Mon Mar 19 03:15:33 2018 (r331161) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #define BCM57417_NPAR1 0x16c0 #define BCM57417_NPAR2 0x16cc #define BCM57417_SFP 0x16e2 +#define BCM57454 0x1614 #define BCM58700 0x16cd #define NETXTREME_C_VF1 0x16cb #define NETXTREME_C_VF2 0x16e1 Modified: stable/11/sys/dev/bnxt/if_bnxt.c ============================================================================== --- stable/11/sys/dev/bnxt/if_bnxt.c Mon Mar 19 03:13:42 2018 (r331160) +++ stable/11/sys/dev/bnxt/if_bnxt.c Mon Mar 19 03:15:33 2018 (r331161) @@ -127,6 +127,8 @@ static pci_vendor_info_t bnxt_vendor_info_array[] = "Broadcom BCM57417 NetXtreme-E Ethernet Partition"), PVID(BROADCOM_VENDOR_ID, BCM57417_SFP, "Broadcom BCM57417 NetXtreme-E 10Gb/25Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57454, + "Broadcom BCM57454 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet"), PVID(BROADCOM_VENDOR_ID, BCM58700, "Broadcom BCM58700 Nitro 1Gb/2.5Gb/10Gb Ethernet"), PVID(BROADCOM_VENDOR_ID, NETXTREME_C_VF1, From owner-svn-src-all@freebsd.org Mon Mar 19 03:19:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D04F6F31; Mon, 19 Mar 2018 03:19:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CBF0759DB; Mon, 19 Mar 2018 03:19:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67A07129A; Mon, 19 Mar 2018 03:19:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3JTXS090321; Mon, 19 Mar 2018 03:19:29 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3JTmm090320; Mon, 19 Mar 2018 03:19:29 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190319.w2J3JTmm090320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331162 - stable/11/usr.bin/fortune/datfiles X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/fortune/datfiles X-SVN-Commit-Revision: 331162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:19:30 -0000 Author: eadler Date: Mon Mar 19 03:19:29 2018 New Revision: 331162 URL: https://svnweb.freebsd.org/changeset/base/331162 Log: MFC r325091: Prefer using https over http Modified: stable/11/usr.bin/fortune/datfiles/freebsd-tips Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/fortune/datfiles/freebsd-tips ============================================================================== --- stable/11/usr.bin/fortune/datfiles/freebsd-tips Mon Mar 19 03:15:33 2018 (r331161) +++ stable/11/usr.bin/fortune/datfiles/freebsd-tips Mon Mar 19 03:19:29 2018 (r331162) @@ -68,7 +68,7 @@ If you need a reminder to leave your terminal, type "l % If you need to ask a question on the FreeBSD-questions mailing list then - http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\ + https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\ freebsd-questions/index.html contains lots of useful advice to help you get the best results. @@ -99,7 +99,7 @@ environment variable in order to make cdcontrol want t If you'd like to keep track of applications in the FreeBSD ports tree, take a look at FreshPorts; - http://www.freshports.org/ + https://www.freshports.org/ % In order to make fetch (the FreeBSD downloading tool) ask for username/password when it encounters a password-protected web page, you can set @@ -445,7 +445,7 @@ You can use "pkg info" to see a list of packages you h % You can use the 'fetch' command to retrieve files over ftp, http or https. - fetch http://www.FreeBSD.org/index.html + fetch https://www.FreeBSD.org/index.html will download the front page of the FreeBSD web site. % From owner-svn-src-all@freebsd.org Mon Mar 19 03:20:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89C2BF42099; Mon, 19 Mar 2018 03:20:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16F9775C5D; Mon, 19 Mar 2018 03:20:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11D1312A0; Mon, 19 Mar 2018 03:20:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3KZ0f090432; Mon, 19 Mar 2018 03:20:35 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3KZWn090431; Mon, 19 Mar 2018 03:20:35 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190320.w2J3KZWn090431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:20:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331163 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 331163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:20:36 -0000 Author: eadler Date: Mon Mar 19 03:20:35 2018 New Revision: 331163 URL: https://svnweb.freebsd.org/changeset/base/331163 Log: MFC r303412: Remove myself from kern_timeout.c yeah! Modified: stable/11/MAINTAINERS Directory Properties: stable/11/ (props changed) Modified: stable/11/MAINTAINERS ============================================================================== --- stable/11/MAINTAINERS Mon Mar 19 03:19:29 2018 (r331162) +++ stable/11/MAINTAINERS Mon Mar 19 03:20:35 2018 (r331163) @@ -37,7 +37,6 @@ subsystem login notes ----------------------------- atf freebsd-testing,jmmv,ngie Pre-commit review requested. ath(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org -callout_*(9) rrs Pre-commit review requested -- becareful its tricksy code :o. contrib/compiler-rt dim Pre-commit review preferred. contrib/libc++ dim Pre-commit review preferred. contrib/libcxxrt dim Pre-commit review preferred. From owner-svn-src-all@freebsd.org Mon Mar 19 03:22:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BDC5F424A7; Mon, 19 Mar 2018 03:22:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3997375F5F; Mon, 19 Mar 2018 03:22:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 349341415; Mon, 19 Mar 2018 03:22:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3Min5094902; Mon, 19 Mar 2018 03:22:44 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3Migo094901; Mon, 19 Mar 2018 03:22:44 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190322.w2J3Migo094901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331164 - stable/11/usr.bin/join X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/join X-SVN-Commit-Revision: 331164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:22:44 -0000 Author: eadler Date: Mon Mar 19 03:22:43 2018 New Revision: 331164 URL: https://svnweb.freebsd.org/changeset/base/331164 Log: MFC r320210: join(1): Fix field ordering for -v output Per POSIX, join(1) (in modes other than -o) is a concatenation of selected character fields. The joined field is first, followed by fields in the order they occurred in the input files. Our join(1) utility previously handled this correctly for lines with a match in the other file. But it failed to order output fields correctly for unmatched lines, printed in -a and -v modes. A simple test case is: $ touch a $ echo "2 1" > b $ join -v2 -2 2 a b 1 2 PR: 217711 Modified: stable/11/usr.bin/join/join.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/join/join.c ============================================================================== --- stable/11/usr.bin/join/join.c Mon Mar 19 03:20:35 2018 (r331163) +++ stable/11/usr.bin/join/join.c Mon Mar 19 03:22:43 2018 (r331164) @@ -469,9 +469,15 @@ outoneline(INPUT *F, LINE *lp) else outfield(lp, 0, 1); } - else + else { + /* + * Output the join field, then the remaining fields. + */ + outfield(lp, F->joinf, 0); for (cnt = 0; cnt < lp->fieldcnt; ++cnt) - outfield(lp, cnt, 0); + if (F->joinf != cnt) + outfield(lp, cnt, 0); + } (void)printf("\n"); if (ferror(stdout)) err(1, "stdout"); From owner-svn-src-all@freebsd.org Mon Mar 19 03:28:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86CDDF42B6F; Mon, 19 Mar 2018 03:28:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F2BBF763BC; Mon, 19 Mar 2018 03:28:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED86C141E; Mon, 19 Mar 2018 03:28:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3SO0U095421; Mon, 19 Mar 2018 03:28:24 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3SOmw095420; Mon, 19 Mar 2018 03:28:24 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190328.w2J3SOmw095420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331165 - stable/11/share/dict X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/dict X-SVN-Commit-Revision: 331165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:28:26 -0000 Author: eadler Date: Mon Mar 19 03:28:24 2018 New Revision: 331165 URL: https://svnweb.freebsd.org/changeset/base/331165 Log: MFC r326913: Sync with NetBSD's /usr/share/dict/words, with the exception of quim due to its vulgar nature. Modified: stable/11/share/dict/web2 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/dict/web2 ============================================================================== --- stable/11/share/dict/web2 Mon Mar 19 03:22:43 2018 (r331164) +++ stable/11/share/dict/web2 Mon Mar 19 03:28:24 2018 (r331165) @@ -1545,9 +1545,9 @@ ackman acknow acknowledge acknowledgeable -acknowledgement acknowledged acknowledgedly +acknowledgement acknowledger acknowledgment aclastic @@ -2648,6 +2648,7 @@ admedial admedian admensuration admi +admin adminicle adminicula adminicular @@ -2656,7 +2657,7 @@ adminiculate adminiculation adminiculum administer -administerd +administered administerial administrable administrant @@ -5948,6 +5949,7 @@ alphabetist alphabetization alphabetize alphabetizer +alphanumeric Alphard alphatoluic Alphean @@ -7003,6 +7005,7 @@ amove Amoy Amoyan Amoyese +amp ampalaya ampalea ampangabeite @@ -19646,6 +19649,7 @@ Beaune beaupere beauseant beauship +beaut beauteous beauteously beauteousness @@ -23499,6 +23503,7 @@ blebby blechnoid Blechnum bleck +bled blee bleed bleeder @@ -32163,6 +32168,7 @@ ceilinged ceilingward ceilingwards ceilometer +cel Celadon celadon celadonite @@ -34048,6 +34054,7 @@ checkless checkman checkmate checkoff +checkout checkrack checkrein checkroll @@ -39340,6 +39347,7 @@ collector collectorate collectorship collectress +Colleen colleen collegatary college @@ -42631,6 +42639,7 @@ coony coop cooper cooperage +cooperate Cooperia coopering coopery @@ -57415,6 +57424,7 @@ downlier downligging downlike downline +downlink downlooked downlooker downlying @@ -68583,6 +68593,7 @@ fatuoid fatuous fatuously fatuousness +fatwa fatwood faucal faucalize @@ -70236,6 +70247,7 @@ firestopping firetail firetop firetrap +firewall firewarden firewater fireweed @@ -71816,6 +71828,7 @@ fomenter fomes fomites Fon +fond fondak fondant fondish @@ -74044,6 +74057,7 @@ fuelizer fuerte fuff fuffy +fug fugacious fugaciously fugaciousness @@ -76068,6 +76082,7 @@ geeldikkop geelhout geepound geerah +geese geest geet Geez @@ -85657,6 +85672,7 @@ hickory Hicksite hickwall Hicoria +hid hidable hidage hidalgism @@ -86106,6 +86122,7 @@ hirmos Hirneola hiro Hirofumi +hirofumi hirondelle Hirotoshi Hiroyuki @@ -95495,6 +95512,7 @@ instantaneously instantaneousness instanter instantial +instantiate instantly instantness instar @@ -101941,6 +101959,7 @@ kickout kickseys kickshaw kickup +kid Kidder kidder Kidderminster @@ -106352,6 +106371,7 @@ Libytheinae Licania licareol licca +lice licensable license licensed @@ -106828,6 +106848,7 @@ Limnorchis Limnoria Limnoriidae limnorioid +limo Limodorum limoid limonene @@ -108017,6 +108038,7 @@ logium loglet loglike logman +logo logocracy logodaedaly logogogue @@ -108253,6 +108275,7 @@ looker looking lookout lookum +lookup loom loomer loomery @@ -118182,6 +118205,7 @@ Molinist Molinistic molka Moll +moll molland Mollberg molle @@ -128067,6 +128091,7 @@ nosewards nosewheel nosewise nosey +nosh nosine nosing nosism @@ -130324,6 +130349,7 @@ Oldfieldia Oldhamia oldhamite oldhearted +oldie oldish oldland oldness @@ -147610,6 +147636,7 @@ placeable Placean placebo placeful +placeholder placeless placelessly placemaker @@ -152000,6 +152027,7 @@ pot potability potable potableness +potage potagerie potagery potamic @@ -153673,6 +153701,7 @@ predynamite predynastic preen preener +preexist preeze prefab prefabricate @@ -162965,6 +162994,7 @@ rakishness rakit rakshasa raku +rale Ralf rallentando ralliance @@ -165219,6 +165249,7 @@ redhoop redia redictate redictation +redid redient redifferentiate redifferentiation @@ -165313,6 +165344,7 @@ redolent redolently redominate redondilla +redone redoom redouble redoublement @@ -166542,6 +166574,7 @@ Rellyanite reload reloan relocable +relocatable relocate relocation relocator @@ -173817,6 +173850,7 @@ sashless sasin sasine saskatoon +sass sassaby sassafac sassafrack @@ -184478,6 +184512,7 @@ softner softness softship softtack +software softwood softy sog @@ -185669,6 +185704,7 @@ spaller spalling spalpeen spalt +spam span spancel spandle @@ -186716,6 +186752,8 @@ spill spillage spiller spillet +spillikin +spillover spillproof spillway spilly @@ -201472,6 +201510,7 @@ Themis themis Themistian themsel +themself themselves then thenabouts @@ -204283,6 +204322,7 @@ tolylenediamine Tolypeutes tolypeutine Tom +tom Toma tomahawk tomahawker @@ -205532,6 +205572,7 @@ trade tradecraft tradeful tradeless +trademark trademaster trader tradership @@ -225433,6 +225474,8 @@ uplight uplimb uplimber upline +uplink +upload uplock uplong uplook @@ -232488,6 +232531,7 @@ wimblelike wimbrel wime wimick +wimp wimple wimpleless wimplelike @@ -233075,6 +233119,7 @@ wog wogiet Wogulian woibe +wok wokas woke wokowi @@ -233456,6 +233501,7 @@ workingman workingwoman workless worklessness +workload workloom workman workmanlike From owner-svn-src-all@freebsd.org Mon Mar 19 03:34:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A234CF462BC; Mon, 19 Mar 2018 03:34:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 452257686E; Mon, 19 Mar 2018 03:34:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D7B01599; Mon, 19 Mar 2018 03:34:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3YeqH000387; Mon, 19 Mar 2018 03:34:40 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3Yesa000386; Mon, 19 Mar 2018 03:34:40 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190334.w2J3Yesa000386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331166 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 331166 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:34:42 -0000 Author: eadler Date: Mon Mar 19 03:34:40 2018 New Revision: 331166 URL: https://svnweb.freebsd.org/changeset/base/331166 Log: MFC r314622: As suggested by several people, note that I prefer to communicate by email. Modified: stable/11/MAINTAINERS Directory Properties: stable/11/ (props changed) Modified: stable/11/MAINTAINERS ============================================================================== --- stable/11/MAINTAINERS Mon Mar 19 03:28:24 2018 (r331165) +++ stable/11/MAINTAINERS Mon Mar 19 03:34:40 2018 (r331166) @@ -49,17 +49,17 @@ dev/usb/wlan adrian Pre-commit review requested, send code, please have patches reviewed by secteam. etc/mail gshapiro Pre-commit review requested. Keep in sync with -STABLE. etc/sendmail gshapiro Pre-commit review requested. Keep in sync with -STABLE. -fetch des Pre-commit review requested. +fetch des Pre-commit review requested, email only. geli pjd Pre-commit review requested (both sys/geom/eli/ and sbin/geom/class/eli/). isci(4) jimharris Pre-commit review requested. iwm(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org iwn(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org kqueue jmg Pre-commit review requested. Documentation Required. libdpv dteske Pre-commit review requested. Keep in sync with dpv(1). -libfetch des Pre-commit review requested. +libfetch des Pre-commit review requested, email only. libfigpar dteske Pre-commit review requested. -libpam des Pre-commit review requested. -linprocfs des Pre-commit review requested. +libpam des Pre-commit review requested, email only. +linprocfs des Pre-commit review requested, email only. lpr gad Pre-commit review requested, particularly for lpd/recvjob.c and lpd/printjob.c. nanobsd imp Pre-commit phabricator review requested. @@ -70,13 +70,13 @@ nvd(4) jimharris Pre-commit review requested. nvme(4) jimharris Pre-commit review requested. nvmecontrol(8) jimharris Pre-commit review requested. opencrypto jmg Pre-commit review requested. Documentation Required. -openssh des Pre-commit review requested. +openssh des Pre-commit review requested, email only. openssl benl,jkim Pre-commit review requested. otus(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org pci bus imp,jhb Pre-commit review requested. pmcstudy(8) rrs Pre-commit review requested. -procfs des Pre-commit review requested. -pseudofs des Pre-commit review requested. +procfs des Pre-commit review requested, email only. +pseudofs des Pre-commit review requested, email only. release/release.sh gjb,re Pre-commit review and regression tests requested. sctp rrs,tuexen Pre-commit review requested (changes need to be backported to github). From owner-svn-src-all@freebsd.org Mon Mar 19 03:37:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B540FF465C8; Mon, 19 Mar 2018 03:37:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 66C8B76AEB; Mon, 19 Mar 2018 03:37:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6122D159E; Mon, 19 Mar 2018 03:37:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3b0AN000634; Mon, 19 Mar 2018 03:37:00 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3b0w4000633; Mon, 19 Mar 2018 03:37:00 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190337.w2J3b0w4000633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331167 - stable/11/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/msun/src X-SVN-Commit-Revision: 331167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:37:00 -0000 Author: eadler Date: Mon Mar 19 03:37:00 2018 New Revision: 331167 URL: https://svnweb.freebsd.org/changeset/base/331167 Log: MFC r326482: lib/msun: remove trailing whitespace from e_pow.c Modified: stable/11/lib/msun/src/e_pow.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/msun/src/e_pow.c ============================================================================== --- stable/11/lib/msun/src/e_pow.c Mon Mar 19 03:34:40 2018 (r331166) +++ stable/11/lib/msun/src/e_pow.c Mon Mar 19 03:37:00 2018 (r331167) @@ -4,7 +4,7 @@ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -19,7 +19,7 @@ __FBSDID("$FreeBSD$"); * 1. Compute and return log2(x) in two pieces: * log2(x) = w1 + w2, * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating multi-precision + * 2. Perform y*log2(x) = n+y' by simulating multi-precision * arithmetic, where |y'|<=0.5. * 3. Return x**y = 2**n*exp(y'*log2) * @@ -47,13 +47,13 @@ __FBSDID("$FreeBSD$"); * Accuracy: * pow(x,y) returns x**y nearly rounded. In particular * pow(integer,integer) - * always returns the correct integer provided it is + * always returns the correct integer provided it is * representable. * * Constants : - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -107,14 +107,14 @@ __ieee754_pow(double x, double y) ix = hx&0x7fffffff; iy = hy&0x7fffffff; /* y==zero: x**0 = 1 */ - if((iy|ly)==0) return one; + if((iy|ly)==0) return one; /* x==1: 1**y = 1, even if y is NaN */ if (hx==0x3ff00000 && lx == 0) return one; /* y!=zero: result is NaN if either arg is NaN */ if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || - iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) return (x+0.0)+(y+0.0); /* determine if y is an odd int when x < 0 @@ -123,7 +123,7 @@ __ieee754_pow(double x, double y) * yisint = 2 ... y is an even int */ yisint = 0; - if(hx<0) { + if(hx<0) { if(iy>=0x43400000) yisint = 2; /* even integer y */ else if(iy>=0x3ff00000) { k = (iy>>20)-0x3ff; /* exponent */ @@ -134,11 +134,11 @@ __ieee754_pow(double x, double y) j = iy>>(20-k); if((j<<(20-k))==iy) yisint = 2-(j&1); } - } - } + } + } /* special value of y */ - if(ly==0) { + if(ly==0) { if (iy==0x7ff00000) { /* y is +-inf */ if(((ix-0x3ff00000)|lx)==0) return one; /* (-1)**+-inf is 1 */ @@ -146,14 +146,14 @@ __ieee754_pow(double x, double y) return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ return (hy<0)?-y: zero; - } + } if(iy==0x3ff00000) { /* y is +-1 */ if(hy<0) return one/x; else return x; } if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3fe00000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return sqrt(x); + return sqrt(x); } } @@ -166,13 +166,13 @@ __ieee754_pow(double x, double y) if(hx<0) { if(((ix-0x3ff00000)|yisint)==0) { z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) + } else if(yisint==1) z = -z; /* (x<0)**odd = -(|x|**odd) */ } return z; } } - + /* CYGNUS LOCAL + fdlibm-5.3 fix: This used to be n = (hx>>31)+1; but ANSI C says a right shift of a signed negative quantity is @@ -194,7 +194,7 @@ __ieee754_pow(double x, double y) /* over/underflow if x is not close to one */ if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny; if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute + /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax-one; /* t has 20 trailing zeros */ w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); @@ -287,7 +287,7 @@ __ieee754_pow(double x, double y) n = ((n&0x000fffff)|0x00100000)>>(20-k); if(j<0) n = -n; p_h -= t; - } + } t = p_l+p_h; SET_LOW_WORD(t,0); u = t*lg2_h; From owner-svn-src-all@freebsd.org Mon Mar 19 03:39:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 606BEF467E6; Mon, 19 Mar 2018 03:39:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 050A276CCA; Mon, 19 Mar 2018 03:39:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F40B615A3; Mon, 19 Mar 2018 03:38:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3cx78000743; Mon, 19 Mar 2018 03:38:59 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3cxak000742; Mon, 19 Mar 2018 03:38:59 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190338.w2J3cxak000742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331168 - stable/11/sys/mips/mips X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/mips/mips X-SVN-Commit-Revision: 331168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:39:00 -0000 Author: eadler Date: Mon Mar 19 03:38:59 2018 New Revision: 331168 URL: https://svnweb.freebsd.org/changeset/base/331168 Log: MFC r303812: Use a more conventional spelling of "breakpoint". Modified: stable/11/sys/mips/mips/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/mips/mips/trap.c ============================================================================== --- stable/11/sys/mips/mips/trap.c Mon Mar 19 03:37:00 2018 (r331167) +++ stable/11/sys/mips/mips/trap.c Mon Mar 19 03:38:59 2018 (r331168) @@ -854,7 +854,7 @@ dofault: } /* * The restoration of the original instruction and - * the clearing of the berakpoint will be done later + * the clearing of the breakpoint will be done later * by the call to ptrace_clear_single_step() in * issignal() when SIGTRAP is processed. */ From owner-svn-src-all@freebsd.org Mon Mar 19 03:44:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 237A1F46F2E; Mon, 19 Mar 2018 03:44:20 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD4B877231; Mon, 19 Mar 2018 03:44:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8448171D; Mon, 19 Mar 2018 03:44:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3iJiN005692; Mon, 19 Mar 2018 03:44:19 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3iJnu005691; Mon, 19 Mar 2018 03:44:19 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190344.w2J3iJnu005691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331169 - stable/11/share/man/man6 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man6 X-SVN-Commit-Revision: 331169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:44:20 -0000 Author: eadler Date: Mon Mar 19 03:44:19 2018 New Revision: 331169 URL: https://svnweb.freebsd.org/changeset/base/331169 Log: MFC r326249: Update intro(6) - remove hint that doesn't work, add explicit list of games instead, and mention the "bsdgames" port. Modified: stable/11/share/man/man6/intro.6 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man6/intro.6 ============================================================================== --- stable/11/share/man/man6/intro.6 Mon Mar 19 03:38:59 2018 (r331168) +++ stable/11/share/man/man6/intro.6 Mon Mar 19 03:44:19 2018 (r331169) @@ -27,30 +27,33 @@ .\" .\" $FreeBSD$ .\" -.Dd February 16, 1997 +.Dd November 27, 2017 .Dt INTRO 6 .Os .Sh NAME .Nm intro .Nd "introduction to games" .Sh DESCRIPTION -This section contains information about games. +This section contains information about the traditional BSD games. The games are located in .Pa /usr/bin if installed. -You can get a short overview about all the games with the -command: -.Bd -literal -offset indent -$ apropos '\\(6\\)' -.Ed .Sh FILES .Bl -tag -width /usr/bin -compact .It Pa /usr/bin location of games .El .Sh SEE ALSO -.Xr intro 1 +.Xr intro 1 , +.Xr banner 6 , +.Xr caesar 6 , +.Xr fortune 6 , +.Xr grdc 6 , +.Xr morse 6 , +.Xr number 6 , +.Xr pom 6 , +.Xr random 6 .Sh HISTORY In earlier versions of .Fx , @@ -61,3 +64,5 @@ The .Nm section manual page appeared in .Fx 2.2 . +Most of the games were moved into the bsdgames port in +.Fx 5.0 . From owner-svn-src-all@freebsd.org Mon Mar 19 03:46:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6B57F4A1E6; Mon, 19 Mar 2018 03:46:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 726D7773D6; Mon, 19 Mar 2018 03:46:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69A951720; Mon, 19 Mar 2018 03:46:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3kDQi005802; Mon, 19 Mar 2018 03:46:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3kDdR005800; Mon, 19 Mar 2018 03:46:13 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190346.w2J3kDdR005800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331170 - in stable/11/sys: dev/atkbdc sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys: dev/atkbdc sys X-SVN-Commit-Revision: 331170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:46:14 -0000 Author: eadler Date: Mon Mar 19 03:46:12 2018 New Revision: 331170 URL: https://svnweb.freebsd.org/changeset/base/331170 Log: MFC r328636: psm(4): Add support for HP EliteBook 1040 ForcePads. ForcePads do not have any physical buttons, instead they detect click based on finger pressure. Forcepads erroneously report button click if there are 2 or more fingers on the touchpad breaking multifinger gestures. To workaround this start reporting a click only after 4 consecutive single touch packets has been received. Skip these packets in case more contacts appear. PR: 223369 Modified: stable/11/sys/dev/atkbdc/psm.c stable/11/sys/sys/mouse.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:44:19 2018 (r331169) +++ stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:46:12 2018 (r331170) @@ -132,6 +132,13 @@ __FBSDID("$FreeBSD$"); #define PSMCPNP_DRIVER_NAME "psmcpnp" +struct psmcpnp_softc { + enum { + PSMCPNP_GENERIC, + PSMCPNP_FORCEPAD, + } type; /* Based on PnP ID */ +}; + /* input queue */ #define PSM_BUFSIZE 960 #define PSM_SMALLBUFSIZE 240 @@ -416,6 +423,7 @@ struct psm_softc { /* Driver status information */ int squelch; /* level to filter movement at low speed */ int syncerrors; /* # of bytes discarded to synchronize */ int pkterrors; /* # of packets failed during quaranteen. */ + int fpcount; /* forcePad valid packet counter */ struct timeval inputtimeout; struct timeval lastsoftintr; /* time of last soft interrupt */ struct timeval lastinputerr; /* time last sync error happened */ @@ -3183,7 +3191,7 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, static int touchpad_buttons; static int guest_buttons; static finger_t f[PSM_FINGERS]; - int w, id, nfingers, ewcode, extended_buttons; + int w, id, nfingers, ewcode, extended_buttons, clickpad_pressed; extended_buttons = 0; @@ -3445,10 +3453,6 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, extended_buttons |= sc->extended_buttons; } } - /* Handle ClickPad */ - if (sc->synhw.capClickPad && - ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01)) - touchpad_buttons |= MOUSE_BUTTON1DOWN; if (sc->synhw.capReportsV && nfingers > 1) f[0] = (finger_t) { @@ -3481,6 +3485,36 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, if (f[0].p < sc->syninfo.min_pressure || f[0].x < 2) nfingers = 0; + /* Handle ClickPad */ + if (sc->synhw.capClickPad) { + clickpad_pressed = (pb->ipacket[0] ^ pb->ipacket[3]) & 0x01; + if (sc->synhw.forcePad) { + /* + * Forcepads erroneously report button click if there + * are 2 or more fingers on the touchpad breaking + * multifinger gestures. To workaround this start + * reporting a click only after 4 consecutive single + * touch packets has been received. + * Skip these packets in case more contacts appear. + */ + switch (nfingers) { + case 0: + sc->fpcount = 0; + break; + case 1: + if (clickpad_pressed && sc->fpcount < INT_MAX) + ++sc->fpcount; + /* FALLTHROUGH */ + default: + if (!clickpad_pressed) + sc->fpcount = 0; + if (sc->fpcount >= sc->syninfo.window_min) + touchpad_buttons |= MOUSE_BUTTON1DOWN; + } + } else if (clickpad_pressed) + touchpad_buttons |= MOUSE_BUTTON1DOWN; + } + for (id = 0; id < PSM_FINGERS; id++) if (id >= nfingers) PSM_FINGER_RESET(f[id]); @@ -6004,6 +6038,8 @@ synaptics_set_mode(struct psm_softc *sc, int mode_byte static int enable_synaptics(struct psm_softc *sc, enum probearg arg) { + device_t psmcpnp; + struct psmcpnp_softc *psmcpnp_sc; KBDC kbdc = sc->kbdc; synapticshw_t synhw; int status[3]; @@ -6081,6 +6117,10 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); } + psmcpnp = devclass_get_device(devclass_find(PSMCPNP_DRIVER_NAME), + sc->unit); + psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL; + /* Set the different capabilities when they exist. */ buttons = 0; synhw.capExtended = (status[0] & 0x80) != 0; @@ -6235,6 +6275,20 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.minimumYCoord = 1408; } + /* + * ClickPad properties are not exported through PS/2 + * protocol. Detection is based on controller's PnP ID. + */ + if (synhw.capClickPad && psmcpnp_sc != NULL) { + switch (psmcpnp_sc->type) { + case PSMCPNP_FORCEPAD: + synhw.forcePad = 1; + break; + default: + break; + } + } + if (verbose >= 2) { printf(" Continued capabilities:\n"); printf(" capClickPad: %d\n", @@ -6271,6 +6325,10 @@ enable_synaptics(struct psm_softc *sc, enum probearg a printf(" minimumYCoord: %d\n", synhw.minimumYCoord); } + if (synhw.capClickPad) { + printf(" forcePad: %d\n", + synhw.forcePad); + } } buttons += synhw.capClickPad; } @@ -7096,7 +7154,7 @@ static device_method_t psmcpnp_methods[] = { static driver_t psmcpnp_driver = { PSMCPNP_DRIVER_NAME, psmcpnp_methods, - 1, /* no softc */ + sizeof(struct psmcpnp_softc), }; static struct isa_pnp_id psmcpnp_ids[] = { @@ -7116,6 +7174,13 @@ static struct isa_pnp_id psmcpnp_ids[] = { { 0 } }; +/* _HID list for quirk detection. Any device below has _CID from psmcpnp_ids */ +static struct isa_pnp_id forcepad_ids[] = { + { 0x0d302e4f, "HP PS/2 forcepad port" }, /* SYN300D, EB 1040 */ + { 0x14302e4f, "HP PS/2 forcepad port" }, /* SYN3014, EB 1040 */ + { 0 } +}; + static int create_a_copy(device_t atkbdc, device_t me) { @@ -7142,11 +7207,16 @@ create_a_copy(device_t atkbdc, device_t me) static int psmcpnp_probe(device_t dev) { + struct psmcpnp_softc *sc = device_get_softc(dev); struct resource *res; u_long irq; int rid; - if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids)) + if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0) + sc->type = PSMCPNP_FORCEPAD; + else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0) + sc->type = PSMCPNP_GENERIC; + else return (ENXIO); /* Modified: stable/11/sys/sys/mouse.h ============================================================================== --- stable/11/sys/sys/mouse.h Mon Mar 19 03:44:19 2018 (r331169) +++ stable/11/sys/sys/mouse.h Mon Mar 19 03:46:12 2018 (r331170) @@ -135,6 +135,7 @@ typedef struct synapticshw { int maximumYCoord; int infoXupmm; int infoYupmm; + int forcePad; } synapticshw_t; /* iftype */ From owner-svn-src-all@freebsd.org Mon Mar 19 03:47:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2025FF4A3C5; Mon, 19 Mar 2018 03:47:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5AB077584; Mon, 19 Mar 2018 03:47:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0AA71724; Mon, 19 Mar 2018 03:47:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3lket005904; Mon, 19 Mar 2018 03:47:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3lkOp005903; Mon, 19 Mar 2018 03:47:46 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190347.w2J3lkOp005903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331171 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 331171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:47:47 -0000 Author: eadler Date: Mon Mar 19 03:47:46 2018 New Revision: 331171 URL: https://svnweb.freebsd.org/changeset/base/331171 Log: MFC r328638: psm(4): Reduce psm watchdog verbosity Modern touchpads do not issue interrupts on inactivity so "lost interrupt" message became annoying spam nowadays. This change quiets the message if debug.psm.loglevel=5 (or less) is set in /boot/loader.conf Approved by: gonzo Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:46:12 2018 (r331170) +++ stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:47:46 2018 (r331171) @@ -2878,7 +2878,7 @@ psmtimeout(void *arg) sc = (struct psm_softc *)arg; s = spltty(); if (sc->watchdog && kbdc_lock(sc->kbdc, TRUE)) { - VLOG(4, (LOG_DEBUG, "psm%d: lost interrupt?\n", sc->unit)); + VLOG(6, (LOG_DEBUG, "psm%d: lost interrupt?\n", sc->unit)); psmintr(sc); kbdc_lock(sc->kbdc, FALSE); } From owner-svn-src-all@freebsd.org Mon Mar 19 03:49:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59421F4A5D7; Mon, 19 Mar 2018 03:49:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0685777711; Mon, 19 Mar 2018 03:49:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 014211726; Mon, 19 Mar 2018 03:49:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3ns6H006011; Mon, 19 Mar 2018 03:49:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3nsaa006010; Mon, 19 Mar 2018 03:49:54 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190349.w2J3nsaa006010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331172 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 331172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:49:55 -0000 Author: eadler Date: Mon Mar 19 03:49:54 2018 New Revision: 331172 URL: https://svnweb.freebsd.org/changeset/base/331172 Log: MFC r328640: psm: Add a kludge to support 0x46 identity middle byte Synaptics touchpads Most synaptics touchpads return 0x47 in middle byte in responce to identify command as stated in p.4.4 of "Synaptics PS/2 TouchPad Interfacing Guide". But some devices e.g. found on HP EliteBook 9470m return 0x46 here. Allow them to be identified as Synaptics as well as 0x47. ExtendedQueries return incorrect data on such a touchpads so we ignore their result and set conservative defaults. PR: 222667 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:47:46 2018 (r331171) +++ stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:49:54 2018 (r331172) @@ -136,6 +136,7 @@ struct psmcpnp_softc { enum { PSMCPNP_GENERIC, PSMCPNP_FORCEPAD, + PSMCPNP_HPSYN81, } type; /* Based on PnP ID */ }; @@ -174,6 +175,15 @@ typedef struct packetbuf { #define PSM_PACKETQUEUE 128 #endif +/* + * Typical bezel limits. Taken from 'Synaptics + * PS/2 TouchPad Interfacing Guide' p.3.2.3. + */ +#define SYNAPTICS_DEFAULT_MAX_X 5472 +#define SYNAPTICS_DEFAULT_MAX_Y 4448 +#define SYNAPTICS_DEFAULT_MIN_X 1472 +#define SYNAPTICS_DEFAULT_MIN_Y 1408 + typedef struct synapticsinfo { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -1096,7 +1106,7 @@ doopen(struct psm_softc *sc, int command_byte) mouse_ext_command(sc->kbdc, 1); get_mouse_status(sc->kbdc, stat, 0, 3); if ((SYNAPTICS_VERSION_GE(sc->synhw, 7, 5) || - stat[1] == 0x47) && + stat[1] == 0x46 || stat[1] == 0x47) && stat[2] == 0x40) { synaptics_set_mode(sc, synaptics_preferred_mode(sc)); VLOG(5, (LOG_DEBUG, "psm%d: Synaptis Absolute Mode " @@ -6043,7 +6053,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a KBDC kbdc = sc->kbdc; synapticshw_t synhw; int status[3]; - int buttons; + int buttons, middle_byte; VLOG(3, (LOG_DEBUG, "synaptics: BEGIN init\n")); @@ -6060,7 +6070,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (status[1] != 0x47) + middle_byte = status[1]; + if (middle_byte != 0x46 && middle_byte != 0x47) return (FALSE); bzero(&synhw, sizeof(synhw)); @@ -6071,7 +6082,15 @@ enable_synaptics(struct psm_softc *sc, enum probearg a printf("Synaptics Touchpad v%d.%d\n", synhw.infoMajor, synhw.infoMinor); - if (synhw.infoMajor < 4) { + /* + * Most synaptics touchpads return 0x47 in middle byte in responce to + * identify command as stated in p.4.4 of "Synaptics PS/2 TouchPad + * Interfacing Guide" and we only support v4.0 or better. But some + * devices return 0x46 here and have a different numbering scheme. + * In the case of 0x46, we allow versions as low as v2.0 + */ + if ((middle_byte == 0x47 && synhw.infoMajor < 4) || + (middle_byte == 0x46 && synhw.infoMajor < 2)) { printf(" Unsupported (pre-v4) Touchpad detected\n"); return (FALSE); } @@ -6112,7 +6131,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) { printf(" Failed to read extended capability bits\n"); return (FALSE); } @@ -6121,10 +6140,29 @@ enable_synaptics(struct psm_softc *sc, enum probearg a sc->unit); psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL; + /* + * Set conservative defaults for 0x46 middle byte touchpads + * as ExtendedQueries return bogus data. + */ + if (middle_byte == 0x46) { + synhw.capExtended = 1; + synhw.capPalmDetect = 1; + synhw.capPassthrough = 1; + synhw.capMultiFinger = 1; + synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X; + synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y; + synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X; + synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y; + /* Enable multitouch mode for HW v8.1 devices */ + if (psmcpnp_sc != NULL && + psmcpnp_sc->type == PSMCPNP_HPSYN81) + synhw.capReportsV = 1; + } else + synhw.capExtended = (status[0] & 0x80) != 0; + /* Set the different capabilities when they exist. */ buttons = 0; - synhw.capExtended = (status[0] & 0x80) != 0; - if (synhw.capExtended) { + if (synhw.capExtended && middle_byte == 0x47) { synhw.nExtendedQueries = (status[0] & 0x70) >> 4; synhw.capMiddle = (status[0] & 0x04) != 0; synhw.capPassthrough = (status[2] & 0x80) != 0; @@ -6246,12 +6284,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.maximumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.maximumXCoord = 5472; - synhw.maximumYCoord = 4448; + synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X; + synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y; } if (synhw.capReportsMin) { @@ -6267,12 +6301,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.minimumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.minimumXCoord = 1472; - synhw.minimumYCoord = 1408; + synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X; + synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y; } /* @@ -6358,7 +6388,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) { printf(" Failed to read mode byte\n"); return (FALSE); } @@ -7181,6 +7211,12 @@ static struct isa_pnp_id forcepad_ids[] = { { 0 } }; +/* List of HW v8.1 synaptics touchpads erroneously detected as HW v2.0 */ +static struct isa_pnp_id hpsyn81_ids[] = { + { 0x9e012e4f, "HP PS/2 trackpad port" }, /* SYN019E, EB 9470 */ + { 0 } +}; + static int create_a_copy(device_t atkbdc, device_t me) { @@ -7214,6 +7250,8 @@ psmcpnp_probe(device_t dev) if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0) sc->type = PSMCPNP_FORCEPAD; + else if(ISA_PNP_PROBE(device_get_parent(dev), dev, hpsyn81_ids) == 0) + sc->type = PSMCPNP_HPSYN81; else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0) sc->type = PSMCPNP_GENERIC; else From owner-svn-src-all@freebsd.org Mon Mar 19 03:53:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F451F4AB2B; Mon, 19 Mar 2018 03:53:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E062577C54; Mon, 19 Mar 2018 03:53:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D985D18BE; Mon, 19 Mar 2018 03:53:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3rkBp010902; Mon, 19 Mar 2018 03:53:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3rkeF010901; Mon, 19 Mar 2018 03:53:46 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190353.w2J3rkeF010901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331173 - stable/11/sys/dev/acpi_support X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/acpi_support X-SVN-Commit-Revision: 331173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:53:47 -0000 Author: eadler Date: Mon Mar 19 03:53:46 2018 New Revision: 331173 URL: https://svnweb.freebsd.org/changeset/base/331173 Log: MFC r312887: Hide unneeded message under bootverbose. Modified: stable/11/sys/dev/acpi_support/acpi_panasonic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpi_support/acpi_panasonic.c ============================================================================== --- stable/11/sys/dev/acpi_support/acpi_panasonic.c Mon Mar 19 03:49:54 2018 (r331172) +++ stable/11/sys/dev/acpi_support/acpi_panasonic.c Mon Mar 19 03:53:46 2018 (r331173) @@ -493,6 +493,10 @@ acpi_panasonic_notify(ACPI_HANDLE h, UINT32 notify, vo } ACPI_SERIAL_END(panasonic); break; + case 0x81: + if (!bootverbose) + break; + /* FALLTHROUGH */ default: device_printf(sc->dev, "unknown notify: %#x\n", notify); break; From owner-svn-src-all@freebsd.org Mon Mar 19 03:55:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ECA2F4AE45; Mon, 19 Mar 2018 03:55:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E506677EA5; Mon, 19 Mar 2018 03:55:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFD6618C1; Mon, 19 Mar 2018 03:55:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3tgKf011034; Mon, 19 Mar 2018 03:55:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3tgd4011033; Mon, 19 Mar 2018 03:55:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190355.w2J3tgd4011033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:55:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331174 - stable/11/lib/libc/stdlib X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libc/stdlib X-SVN-Commit-Revision: 331174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:55:43 -0000 Author: eadler Date: Mon Mar 19 03:55:42 2018 New Revision: 331174 URL: https://svnweb.freebsd.org/changeset/base/331174 Log: MFC r328785: Use standard 2-clause license where copyright is held by the FreeBSD Foundation Modified: stable/11/lib/libc/stdlib/strtold.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdlib/strtold.c ============================================================================== --- stable/11/lib/libc/stdlib/strtold.c Mon Mar 19 03:53:46 2018 (r331173) +++ stable/11/lib/libc/stdlib/strtold.c Mon Mar 19 03:55:42 2018 (r331174) @@ -1,11 +1,12 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2011 The FreeBSD Foundation + * Copyright (C) 2011 The FreeBSD Foundation * All rights reserved. - * Portions of this software were developed by David Chisnall - * under sponsorship from the FreeBSD Foundation. * + * This software was developed by David Chisnall 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: @@ -14,14 +15,11 @@ * 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 University 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND + * 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 REGENTS OR CONTRIBUTORS BE LIABLE + * 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) From owner-svn-src-all@freebsd.org Mon Mar 19 03:57:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7110F4B05F; Mon, 19 Mar 2018 03:57:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74E647802D; Mon, 19 Mar 2018 03:57:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FF8118C4; Mon, 19 Mar 2018 03:57:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3vE3j011136; Mon, 19 Mar 2018 03:57:14 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3vEFj011135; Mon, 19 Mar 2018 03:57:14 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190357.w2J3vEFj011135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331175 - stable/11/sys/dev/extres/clk X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/extres/clk X-SVN-Commit-Revision: 331175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 03:57:15 -0000 Author: eadler Date: Mon Mar 19 03:57:14 2018 New Revision: 331175 URL: https://svnweb.freebsd.org/changeset/base/331175 Log: MFC r328586: Use more verbose panic messages. Modified: stable/11/sys/dev/extres/clk/clk.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/extres/clk/clk.c ============================================================================== --- stable/11/sys/dev/extres/clk/clk.c Mon Mar 19 03:55:42 2018 (r331174) +++ stable/11/sys/dev/extres/clk/clk.c Mon Mar 19 03:57:14 2018 (r331175) @@ -585,10 +585,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx if (clknode->parent_cnt == 0) return; if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) - panic("Invalid clock parent index\n"); + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); if (clknode->parents[idx] == NULL) - panic("%s: Attempt to set invalid parent %d for clock %s", + panic("%s: Invalid parent index %d for clock %s", __func__, idx, clknode->name); /* Remove me from old children list. */ @@ -617,8 +618,8 @@ clknode_init_parent_idx(struct clknode *clknode, int i if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt) || (clknode->parent_names[idx] == NULL)) - panic("%s: Invalid clock parent index: %d\n", __func__, idx); - + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); clknode->parent_idx = idx; } From owner-svn-src-all@freebsd.org Mon Mar 19 04:03:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17635F4B8DB; Mon, 19 Mar 2018 04:03:56 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD3C3785B3; Mon, 19 Mar 2018 04:03:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CCEE1A3D; Mon, 19 Mar 2018 04:03:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J43tbo015998; Mon, 19 Mar 2018 04:03:55 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J43tUX015995; Mon, 19 Mar 2018 04:03:55 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190403.w2J43tUX015995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04:03:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331176 - in stable/11/sys/dev/usb: net serial X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys/dev/usb: net serial X-SVN-Commit-Revision: 331176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 04:03:56 -0000 Author: eadler Date: Mon Mar 19 04:03:55 2018 New Revision: 331176 URL: https://svnweb.freebsd.org/changeset/base/331176 Log: MFC r328162: Improve support for USB based 3G/4G/5G dongles from Huawei. PR: 192345 Modified: stable/11/sys/dev/usb/net/if_cdce.c stable/11/sys/dev/usb/serial/u3g.c stable/11/sys/dev/usb/serial/umodem.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_cdce.c ============================================================================== --- stable/11/sys/dev/usb/net/if_cdce.c Mon Mar 19 03:57:14 2018 (r331175) +++ stable/11/sys/dev/usb/net/if_cdce.c Mon Mar 19 04:03:55 2018 (r331176) @@ -286,6 +286,9 @@ static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x76), USB_DRIVER_INFO(0)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x03), USB_IFACE_PROTOCOL(0x16), + USB_DRIVER_INFO(0)}, }; static const STRUCT_USB_DUAL_ID cdce_dual_devs[] = { Modified: stable/11/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/11/sys/dev/usb/serial/u3g.c Mon Mar 19 03:57:14 2018 (r331175) +++ stable/11/sys/dev/usb/serial/u3g.c Mon Mar 19 04:03:55 2018 (r331176) @@ -307,7 +307,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, E173, 0), U3G_DEV(HUAWEI, E173_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E3131, 0), - U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI), + U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), @@ -326,6 +326,8 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, K4505, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, K4505_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, ETS2055, U3GINIT_HUAWEI), + U3G_DEV(HUAWEI, E3272_INIT, U3GINIT_HUAWEISCSI2), + U3G_DEV(HUAWEI, E3272, 0), U3G_DEV(KYOCERA2, CDMA_MSM_K, 0), U3G_DEV(KYOCERA2, KPC680, 0), U3G_DEV(LONGCHEER, WM66, U3GINIT_HUAWEI), @@ -628,6 +630,45 @@ u3g_huawei_init(struct usb_device *udev) return (0); } +static int +u3g_huawei_is_cdce(uint16_t idVendor, uint8_t bInterfaceSubClass, + uint8_t bInterfaceProtocol) +{ + /* + * This function returns non-zero if the interface being + * probed is of type CDC ethernet, which the U3G driver should + * not attach to. See sys/dev/usb/net/if_cdce.c for matching + * entries. + */ + if (idVendor != USB_VENDOR_HUAWEI) + goto done; + + switch (bInterfaceSubClass) { + case 0x02: + switch (bInterfaceProtocol) { + case 0x16: + case 0x46: + case 0x76: + return (1); + default: + break; + } + break; + case 0x03: + switch (bInterfaceProtocol) { + case 0x16: + return (1); + default: + break; + } + break; + default: + break; + } +done: + return (0); +} + static void u3g_sael_m460_init(struct usb_device *udev) { @@ -841,6 +882,10 @@ u3g_probe(device_t self) if (uaa->info.bInterfaceClass != UICLASS_VENDOR) { return (ENXIO); } + if (u3g_huawei_is_cdce(uaa->info.idVendor, uaa->info.bInterfaceSubClass, + uaa->info.bInterfaceProtocol)) { + return (ENXIO); + } return (usbd_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa)); } @@ -883,6 +928,9 @@ u3g_attach(device_t dev) break; id = usbd_get_interface_descriptor(iface); if (id == NULL || id->bInterfaceClass != UICLASS_VENDOR) + continue; + if (u3g_huawei_is_cdce(uaa->info.idVendor, + id->bInterfaceSubClass, id->bInterfaceProtocol)) continue; usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex); iface_valid |= (1< Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B305F4BBDD; Mon, 19 Mar 2018 04:06:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39EB378790; Mon, 19 Mar 2018 04:06:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A95B1A3F; Mon, 19 Mar 2018 04:06:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J46IsE016142; Mon, 19 Mar 2018 04:06:18 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J46IZP016141; Mon, 19 Mar 2018 04:06:18 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190406.w2J46IZP016141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331177 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 331177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 04:06:19 -0000 Author: eadler Date: Mon Mar 19 04:06:18 2018 New Revision: 331177 URL: https://svnweb.freebsd.org/changeset/base/331177 Log: MFC r328262: This comment is bogus. This is a legit release. Modified: stable/11/sys/cam/scsi/scsi_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_da.c Mon Mar 19 04:03:55 2018 (r331176) +++ stable/11/sys/cam/scsi/scsi_da.c Mon Mar 19 04:06:18 2018 (r331177) @@ -2981,7 +2981,7 @@ more: if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - cam_periph_release_locked(periph); /* XXX is this still valid? I think so but unverified */ + cam_periph_release_locked(periph); } if ((bp->bio_flags & BIO_ORDERED) != 0 || From owner-svn-src-all@freebsd.org Mon Mar 19 04:08:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F2F1F4BE22; Mon, 19 Mar 2018 04:08:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5A7D78927; Mon, 19 Mar 2018 04:08:22 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1C0A1A40; Mon, 19 Mar 2018 04:08:22 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J48MvA016257; Mon, 19 Mar 2018 04:08:22 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J48MvX016256; Mon, 19 Mar 2018 04:08:22 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190408.w2J48MvX016256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331178 - stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt X-SVN-Commit-Revision: 331178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 04:08:23 -0000 Author: eadler Date: Mon Mar 19 04:08:22 2018 New Revision: 331178 URL: https://svnweb.freebsd.org/changeset/base/331178 Log: MFC r313264: Avoid using Sun compiler-specific flags. Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh Mon Mar 19 04:06:18 2018 (r331177) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh Mon Mar 19 04:08:22 2018 (r331178) @@ -77,7 +77,7 @@ main(int argc, char **argv) } EOF -cc -c -xO2 test.c +cc -c -O2 test.c if [ $? -ne 0 ]; then print -u2 "failed to compile test.c" exit 1 From owner-svn-src-all@freebsd.org Mon Mar 19 04:16:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C94EAF4C88A; Mon, 19 Mar 2018 04:16:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D65478E6A; Mon, 19 Mar 2018 04:16:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B991BB7; Mon, 19 Mar 2018 04:16:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J4Gcr1021141; Mon, 19 Mar 2018 04:16:38 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J4Gbqt021135; Mon, 19 Mar 2018 04:16:37 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190416.w2J4Gbqt021135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331179 - stable/11/sbin/dhclient X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sbin/dhclient X-SVN-Commit-Revision: 331179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 04:16:39 -0000 Author: eadler Date: Mon Mar 19 04:16:37 2018 New Revision: 331179 URL: https://svnweb.freebsd.org/changeset/base/331179 Log: MFC r305306: dhclient: add support for interface-mtu (26) Make dhclient set interface MTU if it was provided. This version implements MTU setting in dhclient itself before it runs dhclient-script. PR: 206721 Modified: stable/11/sbin/dhclient/clparse.c stable/11/sbin/dhclient/dhclient.c stable/11/sbin/dhclient/dhcpd.h stable/11/sbin/dhclient/dispatch.c stable/11/sbin/dhclient/privsep.c stable/11/sbin/dhclient/privsep.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/dhclient/clparse.c ============================================================================== --- stable/11/sbin/dhclient/clparse.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/clparse.c Mon Mar 19 04:16:37 2018 (r331179) @@ -104,6 +104,8 @@ read_client_conf(void) [top_level_config.requested_option_count++] = DHO_HOST_NAME; top_level_config.requested_options [top_level_config.requested_option_count++] = DHO_DOMAIN_SEARCH; + top_level_config.requested_options + [top_level_config.requested_option_count++] = DHO_INTERFACE_MTU; if ((cfile = fopen(path_dhclient_conf, "r")) != NULL) { do { Modified: stable/11/sbin/dhclient/dhclient.c ============================================================================== --- stable/11/sbin/dhclient/dhclient.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/dhclient.c Mon Mar 19 04:16:37 2018 (r331179) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include "privsep.h" #include +#include #include @@ -138,6 +139,9 @@ int fork_privchld(int, int); ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +/* Minimum MTU is 68 as per RFC791, p. 24 */ +#define MIN_MTU 68 + static time_t scripttime; int @@ -820,8 +824,19 @@ dhcpack(struct packet *packet) void bind_lease(struct interface_info *ip) { + struct option_data *opt; + /* Remember the medium. */ ip->client->new->medium = ip->client->medium; + + opt = &ip->client->new->options[DHO_INTERFACE_MTU]; + if (opt->len == sizeof(u_int16_t)) { + u_int16_t mtu = be16dec(opt->data); + if (mtu < MIN_MTU) + warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU); + else + interface_set_mtu_unpriv(privfd, mtu); + } /* Write out the new lease. */ write_client_lease(ip, ip->client->new, 0); Modified: stable/11/sbin/dhclient/dhcpd.h ============================================================================== --- stable/11/sbin/dhclient/dhcpd.h Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/dhcpd.h Mon Mar 19 04:16:37 2018 (r331179) @@ -321,6 +321,8 @@ void cancel_timeout(void (*)(void *), void *); void add_protocol(char *, int, void (*)(struct protocol *), void *); void remove_protocol(struct protocol *); int interface_link_status(char *); +void interface_set_mtu_unpriv(int, u_int16_t); +void interface_set_mtu_priv(char *, u_int16_t); /* hash.c */ struct hash_table *new_hash(void); Modified: stable/11/sbin/dhclient/dispatch.c ============================================================================== --- stable/11/sbin/dhclient/dispatch.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/dispatch.c Mon Mar 19 04:16:37 2018 (r331179) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include "dhcpd.h" +#include "privsep.h" #include @@ -498,4 +499,47 @@ interface_link_status(char *ifname) } } return (1); +} + +void +interface_set_mtu_unpriv(int privfd, u_int16_t mtu) +{ + struct imsg_hdr hdr; + struct buf *buf; + int errs = 0; + + hdr.code = IMSG_SET_INTERFACE_MTU; + hdr.len = sizeof(hdr) + + sizeof(u_int16_t); + + if ((buf = buf_open(hdr.len)) == NULL) + error("buf_open: %m"); + + errs += buf_add(buf, &hdr, sizeof(hdr)); + errs += buf_add(buf, &mtu, sizeof(mtu)); + if (errs) + error("buf_add: %m"); + + if (buf_close(privfd, buf) == -1) + error("buf_close: %m"); +} + +void +interface_set_mtu_priv(char *ifname, u_int16_t mtu) +{ + struct ifreq ifr; + int sock; + + if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + error("Can't create socket"); + + memset(&ifr, 0, sizeof(ifr)); + + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = mtu; + + if (ioctl(sock, SIOCSIFMTU, &ifr) == -1) + warning("SIOCSIFMTU failed (%d): %s", mtu, + strerror(errno)); + close(sock); } Modified: stable/11/sbin/dhclient/privsep.c ============================================================================== --- stable/11/sbin/dhclient/privsep.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/privsep.c Mon Mar 19 04:16:37 2018 (r331179) @@ -112,6 +112,7 @@ dispatch_imsg(struct interface_info *ifi, int fd) struct client_lease lease; int ret, i; struct buf *buf; + u_int16_t mtu; buf_read(fd, &hdr, sizeof(hdr)); @@ -235,6 +236,13 @@ dispatch_imsg(struct interface_info *ifi, int fd) break; case IMSG_SEND_PACKET: send_packet_priv(ifi, &hdr, fd); + break; + case IMSG_SET_INTERFACE_MTU: + if (hdr.len < sizeof(hdr) + sizeof(u_int16_t)) + error("corrupted message received"); + + buf_read(fd, &mtu, sizeof(u_int16_t)); + interface_set_mtu_priv(ifi->name, mtu); break; default: error("received unknown message, code %d", hdr.code); Modified: stable/11/sbin/dhclient/privsep.h ============================================================================== --- stable/11/sbin/dhclient/privsep.h Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/privsep.h Mon Mar 19 04:16:37 2018 (r331179) @@ -36,7 +36,8 @@ enum imsg_code { IMSG_SCRIPT_WRITE_PARAMS, IMSG_SCRIPT_GO, IMSG_SCRIPT_GO_RET, - IMSG_SEND_PACKET + IMSG_SEND_PACKET, + IMSG_SET_INTERFACE_MTU, }; struct imsg_hdr { From owner-svn-src-all@freebsd.org Mon Mar 19 05:49:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6A5EF5306F; Mon, 19 Mar 2018 05:49:26 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 933907BF7F; Mon, 19 Mar 2018 05:49:26 +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 8A085293D; Mon, 19 Mar 2018 05:49:26 +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 w2J5nQiM065931; Mon, 19 Mar 2018 05:49:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J5nQe8065930; Mon, 19 Mar 2018 05:49:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201803190549.w2J5nQe8065930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 19 Mar 2018 05:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331180 - head/usr.sbin/rpcbind X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/usr.sbin/rpcbind X-SVN-Commit-Revision: 331180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 05:49:27 -0000 Author: delphij Date: Mon Mar 19 05:49:26 2018 New Revision: 331180 URL: https://svnweb.freebsd.org/changeset/base/331180 Log: Plug a possible memory leak. MFC after: 2 weeks Modified: head/usr.sbin/rpcbind/rpcbind.c Modified: head/usr.sbin/rpcbind/rpcbind.c ============================================================================== --- head/usr.sbin/rpcbind/rpcbind.c Mon Mar 19 04:16:37 2018 (r331179) +++ head/usr.sbin/rpcbind/rpcbind.c Mon Mar 19 05:49:26 2018 (r331180) @@ -565,6 +565,8 @@ init_transport(struct netconfig *nconf) pml->pml_map.pm_port = PMAPPORT; if (strcmp(nconf->nc_proto, NC_TCP) == 0) { if (tcptrans[0]) { + free(pml); + pml = NULL; syslog(LOG_ERR, "cannot have more than one TCP transport"); goto error; From owner-svn-src-all@freebsd.org Mon Mar 19 06:37:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1543F54B4E; Mon, 19 Mar 2018 06:37:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8016B7D7B1; Mon, 19 Mar 2018 06:37:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AC8B30A9; Mon, 19 Mar 2018 06:37:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6bxsh091123; Mon, 19 Mar 2018 06:37:59 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6bxxW091122; Mon, 19 Mar 2018 06:37:59 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190637.w2J6bxxW091122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331181 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 331181 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:38:00 -0000 Author: eadler Date: Mon Mar 19 06:37:59 2018 New Revision: 331181 URL: https://svnweb.freebsd.org/changeset/base/331181 Log: MFC r328300: copyright.h: Update license text to 'THE AUTHOR' This matches the license text at https://www.freebsd.org/copyright/freebsd-license.html Modified: stable/11/sys/sys/copyright.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/copyright.h ============================================================================== --- stable/11/sys/sys/copyright.h Mon Mar 19 05:49:26 2018 (r331180) +++ stable/11/sys/sys/copyright.h Mon Mar 19 06:37:59 2018 (r331181) @@ -12,10 +12,10 @@ * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * 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) From owner-svn-src-all@freebsd.org Mon Mar 19 06:40:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51E66F54C51; Mon, 19 Mar 2018 06:40:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF7A27D918; Mon, 19 Mar 2018 06:40:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5F9330AD; Mon, 19 Mar 2018 06:40:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6eCoG091273; Mon, 19 Mar 2018 06:40:12 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6eCoe091267; Mon, 19 Mar 2018 06:40:12 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190640.w2J6eCoe091267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331182 - in stable/11/sys: arm/allwinner arm/allwinner/a10 dev/iicbus/twsi X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys: arm/allwinner arm/allwinner/a10 dev/iicbus/twsi X-SVN-Commit-Revision: 331182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:40:13 -0000 Author: eadler Date: Mon Mar 19 06:40:11 2018 New Revision: 331182 URL: https://svnweb.freebsd.org/changeset/base/331182 Log: MFC r327184: Change the remaining files using my personnal email address to my freebsd one Modified: stable/11/sys/arm/allwinner/a10/a10_intc.c stable/11/sys/arm/allwinner/allwinner_pinctrl.h stable/11/sys/arm/allwinner/aw_mp.c stable/11/sys/arm/allwinner/aw_mp.h stable/11/sys/arm/allwinner/aw_wdog.c stable/11/sys/dev/iicbus/twsi/a10_twsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/a10/a10_intc.c ============================================================================== --- stable/11/sys/arm/allwinner/a10/a10_intc.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/a10/a10_intc.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2012 Ganbold Tsagaankhuu - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/allwinner_pinctrl.h ============================================================================== --- stable/11/sys/arm/allwinner/allwinner_pinctrl.h Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/allwinner_pinctrl.h Mon Mar 19 06:40:11 2018 (r331182) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/aw_mp.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_mp.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/aw_mp.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Ganbold Tsagaankhuu - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/aw_mp.h ============================================================================== --- stable/11/sys/arm/allwinner/aw_mp.h Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/aw_mp.h Mon Mar 19 06:40:11 2018 (r331182) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/aw_wdog.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_wdog.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/aw_wdog.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2013 Oleksandr Tymoshenko - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/dev/iicbus/twsi/a10_twsi.c ============================================================================== --- stable/11/sys/dev/iicbus/twsi/a10_twsi.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/dev/iicbus/twsi/a10_twsi.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Mon Mar 19 06:45:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0506BF55013; Mon, 19 Mar 2018 06:45:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A236F7DDED; Mon, 19 Mar 2018 06:45:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95D0C3220; Mon, 19 Mar 2018 06:45:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6jeMN096191; Mon, 19 Mar 2018 06:45:40 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6jegR096190; Mon, 19 Mar 2018 06:45:40 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190645.w2J6jegR096190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331183 - stable/11/usr.sbin/vidcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.sbin/vidcontrol X-SVN-Commit-Revision: 331183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:45:41 -0000 Author: eadler Date: Mon Mar 19 06:45:40 2018 New Revision: 331183 URL: https://svnweb.freebsd.org/changeset/base/331183 Log: MFC r316422: Remove checks that background (bg) colors are not bright and buggy attempts to keep them that way. The bg brightness bit is interpreted as blinking in some modes, but it would barely be useful to disallow setting it when it would give blinking in code which knew when that is. The old code mostly knew this wrong, and added handling errors. It is in fact impossible to know, since future mode switches may change the meaning of the bit many times on the screen and in history. Old versions of vidcontrol disallowed bg color numbers >= 8 in all cases. This is very VGA/syscons-centric. Syscons uses the VGA defaults of blinking fg instead of bright bg in text mode and bright bg in graphics mode. On VGA, this is very easy to toggle at any time, and vt blows away the VGA text mode default at boot time. r146736 changed this to try to allow bg color numbers in graphics mode only. This is even more VGA/syscons-centric, and there are many bugs in this, and many nearby bugs in the parser. These are increased or decreased by differences and bugs in vt and teken. Perhaps the most obvious bug was that almost any vidcontrol command which changes any color or the mode causes an error if the initial fg color is bright. E.g., in syscons text mode, after "vidcontrol lightwhite" to make the fg bright, another "vidcontrol lightwhite" is rejected and buggy fixup code changes the fg to white. This is because the bright fg color creates a bright bg color for the phantom reverse video attribute, so was rejected. (The reverse video attribute is phantom because teken ignores the user's setting of it and simply reverses the fg attributes to create the bg attributes. Sometimes some layer masks off the brightness/blinking bit, but not here.) Perhaps the next most obvious one was that "vidcontrol lightgreen lightblue" was misparsed as 2 settings of the fg instead of 1 setting of the fg and 1 invalid setting of the bg. This is because the parser supports an undocumented syntax with many parsing bugs (an ambiguity gives this one). I recently fix bugs in teken that broke setting of bright fg's and bg's in the normal way. This gave more settings of then, so the old bugs showed up more often. Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- stable/11/usr.sbin/vidcontrol/vidcontrol.c Mon Mar 19 06:40:11 2018 (r331182) +++ stable/11/usr.sbin/vidcontrol/vidcontrol.c Mon Mar 19 06:45:40 2018 (r331183) @@ -852,8 +852,7 @@ get_normal_colors(int argc, char **argv, int *_index) normal_fore_color=color; colors_changed = 1; if (*_index < argc - && (color = get_color_number(argv[*_index])) != -1 - && color < 8) { + && (color = get_color_number(argv[*_index])) != -1) { (*_index)++; fprintf(stderr, "\033[=%dG", color); normal_back_color=color; @@ -876,8 +875,7 @@ get_reverse_colors(int argc, char **argv, int *_index) revers_fore_color=color; colors_changed = 1; if (*_index < argc - && (color = get_color_number(argv[*_index])) != -1 - && color < 8) { + && (color = get_color_number(argv[*_index])) != -1) { (*_index)++; fprintf(stderr, "\033[=%dI", color); revers_back_color=color; @@ -1489,18 +1487,8 @@ main(int argc, char **argv) get_normal_colors(argc, argv, &optind); - if (colors_changed || video_mode_changed) { - if (!(new_mode_info.vi_flags & V_INFO_GRAPHICS)) { - if ((normal_back_color < 8) && (revers_back_color < 8)) { - set_colors(); - } else { - revert(); - errx(1, "bg color for text modes must be < 8"); - } - } else { - set_colors(); - } - } + if (colors_changed || video_mode_changed) + set_colors(); if ((optind != argc) || (argc == 1)) usage(); From owner-svn-src-all@freebsd.org Mon Mar 19 06:49:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CD5AF55258; Mon, 19 Mar 2018 06:49:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A21927E07F; Mon, 19 Mar 2018 06:49:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C4F43223; Mon, 19 Mar 2018 06:49:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6nnTF096461; Mon, 19 Mar 2018 06:49:49 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6nnl9096460; Mon, 19 Mar 2018 06:49:49 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190649.w2J6nnl9096460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331184 - stable/11/sys/powerpc/powerpc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/powerpc/powerpc X-SVN-Commit-Revision: 331184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:49:50 -0000 Author: eadler Date: Mon Mar 19 06:49:49 2018 New Revision: 331184 URL: https://svnweb.freebsd.org/changeset/base/331184 Log: MFC r326859: Add identifier for POWER9 CPU to CPU list Without the identifier in the list booting FreeBSD results in printing the following (from a PowerKVM boot): cpu0: Unknown PowerPC CPU revision 0x1201, 2550.00 MHz For now, add the same feature list as POWER8. As new capabilities are added to support POWER9 specific features, they will be added to this. PR: 224344 Modified: stable/11/sys/powerpc/powerpc/cpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/11/sys/powerpc/powerpc/cpu.c Mon Mar 19 06:45:40 2018 (r331183) +++ stable/11/sys/powerpc/powerpc/cpu.c Mon Mar 19 06:49:49 2018 (r331184) @@ -163,6 +163,12 @@ static const struct cputab models[] = { PPC_FEATURE_HAS_VSX, PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_HAS_VCRYPTO, NULL }, + { "IBM POWER9", IBMPOWER9, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | + PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | + PPC_FEATURE_HAS_VSX, + PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_ISEL | + PPC_FEATURE2_HAS_VCRYPTO, NULL }, { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN, PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN, From owner-svn-src-all@freebsd.org Mon Mar 19 06:54:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD68AF555FB; Mon, 19 Mar 2018 06:54:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 806817E5DE; Mon, 19 Mar 2018 06:54:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77D6033B3; Mon, 19 Mar 2018 06:54:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6sHUA001518; Mon, 19 Mar 2018 06:54:17 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6sGMo001507; Mon, 19 Mar 2018 06:54:16 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190654.w2J6sGMo001507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331185 - in stable/11/lib/libc: gen sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/lib/libc: gen sys X-SVN-Commit-Revision: 331185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:54:18 -0000 Author: eadler Date: Mon Mar 19 06:54:16 2018 New Revision: 331185 URL: https://svnweb.freebsd.org/changeset/base/331185 Log: MFC r326437: Correct history for Unix 2nd Edition through 6th Edition for the system calls. Man pages are missing for v2 and v5, so any entries for those versions were inferred by new implementations of these functions in libc. Modified: stable/11/lib/libc/gen/signal.3 stable/11/lib/libc/sys/dup.2 stable/11/lib/libc/sys/getuid.2 stable/11/lib/libc/sys/kill.2 stable/11/lib/libc/sys/mknod.2 stable/11/lib/libc/sys/pipe.2 stable/11/lib/libc/sys/profil.2 stable/11/lib/libc/sys/ptrace.2 stable/11/lib/libc/sys/setuid.2 stable/11/lib/libc/sys/sync.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/signal.3 ============================================================================== --- stable/11/lib/libc/gen/signal.3 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/gen/signal.3 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)signal.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd June 7, 2004 +.Dd December 1, 2017 .Dt SIGNAL 3 .Os .Sh NAME @@ -263,6 +263,10 @@ or .Xr tty 4 .Sh HISTORY The +.Fn signal +function appeared in +.At v4 . +The current .Nm facility appeared in .Bx 4.0 . Modified: stable/11/lib/libc/sys/dup.2 ============================================================================== --- stable/11/lib/libc/sys/dup.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/dup.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)dup.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 1, 2013 +.Dd December 1, 2017 .Dt DUP 2 .Os .Sh NAME @@ -163,7 +163,9 @@ system calls are expected to conform to .Sh HISTORY The .Fn dup -and +function appeared in +.At v3 . +The .Fn dup2 -functions appeared in +function appeared in .At v7 . Modified: stable/11/lib/libc/sys/getuid.2 ============================================================================== --- stable/11/lib/libc/sys/getuid.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/getuid.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -86,4 +86,4 @@ The and .Fn geteuid functions appeared in -.At v7 . +.At v4 . Modified: stable/11/lib/libc/sys/kill.2 ============================================================================== --- stable/11/lib/libc/sys/kill.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/kill.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)kill.2 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd March 15, 2012 +.Dd December 1, 2017 .Dt KILL 2 .Os .Sh NAME @@ -150,7 +150,11 @@ The system call is expected to conform to .St -p1003.1-90 . .Sh HISTORY -The +A version of the .Fn kill function appeared in -.At v7 . +.At v3 . +The signal number was added to the +.Fn kill +function in +.At v4 . Modified: stable/11/lib/libc/sys/mknod.2 ============================================================================== --- stable/11/lib/libc/sys/mknod.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/mknod.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -175,7 +175,7 @@ system call follows The Open Group Extended API Set 2 The .Fn mknod function appeared in -.At v6 . +.At v4 . The .Fn mknodat system call appeared in Modified: stable/11/lib/libc/sys/pipe.2 ============================================================================== --- stable/11/lib/libc/sys/pipe.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/pipe.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)pipe.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 20, 2016 +.Dd December 1, 2017 .Dt PIPE 2 .Os .Sh NAME Modified: stable/11/lib/libc/sys/profil.2 ============================================================================== --- stable/11/lib/libc/sys/profil.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/profil.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -31,7 +31,7 @@ .\" @(#)profil.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2017 .Dt PROFIL 2 .Os .Sh NAME @@ -109,7 +109,7 @@ contains an invalid address. The .Fn profil function appeared in -.At v7 . +.At v6 . .Sh BUGS This routine should be named .Fn profile . Modified: stable/11/lib/libc/sys/ptrace.2 ============================================================================== --- stable/11/lib/libc/sys/ptrace.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/ptrace.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd September 14, 2017 +.Dd December 1, 2017 .Dt PTRACE 2 .Os .Sh NAME @@ -1105,4 +1105,4 @@ holds the minimum buffer size required on return. The .Fn ptrace function appeared in -.At v7 . +.At v6 . Modified: stable/11/lib/libc/sys/setuid.2 ============================================================================== --- stable/11/lib/libc/sys/setuid.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/setuid.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -156,7 +156,7 @@ The and .Fn setgid functions appeared in -.At v7 . +.At v4 . .Sh SECURITY CONSIDERATIONS Read and write permissions to files are determined upon a call to .Xr open 2 . Modified: stable/11/lib/libc/sys/sync.2 ============================================================================== --- stable/11/lib/libc/sys/sync.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/sync.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)sync.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2017 .Dt SYNC 2 .Os .Sh NAME @@ -69,7 +69,7 @@ attributes. The .Fn sync function appeared in -.At v6 . +.At v3 . .Sh BUGS The .Fn sync From owner-svn-src-all@freebsd.org Mon Mar 19 06:54:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D7CAF55686; Mon, 19 Mar 2018 06:54:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 20D6E7E712; Mon, 19 Mar 2018 06:54:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 019D633B4; Mon, 19 Mar 2018 06:54:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6srIn001588; Mon, 19 Mar 2018 06:54:53 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6srvA001587; Mon, 19 Mar 2018 06:54:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190654.w2J6srvA001587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331186 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 331186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:54:54 -0000 Author: eadler Date: Mon Mar 19 06:54:53 2018 New Revision: 331186 URL: https://svnweb.freebsd.org/changeset/base/331186 Log: MFC r326356: Replace a reference to a license in another file with the license text. The relevant file was recently renamed, so the reference was stale. In addition, explicit licenses are more typical in our sources. Modified: stable/11/usr.bin/truss/syscall.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscall.h ============================================================================== --- stable/11/usr.bin/truss/syscall.h Mon Mar 19 06:54:16 2018 (r331185) +++ stable/11/usr.bin/truss/syscall.h Mon Mar 19 06:54:53 2018 (r331186) @@ -1,6 +1,39 @@ -/* - * See i386-fbsd.c for copyright and license terms. +/*- + * SPDX-License-Identifier: BSD-4-Clause * + * Copyright 1997 Sean Eric Fagan + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Sean Eric Fagan + * 4. Neither the name of the author may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * 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$ + */ + +/* * System call arguments come in several flavours: * Hex -- values that should be printed in hex (addresses) * Octal -- Same as above, but octal @@ -33,9 +66,6 @@ * In addition, the pointer types (String, Ptr) may have OUT masked in -- * this means that the data is set on *return* from the system call -- or * IN (meaning that the data is passed *into* the system call). - */ -/* - * $FreeBSD$ */ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, From owner-svn-src-all@freebsd.org Mon Mar 19 06:55:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B87DF5570B; Mon, 19 Mar 2018 06:55:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 510697E849; Mon, 19 Mar 2018 06:55:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BDAA33B5; Mon, 19 Mar 2018 06:55:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6tRPY001687; Mon, 19 Mar 2018 06:55:27 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6tQKE001681; Mon, 19 Mar 2018 06:55:26 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190655.w2J6tQKE001681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331187 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 331187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:55:27 -0000 Author: eadler Date: Mon Mar 19 06:55:26 2018 New Revision: 331187 URL: https://svnweb.freebsd.org/changeset/base/331187 Log: MFC r326183: Add stdio.h to the synopsis for sysdecode functions that take a FILE *. Modified: stable/11/lib/libsysdecode/sysdecode_cap_rights.3 stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 stable/11/lib/libsysdecode/sysdecode_mask.3 stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 stable/11/lib/libsysdecode/sysdecode_utrace.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/sysdecode_cap_rights.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_cap_rights.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_cap_rights.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_cap_rights 3 .Os .Sh NAME @@ -36,6 +36,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft void .Fn sysdecode_cap_rights "FILE *fp" "cap_rights_t *rightsp" Modified: stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_fcntl_arg 3 .Os .Sh NAME @@ -37,6 +37,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft void .Fn sysdecode_fcntl_arg "FILE *fp" "int cmd" "uintptr_t arg" "int base" Modified: stable/11/lib/libsysdecode/sysdecode_mask.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_mask.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_mask.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2017 +.Dd November 24, 2017 .Dt sysdecode_mask 3 .Os .Sh NAME @@ -63,6 +63,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft bool .Fn sysdecode_access_mode "FILE *fp" "int mode" "int *rem" Modified: stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_quotactl_cmd 3 .Os .Sh NAME @@ -36,6 +36,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft bool .Fn sysdecode_quotactl_cmd "FILE *fp" "int cmd" Modified: stable/11/lib/libsysdecode/sysdecode_utrace.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_utrace.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_utrace.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_utrace 3 .Os .Sh NAME @@ -36,6 +36,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft int .Fn sysdecode_utrace "FILE *fp" "void *buf" "size_t len" "int decimal" From owner-svn-src-all@freebsd.org Mon Mar 19 06:56:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73A4CF557EF; Mon, 19 Mar 2018 06:56:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CC6D7E9B4; Mon, 19 Mar 2018 06:56:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05F1933B6; Mon, 19 Mar 2018 06:56:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6uUXt001771; Mon, 19 Mar 2018 06:56:30 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6uUuo001770; Mon, 19 Mar 2018 06:56:30 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190656.w2J6uUuo001770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331188 - stable/11/sys/dev/flash X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/flash X-SVN-Commit-Revision: 331188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:56:31 -0000 Author: eadler Date: Mon Mar 19 06:56:30 2018 New Revision: 331188 URL: https://svnweb.freebsd.org/changeset/base/331188 Log: MFC r325113: Add Microchip 1-MBit SPI flash ID Used on the AmigaOne X5000. Modified: stable/11/sys/dev/flash/mx25l.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/flash/mx25l.c ============================================================================== --- stable/11/sys/dev/flash/mx25l.c Mon Mar 19 06:55:26 2018 (r331187) +++ stable/11/sys/dev/flash/mx25l.c Mon Mar 19 06:56:30 2018 (r331188) @@ -124,6 +124,7 @@ struct mx25l_flash_ident flash_devices[] = { { "s25fl064", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, { "s25fl256s", 0x01, 0x0219, 64 * 1024, 512, FL_NONE }, + { "SST25VF010A", 0xbf, 0x2549, 4 * 1024, 32, FL_ERASE_4K | FL_ERASE_32K }, { "SST25VF032B", 0xbf, 0x254a, 64 * 1024, 64, FL_ERASE_4K | FL_ERASE_32K }, /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ From owner-svn-src-all@freebsd.org Mon Mar 19 06:57:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FD1FF558D9; Mon, 19 Mar 2018 06:57:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F63C7EB19; Mon, 19 Mar 2018 06:57:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49F8C33B7; Mon, 19 Mar 2018 06:57:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6vgaR001851; Mon, 19 Mar 2018 06:57:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6vgPH001850; Mon, 19 Mar 2018 06:57:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190657.w2J6vgPH001850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:57:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331189 - stable/11/sys/powerpc/include X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/powerpc/include X-SVN-Commit-Revision: 331189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 06:57:42 -0000 Author: eadler Date: Mon Mar 19 06:57:41 2018 New Revision: 331189 URL: https://svnweb.freebsd.org/changeset/base/331189 Log: MFC r325112: Add P5010/P5010E for completeness Modified: stable/11/sys/powerpc/include/spr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/include/spr.h ============================================================================== --- stable/11/sys/powerpc/include/spr.h Mon Mar 19 06:56:30 2018 (r331188) +++ stable/11/sys/powerpc/include/spr.h Mon Mar 19 06:57:41 2018 (r331189) @@ -713,6 +713,8 @@ #define SVR_P4040E 0x8208 #define SVR_P4080 0x8201 #define SVR_P4080E 0x8209 +#define SVR_P5010 0x8221 +#define SVR_P5010E 0x8229 #define SVR_P5020 0x8220 #define SVR_P5020E 0x8228 #define SVR_VER(svr) (((svr) >> 16) & 0xffff) From owner-svn-src-all@freebsd.org Mon Mar 19 07:00:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3602DF55A42; Mon, 19 Mar 2018 07:00:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2C407ECA3; Mon, 19 Mar 2018 07:00:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6C2E33BB; Mon, 19 Mar 2018 07:00:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J70FED002035; Mon, 19 Mar 2018 07:00:15 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J70Fkg002034; Mon, 19 Mar 2018 07:00:15 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190700.w2J70Fkg002034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:00:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331190 - stable/11/include X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/include X-SVN-Commit-Revision: 331190 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:00:16 -0000 Author: eadler Date: Mon Mar 19 07:00:15 2018 New Revision: 331190 URL: https://svnweb.freebsd.org/changeset/base/331190 Log: MFC r313818: Small inclusion guard comment fix. Modified: stable/11/include/pthread.h Directory Properties: stable/11/ (props changed) Modified: stable/11/include/pthread.h ============================================================================== --- stable/11/include/pthread.h Mon Mar 19 06:57:41 2018 (r331189) +++ stable/11/include/pthread.h Mon Mar 19 07:00:15 2018 (r331190) @@ -349,4 +349,4 @@ void __pthread_cleanup_pop_imp(int); __END_DECLS __NULLABILITY_PRAGMA_POP -#endif /* _PTHREAD_H_ */ +#endif /* !_PTHREAD_H_ */ From owner-svn-src-all@freebsd.org Mon Mar 19 07:03:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11F54F55D93; Mon, 19 Mar 2018 07:03:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4B447F086; Mon, 19 Mar 2018 07:03:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 950B33893; Mon, 19 Mar 2018 07:03:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7326f006715; Mon, 19 Mar 2018 07:03:02 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J732Jn006714; Mon, 19 Mar 2018 07:03:02 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190703.w2J732Jn006714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331191 - stable/11/sys/dev/fb X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/fb X-SVN-Commit-Revision: 331191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:03:03 -0000 Author: eadler Date: Mon Mar 19 07:03:02 2018 New Revision: 331191 URL: https://svnweb.freebsd.org/changeset/base/331191 Log: MFC r315986: Fix 3 entries in mode tables related to mono and 90-column text modes. Newer VGAs don't support any mono modes, but bugs in the tables created 2 virtual mono modes (#45 90x43 and #112 80x43) that behaved more strangely than crashing. 90-column modes are tweaked 80-column ones and also fail to work on newer VGAs. #45 did crash (hang) on some hardware. Modified: stable/11/sys/dev/fb/vga.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/fb/vga.c ============================================================================== --- stable/11/sys/dev/fb/vga.c Mon Mar 19 07:00:15 2018 (r331190) +++ stable/11/sys/dev/fb/vga.c Mon Mar 19 07:03:02 2018 (r331191) @@ -347,7 +347,7 @@ static video_info_t bios_vmode[] = { { M_EGAMONO80x25, 0, 80, 25, 8, 14, 2, 1, MDA_BUF_BASE, MDA_BUF_SIZE, MDA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, /* EGA */ - { M_ENH_B80x43, 0, 80, 43, 8, 8, 2, 1, + { M_ENH_B80x43, V_INFO_COLOR, 80, 43, 8, 8, 2, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_ENH_C80x43, V_INFO_COLOR, 80, 43, 8, 8, 4, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, @@ -377,7 +377,7 @@ static video_info_t bios_vmode[] = { { M_VGA_C90x30, V_INFO_COLOR, 90, 30, 8, 16, 4, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_VGA_M90x43, 0, 90, 43, 8, 8, 2, 1, - CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, + MDA_BUF_BASE, MDA_BUF_SIZE, MDA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_VGA_C90x43, V_INFO_COLOR, 90, 43, 8, 8, 4, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_VGA_M90x50, 0, 90, 50, 8, 8, 2, 1, @@ -593,7 +593,7 @@ map_mode_num(int mode) { M_VGA_C90x25, M_VGA_C80x25 }, { M_VGA_M90x30, M_VGA_M80x25 }, { M_VGA_C90x30, M_VGA_C80x25 }, - { M_VGA_M90x43, M_ENH_B80x25 }, + { M_VGA_M90x43, M_VGA_M80x25 }, { M_VGA_C90x43, M_ENH_C80x25 }, { M_VGA_M90x50, M_VGA_M80x25 }, { M_VGA_C90x50, M_VGA_C80x25 }, From owner-svn-src-all@freebsd.org Mon Mar 19 07:07:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8EA4F5604E; Mon, 19 Mar 2018 07:07:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 741667F231; Mon, 19 Mar 2018 07:07:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A8713894; Mon, 19 Mar 2018 07:07:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J773Ac006886; Mon, 19 Mar 2018 07:07:03 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J773sg006885; Mon, 19 Mar 2018 07:07:03 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190707.w2J773sg006885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331192 - stable/11/lib/libc/stdlib X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libc/stdlib X-SVN-Commit-Revision: 331192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:07:04 -0000 Author: eadler Date: Mon Mar 19 07:07:03 2018 New Revision: 331192 URL: https://svnweb.freebsd.org/changeset/base/331192 Log: MFC r320992,r320993: Add a complete example to tsearch(3) Modified: stable/11/lib/libc/stdlib/tsearch.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdlib/tsearch.3 ============================================================================== --- stable/11/lib/libc/stdlib/tsearch.3 Mon Mar 19 07:03:02 2018 (r331191) +++ stable/11/lib/libc/stdlib/tsearch.3 Mon Mar 19 07:07:03 2018 (r331192) @@ -27,7 +27,7 @@ .\" OpenBSD: tsearch.3,v 1.2 1998/06/21 22:13:49 millert Exp .\" $FreeBSD$ .\" -.Dd October 9, 2016 +.Dd June 4, 2017 .Dt TSEARCH 3 .Os .Sh NAME @@ -130,6 +130,64 @@ is NULL or the datum cannot be found. The .Fn twalk function returns no value. +.Sh EXAMPLES +This example uses +.Fn tsearch +to search for four strings in +.Dv root . +Because the strings are not already present, they are added. +.Fn tsearch +is called twice on the fourth string to demonstrate that a string is not added when it is already present. +.Fn tfind +is used to find the single instance of the fourth string, and +.Fn tdelete +removes it. +Finally, +.Fn twalk +is used to return and display the resulting binary search tree. +.Bd -literal +#include +#include +#include + +int +comp(const void *a, const void *b) +{ + + return strcmp(a, b); +} + +void +printwalk(const posix_tnode * node, VISIT v, int __unused0) +{ + + if (v == postorder || v == leaf) { + printf("node: %s\en", *(char **)node); + } +} + +int +main(void) +{ + posix_tnode *root = NULL; + + char one[] = "blah1"; + char two[] = "blah-2"; + char three[] = "blah-3"; + char four[] = "blah-4"; + + tsearch(one, &root, comp); + tsearch(two, &root, comp); + tsearch(three, &root, comp); + tsearch(four, &root, comp); + tsearch(four, &root, comp); + printf("four: %s\en", *(char **)tfind(four, &root, comp)); + tdelete(four, &root, comp); + + twalk(root, printwalk); + return 0; +} +.Ed .Sh SEE ALSO .Xr bsearch 3 , .Xr hsearch 3 , From owner-svn-src-all@freebsd.org Mon Mar 19 07:08:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4F4EF56142; Mon, 19 Mar 2018 07:08:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 87FA17F3AE; Mon, 19 Mar 2018 07:08:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8293D3895; Mon, 19 Mar 2018 07:08:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J78E8g006966; Mon, 19 Mar 2018 07:08:14 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J78Emo006965; Mon, 19 Mar 2018 07:08:14 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190708.w2J78Emo006965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331193 - stable/11/usr.bin/cut X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/cut X-SVN-Commit-Revision: 331193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:08:15 -0000 Author: eadler Date: Mon Mar 19 07:08:14 2018 New Revision: 331193 URL: https://svnweb.freebsd.org/changeset/base/331193 Log: MFC r322013: Document -w flag is an extension to POSIX. PR: 201937 Modified: stable/11/usr.bin/cut/cut.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/cut/cut.1 ============================================================================== --- stable/11/usr.bin/cut/cut.1 Mon Mar 19 07:07:03 2018 (r331192) +++ stable/11/usr.bin/cut/cut.1 Mon Mar 19 07:08:14 2018 (r331193) @@ -31,7 +31,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 8, 2012 +.Dd August 3, 2017 .Dt CUT 1 .Os .Sh NAME @@ -154,6 +154,10 @@ The .Nm utility conforms to .St -p1003.2-92 . +.Pp +The +.Fl w +flag is an extension to the specification. .Sh HISTORY A .Nm From owner-svn-src-all@freebsd.org Mon Mar 19 07:28:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10678F576F8; Mon, 19 Mar 2018 07:28:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B80A9802F2; Mon, 19 Mar 2018 07:28:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2F353C5E; Mon, 19 Mar 2018 07:28:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7Ss9e017192; Mon, 19 Mar 2018 07:28:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7SsOF017190; Mon, 19 Mar 2018 07:28:54 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190728.w2J7SsOF017190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331194 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 331194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:28:55 -0000 Author: eadler Date: Mon Mar 19 07:28:54 2018 New Revision: 331194 URL: https://svnweb.freebsd.org/changeset/base/331194 Log: MFC r320268,r320276: ipfw: dummynet: Add 'G' and 'g' suffix for bandwidth configuration/display Modified: stable/11/sbin/ipfw/dummynet.c stable/11/sbin/ipfw/ipfw.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/dummynet.c ============================================================================== --- stable/11/sbin/ipfw/dummynet.c Mon Mar 19 07:08:14 2018 (r331193) +++ stable/11/sbin/ipfw/dummynet.c Mon Mar 19 07:28:54 2018 (r331194) @@ -626,6 +626,8 @@ list_pipes(struct dn_id *oid, struct dn_id *end) /* data rate */ if (b == 0) sprintf(bwbuf, "unlimited "); + else if (b >= 1000000000) + sprintf(bwbuf, "%7.3f Gbit/s", b/1000000000); else if (b >= 1000000) sprintf(bwbuf, "%7.3f Mbit/s", b/1000000); else if (b >= 1000) @@ -818,6 +820,9 @@ read_bandwidth(char *arg, int *bandwidth, char *if_nam } else if (*end == 'M' || *end == 'm') { end++; bw *= 1000000; + } else if (*end == 'G' || *end == 'g') { + end++; + bw *= 1000000000; } if ((*end == 'B' && _substrcmp2(end, "Bi", "Bit/s") != 0) || Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 07:08:14 2018 (r331193) +++ stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 07:28:54 2018 (r331194) @@ -2499,7 +2499,7 @@ The following parameters can be configured for a pipe: .It Cm bw Ar bandwidth | device Bandwidth, measured in .Sm off -.Op Cm K | M +.Op Cm K | M | G .Brq Cm bit/s | Byte/s . .Sm on .Pp From owner-svn-src-all@freebsd.org Mon Mar 19 07:33:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82400F57C1E; Mon, 19 Mar 2018 07:33:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 353E88074E; Mon, 19 Mar 2018 07:33:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 303E53DDD; Mon, 19 Mar 2018 07:33:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7XDtw021755; Mon, 19 Mar 2018 07:33:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7XCDe021753; Mon, 19 Mar 2018 07:33:12 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190733.w2J7XCDe021753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331195 - in stable/11/sys/dev: ahci usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys/dev: ahci usb/controller X-SVN-Commit-Revision: 331195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:33:13 -0000 Author: eadler Date: Mon Mar 19 07:33:12 2018 New Revision: 331195 URL: https://svnweb.freebsd.org/changeset/base/331195 Log: MFC r320178: Add some device IDs for Intel Denverton SoCs. Modified: stable/11/sys/dev/ahci/ahci_pci.c stable/11/sys/dev/usb/controller/xhci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Mon Mar 19 07:28:54 2018 (r331194) +++ stable/11/sys/dev/ahci/ahci_pci.c Mon Mar 19 07:33:12 2018 (r331195) @@ -123,6 +123,26 @@ static const struct { {0x3b298086, 0x00, "Intel Ibex Peak-M", 0}, {0x3b2c8086, 0x00, "Intel Ibex Peak-M (RAID)", 0}, {0x3b2f8086, 0x00, "Intel Ibex Peak-M", 0}, + {0x19b08086, 0x00, "Intel Denverton", 0}, + {0x19b18086, 0x00, "Intel Denverton", 0}, + {0x19b28086, 0x00, "Intel Denverton", 0}, + {0x19b38086, 0x00, "Intel Denverton", 0}, + {0x19b48086, 0x00, "Intel Denverton", 0}, + {0x19b58086, 0x00, "Intel Denverton", 0}, + {0x19b68086, 0x00, "Intel Denverton", 0}, + {0x19b78086, 0x00, "Intel Denverton", 0}, + {0x19be8086, 0x00, "Intel Denverton", 0}, + {0x19bf8086, 0x00, "Intel Denverton", 0}, + {0x19c08086, 0x00, "Intel Denverton", 0}, + {0x19c18086, 0x00, "Intel Denverton", 0}, + {0x19c28086, 0x00, "Intel Denverton", 0}, + {0x19c38086, 0x00, "Intel Denverton", 0}, + {0x19c48086, 0x00, "Intel Denverton", 0}, + {0x19c58086, 0x00, "Intel Denverton", 0}, + {0x19c68086, 0x00, "Intel Denverton", 0}, + {0x19c78086, 0x00, "Intel Denverton", 0}, + {0x19ce8086, 0x00, "Intel Denverton", 0}, + {0x19cf8086, 0x00, "Intel Denverton", 0}, {0x1c028086, 0x00, "Intel Cougar Point", 0}, {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point (RAID)", 0}, Modified: stable/11/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/xhci_pci.c Mon Mar 19 07:28:54 2018 (r331194) +++ stable/11/sys/dev/usb/controller/xhci_pci.c Mon Mar 19 07:33:12 2018 (r331195) @@ -119,6 +119,8 @@ xhci_pci_match(device_t self) case 0x0f358086: return ("Intel BayTrail USB 3.0 controller"); + case 0x19d08086: + return ("Intel Denverton USB 3.0 controller"); case 0x9c318086: case 0x1e318086: return ("Intel Panther Point USB 3.0 controller"); From owner-svn-src-all@freebsd.org Mon Mar 19 07:34:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EA2FF57D6D; Mon, 19 Mar 2018 07:34:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A838808B7; Mon, 19 Mar 2018 07:34:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 159B73DDE; Mon, 19 Mar 2018 07:34:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7YOvg021837; Mon, 19 Mar 2018 07:34:24 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7YOUP021836; Mon, 19 Mar 2018 07:34:24 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190734.w2J7YOUP021836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:34:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331196 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:34:25 -0000 Author: eadler Date: Mon Mar 19 07:34:24 2018 New Revision: 331196 URL: https://svnweb.freebsd.org/changeset/base/331196 Log: MFC r322674: Add Thunderbolt Apple interfaces to the bge(4) supported list. Document message reported by kernel upon removal in DIAGNOSTIC section. Document shortcomings in BUGS section. Modified: stable/11/share/man/man4/bge.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/bge.4 ============================================================================== --- stable/11/share/man/man4/bge.4 Mon Mar 19 07:33:12 2018 (r331195) +++ stable/11/share/man/man4/bge.4 Mon Mar 19 07:34:24 2018 (r331196) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 19, 2012 +.Dd August 18, 2017 .Dt BGE 4 .Os .Sh NAME @@ -159,6 +159,10 @@ following: .It 3Com 3c996-T (10/100/1000baseTX) .It +Apple Thunderbolt Display (10/100/1000baseTX) +.It +Apple Thunderbolt to Gigabit Ethernet Adapter (10/100/1000baseTX) +.It Dell PowerEdge 1750 integrated BCM5704C NIC (10/100/1000baseTX) .It Dell PowerEdge 2550 integrated BCM5700 NIC (10/100/1000baseTX) @@ -236,6 +240,9 @@ during initialization. The driver failed to initialize PCI shared memory mapping. This might happen if the card is not in a bus-master slot. +.It "bge%d: firmware handshake timed out, found 0xffffffff" +The device was physically disconnected from the system, or there is a problem with +the device causing it to stop responding to the host it is attached to. .It "bge%d: no memory for jumbo buffers!" The driver failed to allocate memory for jumbo frames during initialization. @@ -262,3 +269,12 @@ The .Nm driver was written by .An Bill Paul Aq Mt wpaul@windriver.com . +.Sh BUGS +Hotplug is not currently supported in +.Fx , +hence, Thunderbolt interfaces need to be connected prior to system power up on +Apple systems in order for the interface to be detected. +Also, due to the lack of hotplug support, Thunderbolt-based interfaces must not be removed +while the system is up as the kernel is currently unable to cope with a +.Nm +interface disappearing. From owner-svn-src-all@freebsd.org Mon Mar 19 07:35:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCB99F57EE1; Mon, 19 Mar 2018 07:35:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C94480AFC; Mon, 19 Mar 2018 07:35:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 771EB3DE0; Mon, 19 Mar 2018 07:35:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7ZZkE022030; Mon, 19 Mar 2018 07:35:35 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7ZZG9022028; Mon, 19 Mar 2018 07:35:35 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190735.w2J7ZZG9022028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331197 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331197 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:35:36 -0000 Author: eadler Date: Mon Mar 19 07:35:35 2018 New Revision: 331197 URL: https://svnweb.freebsd.org/changeset/base/331197 Log: MFC r324806: Use the .Fx macro consistently. Sponsored by: Spectra Logic Corp Modified: stable/11/share/man/man4/mpr.4 stable/11/share/man/man4/usfs.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/mpr.4 ============================================================================== --- stable/11/share/man/man4/mpr.4 Mon Mar 19 07:34:24 2018 (r331196) +++ stable/11/share/man/man4/mpr.4 Mon Mar 19 07:35:35 2018 (r331197) @@ -380,7 +380,8 @@ These bits have the described effects: .Sh HISTORY The .Nm -driver first appeared in FreeBSD 9.3. +driver first appeared in +.Fx 9.3 . .Sh AUTHORS The .Nm Modified: stable/11/share/man/man4/usfs.4 ============================================================================== --- stable/11/share/man/man4/usfs.4 Mon Mar 19 07:34:24 2018 (r331196) +++ stable/11/share/man/man4/usfs.4 Mon Mar 19 07:35:35 2018 (r331197) @@ -65,4 +65,5 @@ Upon attach the driver creates a RAM disk which can be .Sh HISTORY The .Nm -driver appeared in FreeBSD 8. +driver appeared in +.Fx 8.0 . From owner-svn-src-all@freebsd.org Mon Mar 19 07:37:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74DF3F580C6; Mon, 19 Mar 2018 07:37:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 269F280D43; Mon, 19 Mar 2018 07:37:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2156F3DE5; Mon, 19 Mar 2018 07:37:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7bDkE022271; Mon, 19 Mar 2018 07:37:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7bDtH022268; Mon, 19 Mar 2018 07:37:13 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190737.w2J7bDtH022268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331198 - in stable/11/sys/dev/usb: . misc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . misc X-SVN-Commit-Revision: 331198 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:37:14 -0000 Author: eadler Date: Mon Mar 19 07:37:13 2018 New Revision: 331198 URL: https://svnweb.freebsd.org/changeset/base/331198 Log: MFC r324858: Add Prolific PL27A1 USB 3.0 Host-Host device to udbp(4). Tested with a Plugable cable in VirtualBox against Linux 4.11. Modified: stable/11/sys/dev/usb/misc/udbp.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/misc/udbp.c ============================================================================== --- stable/11/sys/dev/usb/misc/udbp.c Mon Mar 19 07:35:35 2018 (r331197) +++ stable/11/sys/dev/usb/misc/udbp.c Mon Mar 19 07:37:13 2018 (r331198) @@ -265,6 +265,7 @@ static const STRUCT_USB_HOST_ID udbp_devs[] = { {USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_GADGETZERO, 0)}, {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2301, 0)}, {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2302, 0)}, + {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL27A1, 0)}, {USB_VPI(USB_VENDOR_ANCHOR, USB_PRODUCT_ANCHOR_EZLINK, 0)}, {USB_VPI(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL620USB, 0)}, }; Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Mon Mar 19 07:35:35 2018 (r331197) +++ stable/11/sys/dev/usb/usbdevs Mon Mar 19 07:37:13 2018 (r331198) @@ -3633,6 +3633,7 @@ product PROLIFIC PL2305 0x2305 Parallel printer product PROLIFIC ATAPI4 0x2307 ATAPI-4 Controller product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface product PROLIFIC PL2506 0x2506 PL2506 USB to IDE Bridge +product PROLIFIC PL27A1 0x27A1 PL27A1 USB 3.0 Host-Host interface product PROLIFIC HCR331 0x331a HCR331 Hybrid Card Reader product PROLIFIC PHAROS 0xaaa0 Prolific Pharos product PROLIFIC RSAQ3 0xaaa2 PL2303 Serial Adapter (IODATA USB-RSAQ3) From owner-svn-src-all@freebsd.org Mon Mar 19 07:37:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75EDCF58145; Mon, 19 Mar 2018 07:37:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28E3880E54; Mon, 19 Mar 2018 07:37:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23C653DE6; Mon, 19 Mar 2018 07:37:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7bb8c022331; Mon, 19 Mar 2018 07:37:37 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7bbX0022330; Mon, 19 Mar 2018 07:37:37 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190737.w2J7bbX0022330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:37:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331199 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 07:37:37 -0000 Author: eadler Date: Mon Mar 19 07:37:36 2018 New Revision: 331199 URL: https://svnweb.freebsd.org/changeset/base/331199 Log: MFC r324860: Modernise this man page somewhat. 1. Add a reference to a good 3rd party list of compatible cables, but provide suggestions for 'known good' vendors. 2. Change IP-based USB host-host example to a modern Ethernet one which works 'out of box' with current Linux systems. 3. Explain that USB 3.0 is host-host, even though point-to-point soft Ethernet can be achieved. Modified: stable/11/share/man/man4/udbp.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/udbp.4 ============================================================================== --- stable/11/share/man/man4/udbp.4 Mon Mar 19 07:37:13 2018 (r331198) +++ stable/11/share/man/man4/udbp.4 Mon Mar 19 07:37:36 2018 (r331199) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2006 +.Dd October 20, 2017 .Dt UDBP 4 .Os .Sh NAME @@ -48,9 +48,14 @@ udbp_load="YES" The .Nm driver provides support for host-to-host cables -that contain at least two bulk pipes (one for each direction), -for example -the EzLink cable and the NetChip 1080 chip. +that contain at least two bulk pipes (one for each direction). +This typically includes cables branded for use with +.Sy Windows USB Easy Transfer , +and many cables based on the Prolific PL2xx1 series of USB bridge chips. +A useful (but non-comprehensive) list of compatible USB host cables +is listed in the +.Sx SEE ALSO +section below. .Pp .\" XXX The description of how to add netgraph to the kernel .\" is out of place here. It should be limited to the @@ -86,30 +91,64 @@ module and then the .Nm driver. .Pp -.Dl ngctl mkpeer udbp0: iface data inet -.Dl ifconfig ng0 10.0.0.1 10.0.0.2 +.Dl ngctl mkpeer udbp0: eiface data ether +.Dl ifconfig ngeth0 ether aa:dd:xx:xx:xx +.Dl ifconfig ngeth0 inet 169.254.x.x/16 .Pp -Create a new network interface node -and connect its inet hook to the data hook of the +Create a new Ethernet network interface node +and connect its ether hook to the data hook of the .Nm -node. -.Xr ifconfig 8 -configures the resulting network interface ng0 with a local -IP address of 10.0.0.1 and a remote IP address of 10.0.0.2. -On the remote host, the two -IP addresses should of course be reversed. +driver. +.Pp +This enables FreeBSD to communicate with a Linux peer (e.g. using the +.Sy plusb +driver). +The Linux node should be configured to prefer link-local IPv4 addresses +(e.g. using Network Manager in Debian and Red Hat derived distributions). +.Pp +Whilst both FreeBSD and Linux are able to interoperate by +loosely following CDC EEM 1.0 in their behaviour, neither implementation +has been expressly designed to follow its specification. .Sh SEE ALSO .Xr netgraph 4 , -.Xr ng_iface 4 , +.Xr ng_eiface 4 , .Xr ohci 4 , .Xr uhci 4 , .Xr usb 4 , .Xr ngctl 8 +.\" +.Rs +.%B Universal Serial Bus: Communications Class Subclass Specification for Ethernet Emulation Model Devices +.%N Revision 1.0 +.%D February 2, 2005 +.%I USB Implementers Forum, Inc. +.%U http://www.usb.org/developers/docs/devclass_docs/CDC_EEM10.pdf +.Re +.\" +.Rs +.%B Total Commander: Supported cables for USB cable connection +.%I Ghisler Software GmbH. +.%U https://www.ghisler.com/cables/index.htm +.Re +.Sh CAVEATS +The point-to-point nature and additional latency of USB host-host links +makes them unsuitable as a "drop-in" replacement for an Ethernet LAN; +for a USB 3.0 SuperSpeed cable, latency is comparable to 100BaseTX Ethernet +(but often worse), with throughput comparable to 2.5GBASE-T. +.Pp +However, their energy efficiency makes them attractive for embedded +applications. A Plugable PL27A1 cable claims 24mA of USB3 bus power, +as compared to 150mA for a typical USB 3.0 to Gigabit Ethernet interface. .Sh HISTORY The .Nm driver first appeared in .Fx 5.0 . +.Sh BUGS +The +.Nm +driver does not support the special packets described in section 5.1 +of the CDC EEM specification. .Sh AUTHORS .An -nosplit The @@ -121,4 +160,6 @@ and .An Nick Hibma Aq Mt n_hibma@FreeBSD.org . .Pp This manual page was written by -.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org +and updated by +.An Bruce Simpson Aq Mt bms@FreeBSD.org . From owner-svn-src-all@freebsd.org Mon Mar 19 08:28:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56004F5B372; Mon, 19 Mar 2018 08:28:26 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 021CE82870; Mon, 19 Mar 2018 08:28:26 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F145D459D; Mon, 19 Mar 2018 08:28:25 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J8SPC8047601; Mon, 19 Mar 2018 08:28:25 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J8SP6V047600; Mon, 19 Mar 2018 08:28:25 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201803190828.w2J8SP6V047600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Mon, 19 Mar 2018 08:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r331200 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 331200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 08:28:26 -0000 Author: hrs Date: Mon Mar 19 08:28:25 2018 New Revision: 331200 URL: https://svnweb.freebsd.org/changeset/base/331200 Log: Please welcome Vincenzo Maffione (vmaffione) as a new src committer. He will work on netmap framework. I (hrs) will be his mentor. Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Mon Mar 19 07:37:36 2018 (r331199) +++ svnadmin/conf/access Mon Mar 19 08:28:25 2018 (r331200) @@ -218,6 +218,7 @@ tychon ume uqs vangyzen +vmaffione whu will wma From owner-svn-src-all@freebsd.org Mon Mar 19 09:52:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0613F60D35; Mon, 19 Mar 2018 09:52:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7368F86AEA; Mon, 19 Mar 2018 09:52:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E55A5243; Mon, 19 Mar 2018 09:52:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J9qHHd092638; Mon, 19 Mar 2018 09:52:17 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J9qH2B092636; Mon, 19 Mar 2018 09:52:17 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201803190952.w2J9qH2B092636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Mar 2018 09:52:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331201 - in stable/11: sbin/ipfw sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/11: sbin/ipfw sys/netpfil/ipfw X-SVN-Commit-Revision: 331201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 09:52:17 -0000 Author: ae Date: Mon Mar 19 09:52:16 2018 New Revision: 331201 URL: https://svnweb.freebsd.org/changeset/base/331201 Log: MFC r330792: Do not try to reassemble IPv6 fragments in "reass" rule. ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets that it gets. Until proper IPv6 fragments handling function will be implemented, pass IPv6 packets to next rule. PR: 170604 Modified: stable/11/sbin/ipfw/ipfw.8 stable/11/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 08:28:25 2018 (r331200) +++ stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 09:52:16 2018 (r331201) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 3, 2017 +.Dd March 12, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -1135,7 +1135,7 @@ Regardless of matched a packet or not by the .Cm tcp-setmss rule, the search continues with the next rule. .It Cm reass -Queue and reassemble IP fragments. +Queue and reassemble IPv4 fragments. If the packet is not fragmented, counters are updated and processing continues with the next rule. If the packet is the last logical fragment, the packet is reassembled and, if Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 08:28:25 2018 (r331200) +++ stable/11/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 09:52:16 2018 (r331201) @@ -2779,8 +2779,10 @@ do { \ case O_REASS: { int ip_off; - IPFW_INC_RULE_COUNTER(f, pktlen); l = 0; /* in any case exit inner loop */ + if (is_ipv6) /* IPv6 is not supported yet */ + break; + IPFW_INC_RULE_COUNTER(f, pktlen); ip_off = ntohs(ip->ip_off); /* if not fragmented, go to next rule */ From owner-svn-src-all@freebsd.org Mon Mar 19 09:54:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4457F61096; Mon, 19 Mar 2018 09:54:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 558C986D0B; Mon, 19 Mar 2018 09:54:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50566535A; Mon, 19 Mar 2018 09:54:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J9sHEb092768; Mon, 19 Mar 2018 09:54:17 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J9sHOJ092766; Mon, 19 Mar 2018 09:54:17 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201803190954.w2J9sHOJ092766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Mar 2018 09:54:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331202 - in stable/10: sbin/ipfw sys/netpfil/ipfw X-SVN-Group: stable-10 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/10: sbin/ipfw sys/netpfil/ipfw X-SVN-Commit-Revision: 331202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 09:54:17 -0000 Author: ae Date: Mon Mar 19 09:54:16 2018 New Revision: 331202 URL: https://svnweb.freebsd.org/changeset/base/331202 Log: MFC r330792: Do not try to reassemble IPv6 fragments in "reass" rule. ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets that it gets. Until proper IPv6 fragments handling function will be implemented, pass IPv6 packets to next rule. PR: 170604 Modified: stable/10/sbin/ipfw/ipfw.8 stable/10/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ipfw/ipfw.8 ============================================================================== --- stable/10/sbin/ipfw/ipfw.8 Mon Mar 19 09:52:16 2018 (r331201) +++ stable/10/sbin/ipfw/ipfw.8 Mon Mar 19 09:54:16 2018 (r331202) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 26, 2016 +.Dd March 12, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -1016,7 +1016,7 @@ keyword with setdscp. If the tablearg value is not within the 0..64 range, lower 6 bits of supplied value are used. .It Cm reass -Queue and reassemble IP fragments. +Queue and reassemble IPv4 fragments. If the packet is not fragmented, counters are updated and processing continues with the next rule. If the packet is the last logical fragment, the packet is reassembled and, if Modified: stable/10/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/10/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 09:52:16 2018 (r331201) +++ stable/10/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 09:54:16 2018 (r331202) @@ -2461,8 +2461,10 @@ do { \ case O_REASS: { int ip_off; - IPFW_INC_RULE_COUNTER(f, pktlen); l = 0; /* in any case exit inner loop */ + if (is_ipv6) /* IPv6 is not supported yet */ + break; + IPFW_INC_RULE_COUNTER(f, pktlen); ip_off = ntohs(ip->ip_off); /* if not fragmented, go to next rule */ From owner-svn-src-all@freebsd.org Mon Mar 19 10:50:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECC48F64F81; Mon, 19 Mar 2018 10:50:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91E4F69478; Mon, 19 Mar 2018 10:50:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 867A65AE7; Mon, 19 Mar 2018 10:50:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JAoRe8018396; Mon, 19 Mar 2018 10:50:27 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JAoR1I018395; Mon, 19 Mar 2018 10:50:27 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201803191050.w2JAoR1I018395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Mar 2018 10:50:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331203 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 331203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 10:50:28 -0000 Author: ae Date: Mon Mar 19 10:50:27 2018 New Revision: 331203 URL: https://svnweb.freebsd.org/changeset/base/331203 Log: Remove note that `fwd tablearg` is supported only by IPv4. IPv6 is supported too. MFC after: 1 week Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Mar 19 09:54:16 2018 (r331202) +++ head/sbin/ipfw/ipfw.8 Mon Mar 19 10:50:27 2018 (r331203) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 12, 2018 +.Dd March 19, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -825,7 +825,7 @@ The search terminates. Change the next-hop on matching packets to .Ar ipaddr , which can be an IP address or a host name. -For IPv4, the next hop can also be supplied by the last table +The next hop can also be supplied by the last table looked up for the packet by using the .Cm tablearg keyword instead of an explicit address. From owner-svn-src-all@freebsd.org Mon Mar 19 13:51:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D8BDF4E56A; Mon, 19 Mar 2018 13:51:34 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1024770328; Mon, 19 Mar 2018 13:51:34 +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 0B03F7757; Mon, 19 Mar 2018 13:51:34 +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 w2JDpXmZ010982; Mon, 19 Mar 2018 13:51:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JDpXWq010981; Mon, 19 Mar 2018 13:51:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803191351.w2JDpXWq010981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Mar 2018 13:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331204 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 331204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 13:51:34 -0000 Author: hselasky Date: Mon Mar 19 13:51:33 2018 New Revision: 331204 URL: https://svnweb.freebsd.org/changeset/base/331204 Log: Remove redundant integer cast in ibcore. The "ref_count" field already has integer type. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Modified: head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Mon Mar 19 10:50:27 2018 (r331203) +++ head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Mon Mar 19 13:51:33 2018 (r331204) @@ -155,7 +155,7 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *p #ifdef DEBUG if (fmr->ref_count !=0) { pr_warn(PFX "Unmapping FMR %p with ref count %d\n", - fmr, (int)fmr->ref_count); + fmr, fmr->ref_count); } #endif } From owner-svn-src-all@freebsd.org Mon Mar 19 14:28:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F280F50B5B; Mon, 19 Mar 2018 14:28:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED53371BAA; Mon, 19 Mar 2018 14:28:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E83387C15; Mon, 19 Mar 2018 14:28:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JESLrJ027524; Mon, 19 Mar 2018 14:28:21 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JESKXm027512; Mon, 19 Mar 2018 14:28:20 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201803191428.w2JESKXm027512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 19 Mar 2018 14:28:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331205 - in stable/11: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/aarch64 libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/mips libexec/rt... X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/11: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/aarch64 libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rt... X-SVN-Commit-Revision: 331205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 14:28:22 -0000 Author: marius Date: Mon Mar 19 14:28:20 2018 New Revision: 331205 URL: https://svnweb.freebsd.org/changeset/base/331205 Log: MFC: r328834 o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers. o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h. o Sprinkle nitems(). Modified: stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c stable/11/libexec/rtld-elf/aarch64/reloc.c stable/11/libexec/rtld-elf/amd64/reloc.c stable/11/libexec/rtld-elf/arm/reloc.c stable/11/libexec/rtld-elf/i386/reloc.c stable/11/libexec/rtld-elf/mips/reloc.c stable/11/libexec/rtld-elf/powerpc/reloc.c stable/11/libexec/rtld-elf/powerpc64/reloc.c stable/11/libexec/rtld-elf/riscv/reloc.c stable/11/libexec/rtld-elf/rtld.c stable/11/libexec/rtld-elf/rtld.h stable/11/libexec/rtld-elf/sparc64/reloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c ============================================================================== --- stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 14:28:20 2018 (r331205) @@ -29,13 +29,11 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include -#include - #include "__sparc_utrap_private.h" static const struct sparc_utrap_args ua[] = { @@ -47,10 +45,10 @@ static const struct sparc_utrap_args ua[] = { }; static const struct sparc_utrap_install_args uia[] = { - { sizeof (ua) / sizeof (*ua), ua } + { nitems(ua), ua } }; -void __sparc_utrap_setup(void) __attribute__((constructor)); +void __sparc_utrap_setup(void); void __sparc_utrap_setup(void) Modified: stable/11/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/aarch64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/aarch64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -306,6 +306,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } /* Modified: stable/11/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -485,6 +485,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { /* Modified: stable/11/libexec/rtld-elf/arm/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/arm/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/arm/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -481,6 +481,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/i386/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/i386/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/i386/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -471,6 +471,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { void* tls; Modified: stable/11/libexec/rtld-elf/mips/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/mips/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/mips/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -628,6 +628,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -626,6 +626,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -531,6 +531,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/riscv/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/riscv/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/riscv/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -368,6 +368,13 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/rtld.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/rtld.c Mon Mar 19 14:28:20 2018 (r331205) @@ -753,6 +753,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr obj_main->fini_array = (Elf_Addr)NULL; } + /* + * Execute MD initializers required before we call the objects' + * init functions. + */ + pre_init(); + wlock_acquire(rtld_bind_lock, &lockstate); if (obj_main->crt_no_init) preinit_main(); Modified: stable/11/libexec/rtld-elf/rtld.h ============================================================================== --- stable/11/libexec/rtld-elf/rtld.h Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/rtld.h Mon Mar 19 14:28:20 2018 (r331205) @@ -371,8 +371,6 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_lo unsigned long elf_hash(const char *); const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); -void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]); -void init_pltgot(Obj_Entry *); void lockdflt_init(void); void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr); Obj_Entry *globallist_curr(const Obj_Entry *obj); @@ -402,6 +400,9 @@ int reloc_plt(Obj_Entry *); int reloc_jmpslots(Obj_Entry *, int flags, struct Struct_RtldLockState *); int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); int reloc_gnu_ifunc(Obj_Entry *, int flags, struct Struct_RtldLockState *); +void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]); +void pre_init(void); +void init_pltgot(Obj_Entry *); void allocate_initial_tls(Obj_Entry *); #endif /* } */ Modified: stable/11/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -365,8 +365,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *re * Note: R_SPARC_TLS_TPOFF64 must be the numerically largest * relocation type. */ - if (type >= sizeof(reloc_target_bitmask) / - sizeof(*reloc_target_bitmask)) { + if (type >= nitems(reloc_target_bitmask)) { _rtld_error("%s: Unsupported relocation type %d in non-PLT " "object\n", obj->path, type); return (-1); @@ -791,8 +790,18 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + } +extern void __sparc_utrap_setup(void); + +void +pre_init(void) +{ + + __sparc_utrap_setup(); +} + /* * Install rtld function call into this PLT slot. */ @@ -821,6 +830,7 @@ init_pltgot(Obj_Entry *obj) static void install_plt(Elf_Word *pltgot, Elf_Addr proc) { + pltgot[0] = SAVE; flush(pltgot, 0); pltgot[1] = SETHI_l0 | HIVAL(proc, 42); From owner-svn-src-all@freebsd.org Mon Mar 19 14:29:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55FC1F50C0B; Mon, 19 Mar 2018 14:29:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 060D571CE0; Mon, 19 Mar 2018 14:29:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00F927C16; Mon, 19 Mar 2018 14:29:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JESxO1027619; Mon, 19 Mar 2018 14:28:59 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JESwYm027606; Mon, 19 Mar 2018 14:28:58 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201803191428.w2JESwYm027606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 19 Mar 2018 14:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331206 - in stable/10: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-... X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-SVN-Commit-Revision: 331206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 14:29:00 -0000 Author: marius Date: Mon Mar 19 14:28:58 2018 New Revision: 331206 URL: https://svnweb.freebsd.org/changeset/base/331206 Log: MFC: r328834 o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers. o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h. o Sprinkle nitems(). Modified: stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c stable/10/libexec/rtld-elf/amd64/reloc.c stable/10/libexec/rtld-elf/arm/reloc.c stable/10/libexec/rtld-elf/i386/reloc.c stable/10/libexec/rtld-elf/ia64/reloc.c stable/10/libexec/rtld-elf/mips/reloc.c stable/10/libexec/rtld-elf/powerpc/reloc.c stable/10/libexec/rtld-elf/powerpc64/reloc.c stable/10/libexec/rtld-elf/rtld.c stable/10/libexec/rtld-elf/rtld.h stable/10/libexec/rtld-elf/sparc64/reloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c ============================================================================== --- stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 14:28:58 2018 (r331206) @@ -27,13 +27,11 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include -#include - #include "__sparc_utrap_private.h" static const struct sparc_utrap_args ua[] = { @@ -45,10 +43,10 @@ static const struct sparc_utrap_args ua[] = { }; static const struct sparc_utrap_install_args uia[] = { - { sizeof (ua) / sizeof (*ua), ua } + { nitems(ua), ua } }; -void __sparc_utrap_setup(void) __attribute__((constructor)); +void __sparc_utrap_setup(void); void __sparc_utrap_setup(void) Modified: stable/10/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -471,6 +471,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { /* Modified: stable/10/libexec/rtld-elf/arm/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/arm/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/arm/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -437,6 +437,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/i386/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/i386/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/i386/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -457,6 +457,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { void* tls; Modified: stable/10/libexec/rtld-elf/ia64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/ia64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/ia64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -606,6 +606,13 @@ call_init_pointer(const Obj_Entry *obj, Elf_Addr targe void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } /* Initialize the special PLT entries. */ Modified: stable/10/libexec/rtld-elf/mips/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/mips/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/mips/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -620,6 +620,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -622,6 +622,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -490,6 +490,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/rtld.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/rtld.c Mon Mar 19 14:28:58 2018 (r331206) @@ -659,6 +659,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr obj_main->fini_array = (Elf_Addr)NULL; } + /* + * Execute MD initializers required before we call the objects' + * init functions. + */ + pre_init(); + wlock_acquire(rtld_bind_lock, &lockstate); if (obj_main->crt_no_init) preinit_main(); Modified: stable/10/libexec/rtld-elf/rtld.h ============================================================================== --- stable/10/libexec/rtld-elf/rtld.h Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/rtld.h Mon Mar 19 14:28:58 2018 (r331206) @@ -380,8 +380,6 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_lo unsigned long elf_hash(const char *); const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); -void ifunc_init(Elf_Auxinfo *); -void init_pltgot(Obj_Entry *); void lockdflt_init(void); void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr); Obj_Entry *globallist_curr(const Obj_Entry *obj); @@ -411,6 +409,9 @@ int reloc_plt(Obj_Entry *); int reloc_jmpslots(Obj_Entry *, int flags, struct Struct_RtldLockState *); int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); int reloc_gnu_ifunc(Obj_Entry *, int flags, struct Struct_RtldLockState *); +void ifunc_init(Elf_Auxinfo *); +void pre_init(void); +void init_pltgot(Obj_Entry *); void allocate_initial_tls(Obj_Entry *); #endif /* } */ Modified: stable/10/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -365,8 +365,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *re * Note: R_SPARC_TLS_TPOFF64 must be the numerically largest * relocation type. */ - if (type >= sizeof(reloc_target_bitmask) / - sizeof(*reloc_target_bitmask)) { + if (type >= nitems(reloc_target_bitmask)) { _rtld_error("%s: Unsupported relocation type %d in non-PLT " "object\n", obj->path, type); return (-1); @@ -789,8 +788,18 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + } +extern void __sparc_utrap_setup(void); + +void +pre_init(void) +{ + + __sparc_utrap_setup(); +} + /* * Install rtld function call into this PLT slot. */ @@ -819,6 +828,7 @@ init_pltgot(Obj_Entry *obj) static void install_plt(Elf_Word *pltgot, Elf_Addr proc) { + pltgot[0] = SAVE; flush(pltgot, 0); pltgot[1] = SETHI_l0 | HIVAL(proc, 42); From owner-svn-src-all@freebsd.org Mon Mar 19 15:07:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 247E5F535E6; Mon, 19 Mar 2018 15:07:16 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6E967370F; Mon, 19 Mar 2018 15:07:15 +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 C1E411023C; Mon, 19 Mar 2018 15:07:15 +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 w2JF7FCh047484; Mon, 19 Mar 2018 15:07:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JF7Fle047483; Mon, 19 Mar 2018 15:07:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803191507.w2JF7Fle047483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Mar 2018 15:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331207 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:07:16 -0000 Author: emaste Date: Mon Mar 19 15:07:15 2018 New Revision: 331207 URL: https://svnweb.freebsd.org/changeset/base/331207 Log: loader.conf: remove obsolete non-x86 beastie menu statement As of r330005 the same loader.conf defaults are used on all platforms. Sponsored by: The FreeBSD Foundation Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Mon Mar 19 14:28:58 2018 (r331206) +++ head/stand/defaults/loader.conf.5 Mon Mar 19 15:07:15 2018 (r331207) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd March 7, 2018 +.Dd March 19, 2018 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -249,7 +249,6 @@ be displayed. If set to .Dq YES , the beastie boot menu will be skipped. -The beastie boot menu is always skipped if running non-x86 hardware. .It Va loader_logo Pq Dq Li orbbw Selects a desired logo in the beastie boot menu. Possible values are: From owner-svn-src-all@freebsd.org Mon Mar 19 15:11:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CB66F539AD; Mon, 19 Mar 2018 15:11:11 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FCEE73A41; Mon, 19 Mar 2018 15:11:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AC0710266; Mon, 19 Mar 2018 15:11:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JFBAtv047732; Mon, 19 Mar 2018 15:11:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFBAZM047729; Mon, 19 Mar 2018 15:11:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803191511.w2JFBAZM047729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Mar 2018 15:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331208 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331208 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:11:11 -0000 Author: emaste Date: Mon Mar 19 15:11:10 2018 New Revision: 331208 URL: https://svnweb.freebsd.org/changeset/base/331208 Log: linux*_sysvec.c: rationalize whitespace and comments There's a fair amount of duplication between MD linuxulator files. Make indentation and comments consistent between the three versions of linux_sysvec.c to reduce diffs when comparing them. Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 15:07:15 2018 (r331207) +++ head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 15:11:10 2018 (r331208) @@ -126,6 +126,7 @@ static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); +static int exec_linux_imgact_try(struct image_params *iparams); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static int linux_vsyscall(struct thread *td); @@ -669,8 +670,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { @@ -685,15 +684,14 @@ exec_linux_imgact_try(struct image_params *imgp) */ if (((const short *)head)[0] == SHELLMAGIC) { /* - * Run our normal shell image activator. If it succeeds - * attempt to use the alternate path for the interpreter. - * If an alternate path is found, use our stringspace - * to store it. + * Run our normal shell image activator. If it succeeds then + * attempt to use the alternate path for the interpreter. If + * an alternate path is found, use our stringspace to store it. */ if ((error = exec_shell_imgact(imgp)) == 0) { linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, - &rpath, 0, AT_FDCWD); + imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, + AT_FDCWD); if (rpath != NULL) imgp->args->fname_buf = imgp->interpreter_name = rpath; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 15:07:15 2018 (r331207) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 15:11:10 2018 (r331208) @@ -124,6 +124,7 @@ static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); static register_t *linux_copyout_strings(struct image_params *imgp); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); +static int exec_linux_imgact_try(struct image_params *iparams); static void exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); static void linux32_fixlimit(struct rlimit *rl, int which); @@ -722,8 +723,6 @@ linux32_fetch_syscall_args(struct thread *td) * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { @@ -732,16 +731,16 @@ exec_linux_imgact_try(struct image_params *imgp) int error = -1; /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ + * The interpreter for shell scripts run from a Linux binary needs + * to be located in /compat/linux if possible in order to recursively + * maintain Linux path emulation. + */ if (((const short *)head)[0] == SHELLMAGIC) { /* - * Run our normal shell image activator. If it succeeds attempt - * to use the alternate path for the interpreter. If an - * alternate * path is found, use our stringspace to store it. - */ + * Run our normal shell image activator. If it succeeds then + * attempt to use the alternate path for the interpreter. If + * an alternate path is found, use our stringspace to store it. + */ if ((error = exec_shell_imgact(imgp)) == 0) { linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Mar 19 15:07:15 2018 (r331207) +++ head/sys/i386/linux/linux_sysvec.c Mon Mar 19 15:11:10 2018 (r331208) @@ -112,6 +112,7 @@ static int linux_fixup(register_t **stack_base, static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); +static int exec_linux_imgact_try(struct image_params *iparams); static void exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); static register_t *linux_copyout_strings(struct image_params *imgp); @@ -819,35 +820,34 @@ linux_fetch_syscall_args(struct thread *td) * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { - const char *head = (const char *)imgp->image_header; - char *rpath; - int error = -1; + const char *head = (const char *)imgp->image_header; + char *rpath; + int error = -1; - /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ - if (((const short *)head)[0] == SHELLMAGIC) { - /* - * Run our normal shell image activator. If it succeeds attempt - * to use the alternate path for the interpreter. If an alternate - * path is found, use our stringspace to store it. - */ - if ((error = exec_shell_imgact(imgp)) == 0) { - linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) - imgp->args->fname_buf = - imgp->interpreter_name = rpath; - } - } - return (error); + /* + * The interpreter for shell scripts run from a Linux binary needs + * to be located in /compat/linux if possible in order to recursively + * maintain Linux path emulation. + */ + if (((const short *)head)[0] == SHELLMAGIC) { + /* + * Run our normal shell image activator. If it succeeds then + * attempt to use the alternate path for the interpreter. If + * an alternate path is found, use our stringspace to store it. + */ + if ((error = exec_shell_imgact(imgp)) == 0) { + linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), + imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, + AT_FDCWD); + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; + } + } + return (error); } /* From owner-svn-src-all@freebsd.org Mon Mar 19 15:27:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55AECF54EDA; Mon, 19 Mar 2018 15:27:54 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B43F74E95; Mon, 19 Mar 2018 15:27:54 +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 01AB010537; Mon, 19 Mar 2018 15:27:54 +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 w2JFRrbR058669; Mon, 19 Mar 2018 15:27:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFRr7B058668; Mon, 19 Mar 2018 15:27:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191527.w2JFRr7B058668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 15:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331209 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:27:54 -0000 Author: kevans Date: Mon Mar 19 15:27:53 2018 New Revision: 331209 URL: https://svnweb.freebsd.org/changeset/base/331209 Log: Add note to UPDATING about UEFI changes requiring loader(8) update These problems have only been observed with boards using U-Boot (e.g. ARM) where virtual addresses are already set in the memory map by the firmware and the firmware is expecting a call to SetVirtualAddressMap to be made. I refrain from mentioning this in the note because this could also be the case on some not-yet-tested firmware on amd64 and it's not a bad recommendation for the general case. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 19 15:11:10 2018 (r331208) +++ head/UPDATING Mon Mar 19 15:27:53 2018 (r331209) @@ -51,6 +51,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20180319: + For UEFI systems: the UEFI loader(8), loader.efi, should be updated in + conjunction with installing a new kernel after r330868. The kernel, + after this revision, will be more lenient when mapping addresses for + UEFI Runtime Services and this may result in a kernel panic without the + corresponding loader(8) update. + 20180212: FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf. From owner-svn-src-all@freebsd.org Mon Mar 19 15:35:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B298F557B9; Mon, 19 Mar 2018 15:35:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFE12754A6; Mon, 19 Mar 2018 15:35:26 +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 E588B106C3; Mon, 19 Mar 2018 15:35:26 +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 w2JFZQNd063333; Mon, 19 Mar 2018 15:35:26 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFZQqU063332; Mon, 19 Mar 2018 15:35:26 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201803191535.w2JFZQqU063332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 19 Mar 2018 15:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331210 - head/sys/dts X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dts X-SVN-Commit-Revision: 331210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:35:27 -0000 Author: manu Date: Mon Mar 19 15:35:26 2018 New Revision: 331210 URL: https://svnweb.freebsd.org/changeset/base/331210 Log: sys/dts: Remove arm64 from subdir as it no longer exists. r325987 removed the arm64 directory, remove it from SUBDIR too. Modified: head/sys/dts/Makefile Modified: head/sys/dts/Makefile ============================================================================== --- head/sys/dts/Makefile Mon Mar 19 15:27:53 2018 (r331209) +++ head/sys/dts/Makefile Mon Mar 19 15:35:26 2018 (r331210) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR=arm arm64 mips powerpc +SUBDIR=arm mips powerpc .include From owner-svn-src-all@freebsd.org Mon Mar 19 15:43:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73C17F56020; Mon, 19 Mar 2018 15:43:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A73575BF6; Mon, 19 Mar 2018 15:43:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 9F28110A8BE; Mon, 19 Mar 2018 11:42:57 -0400 (EDT) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331057 - head/sys/compat/linux Date: Fri, 16 Mar 2018 14:08:28 -0700 Message-ID: <1806390.PUHUxB7aSs@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201803161451.w2GEpl3T053141@repo.freebsd.org> References: <201803161451.w2GEpl3T053141@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Mar 2018 11:42:57 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:43:04 -0000 On Friday, March 16, 2018 02:51:47 PM Ed Maste wrote: > Author: emaste > Date: Fri Mar 16 14:51:47 2018 > New Revision: 331057 > URL: https://svnweb.freebsd.org/changeset/base/331057 > > Log: > linux_errno.c: add newer errno values > > Also introduce a static assert to ensure the list is kept up to date. > > Sponsored by: Turing Robotic Industries Inc. Could you move the table to a header perhaps so it can also be shared with lib/libsysdecode/errno.c (which has another copy of this table)? -- John Baldwin From owner-svn-src-all@freebsd.org Mon Mar 19 15:48:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BA1AF565ED; Mon, 19 Mar 2018 15:48:32 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3B7075F1A; Mon, 19 Mar 2018 15:48:31 +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 AA57810849; Mon, 19 Mar 2018 15:48:31 +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 w2JFmVkl068677; Mon, 19 Mar 2018 15:48:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFmVGB068675; Mon, 19 Mar 2018 15:48:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191548.w2JFmVGB068675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 15:48:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331211 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:48:32 -0000 Author: kevans Date: Mon Mar 19 15:48:31 2018 New Revision: 331211 URL: https://svnweb.freebsd.org/changeset/base/331211 Log: lualoader: Setup default color scheme if we're using colors The console may have been set for different colors before lualoader kicks in; notably, a black-on-white color scheme is not necessarily what we're expecting. While here, make color.default() a composition of color.escape() instead of rewriting the escape sequence to make it more obvious what it's achieving: a white-on-black color scheme with no attributes set. Reported by: emaste, whose eyes may rest easily Modified: head/stand/lua/color.lua head/stand/lua/loader.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Mar 19 15:35:26 2018 (r331210) +++ head/stand/lua/color.lua Mon Mar 19 15:48:31 2018 (r331211) @@ -89,7 +89,7 @@ function color.default() if color.disabled then return "" end - return core.KEYSTR_CSI .. "0;37;40m" + return color.escape(color.WHITE, color.BLACK, color.DEFAULT) end function color.highlight(str) Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Mon Mar 19 15:35:26 2018 (r331210) +++ head/stand/lua/loader.lua Mon Mar 19 15:48:31 2018 (r331211) @@ -34,6 +34,7 @@ -- Other modules will also need some of the functions it defines to safely -- execute loader commands. require("cli") +local color = require("color") local core = require("core") local config = require("config") local menu @@ -49,6 +50,11 @@ if result ~= nil then end config.load() +-- Our console may have been setup for a different color scheme before we get +-- here, so make sure we set the default. +if color.isEnabled() then + printc(color.default()) +end password.check() -- menu might be disabled if menu ~= nil then From owner-svn-src-all@freebsd.org Mon Mar 19 16:16:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22D38F5850B; Mon, 19 Mar 2018 16:16:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA2DA775AE; Mon, 19 Mar 2018 16:16: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 C0DD110CE3; Mon, 19 Mar 2018 16:16: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 w2JGGCE5083462; Mon, 19 Mar 2018 16:16:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JGGCid083460; Mon, 19 Mar 2018 16:16:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191616.w2JGGCid083460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 16:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331212 - in head: etc/mtree stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: etc/mtree stand/defaults X-SVN-Commit-Revision: 331212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 16:16:13 -0000 Author: kevans Date: Mon Mar 19 16:16:12 2018 New Revision: 331212 URL: https://svnweb.freebsd.org/changeset/base/331212 Log: Move /boot/overlays to /boot/dtb/overlays The former is fairly vague; these are FDT overlays to be applied to the running system, so /boot/dtb is a sensible location to put it without cluttering up /boot/dtb even further if desired. Modified: head/etc/mtree/BSD.root.dist head/stand/defaults/loader.conf Modified: head/etc/mtree/BSD.root.dist ============================================================================== --- head/etc/mtree/BSD.root.dist Mon Mar 19 15:48:31 2018 (r331211) +++ head/etc/mtree/BSD.root.dist Mon Mar 19 16:16:12 2018 (r331212) @@ -11,6 +11,8 @@ defaults .. dtb + overlays tags=package=runtime + .. .. firmware .. @@ -19,8 +21,6 @@ kernel .. modules - .. - overlays tags=package=runtime .. zfs .. Modified: head/stand/defaults/loader.conf ============================================================================== --- head/stand/defaults/loader.conf Mon Mar 19 15:48:31 2018 (r331211) +++ head/stand/defaults/loader.conf Mon Mar 19 16:16:12 2018 (r331212) @@ -80,7 +80,7 @@ bootenv_autolist="YES" # Auto populate the list of ZF #comconsole_speed="9600" # Set the current serial console speed #console="vidconsole" # A comma separated list of console(s) #currdev="disk1s1a" # Set the current device -module_path="/boot/modules;/boot/dtb;/boot/overlays" # Set the module search path +module_path="/boot/modules;/boot/dtb;/boot/dtb/overlays" # Set the module search path #prompt="\\${interpret}" # Set the command prompt #root_disk_unit="0" # Force the root disk unit number #rootdev="disk1s1a" # Set the root filesystem From owner-svn-src-all@freebsd.org Mon Mar 19 16:17:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2D8EF58658; Mon, 19 Mar 2018 16:17:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F5F377747; Mon, 19 Mar 2018 16:17:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A3D510CE5; Mon, 19 Mar 2018 16:17:11 +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 w2JGHAMo083540; Mon, 19 Mar 2018 16:17:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JGHAkW083539; Mon, 19 Mar 2018 16:17:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191617.w2JGHAkW083539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 16:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331213 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 16:17:11 -0000 Author: kevans Date: Mon Mar 19 16:17:10 2018 New Revision: 331213 URL: https://svnweb.freebsd.org/changeset/base/331213 Log: Amend missed reference to /boot/overlays, moved to /boot/dtb/overlays Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Mon Mar 19 16:16:12 2018 (r331212) +++ head/stand/defaults/loader.conf.5 Mon Mar 19 16:17:10 2018 (r331213) @@ -284,7 +284,7 @@ that have no default value: .Bl -tag -width bootfile -offset indent .It Va fdt_overlays Specifies a comma-delimited list of FDT overlays to apply. -.Pa /boot/overlays +.Pa /boot/dtb/overlays is created by default for overlays to be placed in. .It Va kernels_autodetect If set to From owner-svn-src-all@freebsd.org Mon Mar 19 16:37:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13D84F59DE8; Mon, 19 Mar 2018 16:37:49 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B2E4078566; Mon, 19 Mar 2018 16:37:48 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A94B610FDC; Mon, 19 Mar 2018 16:37:48 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JGbmEO093563; Mon, 19 Mar 2018 16:37:48 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JGbmON093556; Mon, 19 Mar 2018 16:37:48 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201803191637.w2JGbmON093556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Mon, 19 Mar 2018 16:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331214 - in head: share/man/man4 sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet/cc X-SVN-Commit-Revision: 331214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 16:37:49 -0000 Author: lstewart Date: Mon Mar 19 16:37:47 2018 New Revision: 331214 URL: https://svnweb.freebsd.org/changeset/base/331214 Log: Add support for the experimental Internet-Draft "TCP Alternative Backoff with ECN (ABE)" proposal to the New Reno congestion control algorithm module. ABE reduces the amount of congestion window reduction in response to ECN-signalled congestion relative to the loss-inferred congestion response. More details about ABE can be found in the Internet-Draft: https://tools.ietf.org/html/draft-ietf-tcpm-alternativebackoff-ecn The implementation introduces four new sysctls: - net.inet.tcp.cc.abe defaults to 0 (disabled) and can be set to non-zero to enable ABE for ECN-enabled TCP connections. - net.inet.tcp.cc.newreno.beta and net.inet.tcp.cc.newreno.beta_ecn set the multiplicative window decrease factor, specified as a percentage, applied to the congestion window in response to a loss-based or ECN-based congestion signal respectively. They default to the values specified in the draft i.e. beta=50 and beta_ecn=80. - net.inet.tcp.cc.abe_frlossreduce defaults to 0 (disabled) and can be set to non-zero to enable the use of standard beta (50% by default) when repairing loss during an ECN-signalled congestion recovery episode. It enables a more conservative congestion response and is provided for the purposes of experimentation as a result of some discussion at IETF 100 in Singapore. The values of beta and beta_ecn can also be set per-connection by way of the TCP_CCALGOOPT TCP-level socket option and the new CC_NEWRENO_BETA or CC_NEWRENO_BETA_ECN CC algo sub-options. Submitted by: Tom Jones Tested by: Tom Jones , Grenville Armitage Relnotes: Yes Differential Revision: https://reviews.freebsd.org/D11616 Added: head/sys/netinet/cc/cc_newreno.h (contents, props changed) Modified: head/share/man/man4/cc_newreno.4 head/share/man/man4/mod_cc.4 head/sys/netinet/cc/cc.c head/sys/netinet/cc/cc.h head/sys/netinet/cc/cc_newreno.c Modified: head/share/man/man4/cc_newreno.4 ============================================================================== --- head/share/man/man4/cc_newreno.4 Mon Mar 19 16:17:10 2018 (r331213) +++ head/share/man/man4/cc_newreno.4 Mon Mar 19 16:37:47 2018 (r331214) @@ -30,17 +30,69 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2011 +.Dd March 19, 2018 .Dt CC_NEWRENO 4 .Os .Sh NAME .Nm cc_newreno .Nd NewReno Congestion Control Algorithm +.Sh SYNOPSIS +.In netinet/cc/cc_newreno.h .Sh DESCRIPTION The NewReno congestion control algorithm is the default for TCP. Details about the algorithm can be found in RFC5681. +.Sh Socket Options +The +.Nm +module supports a number of socket options under TCP_CCALGOOPT (refer to +.Xr tcp 4 +and +.Xr moc_cc 9 for details) +which can +be set with +.Xr setsockopt 2 +and tested with +.Xr getsockopt 2 . +The +.Nm +socket options use this structure defined in +: +.Bd -literal +struct cc_newreno_opts { + int name; + uint32_t val; +} +.Ed +.Bl -tag -width ".Va CC_NEWRENO_BETA_ECN" +.It Va CC_NEWRENO_BETA +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to a congestion signal per: cwnd = (cwnd * +CC_NEWRENO_BETA) / 100. +Default is 50. +.It Va CC_NEWRENO_BETA_ECN +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to an ECN congestion signal when +.Va net.inet.tcp.cc.abe=1 +per: cwnd = (cwnd * CC_NEWRENO_BETA_ECN) / 100. +Default is 80. .Sh MIB Variables -There are currently no tunable MIB variables. +The algorithm exposes these variables in the +.Va net.inet.tcp.cc.newreno +branch of the +.Xr sysctl 3 +MIB: +.Bl -tag -width ".Va beta_ecn" +.It Va beta +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to a congestion signal per: cwnd = (cwnd * +beta) / 100. +Default is 50. +.It Va beta_ecn +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to an ECN congestion signal when +.Va net.inet.tcp.cc.abe=1 +per: cwnd = (cwnd * beta_ecn) / 100. +Default is 80. .Sh SEE ALSO .Xr cc_chd 4 , .Xr cc_cubic 4 , @@ -50,6 +102,24 @@ There are currently no tunable MIB variables. .Xr mod_cc 4 , .Xr tcp 4 , .Xr mod_cc 9 +.Rs +.%A "Mark Allman" +.%A "Vern Paxson" +.%A "Ethan Blanton" +.%T "TCP Congestion Control" +.%O "RFC 5681" +.Re +.Rs +.%A "Naeem Khademi" +.%A "Michael Welzl" +.%A "Grenville Armitage" +.%A "Gorry Fairhurst" +.%T "TCP Alternative Backoff with ECN (ABE)" +.%R "internet draft" +.%D "February 2018" +.%N "draft-ietf-tcpm-alternativebackoff-ecn" +.%O "work in progress" +.Re .Sh ACKNOWLEDGEMENTS Development and testing of this software were made possible in part by grants from the FreeBSD Foundation and Cisco University Research Program Fund at @@ -77,6 +147,9 @@ congestion control module was written by .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org and .An David Hayes Aq Mt david.hayes@ieee.org . +.Pp +Support for TCP ABE was added by +.An Tom Jones Aq Mt tj@enoti.me . .Pp This manual page was written by .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . Modified: head/share/man/man4/mod_cc.4 ============================================================================== --- head/share/man/man4/mod_cc.4 Mon Mar 19 16:17:10 2018 (r331213) +++ head/share/man/man4/mod_cc.4 Mon Mar 19 16:37:47 2018 (r331214) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2016 +.Dd March 19, 2018 .Dt MOD_CC 4 .Os .Sh NAME @@ -73,7 +73,7 @@ The framework exposes the following variables in the branch of the .Xr sysctl 3 MIB: -.Bl -tag -width ".Va available" +.Bl -tag -width ".Va abe_frlossreduce" .It Va available Read-only list of currently available congestion control algorithms by name. .It Va algorithm @@ -83,6 +83,15 @@ When attempting to change the default algorithm, this one of the names listed by the .Va net.inet.tcp.cc.available MIB variable. +.It Va abe +Enable support for draft-ietf-tcpm-alternativebackoff-ecn, +which alters the window decrease factor applied to the congestion window in +response to an ECN congestion signal. +Refer to individual congestion control man pages to determine if they implement +support for ABE and for configuration details. +.It Va abe_frlossreduce +If non-zero, apply standard beta instead of ABE-beta during ECN-signalled +congestion recovery episodes if loss also needs to be repaired. .El .Sh SEE ALSO .Xr cc_cdg 4 , Modified: head/sys/netinet/cc/cc.c ============================================================================== --- head/sys/netinet/cc/cc.c Mon Mar 19 16:17:10 2018 (r331213) +++ head/sys/netinet/cc/cc.c Mon Mar 19 16:37:47 2018 (r331214) @@ -327,3 +327,14 @@ SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, algorithm, SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, available, CTLTYPE_STRING|CTLFLAG_RD, NULL, 0, cc_list_available, "A", "List available congestion control algorithms"); + +VNET_DEFINE(int, cc_do_abe) = 0; +SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(cc_do_abe), 0, + "Enable draft-ietf-tcpm-alternativebackoff-ecn (TCP Alternative Backoff with ECN)"); + +VNET_DEFINE(int, cc_abe_frlossreduce) = 0; +SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe_frlossreduce, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(cc_abe_frlossreduce), 0, + "Apply standard beta instead of ABE-beta during ECN-signalled congestion " + "recovery episodes if loss also needs to be repaired"); Modified: head/sys/netinet/cc/cc.h ============================================================================== --- head/sys/netinet/cc/cc.h Mon Mar 19 16:17:10 2018 (r331213) +++ head/sys/netinet/cc/cc.h Mon Mar 19 16:37:47 2018 (r331214) @@ -64,6 +64,12 @@ extern struct cc_algo newreno_cc_algo; VNET_DECLARE(struct cc_algo *, default_cc_ptr); #define V_default_cc_ptr VNET(default_cc_ptr) +VNET_DECLARE(int, cc_do_abe); +#define V_cc_do_abe VNET(cc_do_abe) + +VNET_DECLARE(int, cc_abe_frlossreduce); +#define V_cc_abe_frlossreduce VNET(cc_abe_frlossreduce) + /* Define the new net.inet.tcp.cc sysctl tree. */ SYSCTL_DECL(_net_inet_tcp_cc); Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Mon Mar 19 16:17:10 2018 (r331213) +++ head/sys/netinet/cc/cc_newreno.c Mon Mar 19 16:37:47 2018 (r331214) @@ -3,7 +3,7 @@ * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 * The Regents of the University of California. - * Copyright (c) 2007-2008,2010 + * Copyright (c) 2007-2008,2010,2014 * Swinburne University of Technology, Melbourne, Australia. * Copyright (c) 2009-2010 Lawrence Stewart * Copyright (c) 2010 The FreeBSD Foundation @@ -48,6 +48,11 @@ * University Research Program Fund at Community Foundation Silicon Valley. * More details are available at: * http://caia.swin.edu.au/urp/newtcp/ + * + * Dec 2014 garmitage@swin.edu.au + * Borrowed code fragments from cc_cdg.c to add modifiable beta + * via sysctls. + * */ #include @@ -69,20 +74,54 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +static MALLOC_DEFINE(M_NEWRENO, "newreno data", + "newreno beta values"); + +#define CAST_PTR_INT(X) (*((int*)(X))) + +static int newreno_cb_init(struct cc_var *ccv); static void newreno_ack_received(struct cc_var *ccv, uint16_t type); static void newreno_after_idle(struct cc_var *ccv); static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); static void newreno_post_recovery(struct cc_var *ccv); +static int newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf); +static VNET_DEFINE(uint32_t, newreno_beta) = 50; +static VNET_DEFINE(uint32_t, newreno_beta_ecn) = 80; +#define V_newreno_beta VNET(newreno_beta) +#define V_newreno_beta_ecn VNET(newreno_beta_ecn) + struct cc_algo newreno_cc_algo = { .name = "newreno", + .cb_init = newreno_cb_init, .ack_received = newreno_ack_received, .after_idle = newreno_after_idle, .cong_signal = newreno_cong_signal, .post_recovery = newreno_post_recovery, + .ctl_output = newreno_ctl_output, }; +struct newreno { + uint32_t beta; + uint32_t beta_ecn; +}; + +int +newreno_cb_init(struct cc_var *ccv) +{ + struct newreno *nreno; + + nreno = malloc(sizeof(struct newreno), M_NEWRENO, M_NOWAIT|M_ZERO); + if (nreno != NULL) { + nreno->beta = V_newreno_beta; + nreno->beta_ecn = V_newreno_beta_ecn; + } + + return (0); +} + static void newreno_ack_received(struct cc_var *ccv, uint16_t type) { @@ -184,27 +223,48 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - u_int win; + struct newreno *nreno; + uint32_t cwin, factor; + u_int mss; + factor = V_newreno_beta; + nreno = ccv->cc_data; + if (nreno != NULL) { + if (V_cc_do_abe) + factor = (type == CC_ECN ? nreno->beta_ecn: nreno->beta); + else + factor = nreno->beta; + } + + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); + /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * - CCV(ccv, t_maxseg); + cwin = max(((uint64_t)cwin * (uint64_t)factor) / (100ULL * (uint64_t)mss), + 2) * mss; switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { + if (IN_CONGRECOVERY(CCV(ccv, t_flags) && + V_cc_do_abe && V_cc_abe_frlossreduce)) { + CCV(ccv, snd_ssthresh) = + ((uint64_t)CCV(ccv, snd_ssthresh) * + (uint64_t)nreno->beta) / + (100ULL * (uint64_t)nreno->beta_ecn); + } if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) - CCV(ccv, snd_ssthresh) = win; + CCV(ccv, snd_ssthresh) = cwin; ENTER_RECOVERY(CCV(ccv, t_flags)); } break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = win; - CCV(ccv, snd_cwnd) = win; + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; @@ -242,5 +302,75 @@ newreno_post_recovery(struct cc_var *ccv) } } +int +newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) +{ + struct newreno *nreno; + struct cc_newreno_opts *opt; + + if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts)) + return (EMSGSIZE); + + nreno = ccv->cc_data; + opt = buf; + + switch (sopt->sopt_dir) { + case SOPT_SET: + switch (opt->name) { + case CC_NEWRENO_BETA: + nreno->beta = opt->val; + break; + case CC_NEWRENO_BETA_ECN: + if (!V_cc_do_abe) + return (EACCES); + nreno->beta_ecn = opt->val; + break; + default: + return (ENOPROTOOPT); + } + case SOPT_GET: + switch (opt->name) { + case CC_NEWRENO_BETA: + opt->val = nreno->beta; + break; + case CC_NEWRENO_BETA_ECN: + opt->val = nreno->beta_ecn; + break; + default: + return (ENOPROTOOPT); + } + default: + return (EINVAL); + } + + return (0); +} + +static int +newreno_beta_handler(SYSCTL_HANDLER_ARGS) +{ + if (req->newptr != NULL ) { + if (arg1 == &VNET_NAME(newreno_beta_ecn) && !V_cc_do_abe) + return (EACCES); + if (CAST_PTR_INT(req->newptr) <= 0 || CAST_PTR_INT(req->newptr) > 100) + return (EINVAL); + } + + return (sysctl_handle_int(oidp, arg1, arg2, req)); +} + +SYSCTL_DECL(_net_inet_tcp_cc_newreno); +SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, CTLFLAG_RW, NULL, + "New Reno related settings"); + +SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta, + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, + &VNET_NAME(newreno_beta), 3, &newreno_beta_handler, "IU", + "New Reno beta, specified as number between 1 and 100"); + +SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_ecn, + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, + &VNET_NAME(newreno_beta_ecn), 3, &newreno_beta_handler, "IU", + "New Reno beta ecn, specified as number between 1 and 100"); DECLARE_CC_MODULE(newreno, &newreno_cc_algo); Added: head/sys/netinet/cc/cc_newreno.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/cc/cc_newreno.h Mon Mar 19 16:37:47 2018 (r331214) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Tom Jones + * 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$ + */ + +#ifndef _CC_NEWRENO_H +#define _CC_NEWRENO_H + +#define CCALGONAME_NEWRENO "newreno" + +struct cc_newreno_opts { + int name; + uint32_t val; +}; + +#define CC_NEWRENO_BETA 1 +#define CC_NEWRENO_BETA_ECN 2 + +#endif /* _CC_NEWRENO_H */ From owner-svn-src-all@freebsd.org Mon Mar 19 17:14:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE596F5CC32; Mon, 19 Mar 2018 17:14:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 621F47A322; Mon, 19 Mar 2018 17:14:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D1E211623; Mon, 19 Mar 2018 17:14:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JHEuuH013450; Mon, 19 Mar 2018 17:14:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JHEuXY013449; Mon, 19 Mar 2018 17:14:56 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803191714.w2JHEuXY013449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Mar 2018 17:14:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331215 - head/sys/x86/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/x86/include X-SVN-Commit-Revision: 331215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:14:56 -0000 Author: jhb Date: Mon Mar 19 17:14:56 2018 New Revision: 331215 URL: https://svnweb.freebsd.org/changeset/base/331215 Log: Fix a typo. Reviewed by: kib Modified: head/sys/x86/include/ucontext.h Modified: head/sys/x86/include/ucontext.h ============================================================================== --- head/sys/x86/include/ucontext.h Mon Mar 19 16:37:47 2018 (r331214) +++ head/sys/x86/include/ucontext.h Mon Mar 19 17:14:56 2018 (r331215) @@ -96,7 +96,7 @@ typedef struct __mcontext { #ifdef __amd64__ /* - * mc_trapno bits. Shall be in sync with TF_XXX. + * mc_flags bits. Shall be in sync with TF_XXX. */ #define _MC_HASSEGS 0x1 #define _MC_HASBASES 0x2 From owner-svn-src-all@freebsd.org Mon Mar 19 17:25:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39C8DF5D8D3; Mon, 19 Mar 2018 17:25:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC4B77AA5C; Mon, 19 Mar 2018 17:25:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 751AF10A87D; Mon, 19 Mar 2018 13:25:57 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: Mariusz Zaborski , Mark Linimon , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r325739 - in head: lib/libcasper/services lib/libcasper/services/cap_syslog share/mk Date: Mon, 19 Mar 2018 09:47:04 -0700 Message-ID: <5637307.jbg60LYNR5@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <20180318170738.GB35894@raichu> References: <201711120834.vAC8YQUq006611@repo.freebsd.org> <20180318142039.GA81224@x-wing> <20180318170738.GB35894@raichu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Mar 2018 13:25:57 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:25:58 -0000 On Sunday, March 18, 2018 01:07:38 PM Mark Johnston wrote: > On Sun, Mar 18, 2018 at 03:20:39PM +0100, Mariusz Zaborski wrote: > > On Mon, Mar 05, 2018 at 11:19:16AM -0600, Mark Linimon wrote: > > > On Mon, Mar 05, 2018 at 11:13:58AM -0500, Mark Johnston wrote: > > > > The growing divergence with stable/11 makes it rather painful to > > > > maintain a port, depending on libcasper, that aims to work on both 11 > > > > and head. > > > > > > Even an MFC won't help you, in the medium-term. > > > > > > e.g. via https://www.freebsd.org/security/#sup, even if the MFC made it > > > into 11.2, you would still have several months of supporting the old > > > one. (The FreeBSD package builds are based on the oldest supported > > > point release from a branch.) The current estimate for 11.2 is late June. > > > > > > mcl > > > > Hi, > > > > Sorry for delay I just get back. > > > > Yes I can integrate all my changes in libcasper and I guess libcapsicum. > > I'm did do a lot of integrations to stable so I have one question - > > if I understand correctly all changes which change API/ABI but are > > pointed as SHLIB_MAJOR I can safety integrate. > > > > Mark what else can I do? > > Sorry, I don't quite follow. I don't think SHLIB_MAJOR bumps can be > MFCed: what happens if an SA is later released for the library in > question? We have MFC'd them in the past I believe and rolled the shlib into the misc/compatXX package (so that one might need misc/compat11 to run older 11.x binaries even on an 11.x host). We haven't done that nearly as often since adding symbol versioning though. I don't know if we ever had to deal with merging an SA to an old library version though. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Mar 19 17:25:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F6C8F5D8DB; Mon, 19 Mar 2018 17:25:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 434B97AA60; Mon, 19 Mar 2018 17:25:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id DE50E10A8BA; Mon, 19 Mar 2018 13:25:58 -0400 (EDT) From: John Baldwin To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331209 - head Date: Mon, 19 Mar 2018 09:20:40 -0700 Message-ID: <4168709.idJmbTaMPK@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201803191527.w2JFRr7B058668@repo.freebsd.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Mar 2018 13:25:59 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:25:59 -0000 On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > Author: kevans > Date: Mon Mar 19 15:27:53 2018 > New Revision: 331209 > URL: https://svnweb.freebsd.org/changeset/base/331209 > > Log: > Add note to UPDATING about UEFI changes requiring loader(8) update > > These problems have only been observed with boards using U-Boot (e.g. ARM) > where virtual addresses are already set in the memory map by the firmware > and the firmware is expecting a call to SetVirtualAddressMap to be made. > I refrain from mentioning this in the note because this could also be the > case on some not-yet-tested firmware on amd64 and it's not a bad > recommendation for the general case. How does this fit with the recommended installation steps of doing 'make installkernel' and rebooting before doing a 'make installworld'? -- John Baldwin From owner-svn-src-all@freebsd.org Mon Mar 19 17:37:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71A5EF5E660; Mon, 19 Mar 2018 17:37:52 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E0627B61F; Mon, 19 Mar 2018 17:37:52 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14C5111975; Mon, 19 Mar 2018 17:37:52 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JHbpIZ023625; Mon, 19 Mar 2018 17:37:51 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JHbpwZ023624; Mon, 19 Mar 2018 17:37:51 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803191737.w2JHbpwZ023624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Mon, 19 Mar 2018 17:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331216 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 331216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:37:52 -0000 Author: dab Date: Mon Mar 19 17:37:51 2018 New Revision: 331216 URL: https://svnweb.freebsd.org/changeset/base/331216 Log: MFC r331015: Modify rc.d/fsck to handle new status from fsck/fsck_ffs r328013 introduced a new error code from fsck_ffs that indicates that it could not completely fix the file system; this happens when it prints the message PLEASE RERUN FSCK. However, this status can happen when fsck is run in "preen" mode and the rc.d/fsck script does not handle that error code. Modify rc.d/fsck so that if "fsck -p" ("preen") returns the new status code (16) it will run "fsck -y", as it currently does for a status code of 8 (the "standard error exit"). Reported by: markj Sponsored by: Dell EMC Modified: stable/11/etc/rc.d/fsck Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/fsck ============================================================================== --- stable/11/etc/rc.d/fsck Mon Mar 19 17:14:56 2018 (r331215) +++ stable/11/etc/rc.d/fsck Mon Mar 19 17:37:51 2018 (r331216) @@ -57,7 +57,7 @@ fsck_start() echo "Reboot failed; help!" stop_boot ;; - 8) + 8|16) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y ${fsck_y_flags}" fsck -y ${fsck_y_flags} From owner-svn-src-all@freebsd.org Mon Mar 19 17:38:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AB63F5E739; Mon, 19 Mar 2018 17:38:36 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E75677B78B; Mon, 19 Mar 2018 17:38:35 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E203011976; Mon, 19 Mar 2018 17:38:35 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JHcZN8023700; Mon, 19 Mar 2018 17:38:35 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JHcZMp023699; Mon, 19 Mar 2018 17:38:35 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803191738.w2JHcZMp023699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Mon, 19 Mar 2018 17:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331217 - stable/10/etc/rc.d X-SVN-Group: stable-10 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/10/etc/rc.d X-SVN-Commit-Revision: 331217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:38:36 -0000 Author: dab Date: Mon Mar 19 17:38:35 2018 New Revision: 331217 URL: https://svnweb.freebsd.org/changeset/base/331217 Log: MFC r331015: Modify rc.d/fsck to handle new status from fsck/fsck_ffs r328013 introduced a new error code from fsck_ffs that indicates that it could not completely fix the file system; this happens when it prints the message PLEASE RERUN FSCK. However, this status can happen when fsck is run in "preen" mode and the rc.d/fsck script does not handle that error code. Modify rc.d/fsck so that if "fsck -p" ("preen") returns the new status code (16) it will run "fsck -y", as it currently does for a status code of 8 (the "standard error exit"). Reported by: markj Sponsored by: Dell EMC Modified: stable/10/etc/rc.d/fsck Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/fsck ============================================================================== --- stable/10/etc/rc.d/fsck Mon Mar 19 17:37:51 2018 (r331216) +++ stable/10/etc/rc.d/fsck Mon Mar 19 17:38:35 2018 (r331217) @@ -42,7 +42,7 @@ fsck_start() echo "Reboot failed; help!" stop_boot ;; - 8) + 8|16) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y ${fsck_y_flags}" fsck -y ${fsck_y_flags} From owner-svn-src-all@freebsd.org Mon Mar 19 17:51:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13A7EF5F3A3; Mon, 19 Mar 2018 17:51:20 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80FCB7BF50; Mon, 19 Mar 2018 17:51:19 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f67.google.com with SMTP id g203-v6so12303996lfg.11; Mon, 19 Mar 2018 10:51:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wTwirE59AfknrnSYY3vZlqN81qxXXx5vCkyXIvI7Z4w=; b=b1RZ3L4ZuO0W2GUL5ccfUevqWv109KGXKYXhKo2WHLeBJq2F/rySW32SRZeMoTXX46 ZQwYTHNhTIGGi+d+VT8s9Qe/jmaYkVjNbdHqnsVDlXLUcaUtmmmlhJyOOvEoA1y2vvE3 9a3HVLng1HVdbrgL8gktBB1plnbrE8w1YjoSU5SMtB19k65WfpXBOaoxxCPDrXuZnjND HeL+R/8DQXhnWBlNckDsUKlpNhg8DANO+IhHDi6t2Bm9f99gM+YMMlArOgpojO2TjUSV 5Tx8cog0U/6+GJYRQoPmViH7QXjo9wJdpkCN0EOMZRZ+MeRF8OXujzW60Ywg6dM7mxkV oXwg== X-Gm-Message-State: AElRT7Fawxhv5yGUHBvlKzmrCcxYZzH/7BoD8hRz+p2lIdOhoO6x5x01 CKx0tm5AGJzDxZtZiIAjjomNxZkp X-Google-Smtp-Source: AG47ELv5hZeOLvB5eaI8ij0nins30fbPp0G+xPJinbJGw4C1GXt7nLuP1+/fs9OhLIkhHwlM+0hFfw== X-Received: by 10.46.44.5 with SMTP id s5mr2280818ljs.111.1521481865657; Mon, 19 Mar 2018 10:51:05 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id k12-v6sm122655lfe.93.2018.03.19.10.51.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 10:51:04 -0700 (PDT) Subject: Re: svn commit: r331209 - head To: John Baldwin , Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> From: Andriy Gapon Message-ID: <2d94ac2c-491b-391b-d5ff-5545b6d83a82@FreeBSD.org> Date: Mon, 19 Mar 2018 19:51:03 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <4168709.idJmbTaMPK@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:51:20 -0000 On 19/03/2018 18:20, John Baldwin wrote: > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: >> Author: kevans >> Date: Mon Mar 19 15:27:53 2018 >> New Revision: 331209 >> URL: https://svnweb.freebsd.org/changeset/base/331209 >> >> Log: >> Add note to UPDATING about UEFI changes requiring loader(8) update >> >> These problems have only been observed with boards using U-Boot (e.g. ARM) >> where virtual addresses are already set in the memory map by the firmware >> and the firmware is expecting a call to SetVirtualAddressMap to be made. >> I refrain from mentioning this in the note because this could also be the >> case on some not-yet-tested firmware on amd64 and it's not a bad >> recommendation for the general case. > > How does this fit with the recommended installation steps of doing > 'make installkernel' and rebooting before doing a 'make installworld'? Installation of /boot/loader along with likes of cat and cut has always puzzled me very much. -- Andriy Gapon From owner-svn-src-all@freebsd.org Mon Mar 19 17:59:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58BCEF5FC94 for ; Mon, 19 Mar 2018 17:59:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E190A7C531 for ; Mon, 19 Mar 2018 17:59:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x229.google.com with SMTP id d13-v6so11584985itf.0 for ; Mon, 19 Mar 2018 10:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=vTKuyXrQsNjZKnnxlR3nZ0L27yI1yLzghFZpobI/HVA=; b=KPJIg3z422y4uuv9NoXqO0Fkwo9HkB0b8R73ojcYhU299yMui8XxPY3BcnR/gO+Psl zMl4Sai41lCBOk+dw5yhLoCr4cToZy3FtB9QLbobGgGX4JJguci/741EPWMefIQB+UBk +BuZKDgYuDvvQQlKobQ2YWMMa+XFQ3ud2Ea/WksEPHWBVphtRuLQ8txqnTsOol8tR5ma lXQOZuAK2K19k6u4I0no3/KgaRo3T//MaAfJ+yVWvaJwSPQTgbWBc+G2GM0uSecoBcS0 THL991EBP8KPEXoxzYNgWw+MV3u3JULVQjvsKTZtbCs8nHIX1pZzWlqityfH5M8YU+1Z zsMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=vTKuyXrQsNjZKnnxlR3nZ0L27yI1yLzghFZpobI/HVA=; b=CaooDNxYAxTeK8yLjW+0iOHxQDKd45CTRCTA+pfTco9DvTBmGlszLEalx7OiJSCFeT xL3QHqHJ0maCnv7EySuz9Ne+XE9EkxLDjdHoempzRtoNdlcqe+p8hVQdr2yLucnw9bjP KdMD+gZVRRJOOpaVI7w4lIK4ASu/EkrlCq+M1Zj99fKc6YHl9ly+GFfzOxyg5r6AEIvy SpLKz5XfBhQfdJq/6pNQ0KRYAFoEXC9lcedO4wQRMAooaAIxgQH0fEzqC0BUjx3ozRal nnWJhkCCG9hsu76zvGnUzOvM9B55RjUu4e/kr90TIoo3ZyC2AzMtKjdzYPgIK4PdftW8 z4Yg== X-Gm-Message-State: AElRT7EhggeBghRT5gESJ9ph253eeCb7Bpfsw4CKwgIEGkMYpSMqAWXr e9dItWpIKNZXsZ48q4HGOB37SnaQBwJqiGY4b561/g== X-Google-Smtp-Source: AG47ELsLZBQef5ze+00087SE6iL3dqnlYSSfAUEkVXzYE0XZY5Cu5v11JuAOb4J3Px2+K7AtBWpRKEspdp2DDmPBksI= X-Received: by 2002:a24:441:: with SMTP id 62-v6mr12817109itb.57.1521482393815; Mon, 19 Mar 2018 10:59:53 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Mon, 19 Mar 2018 10:59:52 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <2d94ac2c-491b-391b-d5ff-5545b6d83a82@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <2d94ac2c-491b-391b-d5ff-5545b6d83a82@FreeBSD.org> From: Warner Losh Date: Mon, 19 Mar 2018 11:59:52 -0600 X-Google-Sender-Auth: R72HoLI5DnAgs07tTd96dApSyG8 Message-ID: Subject: Re: svn commit: r331209 - head To: Andriy Gapon Cc: John Baldwin , Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:59:55 -0000 On Mon, Mar 19, 2018 at 11:51 AM, Andriy Gapon wrote: > On 19/03/2018 18:20, John Baldwin wrote: > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > >> Author: kevans > >> Date: Mon Mar 19 15:27:53 2018 > >> New Revision: 331209 > >> URL: https://svnweb.freebsd.org/changeset/base/331209 > >> > >> Log: > >> Add note to UPDATING about UEFI changes requiring loader(8) update > >> > >> These problems have only been observed with boards using U-Boot (e.g. > ARM) > >> where virtual addresses are already set in the memory map by the > firmware > >> and the firmware is expecting a call to SetVirtualAddressMap to be > made. > >> I refrain from mentioning this in the note because this could also be > the > >> case on some not-yet-tested firmware on amd64 and it's not a bad > >> recommendation for the general case. > > > > How does this fit with the recommended installation steps of doing > > 'make installkernel' and rebooting before doing a 'make installworld'? > > Installation of /boot/loader along with likes of cat and cut has always > puzzled > me very much. > Historical reason. We've always installed /boot/loader with installworld. We also install the other boot loaders, but don't deploy them (so there's a new /boot/boot, but it isn't installed into /). To get around this issue, though, is trivial: make installkenrel cd stand make install reboot make installworld in this weird case. Warner From owner-svn-src-all@freebsd.org Mon Mar 19 18:09:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EA72F60952; Mon, 19 Mar 2018 18:09:59 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE1527CE95; Mon, 19 Mar 2018 18:09:58 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2JI9tjo013234; Mon, 19 Mar 2018 11:09:55 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2JI9tOP013233; Mon, 19 Mar 2018 11:09:55 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803191809.w2JI9tOP013233@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331209 - head In-Reply-To: To: Warner Losh Date: Mon, 19 Mar 2018 11:09:55 -0700 (PDT) CC: Andriy Gapon , John Baldwin , Kyle Evans , src-committers , 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-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:09:59 -0000 > On Mon, Mar 19, 2018 at 11:51 AM, Andriy Gapon wrote: > > > On 19/03/2018 18:20, John Baldwin wrote: > > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > >> Author: kevans > > >> Date: Mon Mar 19 15:27:53 2018 > > >> New Revision: 331209 > > >> URL: https://svnweb.freebsd.org/changeset/base/331209 > > >> > > >> Log: > > >> Add note to UPDATING about UEFI changes requiring loader(8) update > > >> > > >> These problems have only been observed with boards using U-Boot (e.g. > > ARM) > > >> where virtual addresses are already set in the memory map by the > > firmware > > >> and the firmware is expecting a call to SetVirtualAddressMap to be > > made. > > >> I refrain from mentioning this in the note because this could also be > > the > > >> case on some not-yet-tested firmware on amd64 and it's not a bad > > >> recommendation for the general case. > > > > > > How does this fit with the recommended installation steps of doing > > > 'make installkernel' and rebooting before doing a 'make installworld'? > > > > Installation of /boot/loader along with likes of cat and cut has always > > puzzled > > me very much. > > > > Historical reason. We've always installed /boot/loader with installworld. > We also install the other boot loaders, but don't deploy them (so there's a > new /boot/boot, but it isn't installed into /). More complete historical information. The "boot" code use to live in hidden places in the MBR, and the {disk,bsd}label, so installing it into the file system had 0 effect, as the actuall in use running code was hidden and had to be replaced using either fdisk or {disk,bsd}label. When "loader" was added this should of probably changed with preseverations of old code and ways to get back to it incase things went a foul, and ways to update it in a more controlled manner than installworld. And more approprate timing of installing it (should it now go with installkernel?). > To get around this issue, though, is trivial: > > make installkenrel > cd stand > make install > reboot > make installworld > > in this weird case. > > Warner -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Mon Mar 19 18:26:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF40EF61CA7 for ; Mon, 19 Mar 2018 18:26:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37A577DB67 for ; Mon, 19 Mar 2018 18:26:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22a.google.com with SMTP id e98-v6so11493543itd.4 for ; Mon, 19 Mar 2018 11:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ieunJ1wyLSGt1NLXMOsIy6Jvh84YG3K8V7Uc7z2bRYI=; b=CKJ2RGporXUC2tWkbdDo/zRAIq5gXMtBJIbbccqO8ib2la7iPKNxipFGV3lFfU1wK/ J2mQ4uQiMrBTuCvVrni00jTl7OhKGxSuBFyGXLBO446Jm/Pc0iX52cRytvYgFUSwUDtQ UnjYtol1MakM3SP/w2q1xkNUlE1DSZCrFAgIfYQDM2adN3SAk3r+v55hcJHGv6MeaDqe 8qfuqMWQy4RmSZGM4v6nWfj4J8FRqPDwYRB9H0cuE00wzlX01OaxEvb8GSeKa+9QKiRf Z8AUZs/P4BceAsDVELuBZkHZIALP+JLdW8sX+tYFRz2IWaMdvrs1iHZ42aWkuOQZxnck 2O8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ieunJ1wyLSGt1NLXMOsIy6Jvh84YG3K8V7Uc7z2bRYI=; b=ssmy2yK0uMqjCJKEComJcBF8KX1d6L8u9vVSfok7E3z4dRFVdmuwdzFk2i2bUlnVbe plG/TiPXHFSW5eYYyB038LrlPl8HWiXH75R5pPWCJwvhbqFJ/o4pS9FI/RjfC4assWPg rYqzV95lucK60zv1jQzGqn2P/frEM+xKv9xRuDIq+mlXrjEKhTaOUT8TaP/v82vv4JXm q9KtXek3Zn+VxgojYK5iwsIQ9RkISs9sl97wdbOPi33D4NN2bNdQvki2W2eglCybOjd2 5BqlO6fJ1si4t6QUWB4mU3qqg6OZqQyptNL+sUU5N03Lz9NqZMzkFtqq/5V389BRmLaM +6CQ== X-Gm-Message-State: AElRT7EZqEb6k6of3K71+LkdpfU8UMiXAtW131GKFfad9vdWa60zGUkF tZx3IwYEf2KyDJv803twjApwXx67LBmnEKfwkn6CGQ== X-Google-Smtp-Source: AG47ELu2qg80ItqzI+WE5k9Qvqru/En6tZstqq3zn2JJ0687DNEHvnQaQ/sofh9ZigzbkhsZpKwIhA5AjTr6gVnTQhI= X-Received: by 2002:a24:441:: with SMTP id 62-v6mr12916018itb.57.1521483959377; Mon, 19 Mar 2018 11:25:59 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Mon, 19 Mar 2018 11:25:58 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201803191809.w2JI9tOP013233@pdx.rh.CN85.dnsmgr.net> References: <201803191809.w2JI9tOP013233@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Mon, 19 Mar 2018 12:25:58 -0600 X-Google-Sender-Auth: FKNtna_5BI6Dh0ZAiaqsIkgamw8 Message-ID: Subject: Re: svn commit: r331209 - head To: "Rodney W. Grimes" Cc: Andriy Gapon , John Baldwin , Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:26:00 -0000 On Mon, Mar 19, 2018 at 12:09 PM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > On Mon, Mar 19, 2018 at 11:51 AM, Andriy Gapon wrote: > > > > > On 19/03/2018 18:20, John Baldwin wrote: > > > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > > >> Author: kevans > > > >> Date: Mon Mar 19 15:27:53 2018 > > > >> New Revision: 331209 > > > >> URL: https://svnweb.freebsd.org/changeset/base/331209 > > > >> > > > >> Log: > > > >> Add note to UPDATING about UEFI changes requiring loader(8) update > > > >> > > > >> These problems have only been observed with boards using U-Boot > (e.g. > > > ARM) > > > >> where virtual addresses are already set in the memory map by the > > > firmware > > > >> and the firmware is expecting a call to SetVirtualAddressMap to be > > > made. > > > >> I refrain from mentioning this in the note because this could > also be > > > the > > > >> case on some not-yet-tested firmware on amd64 and it's not a bad > > > >> recommendation for the general case. > > > > > > > > How does this fit with the recommended installation steps of doing > > > > 'make installkernel' and rebooting before doing a 'make > installworld'? > > > > > > Installation of /boot/loader along with likes of cat and cut has always > > > puzzled > > > me very much. > > > > > > > Historical reason. We've always installed /boot/loader with installworld. > > We also install the other boot loaders, but don't deploy them (so > there's a > > new /boot/boot, but it isn't installed into /). > > More complete historical information. The "boot" code use to live in > hidden places in the MBR, and the {disk,bsd}label, so installing it > into the file system had 0 effect, as the actuall in use running > code was hidden and had to be replaced using either fdisk or > {disk,bsd}label. > Right. That's still the case, but these bits are considered 'static' and uninteresting to update. > When "loader" was added this should of probably changed with > preseverations of old code and ways to get back to it incase > things went a foul, and ways to update it in a more controlled > manner than installworld. And more approprate timing of > installing it (should it now go with installkernel?). No. Where it is fine. The arm64 thing is actually fixed in the kernel so we don't need to cope with it. Warner > > To get around this issue, though, is trivial: > > > > make installkenrel > > cd stand > > make install > > reboot > > make installworld > > > > in this weird case. > > > > Warner > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-all@freebsd.org Mon Mar 19 18:34:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFC96F62564; Mon, 19 Mar 2018 18:34:09 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EC157E1B8; Mon, 19 Mar 2018 18:34:09 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F02512308; Mon, 19 Mar 2018 18:34:09 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JIY9x7053706; Mon, 19 Mar 2018 18:34:09 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JIY8WH053697; Mon, 19 Mar 2018 18:34:08 GMT (envelope-from br@FreeBSD.org) Message-Id: <201803191834.w2JIY8WH053697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 19 Mar 2018 18:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r331218 - in vendor/processor-trace: . 24982c1a6fce48f1e416461d42899805f74fbb26 24982c1a6fce48f1e416461d42899805f74fbb26/doc 24982c1a6fce48f1e416461d42899805f74fbb26/doc/man 24982c1a6fc... X-SVN-Group: vendor X-SVN-Commit-Author: br X-SVN-Commit-Paths: in vendor/processor-trace: . 24982c1a6fce48f1e416461d42899805f74fbb26 24982c1a6fce48f1e416461d42899805f74fbb26/doc 24982c1a6fce48f1e416461d42899805f74fbb26/doc/man 24982c1a6fce48f1e416461d42899805f74f... X-SVN-Commit-Revision: 331218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:34:10 -0000 Author: br Date: Mon Mar 19 18:34:08 2018 New Revision: 331218 URL: https://svnweb.freebsd.org/changeset/base/331218 Log: Import Intel Processor Trace library. Git ID 24982c1a6fce48f1e416461d42899805f74fbb26 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12815 Added: vendor/processor-trace/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/.gitignore vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/CONTRIBUTING (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/LICENSE vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/README vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/getting_started.md (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_build.md (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_capture.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_libipt.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_pttc.md (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_alloc_encoder.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_blk_alloc_decoder.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_blk_get_offset.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_blk_next.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_blk_sync_forward.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_config.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_enc_get_config.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_enc_get_offset.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_image_add_file.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_image_alloc.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_image_remove_by_filename.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_image_set_callback.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_insn_alloc_decoder.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_insn_get_image.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_insn_get_offset.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_insn_next.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_insn_sync_forward.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_iscache_add_file.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_iscache_alloc.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_iscache_read.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_iscache_set_limit.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_library_version.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_packet.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_pkt_alloc_decoder.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_pkt_get_offset.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_pkt_sync_forward.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_qry_alloc_decoder.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_qry_cond_branch.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_qry_event.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_qry_get_offset.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_qry_sync_forward.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/man/pt_qry_time.3.md vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/posix/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/posix/threads.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/pt_compiler.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/windows/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/windows/inttypes.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/windows/threads.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/intel-pt.h.in (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/posix/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/posix/pt_section_posix.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_asid.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_block_cache.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_block_decoder.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_config.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_cpu.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_cpuid.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_decoder_function.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_encoder.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_event_queue.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_ild.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_image.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_image_section_cache.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_insn.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_insn_decoder.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_last_ip.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_mapped_section.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_msec_cache.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_opcodes.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_packet.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_packet_decoder.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_query_decoder.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_retstack.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_section.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_section_file.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_sync.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_time.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pt_tnt_cache.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pti-disp-defs.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pti-disp.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pti-imm-defs.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pti-imm.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pti-modrm-defs.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/pti-modrm.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/windows/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/internal/include/windows/pt_section_windows.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/posix/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/posix/init.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/posix/pt_cpuid.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/posix/pt_section_posix.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_asid.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_block_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_block_decoder.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_config.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_cpu.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_decoder_function.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_encoder.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_error.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_event_queue.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_ild.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_image.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_image_section_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_insn.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_insn_decoder.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_last_ip.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_msec_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_packet.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_packet_decoder.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_query_decoder.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_retstack.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_section.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_section_file.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_sync.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_time.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_tnt_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/pt_version.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/windows/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/windows/init.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/windows/pt_cpuid.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/src/windows/pt_section_windows.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-asid.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-block_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-config.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-cpp.cpp (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-cpu.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-event_queue.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-fetch.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-ild.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-image.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-image_section_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-last_ip.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-mapped_section.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-msec_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-packet.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-query.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-retstack.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-section-file.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-section.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-sync.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-time.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/test/src/ptunit-tnt_cache.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/include/pevent.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/src/pevent.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/test/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/test/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pevent/test/src/ptunit-pevent.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptdump/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptdump/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptdump/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptdump/src/ptdump.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/include/errcode.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/include/file.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/include/parse.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/include/pttc.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/include/util.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/include/yasm.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/errcode.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/file.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/main.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/parse.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/posix/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/posix/util.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/pttc.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/util.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/windows/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/windows/util.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/src/yasm.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/test/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/test/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/test/src/test_all_directives.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/test/src/test_exp_labels.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/pttc/test/src/test_label_addr.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/include/ptunit.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/include/ptunit_mkfile.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/include/ptunit_threads.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/src/posix/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/src/posix/ptunit_mkfile.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/src/ptunit.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/src/windows/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/src/windows/ptunit_mkfile.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/test/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/test/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptunit/test/src/ptunit-selftest.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptxed/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptxed/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptxed/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptxed/include/load_elf.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptxed/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptxed/src/load_elf.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/ptxed/src/ptxed.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/script/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/script/perf-copy-mapped-files.bash (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/script/perf-get-opts.bash (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/script/perf-read-aux.bash (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/script/perf-read-sideband.bash (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/script/test.bash (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/include/libipt-sb.h.in (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/internal/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/internal/include/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/internal/include/pt_sb_context.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/internal/include/pt_sb_decoder.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/internal/include/pt_sb_file.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/internal/include/pt_sb_pevent.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/internal/include/pt_sb_session.h (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/src/pt_sb_context.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/src/pt_sb_file.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/src/pt_sb_pevent.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/sideband/src/pt_sb_session.c (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/CMakeLists.txt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-comm_exec-mmap-tsc-iret.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-dump.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-dump_verbose.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-fork.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-mmap-tip_cached.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-mmap_secondary-tsc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-split.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-tip_pgd-comm_exec-mmap-tsc-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-tip_pgd-mmap-tsc-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-tip_pgd-switch-tsc-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-tip_pgd-switch_cpu_wide-tsc-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/pevent/src/pevent-warn.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/apl11.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/apl12-psb.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/apl12-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/bad_cpu.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/bdm64-tip-xabort.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/bdm64-tnt-cond-xabort.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/bdm64-tnt-ind_call-xabort.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/bdm70-psb_fup-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/bdm70-tip_pgd-psb_fup-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/call_direct-ret_compressed-pic.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/call_direct-ret_compressed.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/call_direct-ret_uncompressed.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/call_indirect-ret_compressed.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/call_indirect-ret_uncompressed.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/call_indirect_deferred-ret_compressed.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/cbr-cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/cbr-mtc-cyc-mtc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/cbr-tsc-cyc-tma.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/cbr-tsc-tma-mtc-cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/direct_call-tip_pgd_noip-syscall.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/direct_jump-tip_pgd_noip-far_call.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/dump-all-packets.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/exstop_ip-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-pip-vmcs-tip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-pip-vmcs-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip-eos.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip_pgd-stop.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip_pgd-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip_pgd-tip_pge_other_ip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/fup-tip_pgd_noip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/int-iret-cpl_0.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/int-iret-cpl_3.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/int-iret.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/linear-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/linear-tip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/loop-tnt-64.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/loop-tnt-tnt.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/loop-tnt.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/mode_exec-tip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/mtc-cyc_calibrate.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/mtc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/mwait-pwre-exstop_ip-fup-ovf.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/mwait-pwre-exstop_ip-ovf.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/mwait-pwre-exstop_ip-pwrx.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf-fup.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf-mnt-fup.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf-mnt-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf-pwre-pwrx-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf-timing-fup.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf-timing-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ovf.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/pip-far_call.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/pip-pip_mov_cr3-fail.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/pip-vmcs-tip_pgd.ptt (contents, props changed) vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/pip_mov_cr3-pip_mov_cr3.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-empty.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-exstop.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-fup-psbend.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-fup-tip_pgd-stop.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-mnt-fup-psbend.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-mnt-psbend.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-ovf-fup.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-ovf-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-pip-psb.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-pip-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-psb.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-stop.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-tnt-psb.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-tsx.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-tsx_abort-tip-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-tsx_abort-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-tsx_abort.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb-vmcs.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/psb_nofup-psb.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptdump-exec-mode.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptdump-last-ip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptdump-no-offset-raw.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptdump-no-offset.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptw-fup.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptw.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-block-stat.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-block-stat_blocks.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-end_on_call-fup-tip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-end_on_call-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-end_on_call-ret_tip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-end_on_call-ret_tnt.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-end_on_call-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-end_on_jump-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-insn-stat.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-stat_insn.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ptxed-tick.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/pwre-exstop_ip-pwrx.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/ret_near_far.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skd007.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skd010-mode_tsx-fup.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skd010-psb.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skd010-tip.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skd010-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skd022.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skl014-call.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skl014-jmp-jmp.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skl014-jmp.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/skl014-no_filter.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/syscall-sysret-cpl_0.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/syscall-sysret-cpl_3.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/syscall-sysret.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/sysenter-sysexit-cpl_0.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/sysenter-sysexit-cpl_3.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/sysenter-sysexit.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip-eos.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-direct_call.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-direct_jump.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-exstop-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-indirect_call.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-indirect_jump.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-pip-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-psb-stop.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-stop.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-tnt_not_taken.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-tnt_taken.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd-tsx.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd_noip-far_jump.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pgd_noip-mov_cr3.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-exstop.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-fup-tip_pgd-tip_pge.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-ptw-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-ptw-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-pwre-pwrx-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-tsx_abort-tip-fup-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tip_pge-tsx_abort-tip_pgd.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tnt-tip_pgd_noip-sysret.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tnt_n-eos.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tnt_t-eos.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/truncated.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-cbr-cyc-tsc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-cyc_calibrate.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-mtc-tma-mtc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-cyc-mtc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-mtc-cyc-mtc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-mtc-cyc-no_cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-mtc-cyc-tsc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-mtc-cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-mtc-cyc_calibrate.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cbr-mtc-mtc-cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc-cyc_calibrate.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc-mtc-cyc_calibrate.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc-tsc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc_absolute.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc_infreq.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc_infreq_wrap.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc_relative.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma-mtc_wrap.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc-tma_zero_fc-cbr-cyc.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsc_tma_mtc_gap.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsx-abort.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsx-commit.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/tsx-no_spurious_commit.ptt vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/test/src/vmcs-far_call.ptt Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/.gitignore ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/.gitignore Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,7 @@ +*.lst +*.bin +*.pt +*.sb +*.exp +*.out +*.diff Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/CMakeLists.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/CMakeLists.txt Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,304 @@ +# Copyright (c) 2013-2018, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * 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. +# * Neither the name of Intel Corporation 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 OWNER 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. + +cmake_minimum_required(VERSION 2.8.6) + +project(PT C) + +# versioning +# +# the major and the minor number define the supported Intel PT set. +# +# a build number and a version extension can be optionally specified. +# +set(PT_VERSION_MAJOR 1) +set(PT_VERSION_MINOR 6) +set(PT_VERSION_BUILD "0" CACHE STRING "") +set(PT_VERSION_EXT "" CACHE STRING "") + +set(PT_VERSION "${PT_VERSION_MAJOR}.${PT_VERSION_MINOR}.${PT_VERSION_BUILD}") + +add_definitions( + -DPT_VERSION_MAJOR=${PT_VERSION_MAJOR} + -DPT_VERSION_MINOR=${PT_VERSION_MINOR} + -DPT_VERSION_BUILD=${PT_VERSION_BUILD} + -DPT_VERSION_EXT=\"${PT_VERSION_EXT}\" +) + +include(GNUInstallDirs) +include(FindUnixCommands) +include(CheckCCompilerFlag) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(MAN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/man) + +set(CMAKE_COLOR_MAKEFILE OFF) +set(CMAKE_VERBOSE_MAKEFILE ON) + +set(CMAKE_MACOSX_RPATH ON) + +option(FEATURE_THREADS "A small amount of multi-threading support." ON) +if (FEATURE_THREADS) + add_definitions(-DFEATURE_THREADS) +endif (FEATURE_THREADS) + +option(DEVBUILD "Enable compiler warnings and turn them into errors." OFF) + +option(PTDUMP "Enable ptdump, a packet dumper") +option(PTXED "Enable ptxed, an instruction flow dumper") +option(PTTC "Enable pttc, a test compiler") +option(PTUNIT "Enable ptunit, a unit test system and libipt unit tests") +option(MAN "Enable man pages (requires pandoc)." OFF) +option(SIDEBAND "Enable libipt-sb, a sideband correlation library") + +if (SIDEBAND) + option(PEVENT "Enable perf_event sideband support." OFF) +endif (SIDEBAND) + +if (PTXED OR PEVENT) + option(FEATURE_ELF "Support ELF files." OFF) +endif (PTXED OR PEVENT) + +set(PTT OFF) +if (BASH AND PTDUMP AND PTXED AND PTTC) + set(PTT ON) +endif () + +if (PTUNIT OR PTT) + ENABLE_TESTING() +endif() + +if (PTUNIT) + enable_language(CXX) +endif() + +include_directories( + include + ${CMAKE_CURRENT_BINARY_DIR}/libipt/include +) + +if (PTUNIT) + include_directories( + ptunit/include + ) +endif (PTUNIT) + +if (FEATURE_ELF) + add_definitions( + -DFEATURE_ELF + ) +endif (FEATURE_ELF) + +if (SIDEBAND) + add_definitions( + -DFEATURE_SIDEBAND + ) + + include_directories( + ${CMAKE_CURRENT_BINARY_DIR}/sideband/include + ) +endif (SIDEBAND) + +if (PEVENT) + add_definitions( + -DFEATURE_PEVENT + ) + + include_directories( + pevent/include + ) +endif (PEVENT) + + +function(add_cflag_if_available option) + + check_c_compiler_flag(${option} ${option}_supported) + if (${option}_supported) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${option}" PARENT_SCOPE) + endif (${option}_supported) + +endfunction(add_cflag_if_available) + + +if (CMAKE_HOST_WIN32) + include_directories( + include/windows + ) + + add_definitions( + # cl spells inline __inline in C + # + /Dinline=__inline + + # cl spells strtoll _strtoi64 + # + /Dstrtoll=_strtoi64 + + # cl spells strtoull _strtoui64 + # + /Dstrtoull=_strtoui64 + + # avoid annoying warnings about unsecure standard functions + # + /D_CRT_SECURE_NO_WARNINGS + ) + + # enable parallel build + # + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") + + if (DEVBUILD) + # compiler warnings + # + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + + # warnings are errors + # + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") + endif (DEVBUILD) + + if (CMAKE_C_COMPILER_ID MATCHES "MSVC") + # prevent complaints on: + # - do {} while(0) constructs + # - int arr[] constructs + # + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4200") + + endif (CMAKE_C_COMPILER_ID MATCHES "MSVC") + +endif (CMAKE_HOST_WIN32) + +if (CMAKE_HOST_UNIX) + include_directories( + include/posix + ) + + add_definitions( + -D_POSIX_C_SOURCE=200809L + ) + + option(GCOV "Compile for GNU code coverage analysis." OFF) + + if (GCOV) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage") + + link_libraries(gcov) + endif (GCOV) + + if (FEATURE_THREADS) + link_libraries(pthread) + endif (FEATURE_THREADS) + + # set the language + # + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") + + # windows-like dll export model + # + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + + if (DEVBUILD) + # compiler warnings + # + if (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Weverything") + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-disabled-macro-expansion") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-covered-switch-default") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-sign-conversion") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-switch-enum") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-align") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-padded") + else (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic") + + add_cflag_if_available("-Wimplicit-fallthrough=5") + endif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + + # warnings are errors + # + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + endif (DEVBUILD) + +endif (CMAKE_HOST_UNIX) + + +function(add_ptunit_test_base name) + if (PTUNIT) + add_executable(${name} ${ARGN}) + target_link_libraries(${name} ptunit) + + add_test(NAME ${name} COMMAND ${name}) + endif (PTUNIT) +endfunction(add_ptunit_test_base) + +function(add_ptunit_c_test name) + add_ptunit_test_base(ptunit-${name} test/src/ptunit-${name}.c ${ARGN}) +endfunction(add_ptunit_c_test) + +function(add_ptunit_cpp_test name) + add_ptunit_test_base(ptunit-${name} test/src/ptunit-${name}.cpp ${ARGN}) +endfunction(add_ptunit_cpp_test) + +function(add_ptunit_libraries name) + if (PTUNIT) + target_link_libraries(ptunit-${name} ${ARGN}) + endif (PTUNIT) +endfunction(add_ptunit_libraries) + + +add_subdirectory(libipt) + +if (PTDUMP) + add_subdirectory(ptdump) +endif (PTDUMP) +if (PTXED) + add_subdirectory(ptxed) +endif (PTXED) +if (PTTC) + add_subdirectory(pttc) +endif (PTTC) +if (PTUNIT) + add_subdirectory(ptunit) +endif (PTUNIT) +if (PTT) + add_subdirectory(test) +endif (PTT) +if (MAN) + add_subdirectory(doc/man) +endif (MAN) +if (SIDEBAND) + add_subdirectory(sideband) +endif (SIDEBAND) +if (PEVENT) + add_subdirectory(pevent) +endif (PEVENT) Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/CONTRIBUTING ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/CONTRIBUTING Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,107 @@ +Contributing to this Project +============================ + +## License + +This project is licensed under the terms and conditions of the 3-Clause BSD +[LICENSE](LICENSE). By contributing to this project, you agree that you are +providing your contribution under the terms and conditions of that license. + + +## Patches + +We accept patches to this project as pull requests on GitHub. When submitting +patches, please keep each patch self-contained and as small as possible. Please +address one topic per patch series. Intermediate patches must build without +errors (with DEVBUILD=ON) and not introduce test fails. Please describe what +each patch is doing in its commit message. + +If you are contributing a patch series that addresses a GitHub Issue, the last +patch in the series should have 'fixes #' in its commit-message. + +If the patch series addresses a bug that is not tracked, please provide a +detailed description of the issue in the commit-message, ideally with a +description of the 'before' and 'after' behavior. + +The patch series should contain regression tests either as PTT tests or as +ptunit tests. Please make sure that all tests are passing. This may require +re-ordering patches to introduce the regression test after the issue was fixed. + +If the patch series adds a new feature, please make sure to add documentation. +Prior to submitting this type of contribution, it may be a good idea to first +discuss the feature as a GitHub issue or via email before implementing it. + +This project is using the Linux coding style. + + +## Sign Your Patch + +Please use the sign-off line at the end of each patch. Your signature +certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. The rules are pretty simple: if you can +certify the below (from +[developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. + + +## Reporting Issues + +If you want to report an issue or bug, please report them via the GitHub Issues +tracker. + +When reporting a bug, please provide the steps to reproduce it with the ptdump +and ptxed tools contained in the tree. Please include the command-line that was +used and the exact error message. You may also attach a trace file and the +binaries necessary for reproducing the issue or write a small PTT test to +demonstrate the issue. + +When providing trace snippets, please provide a few extra packets of context. + +Please also provide the processor family and model on which the trace was +recorded and the version of the decoder that was used to decode the trace. Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/LICENSE Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,24 @@ +Copyright (c) 2013-2018, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * 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. + * Neither the name of Intel Corporation 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 OWNER 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. Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/README Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,79 @@ +Intel(R) Processor Trace Decoder Library +======================================== + +The Intel Processor Trace (Intel PT) Decoder Library is Intel's reference +implementation for decoding Intel PT. It can be used as a standalone library or +it can be partially or fully integrated into your tool. + +The library comes with a set of sample tools built on top of it and a test +system built on top of the sample tools. The samples demonstrate how to use the +library and may serve as a starting point for integrating the library into your +tool. + +Go to https://software.intel.com/en-us/intel-platform-analysis-library for +support of upcoming (non-public) processors (NDA required). + + +Contents +-------- + + README this file + + libipt A packet encoder/decoder library + + +Optional Contents and Samples +----------------------------- + + ptdump Example implementation of a packet dumper + + ptxed Example implementation of a trace disassembler + + pttc A trace test generator + + ptunit A simple unit test system + + sideband A sideband correlation library + + pevent A library for reading/writing Linux perf event records + + script A collection of scripts + + test A collection of tests + + include A collection of substitute headers + + doc A document describing the build + A document describing how to get started + A document describing the usage of the decoder library + A document describing how to capture trace + A document describing pttc + + doc/man Man pages for the encoder/decoder library + + +Dependencies +------------ + +We use cmake for building. + + cmake The cross-platform open-source build system. + http://www.cmake.org + + +Other packages you need for some of the above optional components. + + xed The Intel x86 instruction encoder and decoder. + https://github.com/intelxed/xed + + This is needed to build and run ptxed. + + yasm The Yasm Modular Assembler + http://github.com/yasm + + This is needed to run pttc. + + pandoc A universal document converter + http://pandoc.org + + This is needed for man pages. Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/getting_started.md ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/getting_started.md Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,93 @@ +Getting Started {#start} +======================== + + + +This chapter gives a brief introduction into the sample tools using one of the +tests as example. It assumes that you are already familiar with Intel(R) +Processor Trace (Intel PT) and that you already built the decoder library and +the sample tools. For detailed information about Intel PT, please refer to +chapter 11 of the Intel Architecture Instruction Set Extensions Programming +Reference at http://www.intel.com/products/processor/manuals/. + +Start by compiling the loop-tnt test. It consists of a small assembly program +with interleaved Intel PT directives: + + $ pttc test/src/loop-tnt.ptt + loop-tnt-ptxed.exp + loop-tnt-ptdump.exp + +This produces the following output files: + + loop-tnt.lst a yasm assembly listing file + loop-tnt.bin a raw binary file + loop-tnt.pt a Intel PT file + loop-tnt-ptxed.exp the expected ptxed output + loop-tnt-ptdump.exp the expected ptdump output + +The latter two files are generated based on the `@pt .exp()` directives +found in the `.ptt` file. They are used for automated testing. See +script/test.bash for details on that. + + +Use `ptdump` to dump the Intel PT packets: + + $ ptdump loop-tnt.pt + 0000000000000000 psb + 0000000000000010 fup 3: 0x0000000000100000, ip=0x0000000000100000 + 0000000000000017 mode.exec cs.d=0, cs.l=1 (64-bit mode) + 0000000000000019 psbend + 000000000000001b tnt8 !!. + 000000000000001c tip.pgd 3: 0x0000000000100013, ip=0x0000000000100013 + +The ptdump tool takes an Intel PT file as input and dumps the packets in +human-readable form. The number on the very left is the offset into the Intel +PT packet stream in hex. This is followed by the packet opcode and payload. + + +Use `ptxed` for reconstructing the execution flow. For this, you need the Intel +PT file as well as the corresponding binary image. You need to specify the load +address given by the org directive in the .ptt file when using a raw binary +file. + + $ ptxed --pt loop-tnt.pt --raw loop-tnt.bin:0x100000 + 0x0000000000100000 mov rax, 0x0 + 0x0000000000100007 jmp 0x10000d + 0x000000000010000d cmp rax, 0x1 + 0x0000000000100011 jle 0x100009 + 0x0000000000100009 add rax, 0x1 + 0x000000000010000d cmp rax, 0x1 + 0x0000000000100011 jle 0x100009 + 0x0000000000100009 add rax, 0x1 + 0x000000000010000d cmp rax, 0x1 + 0x0000000000100011 jle 0x100009 + [disabled] + +Ptxed prints disassembled instructions in execution order as well as status +messages enclosed in brackets. Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_build.md ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_build.md Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,197 @@ +Building the Intel(R) Processor Trace (Intel PT) Decoder Library and Samples {#build} +============================================================================ + + + +This chapter gives step-by-step instructions for building the library and the +sample tools using cmake. For detailed information on cmake, see +http://www.cmake.org. + + +## Configuration + +Besides the standard cmake options of build type and install directory, you will +find project-specific options for enabling optional features, optional +components, or optional build variants. + + +### Optional Components + +By default, only the decoder library is built. Other components can be enabled +by setting the respective cmake variable to ON. + +The following optional components are availble: + + PTUNIT A simple unit test framework. + A collection of unit tests for libipt. + + PTDUMP A packet dumper example. + + PTXED A trace disassembler example. + + PTTC A trace test generator. + + SIDEBAND A sideband correlation library + + PEVENT Support for the Linux perf_event sideband format. + + This feature requires the linux/perf_event.h header. + + +### Optional Features + +Features are enabled by setting the respective FEATURE_ cmake variable. +This causes the FEATURE_ pre-processor macro to be defined and may also +cause additional source files to be compiled and additional libraries to be +linked. + +Features are enabled globally and will be used by all components that support +the feature. The following features are supported: + + FEATURE_ELF Support for the ELF object format. + + This feature requires the elf.h header. + + + FEATURE_THREADS Support some amount of multi-threading. + + This feature makes image functions thread-safe. + + +### Build Variants + +Some build variants depend on libraries or header files that may not be +available on all supported platforms. + + GCOV Support for code coverage using libgcov. + + This build variant requires libgcov and is not availble + on Windows. + + + DEVBUILD Enable compiler warnings and turn them into errors. + + +### Version Settings + +The major and minor version numbers are set in the sources and must be changed +there. You can set the build number and an arbitrary extension string. +build. + + PT_VERSION_BUILD The build number. + + Defaults to zero. + + + PT_VERSION_EXT An arbitrary version extension string. + + Defaults to the empty string. + + +### Dependencies + +In order to build ptxed, the location of the XED library and the XED header +files must be specified. + + XED_INCLUDE Path to the directory containing the XED header files. + + XED_LIBDIR Path to the directory containing the XED library. + + +When using XED from a PIN distribution, the respective directories are located +in `extras/xed2-/`. + + +## Building on Linux``*`` and OS X``*`` + +We recommend out-of-tree builds. Start by creating the destination directory +and navigating into it: + + $ mkdir -p /path/to/dest + $ cd /path/to/dest + + +From here, call cmake with the top-level source directory as argument. You may +already pass some or all of the cmake variables as arguments to cmake. Without +arguments, cmake uses default values. + + $ cmake /path/to/src + + +If you have not passed values for XED_INCLUDE or XED_LIBDIR, you need to +configure them now if you want to build ptxed. You may also use this command to +change the configuration at any time later on. + + $ make edit_cache + + +After configuring the cmake cache, you can build either specific targets or +everything using one of: + + $ make + $ make + + +Use the help make target to learn about available make targets: + + $ make help + + + +## Building on Windows``*`` + +We recommend using the cmake GUI. After starting the cmake GUI, fill in the +following fields: + + Where is the source code: Path to the top-level source directory. + + Where to build the binaries: Path to the destination directory. + + +We recommend out-of-tree builds, so the build directory should not be the same +as or below the source directory. After this first configuration step, press +the + + Configure + +button and select the builder you want to use. + +Cmake will now populate the remainder of the window with configuration options. +Please make sure to specify at least XED_INCLUDE and XED_LIBDIR if you want to +build ptxed. After completing the configuration, press the + + Generate + +button. If you selected a Visual Studio generator in the first step, cmake will +now generate a Visual Studio solution. You can repeat this step if you want to +change the configuration later on. Beware that you always need to press the +Generate button after changing the configuration. + +In the case of a Visual Studio generator, you may now open the generated Visual +Studio solution and build the library and samples. Added: vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_capture.md ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/doc/howto_capture.md Mon Mar 19 18:34:08 2018 (r331218) @@ -0,0 +1,628 @@ +Capturing Intel(R) Processor Trace (Intel PT) {#capture} +============================================= + + + +This chapter describes how to capture Intel PT for processing with libipt. For +illustration, we use the sample tools ptdump and ptxed. We assume that they are +configured with: + + * PEVENT=ON + * FEATURE_ELF=ON + + +## Capturing Intel PT on Linux + +Starting with version 4.1, the Linux kernel supports Intel PT via the perf_event +kernel interface. Starting with version 4.3, the perf user-space tool will +support Intel PT as well. + + +### Capturing Intel PT via Linux perf_event + +We start with setting up a perf_event_attr object for capturing Intel PT. The +structure is declared in `/usr/include/linux/perf_event.h`. + +The Intel PT PMU type is dynamic. Its value can be read from +`/sys/bus/event_source/devices/intel_pt/type`. + +~~~{.c} + struct perf_event_attr attr; + + memset(&attr, 0, sizeof(attr)); + attr.size = sizeof(attr); + attr.type = (); + + attr.exclude_kernel = 1; + ... +~~~ + + +Once all desired fields have been set, we can open a perf_event counter for +Intel PT. See `perf_event_open(2)` for details. In our example, we configure +it for tracing a single thread. + +The system call returns a file descriptor on success, `-1` otherwise. + +~~~{.c} + int fd; + + fd = syscall(SYS_perf_event_open, &attr, , -1, -1, 0); +~~~ + + +The Intel PT trace is captured in the AUX area, which has been introduced with +kernel 4.1. The DATA area contains sideband information such as image changes +that are necessary for decoding the trace. + +In theory, both areas can be configured as circular buffers or as linear buffers +by mapping them read-only or read-write, respectively. When configured as +circular buffer, new data will overwrite older data. When configured as linear +buffer, the user is expected to continuously read out the data and update the +buffer's tail pointer. New data that do not fit into the buffer will be +dropped. + +When using the AUX area, its size and offset have to be filled into the +`perf_event_mmap_page`, which is mapped together with the DATA area. This +requires the DATA area to be mapped read-write and hence configured as linear +buffer. In our example, we configure the AUX area as circular buffer. + +Note that the size of both the AUX and the DATA area has to be a power of two +pages. The DATA area needs one additional page to contain the +`perf_event_mmap_page`. + +~~~{.c} + struct perf_event_mmap_page *header; + void *base, *data, *aux; + + base = mmap(NULL, (1+2**n) * PAGE_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); + if (base == MAP_FAILED) + return (); + + header = base; + data = base + header->data_offset; + + header->aux_offset = header->data_offset + header->data_size; + header->aux_size = (2**m) * PAGE_SIZE; + + aux = mmap(NULL, header->aux_size, PROT_READ, MAP_SHARED, fd, + header->aux_offset); + if (aux == MAP_FAILED) + return (); +~~~ + + +### Capturing Intel PT via the perf user-space tool + +Starting with kernel 4.3, the perf user-space tool can be used to capture Intel +PT with the `intel_pt` event. See tools/perf/Documentation in the Linux kernel +tree for further information. In this text, we describe how to use the captured +trace with the ptdump and ptxed sample tools. + +We start with capturing some Intel PT trace using the `intel_pt` event. Note +that when collecting system-wide (`-a`) trace, we need context switch events +(`--switch-events`) to decode the trace. See `perf-record(1)` for details. + +~~~{.sh} + $ perf record -e intel_pt//[uk] [--per-thread] [-a --switch-events] -T -- ls + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.384 MB perf.data ] +~~~ + + +This generates a file called `perf.data` that contains the Intel PT trace, the +sideband information, and some metadata. To process the trace with ptxed, we +extract the Intel PT trace into one file per thread or cpu. + +Looking at the raw trace dump of `perf script -D`, we notice +`PERF_RECORD_AUXTRACE` records. The raw Intel PT trace is contained directly +after such records. We can extract it with the `dd` command. The arguments to +`dd` can be computed from the record's fields. This can be done automatically, +for example with an AWK script. + +~~~{.awk} + /PERF_RECORD_AUXTRACE / { + offset = strtonum($1) + hsize = strtonum(substr($2, 2)) + size = strtonum($5) + idx = strtonum($11) + + ofile = sprintf("perf.data-aux-idx%d.bin", idx) + begin = offset + hsize + + cmd = sprintf("dd if=perf.data of=%s conv=notrunc oflag=append ibs=1 \ + skip=%d count=%d status=none", ofile, begin, size) + + system(cmd) + } +~~~ + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Mar 19 18:36:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD85FF62826; Mon, 19 Mar 2018 18:36: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D7C67E3AC; Mon, 19 Mar 2018 18:36: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 6386C1230A; Mon, 19 Mar 2018 18:36:46 +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 w2JIakgl053874; Mon, 19 Mar 2018 18:36:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JIah8o053850; Mon, 19 Mar 2018 18:36:43 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201803191836.w2JIah8o053850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 19 Mar 2018 18:36:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331219 - in stable/11: contrib/llvm/include/llvm contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/Target contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/to... X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11: contrib/llvm/include/llvm contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/Target contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/tools/clang/include/clang/D... X-SVN-Commit-Revision: 331219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:36:47 -0000 Author: dim Date: Mon Mar 19 18:36:43 2018 New Revision: 331219 URL: https://svnweb.freebsd.org/changeset/base/331219 Log: Merge retpoline support from the upstream llvm, clang and lld 5.0 branches. Upstream merge revisions: r324007: merging r323155 for llvm r324009: merging r323915 for llvm r324012: merging r323155 for clang r324025: merging r323155 for lld, with modifications to handle int3 fill r324026: merging r323288 for lld r325088: merging r324449 for llvm r325089: merging r324645 for llvm r325090: merging r325049 for llvm r325091: merging r325085 for llvm Original commit messages: r323155 (by Chandler Carruth): Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre. Summary: First, we need to explain the core of the vulnerability. Note that this is a very incomplete description, please see the Project Zero blog post for details: https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html The basis for branch target injection is to direct speculative execution of the processor to some "gadget" of executable code by poisoning the prediction of indirect branches with the address of that gadget. The gadget in turn contains an operation that provides a side channel for reading data. Most commonly, this will look like a load of secret data followed by a branch on the loaded value and then a load of some predictable cache line. The attacker then uses timing of the processors cache to determine which direction the branch took *in the speculative execution*, and in turn what one bit of the loaded value was. Due to the nature of these timing side channels and the branch predictor on Intel processors, this allows an attacker to leak data only accessible to a privileged domain (like the kernel) back into an unprivileged domain. The goal is simple: avoid generating code which contains an indirect branch that could have its prediction poisoned by an attacker. In many cases, the compiler can simply use directed conditional branches and a small search tree. LLVM already has support for lowering switches in this way and the first step of this patch is to disable jump-table lowering of switches and introduce a pass to rewrite explicit indirectbr sequences into a switch over integers. However, there is no fully general alternative to indirect calls. We introduce a new construct we call a "retpoline" to implement indirect calls in a non-speculatable way. It can be thought of loosely as a trampoline for indirect calls which uses the RET instruction on x86. Further, we arrange for a specific call->ret sequence which ensures the processor predicts the return to go to a controlled, known location. The retpoline then "smashes" the return address pushed onto the stack by the call with the desired target of the original indirect call. The result is a predicted return to the next instruction after a call (which can be used to trap speculative execution within an infinite loop) and an actual indirect branch to an arbitrary address. On 64-bit x86 ABIs, this is especially easily done in the compiler by using a guaranteed scratch register to pass the target into this device. For 32-bit ABIs there isn't a guaranteed scratch register and so several different retpoline variants are introduced to use a scratch register if one is available in the calling convention and to otherwise use direct stack push/pop sequences to pass the target address. This "retpoline" mitigation is fully described in the following blog post: https://support.google.com/faqs/answer/7625886 We also support a target feature that disables emission of the retpoline thunk by the compiler to allow for custom thunks if users want them. These are particularly useful in environments like kernels that routinely do hot-patching on boot and want to hot-patch their thunk to different code sequences. They can write this custom thunk and use `-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this case, on x86-64 thu thunk names must be: ``` __llvm_external_retpoline_r11 ``` or on 32-bit: ``` __llvm_external_retpoline_eax __llvm_external_retpoline_ecx __llvm_external_retpoline_edx __llvm_external_retpoline_push ``` And the target of the retpoline is passed in the named register, or in the case of the `push` suffix on the top of the stack via a `pushl` instruction. There is one other important source of indirect branches in x86 ELF binaries: the PLT. These patches also include support for LLD to generate PLT entries that perform a retpoline-style indirection. The only other indirect branches remaining that we are aware of are from precompiled runtimes (such as crt0.o and similar). The ones we have found are not really attackable, and so we have not focused on them here, but eventually these runtimes should also be replicated for retpoline-ed configurations for completeness. For kernels or other freestanding or fully static executables, the compiler switch `-mretpoline` is sufficient to fully mitigate this particular attack. For dynamic executables, you must compile *all* libraries with `-mretpoline` and additionally link the dynamic executable and all shared libraries with LLD and pass `-z retpolineplt` (or use similar functionality from some other linker). We strongly recommend also using `-z now` as non-lazy binding allows the retpoline-mitigated PLT to be substantially smaller. When manually apply similar transformations to `-mretpoline` to the Linux kernel we observed very small performance hits to applications running typical workloads, and relatively minor hits (approximately 2%) even for extremely syscall-heavy applications. This is largely due to the small number of indirect branches that occur in performance sensitive paths of the kernel. When using these patches on statically linked applications, especially C++ applications, you should expect to see a much more dramatic performance hit. For microbenchmarks that are switch, indirect-, or virtual-call heavy we have seen overheads ranging from 10% to 50%. However, real-world workloads exhibit substantially lower performance impact. Notably, techniques such as PGO and ThinLTO dramatically reduce the impact of hot indirect calls (by speculatively promoting them to direct calls) and allow optimized search trees to be used to lower switches. If you need to deploy these techniques in C++ applications, we *strongly* recommend that you ensure all hot call targets are statically linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well tuned servers using all of these techniques saw 5% - 10% overhead from the use of retpoline. We will add detailed documentation covering these components in subsequent patches, but wanted to make the core functionality available as soon as possible. Happy for more code review, but we'd really like to get these patches landed and backported ASAP for obvious reasons. We're planning to backport this to both 6.0 and 5.0 release streams and get a 5.0 release with just this cherry picked ASAP for distros and vendors. This patch is the work of a number of people over the past month: Eric, Reid, Rui, and myself. I'm mailing it out as a single commit due to the time sensitive nature of landing this and the need to backport it. Huge thanks to everyone who helped out here, and everyone at Intel who helped out in discussions about how to craft this. Also, credit goes to Paul Turner (at Google, but not an LLVM contributor) for much of the underlying retpoline design. Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D41723 r323915 (by Chandler Carruth): [x86] Make the retpoline thunk insertion a machine function pass. Summary: This removes the need for a machine module pass using some deeply questionable hacks. This should address PR36123 which is a case where in full LTO the memory usage of a machine module pass actually ended up being significant. We should revert this on trunk as soon as we understand and fix the memory usage issue, but we should include this in any backports of retpolines themselves. Reviewers: echristo, MatzeB Subscribers: sanjoy, mcrosier, mehdi_amini, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D42726 r323288 (by Rui Ueyama): Fix retpoline PLT header size for i386. Differential Revision: https://reviews.llvm.org/D42397 r324449 (by Chandler Carruth): [x86/retpoline] Make the external thunk names exactly match the names that happened to end up in GCC. This is really unfortunate, as the names don't have much rhyme or reason to them. Originally in the discussions it seemed fine to rely on aliases to map different names to whatever external thunk code developers wished to use but there are practical problems with that in the kernel it turns out. And since we're discovering this practical problems late and since GCC has already shipped a release with one set of names, we are forced, yet again, to blindly match what is there. Somewhat rushing this patch out for the Linux kernel folks to test and so we can get it patched into our releases. Differential Revision: https://reviews.llvm.org/D42998 r324645 (by David Woodhouse): [X86] Support 'V' register operand modifier This allows the register name to be printed without the leading '%'. This can be used for emitting calls to the retpoline thunks from inline asm. r325049 (by Reid Kleckner): [X86] Use EDI for retpoline when no scratch regs are left Summary: Instead of solving the hard problem of how to pass the callee to the indirect jump thunk without a register, just use a CSR. At a call boundary, there's nothing stopping us from using a CSR to hold the callee as long as we save and restore it in the prologue. Also, add tests for this mregparm=3 case. I wrote execution tests for __llvm_retpoline_push, but they never got committed as lit tests, either because I never rewrote them or because they got lost in merge conflicts. Reviewers: chandlerc, dwmw2 Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D43214 r325085 (by Reid Kleckner): [X86] Remove dead code from retpoline thunk generation Differential Revision: https://reviews.freebsd.org/D14720 Added: stable/11/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp stable/11/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp Modified: stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h stable/11/contrib/llvm/include/llvm/InitializePasses.h stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp stable/11/contrib/llvm/lib/Target/X86/X86.h stable/11/contrib/llvm/lib/Target/X86/X86.td stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp stable/11/contrib/llvm/lib/Target/X86/X86Subtarget.cpp stable/11/contrib/llvm/lib/Target/X86/X86Subtarget.h stable/11/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp stable/11/contrib/llvm/tools/clang/include/clang/Driver/Options.td stable/11/contrib/llvm/tools/clang/lib/Basic/Targets.cpp stable/11/contrib/llvm/tools/lld/ELF/Arch/X86.cpp stable/11/contrib/llvm/tools/lld/ELF/Arch/X86_64.cpp stable/11/contrib/llvm/tools/lld/ELF/Config.h stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp stable/11/contrib/llvm/tools/opt/opt.cpp stable/11/lib/clang/freebsd_cc_version.h stable/11/lib/clang/libllvm/Makefile stable/11/sys/sys/param.h Modified: stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h Mon Mar 19 18:36:43 2018 (r331219) @@ -420,6 +420,9 @@ namespace llvm { /// shuffles. FunctionPass *createExpandReductionsPass(); + // This pass expands indirectbr instructions. + FunctionPass *createIndirectBrExpandPass(); + } // End llvm namespace #endif Modified: stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h Mon Mar 19 18:36:43 2018 (r331219) @@ -406,6 +406,13 @@ class TargetPassConfig : public ImmutablePass { (prote /// immediately before machine code is emitted. virtual void addPreEmitPass() { } + /// Targets may add passes immediately before machine code is emitted in this + /// callback. This is called even later than `addPreEmitPass`. + // FIXME: Rename `addPreEmitPass` to something more sensible given its actual + // position and remove the `2` suffix here as this callback is what + // `addPreEmitPass` *should* be but in reality isn't. + virtual void addPreEmitPass2() {} + /// Utilities for targets to add passes to the pass manager. /// Modified: stable/11/contrib/llvm/include/llvm/InitializePasses.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/InitializePasses.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/InitializePasses.h Mon Mar 19 18:36:43 2018 (r331219) @@ -157,6 +157,7 @@ void initializeIVUsersWrapperPassPass(PassRegistry&); void initializeIfConverterPass(PassRegistry&); void initializeImplicitNullChecksPass(PassRegistry&); void initializeIndVarSimplifyLegacyPassPass(PassRegistry&); +void initializeIndirectBrExpandPassPass(PassRegistry&); void initializeInductiveRangeCheckEliminationPass(PassRegistry&); void initializeInferAddressSpacesPass(PassRegistry&); void initializeInferFunctionAttrsLegacyPassPass(PassRegistry&); Modified: stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h Mon Mar 19 18:36:43 2018 (r331219) @@ -799,7 +799,7 @@ class TargetLoweringBase { (public) } /// Return true if lowering to a jump table is allowed. - bool areJTsAllowed(const Function *Fn) const { + virtual bool areJTsAllowed(const Function *Fn) const { if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true") return false; Modified: stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h Mon Mar 19 18:36:43 2018 (r331219) @@ -172,6 +172,9 @@ class TargetSubtargetInfo : public MCSubtargetInfo { ( /// \brief True if the subtarget should run the atomic expansion pass. virtual bool enableAtomicExpand() const; + /// True if the subtarget should run the indirectbr expansion pass. + virtual bool enableIndirectBrExpand() const; + /// \brief Override generic scheduling policy within a region. /// /// This is a convenient way for targets that don't provide any custom Modified: stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -39,6 +39,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeGCModuleInfoPass(Registry); initializeIfConverterPass(Registry); initializeImplicitNullChecksPass(Registry); + initializeIndirectBrExpandPassPass(Registry); initializeInterleavedAccessPass(Registry); initializeLiveDebugValuesPass(Registry); initializeLiveDebugVariablesPass(Registry); Added: stable/11/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -0,0 +1,221 @@ +//===- IndirectBrExpandPass.cpp - Expand indirectbr to switch -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// Implements an expansion pass to turn `indirectbr` instructions in the IR +/// into `switch` instructions. This works by enumerating the basic blocks in +/// a dense range of integers, replacing each `blockaddr` constant with the +/// corresponding integer constant, and then building a switch that maps from +/// the integers to the actual blocks. All of the indirectbr instructions in the +/// function are redirected to this common switch. +/// +/// While this is generically useful if a target is unable to codegen +/// `indirectbr` natively, it is primarily useful when there is some desire to +/// get the builtin non-jump-table lowering of a switch even when the input +/// source contained an explicit indirect branch construct. +/// +/// Note that it doesn't make any sense to enable this pass unless a target also +/// disables jump-table lowering of switches. Doing that is likely to pessimize +/// the code. +/// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Sequence.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/TargetPassConfig.h" +#include "llvm/Target/TargetSubtargetInfo.h" +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/InstIterator.h" +#include "llvm/IR/Instruction.h" +#include "llvm/IR/Instructions.h" +#include "llvm/Pass.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetMachine.h" + +using namespace llvm; + +#define DEBUG_TYPE "indirectbr-expand" + +namespace { + +class IndirectBrExpandPass : public FunctionPass { + const TargetLowering *TLI = nullptr; + +public: + static char ID; // Pass identification, replacement for typeid + + IndirectBrExpandPass() : FunctionPass(ID) { + initializeIndirectBrExpandPassPass(*PassRegistry::getPassRegistry()); + } + + bool runOnFunction(Function &F) override; +}; + +} // end anonymous namespace + +char IndirectBrExpandPass::ID = 0; + +INITIALIZE_PASS(IndirectBrExpandPass, DEBUG_TYPE, + "Expand indirectbr instructions", false, false) + +FunctionPass *llvm::createIndirectBrExpandPass() { + return new IndirectBrExpandPass(); +} + +bool IndirectBrExpandPass::runOnFunction(Function &F) { + auto &DL = F.getParent()->getDataLayout(); + auto *TPC = getAnalysisIfAvailable(); + if (!TPC) + return false; + + auto &TM = TPC->getTM(); + auto &STI = *TM.getSubtargetImpl(F); + if (!STI.enableIndirectBrExpand()) + return false; + TLI = STI.getTargetLowering(); + + SmallVector IndirectBrs; + + // Set of all potential successors for indirectbr instructions. + SmallPtrSet IndirectBrSuccs; + + // Build a list of indirectbrs that we want to rewrite. + for (BasicBlock &BB : F) + if (auto *IBr = dyn_cast(BB.getTerminator())) { + // Handle the degenerate case of no successors by replacing the indirectbr + // with unreachable as there is no successor available. + if (IBr->getNumSuccessors() == 0) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + continue; + } + + IndirectBrs.push_back(IBr); + for (BasicBlock *SuccBB : IBr->successors()) + IndirectBrSuccs.insert(SuccBB); + } + + if (IndirectBrs.empty()) + return false; + + // If we need to replace any indirectbrs we need to establish integer + // constants that will correspond to each of the basic blocks in the function + // whose address escapes. We do that here and rewrite all the blockaddress + // constants to just be those integer constants cast to a pointer type. + SmallVector BBs; + + for (BasicBlock &BB : F) { + // Skip blocks that aren't successors to an indirectbr we're going to + // rewrite. + if (!IndirectBrSuccs.count(&BB)) + continue; + + auto IsBlockAddressUse = [&](const Use &U) { + return isa(U.getUser()); + }; + auto BlockAddressUseIt = llvm::find_if(BB.uses(), IsBlockAddressUse); + if (BlockAddressUseIt == BB.use_end()) + continue; + + assert(std::find_if(std::next(BlockAddressUseIt), BB.use_end(), + IsBlockAddressUse) == BB.use_end() && + "There should only ever be a single blockaddress use because it is " + "a constant and should be uniqued."); + + auto *BA = cast(BlockAddressUseIt->getUser()); + + // Skip if the constant was formed but ended up not being used (due to DCE + // or whatever). + if (!BA->isConstantUsed()) + continue; + + // Compute the index we want to use for this basic block. We can't use zero + // because null can be compared with block addresses. + int BBIndex = BBs.size() + 1; + BBs.push_back(&BB); + + auto *ITy = cast(DL.getIntPtrType(BA->getType())); + ConstantInt *BBIndexC = ConstantInt::get(ITy, BBIndex); + + // Now rewrite the blockaddress to an integer constant based on the index. + // FIXME: We could potentially preserve the uses as arguments to inline asm. + // This would allow some uses such as diagnostic information in crashes to + // have higher quality even when this transform is enabled, but would break + // users that round-trip blockaddresses through inline assembly and then + // back into an indirectbr. + BA->replaceAllUsesWith(ConstantExpr::getIntToPtr(BBIndexC, BA->getType())); + } + + if (BBs.empty()) { + // There are no blocks whose address is taken, so any indirectbr instruction + // cannot get a valid input and we can replace all of them with unreachable. + for (auto *IBr : IndirectBrs) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + } + return true; + } + + BasicBlock *SwitchBB; + Value *SwitchValue; + + // Compute a common integer type across all the indirectbr instructions. + IntegerType *CommonITy = nullptr; + for (auto *IBr : IndirectBrs) { + auto *ITy = + cast(DL.getIntPtrType(IBr->getAddress()->getType())); + if (!CommonITy || ITy->getBitWidth() > CommonITy->getBitWidth()) + CommonITy = ITy; + } + + auto GetSwitchValue = [DL, CommonITy](IndirectBrInst *IBr) { + return CastInst::CreatePointerCast( + IBr->getAddress(), CommonITy, + Twine(IBr->getAddress()->getName()) + ".switch_cast", IBr); + }; + + if (IndirectBrs.size() == 1) { + // If we only have one indirectbr, we can just directly replace it within + // its block. + SwitchBB = IndirectBrs[0]->getParent(); + SwitchValue = GetSwitchValue(IndirectBrs[0]); + IndirectBrs[0]->eraseFromParent(); + } else { + // Otherwise we need to create a new block to hold the switch across BBs, + // jump to that block instead of each indirectbr, and phi together the + // values for the switch. + SwitchBB = BasicBlock::Create(F.getContext(), "switch_bb", &F); + auto *SwitchPN = PHINode::Create(CommonITy, IndirectBrs.size(), + "switch_value_phi", SwitchBB); + SwitchValue = SwitchPN; + + // Now replace the indirectbr instructions with direct branches to the + // switch block and fill out the PHI operands. + for (auto *IBr : IndirectBrs) { + SwitchPN->addIncoming(GetSwitchValue(IBr), IBr->getParent()); + BranchInst::Create(SwitchBB, IBr); + IBr->eraseFromParent(); + } + } + + // Now build the switch in the block. The block will have no terminator + // already. + auto *SI = SwitchInst::Create(SwitchValue, BBs[0], BBs.size(), SwitchBB); + + // Add a case for each block. + for (int i : llvm::seq(1, BBs.size())) + SI->addCase(ConstantInt::get(CommonITy, i + 1), BBs[i]); + + return true; +} Modified: stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -790,6 +790,9 @@ void TargetPassConfig::addMachinePasses() { if (EnableMachineOutliner) PM->add(createMachineOutlinerPass()); + // Add passes that directly emit MI after all other MI passes. + addPreEmitPass2(); + AddingMachinePasses = false; } Modified: stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -37,6 +37,10 @@ bool TargetSubtargetInfo::enableAtomicExpand() const { return true; } +bool TargetSubtargetInfo::enableIndirectBrExpand() const { + return false; +} + bool TargetSubtargetInfo::enableMachineScheduler() const { return false; } Modified: stable/11/contrib/llvm/lib/Target/X86/X86.h ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86.h Mon Mar 19 18:36:43 2018 (r331219) @@ -22,6 +22,7 @@ namespace llvm { class FunctionPass; class ImmutablePass; class InstructionSelector; +class ModulePass; class PassRegistry; class X86RegisterBankInfo; class X86Subtarget; @@ -97,6 +98,9 @@ void initializeFixupBWInstPassPass(PassRegistry &); /// This pass replaces EVEX ecnoded of AVX-512 instructiosn by VEX /// encoding when possible in order to reduce code size. FunctionPass *createX86EvexToVexInsts(); + +/// This pass creates the thunks for the retpoline feature. +FunctionPass *createX86RetpolineThunksPass(); InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM, X86Subtarget &, Modified: stable/11/contrib/llvm/lib/Target/X86/X86.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86.td Mon Mar 19 18:36:43 2018 (r331219) @@ -290,6 +290,27 @@ def FeatureERMSB "ermsb", "HasERMSB", "true", "REP MOVS/STOS are fast">; +// Enable mitigation of some aspects of speculative execution related +// vulnerabilities by removing speculatable indirect branches. This disables +// jump-table formation, rewrites explicit `indirectbr` instructions into +// `switch` instructions, and uses a special construct called a "retpoline" to +// prevent speculation of the remaining indirect branches (indirect calls and +// tail calls). +def FeatureRetpoline + : SubtargetFeature<"retpoline", "UseRetpoline", "true", + "Remove speculation of indirect branches from the " + "generated code, either by avoiding them entirely or " + "lowering them with a speculation blocking construct.">; + +// Rely on external thunks for the emitted retpoline calls. This allows users +// to provide their own custom thunk definitions in highly specialized +// environments such as a kernel that does boot-time hot patching. +def FeatureRetpolineExternalThunk + : SubtargetFeature< + "retpoline-external-thunk", "UseRetpolineExternalThunk", "true", + "Enable retpoline, but with an externally provided thunk.", + [FeatureRetpoline]>; + //===----------------------------------------------------------------------===// // X86 processors supported. //===----------------------------------------------------------------------===// Modified: stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -344,6 +344,8 @@ static void printIntelMemReference(X86AsmPrinter &P, c static bool printAsmMRegister(X86AsmPrinter &P, const MachineOperand &MO, char Mode, raw_ostream &O) { unsigned Reg = MO.getReg(); + bool EmitPercent = true; + switch (Mode) { default: return true; // Unknown mode. case 'b': // Print QImode register @@ -358,6 +360,9 @@ static bool printAsmMRegister(X86AsmPrinter &P, const case 'k': // Print SImode register Reg = getX86SubSuperRegister(Reg, 32); break; + case 'V': + EmitPercent = false; + LLVM_FALLTHROUGH; case 'q': // Print 64-bit register names if 64-bit integer registers are available. // Otherwise, print 32-bit register names. @@ -365,7 +370,10 @@ static bool printAsmMRegister(X86AsmPrinter &P, const break; } - O << '%' << X86ATTInstPrinter::getRegisterName(Reg); + if (EmitPercent) + O << '%'; + + O << X86ATTInstPrinter::getRegisterName(Reg); return false; } @@ -438,6 +446,7 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr case 'w': // Print HImode register case 'k': // Print SImode register case 'q': // Print DImode register + case 'V': // Print native register without '%' if (MO.isReg()) return printAsmMRegister(*this, MO, ExtraCode[0], O); printOperand(*this, MI, OpNo, O); Modified: stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h Mon Mar 19 18:36:43 2018 (r331219) @@ -30,6 +30,7 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public A StackMaps SM; FaultMaps FM; std::unique_ptr CodeEmitter; + bool NeedsRetpoline = false; // This utility class tracks the length of a stackmap instruction's 'shadow'. // It is used by the X86AsmPrinter to ensure that the stackmap shadow Modified: stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -3161,6 +3161,10 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) (CalledFn && CalledFn->hasFnAttribute("no_caller_saved_registers"))) return false; + // Functions using retpoline should use SDISel for calls. + if (Subtarget->useRetpoline()) + return false; + // Handle only C, fastcc, and webkit_js calling conventions for now. switch (CC) { default: return false; Modified: stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -742,6 +742,11 @@ void X86FrameLowering::emitStackProbeCall(MachineFunct bool InProlog) const { bool IsLargeCodeModel = MF.getTarget().getCodeModel() == CodeModel::Large; + // FIXME: Add retpoline support and remove this. + if (Is64Bit && IsLargeCodeModel && STI.useRetpoline()) + report_fatal_error("Emitting stack probe calls on 64-bit with the large " + "code model and retpoline not yet implemented."); + unsigned CallOp; if (Is64Bit) CallOp = IsLargeCodeModel ? X86::CALL64r : X86::CALL64pcrel32; @@ -2337,6 +2342,10 @@ void X86FrameLowering::adjustForSegmentedStacks( // This solution is not perfect, as it assumes that the .rodata section // is laid out within 2^31 bytes of each function body, but this seems // to be sufficient for JIT. + // FIXME: Add retpoline support and remove the error here.. + if (STI.useRetpoline()) + report_fatal_error("Emitting morestack calls on 64-bit with the large " + "code model and retpoline not yet implemented."); BuildMI(allocMBB, DL, TII.get(X86::CALL64m)) .addReg(X86::RIP) .addImm(0) Modified: stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -550,11 +550,11 @@ void X86DAGToDAGISel::PreprocessISelDAG() { SDNode *N = &*I++; // Preincrement iterator to avoid invalidation issues. if (OptLevel != CodeGenOpt::None && - // Only does this when target favors doesn't favor register indirect - // call. + // Only do this when the target can fold the load into the call or + // jmp. + !Subtarget->useRetpoline() && ((N->getOpcode() == X86ISD::CALL && !Subtarget->callRegIndirect()) || (N->getOpcode() == X86ISD::TC_RETURN && - // Only does this if load can be folded into TC_RETURN. (Subtarget->is64Bit() || !getTargetMachine().isPositionIndependent())))) { /// Also try moving call address load from outside callseq_start to just Modified: stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -24994,6 +24994,15 @@ X86TargetLowering::isVectorClearMaskLegal(const SmallV return isShuffleMaskLegal(Mask, VT); } +bool X86TargetLowering::areJTsAllowed(const Function *Fn) const { + // If the subtarget is using retpolines, we need to not generate jump tables. + if (Subtarget.useRetpoline()) + return false; + + // Otherwise, fallback on the generic logic. + return TargetLowering::areJTsAllowed(Fn); +} + //===----------------------------------------------------------------------===// // X86 Scheduler Hooks //===----------------------------------------------------------------------===// @@ -26225,7 +26234,131 @@ X86TargetLowering::EmitLoweredTLSCall(MachineInstr &MI return BB; } +static unsigned getOpcodeForRetpoline(unsigned RPOpc) { + switch (RPOpc) { + case X86::RETPOLINE_CALL32: + return X86::CALLpcrel32; + case X86::RETPOLINE_CALL64: + return X86::CALL64pcrel32; + case X86::RETPOLINE_TCRETURN32: + return X86::TCRETURNdi; + case X86::RETPOLINE_TCRETURN64: + return X86::TCRETURNdi64; + } + llvm_unreachable("not retpoline opcode"); +} + +static const char *getRetpolineSymbol(const X86Subtarget &Subtarget, + unsigned Reg) { + if (Subtarget.useRetpolineExternalThunk()) { + // When using an external thunk for retpolines, we pick names that match the + // names GCC happens to use as well. This helps simplify the implementation + // of the thunks for kernels where they have no easy ability to create + // aliases and are doing non-trivial configuration of the thunk's body. For + // example, the Linux kernel will do boot-time hot patching of the thunk + // bodies and cannot easily export aliases of these to loaded modules. + // + // Note that at any point in the future, we may need to change the semantics + // of how we implement retpolines and at that time will likely change the + // name of the called thunk. Essentially, there is no hard guarantee that + // LLVM will generate calls to specific thunks, we merely make a best-effort + // attempt to help out kernels and other systems where duplicating the + // thunks is costly. + switch (Reg) { + case X86::EAX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_eax"; + case X86::ECX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_ecx"; + case X86::EDX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_edx"; + case X86::EDI: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_edi"; + case X86::R11: + assert(Subtarget.is64Bit() && "Should not be using a 64-bit thunk!"); + return "__x86_indirect_thunk_r11"; + } + llvm_unreachable("unexpected reg for retpoline"); + } + + // When targeting an internal COMDAT thunk use an LLVM-specific name. + switch (Reg) { + case X86::EAX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_eax"; + case X86::ECX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_ecx"; + case X86::EDX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_edx"; + case X86::EDI: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_edi"; + case X86::R11: + assert(Subtarget.is64Bit() && "Should not be using a 64-bit thunk!"); + return "__llvm_retpoline_r11"; + } + llvm_unreachable("unexpected reg for retpoline"); +} + MachineBasicBlock * +X86TargetLowering::EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const { + // Copy the virtual register into the R11 physical register and + // call the retpoline thunk. + DebugLoc DL = MI.getDebugLoc(); + const X86InstrInfo *TII = Subtarget.getInstrInfo(); + unsigned CalleeVReg = MI.getOperand(0).getReg(); + unsigned Opc = getOpcodeForRetpoline(MI.getOpcode()); + + // Find an available scratch register to hold the callee. On 64-bit, we can + // just use R11, but we scan for uses anyway to ensure we don't generate + // incorrect code. On 32-bit, we use one of EAX, ECX, or EDX that isn't + // already a register use operand to the call to hold the callee. If none + // are available, use EDI instead. EDI is chosen because EBX is the PIC base + // register and ESI is the base pointer to realigned stack frames with VLAs. + SmallVector AvailableRegs; + if (Subtarget.is64Bit()) + AvailableRegs.push_back(X86::R11); + else + AvailableRegs.append({X86::EAX, X86::ECX, X86::EDX, X86::EDI}); + + // Zero out any registers that are already used. + for (const auto &MO : MI.operands()) { + if (MO.isReg() && MO.isUse()) + for (unsigned &Reg : AvailableRegs) + if (Reg == MO.getReg()) + Reg = 0; + } + + // Choose the first remaining non-zero available register. + unsigned AvailableReg = 0; + for (unsigned MaybeReg : AvailableRegs) { + if (MaybeReg) { + AvailableReg = MaybeReg; + break; + } + } + if (!AvailableReg) + report_fatal_error("calling convention incompatible with retpoline, no " + "available registers"); + + const char *Symbol = getRetpolineSymbol(Subtarget, AvailableReg); + + BuildMI(*BB, MI, DL, TII->get(TargetOpcode::COPY), AvailableReg) + .addReg(CalleeVReg); + MI.getOperand(0).ChangeToES(Symbol); + MI.setDesc(TII->get(Opc)); + MachineInstrBuilder(*BB->getParent(), &MI) + .addReg(AvailableReg, RegState::Implicit | RegState::Kill); + return BB; +} + +MachineBasicBlock * X86TargetLowering::emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const { DebugLoc DL = MI.getDebugLoc(); @@ -26689,6 +26822,11 @@ X86TargetLowering::EmitInstrWithCustomInserter(Machine case X86::TLS_base_addr32: case X86::TLS_base_addr64: return EmitLoweredTLSAddr(MI, BB); + case X86::RETPOLINE_CALL32: + case X86::RETPOLINE_CALL64: + case X86::RETPOLINE_TCRETURN32: + case X86::RETPOLINE_TCRETURN64: + return EmitLoweredRetpoline(MI, BB); case X86::CATCHRET: return EmitLoweredCatchRet(MI, BB); case X86::CATCHPAD: Modified: stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h Mon Mar 19 18:36:43 2018 (r331219) @@ -986,6 +986,9 @@ namespace llvm { bool isVectorClearMaskLegal(const SmallVectorImpl &Mask, EVT VT) const override; + /// Returns true if lowering to a jump table is allowed. + bool areJTsAllowed(const Function *Fn) const override; + /// If true, then instruction selection should /// seek to shrink the FP constant of the specified type to a smaller type /// in order to save space and / or reduce runtime. @@ -1288,6 +1291,9 @@ namespace llvm { MachineBasicBlock *EmitLoweredTLSCall(MachineInstr &MI, MachineBasicBlock *BB) const; + + MachineBasicBlock *EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const; MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const; Modified: stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Mon Mar 19 18:36:43 2018 (r331219) @@ -1106,14 +1106,14 @@ def X86tcret_6regs : PatFrag<(ops node:$ptr, node:$off def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[Not64BitMode]>; + Requires<[Not64BitMode, NotUseRetpoline]>; // FIXME: This is disabled for 32-bit PIC mode because the global base // register which is part of the address mode may be assigned a // callee-saved register. def : Pat<(X86tcret (load addr:$dst), imm:$off), (TCRETURNmi addr:$dst, imm:$off)>, - Requires<[Not64BitMode, IsNotPIC]>; + Requires<[Not64BitMode, IsNotPIC, NotUseRetpoline]>; def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off), (TCRETURNdi tglobaladdr:$dst, imm:$off)>, @@ -1125,13 +1125,21 @@ def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off) def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri64 ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; // Don't fold loads into X86tcret requiring more than 6 regs. // There wouldn't be enough scratch registers for base+index. def : Pat<(X86tcret_6regs (load addr:$dst), imm:$off), (TCRETURNmi64 addr:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN64 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[In64BitMode, UseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN32 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[Not64BitMode, UseRetpoline]>; def : Pat<(X86tcret (i64 tglobaladdr:$dst), imm:$off), (TCRETURNdi64 tglobaladdr:$dst, imm:$off)>, Modified: stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td Mon Mar 19 18:36:43 2018 (r331219) @@ -211,11 +211,12 @@ let isCall = 1 in Sched<[WriteJumpLd]>; def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst), "call{l}\t{*}$dst", [(X86call GR32:$dst)], IIC_CALL_RI>, - OpSize32, Requires<[Not64BitMode]>, Sched<[WriteJump]>; + OpSize32, Requires<[Not64BitMode,NotUseRetpoline]>, + Sched<[WriteJump]>; def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst), "call{l}\t{*}$dst", [(X86call (loadi32 addr:$dst))], IIC_CALL_MEM>, OpSize32, - Requires<[Not64BitMode,FavorMemIndirectCall]>, + Requires<[Not64BitMode,FavorMemIndirectCall,NotUseRetpoline]>, Sched<[WriteJumpLd]>; let Predicates = [Not64BitMode] in { @@ -298,11 +299,12 @@ let isCall = 1, Uses = [RSP], SchedRW = [WriteJump] in def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst), "call{q}\t{*}$dst", [(X86call GR64:$dst)], IIC_CALL_RI>, - Requires<[In64BitMode]>; + Requires<[In64BitMode,NotUseRetpoline]>; def CALL64m : I<0xFF, MRM2m, (outs), (ins i64mem:$dst), "call{q}\t{*}$dst", [(X86call (loadi64 addr:$dst))], IIC_CALL_MEM>, - Requires<[In64BitMode,FavorMemIndirectCall]>; + Requires<[In64BitMode,FavorMemIndirectCall, + NotUseRetpoline]>; def FARCALL64 : RI<0xFF, MRM3m, (outs), (ins opaque80mem:$dst), "lcall{q}\t{*}$dst", [], IIC_CALL_FAR_MEM>; @@ -338,6 +340,27 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarr let mayLoad = 1 in def TAILJMPm64_REX : I<0xFF, MRM4m, (outs), (ins i64mem_TC:$dst), "rex64 jmp{q}\t{*}$dst", [], IIC_JMP_MEM>; + } +} + +let isPseudo = 1, isCall = 1, isCodeGenOnly = 1, + Uses = [RSP], + usesCustomInserter = 1, + SchedRW = [WriteJump] in { + def RETPOLINE_CALL32 : + PseudoI<(outs), (ins GR32:$dst), [(X86call GR32:$dst)]>, + Requires<[Not64BitMode,UseRetpoline]>; + + def RETPOLINE_CALL64 : + PseudoI<(outs), (ins GR64:$dst), [(X86call GR64:$dst)]>, + Requires<[In64BitMode,UseRetpoline]>; + + // Retpoline variant of indirect tail calls. + let isTerminator = 1, isReturn = 1, isBarrier = 1 in { + def RETPOLINE_TCRETURN64 : + PseudoI<(outs), (ins GR64:$dst, i32imm:$offset), []>; + def RETPOLINE_TCRETURN32 : + PseudoI<(outs), (ins GR32:$dst, i32imm:$offset), []>; } } Modified: stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td Mon Mar 19 18:36:43 2018 (r331219) @@ -917,6 +917,8 @@ def HasFastLZCNT : Predicate<"Subtarget->hasFastLZCNT( def HasFastSHLDRotate : Predicate<"Subtarget->hasFastSHLDRotate()">; def HasERMSB : Predicate<"Subtarget->hasERMSB()">; def HasMFence : Predicate<"Subtarget->hasMFence()">; +def UseRetpoline : Predicate<"Subtarget->useRetpoline()">; +def NotUseRetpoline : Predicate<"!Subtarget->useRetpoline()">; //===----------------------------------------------------------------------===// // X86 Instruction Format Definitions. Modified: stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -874,6 +874,10 @@ void X86AsmPrinter::LowerSTATEPOINT(const MachineInstr // address is to far away. (TODO: support non-relative addressing) break; case MachineOperand::MO_Register: + // FIXME: Add retpoline support and remove this. + if (Subtarget->useRetpoline()) + report_fatal_error("Lowering register statepoints with retpoline not " + "yet implemented."); CallTargetMCOp = MCOperand::createReg(CallTarget.getReg()); CallOpcode = X86::CALL64r; break; @@ -1028,6 +1032,10 @@ void X86AsmPrinter::LowerPATCHPOINT(const MachineInstr EmitAndCountInstruction( MCInstBuilder(X86::MOV64ri).addReg(ScratchReg).addOperand(CalleeMCOp)); + // FIXME: Add retpoline support and remove this. + if (Subtarget->useRetpoline()) + report_fatal_error( + "Lowering patchpoint with retpoline not yet implemented."); EmitAndCountInstruction(MCInstBuilder(X86::CALL64r).addReg(ScratchReg)); } Added: stable/11/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -0,0 +1,265 @@ +//======- X86RetpolineThunks.cpp - Construct retpoline thunks for x86 --=====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// Pass that injects an MI thunk implementing a "retpoline". This is +/// a RET-implemented trampoline that is used to lower indirect calls in a way +/// that prevents speculation on some x86 processors and can be used to mitigate +/// security vulnerabilities due to targeted speculative execution and side +/// channels such as CVE-2017-5715. +/// +/// TODO(chandlerc): All of this code could use better comments and +/// documentation. +/// +//===----------------------------------------------------------------------===// + +#include "X86.h" +#include "X86InstrBuilder.h" +#include "X86Subtarget.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/TargetPassConfig.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/Instructions.h" +#include "llvm/IR/Module.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" + +using namespace llvm; + +#define DEBUG_TYPE "x86-retpoline-thunks" + +static const char ThunkNamePrefix[] = "__llvm_retpoline_"; +static const char R11ThunkName[] = "__llvm_retpoline_r11"; +static const char EAXThunkName[] = "__llvm_retpoline_eax"; +static const char ECXThunkName[] = "__llvm_retpoline_ecx"; +static const char EDXThunkName[] = "__llvm_retpoline_edx"; +static const char EDIThunkName[] = "__llvm_retpoline_edi"; + +namespace { +class X86RetpolineThunks : public MachineFunctionPass { +public: + static char ID; + + X86RetpolineThunks() : MachineFunctionPass(ID) {} + + StringRef getPassName() const override { return "X86 Retpoline Thunks"; } + + bool doInitialization(Module &M) override; + bool runOnMachineFunction(MachineFunction &F) override; + + void getAnalysisUsage(AnalysisUsage &AU) const override { + MachineFunctionPass::getAnalysisUsage(AU); + AU.addRequired(); + AU.addPreserved(); + } + +private: + MachineModuleInfo *MMI; + const TargetMachine *TM; + bool Is64Bit; + const X86Subtarget *STI; + const X86InstrInfo *TII; + + bool InsertedThunks; + + void createThunkFunction(Module &M, StringRef Name); + void insertRegReturnAddrClobber(MachineBasicBlock &MBB, unsigned Reg); + void populateThunk(MachineFunction &MF, Optional Reg = None); +}; + +} // end anonymous namespace + +FunctionPass *llvm::createX86RetpolineThunksPass() { + return new X86RetpolineThunks(); +} + +char X86RetpolineThunks::ID = 0; + +bool X86RetpolineThunks::doInitialization(Module &M) { + InsertedThunks = false; + return false; +} + +bool X86RetpolineThunks::runOnMachineFunction(MachineFunction &MF) { + DEBUG(dbgs() << getPassName() << '\n'); + + TM = &MF.getTarget();; + STI = &MF.getSubtarget(); + TII = STI->getInstrInfo(); + Is64Bit = TM->getTargetTriple().getArch() == Triple::x86_64; + + MMI = &getAnalysis(); + Module &M = const_cast(*MMI->getModule()); + + // If this function is not a thunk, check to see if we need to insert + // a thunk. + if (!MF.getName().startswith(ThunkNamePrefix)) { + // If we've already inserted a thunk, nothing else to do. + if (InsertedThunks) + return false; + + // Only add a thunk if one of the functions has the retpoline feature + // enabled in its subtarget, and doesn't enable external thunks. + // FIXME: Conditionalize on indirect calls so we don't emit a thunk when + // nothing will end up calling it. + // FIXME: It's a little silly to look at every function just to enumerate + // the subtargets, but eventually we'll want to look at them for indirect + // calls, so maybe this is OK. + if (!STI->useRetpoline() || STI->useRetpolineExternalThunk()) + return false; + + // Otherwise, we need to insert the thunk. + // WARNING: This is not really a well behaving thing to do in a function + // pass. We extract the module and insert a new function (and machine + // function) directly into the module. + if (Is64Bit) + createThunkFunction(M, R11ThunkName); + else + for (StringRef Name : + {EAXThunkName, ECXThunkName, EDXThunkName, EDIThunkName}) + createThunkFunction(M, Name); + InsertedThunks = true; + return true; + } + + // If this *is* a thunk function, we need to populate it with the correct MI. + if (Is64Bit) { + assert(MF.getName() == "__llvm_retpoline_r11" && + "Should only have an r11 thunk on 64-bit targets"); + + // __llvm_retpoline_r11: + // callq .Lr11_call_target + // .Lr11_capture_spec: + // pause + // lfence + // jmp .Lr11_capture_spec + // .align 16 + // .Lr11_call_target: + // movq %r11, (%rsp) + // retq + populateThunk(MF, X86::R11); + } else { + // For 32-bit targets we need to emit a collection of thunks for various + // possible scratch registers as well as a fallback that uses EDI, which is + // normally callee saved. + // __llvm_retpoline_eax: + // calll .Leax_call_target + // .Leax_capture_spec: + // pause + // jmp .Leax_capture_spec + // .align 16 + // .Leax_call_target: + // movl %eax, (%esp) # Clobber return addr + // retl + // + // __llvm_retpoline_ecx: + // ... # Same setup + // movl %ecx, (%esp) + // retl + // + // __llvm_retpoline_edx: + // ... # Same setup + // movl %edx, (%esp) + // retl + // + // __llvm_retpoline_edi: + // ... # Same setup + // movl %edi, (%esp) + // retl + if (MF.getName() == EAXThunkName) + populateThunk(MF, X86::EAX); + else if (MF.getName() == ECXThunkName) + populateThunk(MF, X86::ECX); + else if (MF.getName() == EDXThunkName) + populateThunk(MF, X86::EDX); + else if (MF.getName() == EDIThunkName) + populateThunk(MF, X86::EDI); + else + llvm_unreachable("Invalid thunk name on x86-32!"); + } + + return true; +} + +void X86RetpolineThunks::createThunkFunction(Module &M, StringRef Name) { + assert(Name.startswith(ThunkNamePrefix) && + "Created a thunk with an unexpected prefix!"); + + LLVMContext &Ctx = M.getContext(); + auto Type = FunctionType::get(Type::getVoidTy(Ctx), false); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Mar 19 18:59:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84698F63FFB; Mon, 19 Mar 2018 18:59:16 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D38F7F24F; Mon, 19 Mar 2018 18:59:16 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 213C41262C; Mon, 19 Mar 2018 18:59:16 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JIxFMW063688; Mon, 19 Mar 2018 18:59:15 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JIxF9s063687; Mon, 19 Mar 2018 18:59:15 GMT (envelope-from br@FreeBSD.org) Message-Id: <201803191859.w2JIxF9s063687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 19 Mar 2018 18:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331220 - in head/contrib/processor-trace: . include libipt libipt/include X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/contrib/processor-trace: . include libipt libipt/include X-SVN-Commit-Revision: 331220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:59:16 -0000 Author: br Date: Mon Mar 19 18:59:15 2018 New Revision: 331220 URL: https://svnweb.freebsd.org/changeset/base/331220 Log: Import Intel Processor Trace decoder library from vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26 Sponsored by: DARPA, AFRL Added: head/contrib/processor-trace/ head/contrib/processor-trace/include/ - copied from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/ head/contrib/processor-trace/libipt/ - copied from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/ head/contrib/processor-trace/libipt/include/intel-pt.h - copied unchanged from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/intel-pt.h.in Copied: head/contrib/processor-trace/libipt/include/intel-pt.h (from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/intel-pt.h.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/processor-trace/libipt/include/intel-pt.h Mon Mar 19 18:59:15 2018 (r331220, copy of r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/intel-pt.h.in) @@ -0,0 +1,2463 @@ +/* + * Copyright (c) 2013-2018, Intel Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Intel Corporation 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 OWNER 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. + */ + +#ifndef INTEL_PT_H +#define INTEL_PT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Intel(R) Processor Trace (Intel PT) decoder library. + * + * This file is logically structured into the following sections: + * + * - Version + * - Errors + * - Configuration + * - Packet encoder / decoder + * - Query decoder + * - Traced image + * - Instruction flow decoder + * - Block decoder + */ + + + +struct pt_encoder; +struct pt_packet_decoder; +struct pt_query_decoder; +struct pt_insn_decoder; +struct pt_block_decoder; + + + +/* A macro to mark functions as exported. */ +#ifndef pt_export +# if defined(__GNUC__) +# define pt_export __attribute__((visibility("default"))) +# elif defined(_MSC_VER) +# define pt_export __declspec(dllimport) +# else +# error "unknown compiler" +# endif +#endif + + + +/* Version. */ + + +/** The header version. */ +#define LIBIPT_VERSION_MAJOR ${PT_VERSION_MAJOR} +#define LIBIPT_VERSION_MINOR ${PT_VERSION_MINOR} + +#define LIBIPT_VERSION ((LIBIPT_VERSION_MAJOR << 8) + LIBIPT_VERSION_MINOR) + + +/** The library version. */ +struct pt_version { + /** Major version number. */ + uint8_t major; + + /** Minor version number. */ + uint8_t minor; + + /** Reserved bits. */ + uint16_t reserved; + + /** Build number. */ + uint32_t build; + + /** Version extension. */ + const char *ext; +}; + + +/** Return the library version. */ +extern pt_export struct pt_version pt_library_version(void); + + + +/* Errors. */ + + + +/** Error codes. */ +enum pt_error_code { + /* No error. Everything is OK. */ + pte_ok, + + /* Internal decoder error. */ + pte_internal, + + /* Invalid argument. */ + pte_invalid, + + /* Decoder out of sync. */ + pte_nosync, + + /* Unknown opcode. */ + pte_bad_opc, + + /* Unknown payload. */ + pte_bad_packet, + + /* Unexpected packet context. */ + pte_bad_context, + + /* Decoder reached end of trace stream. */ + pte_eos, + + /* No packet matching the query to be found. */ + pte_bad_query, + + /* Decoder out of memory. */ + pte_nomem, + + /* Bad configuration. */ + pte_bad_config, + + /* There is no IP. */ + pte_noip, + + /* The IP has been suppressed. */ + pte_ip_suppressed, + + /* There is no memory mapped at the requested address. */ + pte_nomap, + + /* An instruction could not be decoded. */ + pte_bad_insn, + + /* No wall-clock time is available. */ + pte_no_time, + + /* No core:bus ratio available. */ + pte_no_cbr, + + /* Bad traced image. */ + pte_bad_image, + + /* A locking error. */ + pte_bad_lock, + + /* The requested feature is not supported. */ + pte_not_supported, + + /* The return address stack is empty. */ + pte_retstack_empty, + + /* A compressed return is not indicated correctly by a taken branch. */ + pte_bad_retcomp, + + /* The current decoder state does not match the state in the trace. */ + pte_bad_status_update, + + /* The trace did not contain an expected enabled event. */ + pte_no_enable, + + /* An event was ignored. */ + pte_event_ignored, + + /* Something overflowed. */ + pte_overflow, + + /* A file handling error. */ + pte_bad_file, + + /* Unknown cpu. */ + pte_bad_cpu +}; + + +/** Decode a function return value into an pt_error_code. */ +static inline enum pt_error_code pt_errcode(int status) +{ + return (status >= 0) ? pte_ok : (enum pt_error_code) -status; +} + +/** Return a human readable error string. */ +extern pt_export const char *pt_errstr(enum pt_error_code); + + + +/* Configuration. */ + + + +/** A cpu vendor. */ +enum pt_cpu_vendor { + pcv_unknown, + pcv_intel +}; + +/** A cpu identifier. */ +struct pt_cpu { + /** The cpu vendor. */ + enum pt_cpu_vendor vendor; + + /** The cpu family. */ + uint16_t family; + + /** The cpu model. */ + uint8_t model; + + /** The stepping. */ + uint8_t stepping; +}; + +/** A collection of Intel PT errata. */ +struct pt_errata { + /** BDM70: Intel(R) Processor Trace PSB+ Packets May Contain + * Unexpected Packets. + * + * Same as: SKD024, SKL021, KBL021. + * + * Some Intel Processor Trace packets should be issued only between + * TIP.PGE and TIP.PGD packets. Due to this erratum, when a TIP.PGE + * packet is generated it may be preceded by a PSB+ that incorrectly + * includes FUP and MODE.Exec packets. + */ + uint32_t bdm70:1; + + /** BDM64: An Incorrect LBR or Intel(R) Processor Trace Packet May Be + * Recorded Following a Transactional Abort. + * + * Use of Intel(R) Transactional Synchronization Extensions (Intel(R) + * TSX) may result in a transactional abort. If an abort occurs + * immediately following a branch instruction, an incorrect branch + * target may be logged in an LBR (Last Branch Record) or in an Intel(R) + * Processor Trace (Intel(R) PT) packet before the LBR or Intel PT + * packet produced by the abort. + */ + uint32_t bdm64:1; + + /** SKD007: Intel(R) PT Buffer Overflow May Result in Incorrect Packets. + * + * Same as: SKL049, KBL041. + * + * Under complex micro-architectural conditions, an Intel PT (Processor + * Trace) OVF (Overflow) packet may be issued after the first byte of a + * multi-byte CYC (Cycle Count) packet, instead of any remaining bytes + * of the CYC. + */ + uint32_t skd007:1; + + /** SKD022: VM Entry That Clears TraceEn May Generate a FUP. + * + * Same as: SKL024, KBL023. + * + * If VM entry clears Intel(R) PT (Intel Processor Trace) + * IA32_RTIT_CTL.TraceEn (MSR 570H, bit 0) while PacketEn is 1 then a + * FUP (Flow Update Packet) will precede the TIP.PGD (Target IP Packet, + * Packet Generation Disable). VM entry can clear TraceEn if the + * VM-entry MSR-load area includes an entry for the IA32_RTIT_CTL MSR. + */ + uint32_t skd022:1; + + /** SKD010: Intel(R) PT FUP May be Dropped After OVF. + * + * Same as: SKD014, SKL033, KBL030. + * + * Some Intel PT (Intel Processor Trace) OVF (Overflow) packets may not + * be followed by a FUP (Flow Update Packet) or TIP.PGE (Target IP + * Packet, Packet Generation Enable). + */ + uint32_t skd010:1; + + /** SKL014: Intel(R) PT TIP.PGD May Not Have Target IP Payload. + * + * Same as: KBL014. + * + * When Intel PT (Intel Processor Trace) is enabled and a direct + * unconditional branch clears IA32_RTIT_STATUS.FilterEn (MSR 571H, bit + * 0), due to this erratum, the resulting TIP.PGD (Target IP Packet, + * Packet Generation Disable) may not have an IP payload with the target + * IP. + */ + uint32_t skl014:1; + + /** APL12: Intel(R) PT OVF May Be Followed By An Unexpected FUP Packet. + * + * Certain Intel PT (Processor Trace) packets including FUPs (Flow + * Update Packets), should be issued only between TIP.PGE (Target IP + * Packet - Packet Generaton Enable) and TIP.PGD (Target IP Packet - + * Packet Generation Disable) packets. When outside a TIP.PGE/TIP.PGD + * pair, as a result of IA32_RTIT_STATUS.FilterEn[0] (MSR 571H) being + * cleared, an OVF (Overflow) packet may be unexpectedly followed by a + * FUP. + */ + uint32_t apl12:1; + + /** APL11: Intel(R) PT OVF Pakcet May Be Followed by TIP.PGD Packet + * + * If Intel PT (Processor Trace) encounters an internal buffer overflow + * and generates an OVF (Overflow) packet just as IA32_RTIT_CTL (MSR + * 570H) bit 0 (TraceEn) is cleared, or during a far transfer that + * causes IA32_RTIT_STATUS.ContextEn[1] (MSR 571H) to be cleared, the + * OVF may be followed by a TIP.PGD (Target Instruction Pointer - Packet + * Generation Disable) packet. + */ + uint32_t apl11:1; + + /* Reserve a few bytes for the future. */ + uint32_t reserved[15]; +}; + +/** A collection of decoder-specific configuration flags. */ +struct pt_conf_flags { + /** The decoder variant. */ + union { + /** Flags for the block decoder. */ + struct { + /** End a block after a call instruction. */ + uint32_t end_on_call:1; + + /** Enable tick events for timing updates. */ + uint32_t enable_tick_events:1; + + /** End a block after a jump instruction. */ + uint32_t end_on_jump:1; + } block; + + /** Flags for the instruction flow decoder. */ + struct { + /** Enable tick events for timing updates. */ + uint32_t enable_tick_events:1; + } insn; + + /* Reserve a few bytes for future extensions. */ + uint32_t reserved[4]; + } variant; +}; + +/** The address filter configuration. */ +struct pt_conf_addr_filter { + /** The address filter configuration. + * + * This corresponds to the respective fields in IA32_RTIT_CTL MSR. + */ + union { + uint64_t addr_cfg; + + struct { + uint32_t addr0_cfg:4; + uint32_t addr1_cfg:4; + uint32_t addr2_cfg:4; + uint32_t addr3_cfg:4; + } ctl; + } config; + + /** The address ranges configuration. + * + * This corresponds to the IA32_RTIT_ADDRn_A/B MSRs. + */ + uint64_t addr0_a; + uint64_t addr0_b; + uint64_t addr1_a; + uint64_t addr1_b; + uint64_t addr2_a; + uint64_t addr2_b; + uint64_t addr3_a; + uint64_t addr3_b; + + /* Reserve some space. */ + uint64_t reserved[8]; +}; + +/** An unknown packet. */ +struct pt_packet_unknown; + +/** An Intel PT decoder configuration. + */ +struct pt_config { + /** The size of the config structure in bytes. */ + size_t size; + + /** The trace buffer begin address. */ + uint8_t *begin; + + /** The trace buffer end address. */ + uint8_t *end; + + /** An optional callback for handling unknown packets. + * + * If \@callback is not NULL, it is called for any unknown opcode. + */ + struct { + /** The callback function. + * + * It shall decode the packet at \@pos into \@unknown. + * It shall return the number of bytes read upon success. + * It shall return a negative pt_error_code otherwise. + * The below context is passed as \@context. + */ + int (*callback)(struct pt_packet_unknown *unknown, + const struct pt_config *config, + const uint8_t *pos, void *context); + + /** The user-defined context for this configuration. */ + void *context; + } decode; + + /** The cpu on which Intel PT has been recorded. */ + struct pt_cpu cpu; + + /** The errata to apply when encoding or decoding Intel PT. */ + struct pt_errata errata; + + /* The CTC frequency. + * + * This is only required if MTC packets have been enabled in + * IA32_RTIT_CTRL.MTCEn. + */ + uint32_t cpuid_0x15_eax, cpuid_0x15_ebx; + + /* The MTC frequency as defined in IA32_RTIT_CTL.MTCFreq. + * + * This is only required if MTC packets have been enabled in + * IA32_RTIT_CTRL.MTCEn. + */ + uint8_t mtc_freq; + + /* The nominal frequency as defined in MSR_PLATFORM_INFO[15:8]. + * + * This is only required if CYC packets have been enabled in + * IA32_RTIT_CTRL.CYCEn. + * + * If zero, timing calibration will only be able to use MTC and CYC + * packets. + * + * If not zero, timing calibration will also be able to use CBR + * packets. + */ + uint8_t nom_freq; + + /** A collection of decoder-specific flags. */ + struct pt_conf_flags flags; + + /** The address filter configuration. */ + struct pt_conf_addr_filter addr_filter; +}; + + +/** Zero-initialize an Intel PT configuration. */ +static inline void pt_config_init(struct pt_config *config) +{ + memset(config, 0, sizeof(*config)); + + config->size = sizeof(*config); +} + +/** Determine errata for a given cpu. + * + * Updates \@errata based on \@cpu. + * + * Returns 0 on success, a negative error code otherwise. + * Returns -pte_invalid if \@errata or \@cpu is NULL. + * Returns -pte_bad_cpu if \@cpu is not known. + */ +extern pt_export int pt_cpu_errata(struct pt_errata *errata, + const struct pt_cpu *cpu); + + + +/* Packet encoder / decoder. */ + + + +/** Intel PT packet types. */ +enum pt_packet_type { + /* An invalid packet. */ + ppt_invalid, + + /* A packet decodable by the optional decoder callback. */ + ppt_unknown, + + /* Actual packets supported by this library. */ + ppt_pad, + ppt_psb, + ppt_psbend, + ppt_fup, + ppt_tip, + ppt_tip_pge, + ppt_tip_pgd, + ppt_tnt_8, + ppt_tnt_64, + ppt_mode, + ppt_pip, + ppt_vmcs, + ppt_cbr, + ppt_tsc, + ppt_tma, + ppt_mtc, + ppt_cyc, + ppt_stop, + ppt_ovf, + ppt_mnt, + ppt_exstop, + ppt_mwait, + ppt_pwre, + ppt_pwrx, + ppt_ptw +}; + +/** The IP compression. */ +enum pt_ip_compression { + /* The bits encode the payload size and the encoding scheme. + * + * No payload. The IP has been suppressed. + */ + pt_ipc_suppressed = 0x0, + + /* Payload: 16 bits. Update last IP. */ + pt_ipc_update_16 = 0x01, + + /* Payload: 32 bits. Update last IP. */ + pt_ipc_update_32 = 0x02, + + /* Payload: 48 bits. Sign extend to full address. */ + pt_ipc_sext_48 = 0x03, + + /* Payload: 48 bits. Update last IP. */ + pt_ipc_update_48 = 0x04, + + /* Payload: 64 bits. Full address. */ + pt_ipc_full = 0x06 +}; + +/** An execution mode. */ +enum pt_exec_mode { + ptem_unknown, + ptem_16bit, + ptem_32bit, + ptem_64bit +}; + +/** Mode packet leaves. */ +enum pt_mode_leaf { + pt_mol_exec = 0x00, + pt_mol_tsx = 0x20 +}; + +/** A TNT-8 or TNT-64 packet. */ +struct pt_packet_tnt { + /** TNT payload bit size. */ + uint8_t bit_size; + + /** TNT payload excluding stop bit. */ + uint64_t payload; +}; + +/** A packet with IP payload. */ +struct pt_packet_ip { + /** IP compression. */ + enum pt_ip_compression ipc; + + /** Zero-extended payload ip. */ + uint64_t ip; +}; + +/** A mode.exec packet. */ +struct pt_packet_mode_exec { + /** The mode.exec csl bit. */ + uint32_t csl:1; + + /** The mode.exec csd bit. */ + uint32_t csd:1; +}; + +static inline enum pt_exec_mode +pt_get_exec_mode(const struct pt_packet_mode_exec *packet) +{ + if (packet->csl) + return packet->csd ? ptem_unknown : ptem_64bit; + else + return packet->csd ? ptem_32bit : ptem_16bit; +} + +static inline struct pt_packet_mode_exec +pt_set_exec_mode(enum pt_exec_mode mode) +{ + struct pt_packet_mode_exec packet; + + switch (mode) { + default: + packet.csl = 1; + packet.csd = 1; + break; + + case ptem_64bit: + packet.csl = 1; + packet.csd = 0; + break; + + case ptem_32bit: + packet.csl = 0; + packet.csd = 1; + break; + + case ptem_16bit: + packet.csl = 0; + packet.csd = 0; + break; + } + + return packet; +} + +/** A mode.tsx packet. */ +struct pt_packet_mode_tsx { + /** The mode.tsx intx bit. */ + uint32_t intx:1; + + /** The mode.tsx abrt bit. */ + uint32_t abrt:1; +}; + +/** A mode packet. */ +struct pt_packet_mode { + /** Mode leaf. */ + enum pt_mode_leaf leaf; + + /** Mode bits. */ + union { + /** Packet: mode.exec. */ + struct pt_packet_mode_exec exec; + + /** Packet: mode.tsx. */ + struct pt_packet_mode_tsx tsx; + } bits; +}; + +/** A PIP packet. */ +struct pt_packet_pip { + /** The CR3 value. */ + uint64_t cr3; + + /** The non-root bit. */ + uint32_t nr:1; +}; + +/** A TSC packet. */ +struct pt_packet_tsc { + /** The TSC value. */ + uint64_t tsc; +}; + +/** A CBR packet. */ +struct pt_packet_cbr { + /** The core/bus cycle ratio. */ + uint8_t ratio; +}; + +/** A TMA packet. */ +struct pt_packet_tma { + /** The crystal clock tick counter value. */ + uint16_t ctc; + + /** The fast counter value. */ + uint16_t fc; +}; + +/** A MTC packet. */ +struct pt_packet_mtc { + /** The crystal clock tick counter value. */ + uint8_t ctc; +}; + +/** A CYC packet. */ +struct pt_packet_cyc { + /** The cycle counter value. */ + uint64_t value; +}; + +/** A VMCS packet. */ +struct pt_packet_vmcs { + /* The VMCS Base Address (i.e. the shifted payload). */ + uint64_t base; +}; + +/** A MNT packet. */ +struct pt_packet_mnt { + /** The raw payload. */ + uint64_t payload; +}; + +/** A EXSTOP packet. */ +struct pt_packet_exstop { + /** A flag specifying the binding of the packet: + * + * set: binds to the next FUP. + * clear: standalone. + */ + uint32_t ip:1; +}; + +/** A MWAIT packet. */ +struct pt_packet_mwait { + /** The MWAIT hints (EAX). */ + uint32_t hints; + + /** The MWAIT extensions (ECX). */ + uint32_t ext; +}; + +/** A PWRE packet. */ +struct pt_packet_pwre { + /** The resolved thread C-state. */ + uint8_t state; + + /** The resolved thread sub C-state. */ + uint8_t sub_state; + + /** A flag indicating whether the C-state entry was initiated by h/w. */ + uint32_t hw:1; +}; + +/** A PWRX packet. */ +struct pt_packet_pwrx { + /** The core C-state at the time of the wake. */ + uint8_t last; + + /** The deepest core C-state achieved during sleep. */ + uint8_t deepest; + + /** The wake reason: + * + * - due to external interrupt received. + */ + uint32_t interrupt:1; + + /** - due to store to monitored address. */ + uint32_t store:1; + + /** - due to h/w autonomous condition such as HDC. */ + uint32_t autonomous:1; +}; + +/** A PTW packet. */ +struct pt_packet_ptw { + /** The raw payload. */ + uint64_t payload; + + /** The payload size as encoded in the packet. */ + uint8_t plc; + + /** A flag saying whether a FUP is following PTW that provides + * the IP of the corresponding PTWRITE instruction. + */ + uint32_t ip:1; +}; + +static inline int pt_ptw_size(uint8_t plc) +{ + switch (plc) { + case 0: + return 4; + + case 1: + return 8; + + case 2: + case 3: + return -pte_bad_packet; + } + + return -pte_internal; +} + +/** An unknown packet decodable by the optional decoder callback. */ +struct pt_packet_unknown { + /** Pointer to the raw packet bytes. */ + const uint8_t *packet; + + /** Optional pointer to a user-defined structure. */ + void *priv; +}; + +/** An Intel PT packet. */ +struct pt_packet { + /** The type of the packet. + * + * This also determines the \@payload field. + */ + enum pt_packet_type type; + + /** The size of the packet including opcode and payload. */ + uint8_t size; + + /** Packet specific data. */ + union { + /** Packets: pad, ovf, psb, psbend, stop - no payload. */ + + /** Packet: tnt-8, tnt-64. */ + struct pt_packet_tnt tnt; + + /** Packet: tip, fup, tip.pge, tip.pgd. */ + struct pt_packet_ip ip; + + /** Packet: mode. */ + struct pt_packet_mode mode; + + /** Packet: pip. */ + struct pt_packet_pip pip; + + /** Packet: tsc. */ + struct pt_packet_tsc tsc; + + /** Packet: cbr. */ + struct pt_packet_cbr cbr; + + /** Packet: tma. */ + struct pt_packet_tma tma; + + /** Packet: mtc. */ + struct pt_packet_mtc mtc; + + /** Packet: cyc. */ + struct pt_packet_cyc cyc; + + /** Packet: vmcs. */ + struct pt_packet_vmcs vmcs; + + /** Packet: mnt. */ + struct pt_packet_mnt mnt; + + /** Packet: exstop. */ + struct pt_packet_exstop exstop; + + /** Packet: mwait. */ + struct pt_packet_mwait mwait; + + /** Packet: pwre. */ + struct pt_packet_pwre pwre; + + /** Packet: pwrx. */ + struct pt_packet_pwrx pwrx; + + /** Packet: ptw. */ + struct pt_packet_ptw ptw; + + /** Packet: unknown. */ + struct pt_packet_unknown unknown; + } payload; +}; + + + +/* Packet encoder. */ + + + +/** Allocate an Intel PT packet encoder. + * + * The encoder will work on the buffer defined in \@config, it shall contain + * raw trace data and remain valid for the lifetime of the encoder. + * + * The encoder starts at the beginning of the trace buffer. + */ +extern pt_export struct pt_encoder * +pt_alloc_encoder(const struct pt_config *config); + +/** Free an Intel PT packet encoder. + * + * The \@encoder must not be used after a successful return. + */ +extern pt_export void pt_free_encoder(struct pt_encoder *encoder); + +/** Hard set synchronization point of an Intel PT packet encoder. + * + * Synchronize \@encoder to \@offset within the trace buffer. + * + * Returns zero on success, a negative error code otherwise. + * + * Returns -pte_eos if the given offset is behind the end of the trace buffer. + * Returns -pte_invalid if \@encoder is NULL. + */ +extern pt_export int pt_enc_sync_set(struct pt_encoder *encoder, + uint64_t offset); + +/** Get the current packet encoder position. + * + * Fills the current \@encoder position into \@offset. + * + * This is useful for reporting errors. + * + * Returns zero on success, a negative error code otherwise. + * + * Returns -pte_invalid if \@encoder or \@offset is NULL. + */ +extern pt_export int pt_enc_get_offset(const struct pt_encoder *encoder, + uint64_t *offset); + +/* Return a pointer to \@encoder's configuration. + * + * Returns a non-null pointer on success, NULL if \@encoder is NULL. + */ +extern pt_export const struct pt_config * +pt_enc_get_config(const struct pt_encoder *encoder); + +/** Encode an Intel PT packet. + * + * Writes \@packet at \@encoder's current position in the Intel PT buffer and + * advances the \@encoder beyond the written packet. + * + * The \@packet.size field is ignored. + * + * In case of errors, the \@encoder is not advanced and nothing is written + * into the Intel PT buffer. + * + * Returns the number of bytes written on success, a negative error code + * otherwise. + * + * Returns -pte_bad_opc if \@packet.type is not known. + * Returns -pte_bad_packet if \@packet's payload is invalid. + * Returns -pte_eos if \@encoder reached the end of the Intel PT buffer. + * Returns -pte_invalid if \@encoder or \@packet is NULL. + */ +extern pt_export int pt_enc_next(struct pt_encoder *encoder, + const struct pt_packet *packet); + + + +/* Packet decoder. */ + + + +/** Allocate an Intel PT packet decoder. + * + * The decoder will work on the buffer defined in \@config, it shall contain + * raw trace data and remain valid for the lifetime of the decoder. + * + * The decoder needs to be synchronized before it can be used. + */ +extern pt_export struct pt_packet_decoder * +pt_pkt_alloc_decoder(const struct pt_config *config); + +/** Free an Intel PT packet decoder. + * + * The \@decoder must not be used after a successful return. + */ +extern pt_export void pt_pkt_free_decoder(struct pt_packet_decoder *decoder); + +/** Synchronize an Intel PT packet decoder. + * + * Search for the next synchronization point in forward or backward direction. + * + * If \@decoder has not been synchronized, yet, the search is started at the + * beginning of the trace buffer in case of forward synchronization and at the + * end of the trace buffer in case of backward synchronization. + * + * Returns zero or a positive value on success, a negative error code otherwise. + * + * Returns -pte_eos if no further synchronization point is found. + * Returns -pte_invalid if \@decoder is NULL. + */ +extern pt_export int pt_pkt_sync_forward(struct pt_packet_decoder *decoder); +extern pt_export int pt_pkt_sync_backward(struct pt_packet_decoder *decoder); + +/** Hard set synchronization point of an Intel PT decoder. + * + * Synchronize \@decoder to \@offset within the trace buffer. + * + * Returns zero on success, a negative error code otherwise. + * + * Returns -pte_eos if the given offset is behind the end of the trace buffer. + * Returns -pte_invalid if \@decoder is NULL. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Mar 19 19:09:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CC37F64A4D; Mon, 19 Mar 2018 19:09:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02AA77F92D; Mon, 19 Mar 2018 19:09:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED863127A6; Mon, 19 Mar 2018 19:09:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JJ9FIa068749; Mon, 19 Mar 2018 19:09:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JJ9F1D068748; Mon, 19 Mar 2018 19:09:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803191909.w2JJ9F1D068748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Mar 2018 19:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331221 - head/tests/sys/aio X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/tests/sys/aio X-SVN-Commit-Revision: 331221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 19:09:16 -0000 Author: jhb Date: Mon Mar 19 19:09:15 2018 New Revision: 331221 URL: https://svnweb.freebsd.org/changeset/base/331221 Log: Revert r318180 and re-enable AIO tests on md(4) by default. The 'physio' fast-path used by AIO requests on md(4) devices, is not gated on the unsafe_aio knob. Prior to r327755, some AIO requests could fail the fast-path and fall back to the slow-path (requests for devices not supporting unmapped I/O and requests which failed with EFAULT during the fast-path). However, those cases now return a suitable error rather than using the slow-path. PR: 217261 Reviewed by: asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14742 Modified: head/tests/sys/aio/aio_test.c Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Mon Mar 19 18:59:15 2018 (r331220) +++ head/tests/sys/aio/aio_test.c Mon Mar 19 19:09:15 2018 (r331221) @@ -667,7 +667,6 @@ aio_md_test(completion comp, struct sigevent *sev) char buf[80]; ATF_REQUIRE_KERNEL_MODULE("aio"); - ATF_REQUIRE_UNSAFE_AIO(); mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); ATF_REQUIRE_MSG(mdctl_fd != -1, From owner-svn-src-all@freebsd.org Mon Mar 19 19:32:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17146F665DE; Mon, 19 Mar 2018 19:32:06 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEB3480B7A; Mon, 19 Mar 2018 19:32:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9CB412C0B; Mon, 19 Mar 2018 19:32:05 +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 w2JJW5VU081065; Mon, 19 Mar 2018 19:32:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JJW5L5081064; Mon, 19 Mar 2018 19:32:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803191932.w2JJW5L5081064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Mar 2018 19:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331222 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 331222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 19:32:06 -0000 Author: markj Date: Mon Mar 19 19:32:05 2018 New Revision: 331222 URL: https://svnweb.freebsd.org/changeset/base/331222 Log: Given hidden visibility to symbols referenced by the DOF section. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Mar 19 19:09:15 2018 (r331221) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Mar 19 19:32:05 2018 (r331222) @@ -22,6 +22,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2017-2018 Mark Johnston */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -265,7 +266,7 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, sym->st_value = 0; sym->st_size = 0; sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_FUNC); - sym->st_other = 0; + sym->st_other = ELF32_ST_VISIBILITY(STV_HIDDEN); sym->st_shndx = SHN_UNDEF; rel++; @@ -449,7 +450,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, sym->st_value = 0; sym->st_size = 0; sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_FUNC); - sym->st_other = 0; + sym->st_other = ELF64_ST_VISIBILITY(STV_HIDDEN); sym->st_shndx = SHN_UNDEF; rel++; From owner-svn-src-all@freebsd.org Mon Mar 19 19:43:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8833FF6734E; Mon, 19 Mar 2018 19:43:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DE5F8145E; Mon, 19 Mar 2018 19:43:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 2EA0410A87D; Mon, 19 Mar 2018 15:43:53 -0400 (EDT) From: John Baldwin To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: Re: svn commit: r331218 - in vendor/processor-trace: . 24982c1a6fce48f1e416461d42899805f74fbb26 24982c1a6fce48f1e416461d42899805f74fbb26/doc 24982c1a6fce48f1e416461d42899805f74fbb26/doc/man 24982c1a6fc... Date: Mon, 19 Mar 2018 12:43:49 -0700 Message-ID: <1956273.kgoNNMadGV@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201803191834.w2JIY8WH053697@repo.freebsd.org> References: <201803191834.w2JIY8WH053697@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Mar 2018 15:43:53 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 19:43:54 -0000 On Monday, March 19, 2018 06:34:08 PM Ruslan Bukin wrote: > Author: br > Date: Mon Mar 19 18:34:08 2018 > New Revision: 331218 > URL: https://svnweb.freebsd.org/changeset/base/331218 > > Log: > Import Intel Processor Trace library. > > Git ID 24982c1a6fce48f1e416461d42899805f74fbb26 > > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D12815 Presumably you meant to import this to vendor/processor-trace/dist and then do an 'svn cp' to tag it to the git hash? If you do the svn cp from the git hash instead of from dist I'm not sure if future 'svn merge' requests from the vendor area will work correctly when you try to merge an update. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Mar 19 20:19:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BE4EF69C96; Mon, 19 Mar 2018 20:19:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1062783212; Mon, 19 Mar 2018 20:19:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AD921321E; Mon, 19 Mar 2018 20:19:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JKJ0eI003744; Mon, 19 Mar 2018 20:19:00 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JKJ0Td003743; Mon, 19 Mar 2018 20:19:00 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201803192019.w2JKJ0Td003743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 19 Mar 2018 20:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331223 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 20:19:01 -0000 Author: ken Date: Mon Mar 19 20:19:00 2018 New Revision: 331223 URL: https://svnweb.freebsd.org/changeset/base/331223 Log: cam_periph_acquire() now returns an errno. The ch(4) driver was missed in change 328918, which changed cam_periph_acquire() to return an errno instead of cam_status. As a result, ch(4) failed to attach. Sponsored by: Spectra Logic Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Mon Mar 19 19:32:05 2018 (r331222) +++ head/sys/cam/scsi/scsi_ch.c Mon Mar 19 20:19:00 2018 (r331223) @@ -419,7 +419,7 @@ chregister(struct cam_periph *periph, void *arg) * instance for it. We'll release this reference once the devfs * instance has been freed. */ - if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + if (cam_periph_acquire(periph) != 0) { xpt_print(periph->path, "%s: lost periph during " "registration!\n", __func__); cam_periph_lock(periph); @@ -467,7 +467,7 @@ chopen(struct cdev *dev, int flags, int fmt, struct th int error; periph = (struct cam_periph *)dev->si_drv1; - if (cam_periph_acquire(periph) != CAM_REQ_CMP) + if (cam_periph_acquire(periph) != 0) return (ENXIO); softc = (struct ch_softc *)periph->softc; From owner-svn-src-all@freebsd.org Mon Mar 19 20:55:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C047F423ED; Mon, 19 Mar 2018 20:55:07 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F89184EDC; Mon, 19 Mar 2018 20:55:07 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28B9313847; Mon, 19 Mar 2018 20:55:07 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JKt7CH024203; Mon, 19 Mar 2018 20:55:07 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JKt5a3024188; Mon, 19 Mar 2018 20:55:05 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201803192055.w2JKt5a3024188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 19 Mar 2018 20:55:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331224 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 331224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 20:55:08 -0000 Author: erj Date: Mon Mar 19 20:55:05 2018 New Revision: 331224 URL: https://svnweb.freebsd.org/changeset/base/331224 Log: ixgbe(4): Update shared code, add support for X552 1G, fix bug This patch will: - Update ixgbe shared code - Add support for Intel(R) Ethernet Connection X552 1000BASE-T - Add error handling for link state check preventing VF from stopping traffic after changing PF's MTU value Submitted by: Krzysztof Galazka Reviewed by: Intel Networking Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D13885 Modified: head/sys/dev/ixgbe/if_ix.c head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixgbe/ixgbe_82598.c head/sys/dev/ixgbe/ixgbe_82599.c head/sys/dev/ixgbe/ixgbe_api.c head/sys/dev/ixgbe/ixgbe_common.c head/sys/dev/ixgbe/ixgbe_common.h head/sys/dev/ixgbe/ixgbe_dcb.c head/sys/dev/ixgbe/ixgbe_dcb_82598.c head/sys/dev/ixgbe/ixgbe_dcb_82599.c head/sys/dev/ixgbe/ixgbe_phy.c head/sys/dev/ixgbe/ixgbe_type.h head/sys/dev/ixgbe/ixgbe_vf.c head/sys/dev/ixgbe/ixgbe_x540.c head/sys/dev/ixgbe/ixgbe_x550.c Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/if_ix.c Mon Mar 19 20:55:05 2018 (r331224) @@ -47,7 +47,7 @@ /************************************************************************ * Driver version ************************************************************************/ -char ixgbe_driver_version[] = "4.0.0-k"; +char ixgbe_driver_version[] = "4.0.1-k"; /************************************************************************ @@ -92,6 +92,7 @@ static pci_vendor_info_t ixgbe_vendor_info_array[] = PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_KR, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_KX4, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_10G_T, "Intel(R) PRO/10GbE PCI-Express Network Driver"), + PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_1G_T, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_SFP, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_A_KR, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_A_KR_L, "Intel(R) PRO/10GbE PCI-Express Network Driver"), Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/if_ixv.c Mon Mar 19 20:55:05 2018 (r331224) @@ -45,7 +45,7 @@ /************************************************************************ * Driver version ************************************************************************/ -char ixv_driver_version[] = "2.0.0-k"; +char ixv_driver_version[] = "2.0.1-k"; /************************************************************************ * PCI Device ID Table @@ -616,6 +616,7 @@ ixv_if_init(if_ctx_t ctx) /* Reset VF and renegotiate mailbox API version */ hw->mac.ops.reset_hw(hw); + hw->mac.ops.start_hw(hw); error = ixv_negotiate_api(adapter); if (error) { device_printf(dev, @@ -909,10 +910,18 @@ ixv_if_update_admin_status(if_ctx_t ctx) { struct adapter *adapter = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); + s32 status; adapter->hw.mac.get_link_status = TRUE; - ixgbe_check_link(&adapter->hw, &adapter->link_speed, &adapter->link_up, - FALSE); + + status = ixgbe_check_link(&adapter->hw, &adapter->link_speed, + &adapter->link_up, FALSE); + + if (status != IXGBE_SUCCESS && adapter->hw.adapter_stopped == FALSE) { + /* Mailbox's Clear To Send status is lost or timeout occurred. + * We need reinitialization. */ + iflib_get_ifp(ctx)->if_init(ctx); + } if (adapter->link_up) { if (adapter->link_active == FALSE) { Modified: head/sys/dev/ixgbe/ixgbe_82598.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_82598.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_82598.c Mon Mar 19 20:55:05 2018 (r331224) @@ -550,6 +550,7 @@ out: /** * ixgbe_start_mac_link_82598 - Configures MAC link settings * @hw: pointer to hardware structure + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Configures link settings based on values in the ixgbe_hw struct. * Restarts the link. Performs autonegotiation if needed. @@ -1207,7 +1208,7 @@ s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u * ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface. * @hw: pointer to hardware structure * @byte_offset: byte offset at address 0xA2 - * @eeprom_data: value read + * @sff8472_data: value read * * Performs 8 byte read operation to SFP module's SFF-8472 data over I2C **/ Modified: head/sys/dev/ixgbe/ixgbe_82599.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_82599.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_82599.c Mon Mar 19 20:55:05 2018 (r331224) @@ -270,7 +270,7 @@ s32 prot_autoc_read_82599(struct ixgbe_hw *hw, bool *l /** * prot_autoc_write_82599 - Hides MAC differences needed for AUTOC write * @hw: pointer to hardware structure - * @reg_val: value to write to AUTOC + * @autoc: value to write to AUTOC * @locked: bool to indicate whether the SW/FW lock was already taken by * previous proc_autoc_read_82599. * @@ -1373,6 +1373,7 @@ s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *h s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl, bool cloud_mode) { + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_init_fdir_perfect_82599"); /* @@ -1461,7 +1462,8 @@ do { \ /** * ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash - * @stream: input bitstream to compute the hash on + * @input: input bitstream to compute the hash on + * @common: compressed common input dword * * This function is almost identical to the function above but contains * several optimizations such as unwinding all of the loops, letting the @@ -1600,7 +1602,7 @@ do { \ /** * ixgbe_atr_compute_perfect_hash_82599 - Compute the perfect filter hash - * @atr_input: input bitstream to compute the hash on + * @input: input bitstream to compute the hash on * @input_mask: mask for the input bitstream * * This function serves two main purposes. First it applies the input_mask @@ -1701,6 +1703,7 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *h u32 fdirm = IXGBE_FDIRM_DIPv6; u32 fdirtcpm; u32 fdirip6m; + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_fdir_set_atr_input_mask_82599"); /* @@ -1877,6 +1880,7 @@ s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe u32 addr_low, addr_high; u32 cloud_type = 0; s32 err; + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_fdir_write_perfect_filter_82599"); if (!cloud_mode) { @@ -2001,6 +2005,7 @@ s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe * @input_mask: mask for the input bitstream * @soft_id: software index for the filters * @queue: queue index to direct traffic to + * @cloud_mode: unused * * Note that the caller to this function must lock before calling, since the * hardware writes must be protected from one another. @@ -2011,6 +2016,7 @@ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_h u16 soft_id, u8 queue, bool cloud_mode) { s32 err = IXGBE_ERR_CONFIG; + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_fdir_add_perfect_filter_82599"); @@ -2520,6 +2526,7 @@ reset_pipeline_out: * ixgbe_read_i2c_byte_82599 - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * * Performs byte read operation to SFP module's EEPROM over I2C interface at @@ -2577,6 +2584,7 @@ release_i2c_access: * ixgbe_write_i2c_byte_82599 - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to read from * @data: value to write * * Performs byte write operation to SFP module's EEPROM over I2C interface at Modified: head/sys/dev/ixgbe/ixgbe_api.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_api.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_api.c Mon Mar 19 20:55:05 2018 (r331224) @@ -521,6 +521,7 @@ s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw * ixgbe_read_phy_reg - Read PHY register * @hw: pointer to hardware structure * @reg_addr: 32 bit address of PHY register to read + * @device_type: type of device you want to communicate with * @phy_data: Pointer to read data from PHY register * * Reads a value from a specified PHY register @@ -539,6 +540,7 @@ s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_ad * ixgbe_write_phy_reg - Write PHY register * @hw: pointer to hardware structure * @reg_addr: 32 bit PHY register to write + * @device_type: type of device you want to communicate with * @phy_data: Data to write to the PHY register * * Writes a value to specified PHY register @@ -582,6 +584,8 @@ s32 ixgbe_setup_internal_phy(struct ixgbe_hw *hw) /** * ixgbe_check_phy_link - Determine link and speed status * @hw: pointer to hardware structure + * @speed: link speed + * @link_up: TRUE when link is up * * Reads a PHY register to determine if link is up and the current speed for * the PHY. @@ -597,6 +601,7 @@ s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_li * ixgbe_setup_phy_link_speed - Set auto advertise * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Sets the auto advertised capabilities **/ @@ -622,6 +627,9 @@ s32 ixgbe_set_phy_power(struct ixgbe_hw *hw, bool on) /** * ixgbe_check_link - Get link and speed status * @hw: pointer to hardware structure + * @speed: pointer to link speed + * @link_up: TRUE when link is up + * @link_up_wait_to_complete: bool used to wait for link up or not * * Reads the links register to determine if link is up and the current speed **/ @@ -675,6 +683,7 @@ void ixgbe_flap_tx_laser(struct ixgbe_hw *hw) * ixgbe_setup_link - Set link speed * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Configures link settings. Restarts the link. * Performs autonegotiation if needed. @@ -691,6 +700,7 @@ s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_s * ixgbe_setup_mac_link - Set link speed * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Configures link settings. Restarts the link. * Performs autonegotiation if needed. @@ -706,6 +716,8 @@ s32 ixgbe_setup_mac_link(struct ixgbe_hw *hw, ixgbe_li /** * ixgbe_get_link_capabilities - Returns link capabilities * @hw: pointer to hardware structure + * @speed: link speed capabilities + * @autoneg: TRUE when autoneg or autotry is enabled * * Determines the link capabilities of the current configuration. **/ @@ -758,6 +770,7 @@ s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 ind /** * ixgbe_blink_led_stop - Stop blinking LEDs * @hw: pointer to hardware structure + * @index: led number to stop * * Stop blinking LED based on index. **/ @@ -1000,6 +1013,7 @@ s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 * @mc_addr_list: the list of new multicast addresses * @mc_addr_count: number of addresses * @func: iterator function to walk the multicast address list + * @clear: flag, when set clears the table beforehand * * The given list replaces any existing list. Clears the MC addrs from receive * address registers and the multicast table. Uses unused receive address @@ -1190,7 +1204,7 @@ s32 ixgbe_setup_eee(struct ixgbe_hw *hw, bool enable_e /** * ixgbe_set_source_address_pruning - Enable/Disable source address pruning * @hw: pointer to hardware structure - * @enbale: enable or disable source address pruning + * @enable: enable or disable source address pruning * @pool: Rx pool - Rx pool to toggle source address pruning **/ void ixgbe_set_source_address_pruning(struct ixgbe_hw *hw, bool enable, Modified: head/sys/dev/ixgbe/ixgbe_common.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_common.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_common.c Mon Mar 19 20:55:05 2018 (r331224) @@ -2099,6 +2099,7 @@ static void ixgbe_shift_out_eeprom_bits(struct ixgbe_h /** * ixgbe_shift_in_eeprom_bits - Shift data bits in from the EEPROM * @hw: pointer to hardware structure + * @count: number of bits to shift **/ static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count) { @@ -2157,7 +2158,7 @@ static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw /** * ixgbe_lower_eeprom_clk - Lowers the EEPROM's clock input. * @hw: pointer to hardware structure - * @eecd: EECD's current value + * @eec: EEC's current value **/ static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) { @@ -2537,6 +2538,7 @@ s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) * ixgbe_add_uc_addr - Adds a secondary unicast address. * @hw: pointer to hardware structure * @addr: new address + * @vmdq: VMDq "set" or "pool" index * * Adds it to unused receive address register or goes into promiscuous mode. **/ @@ -2681,7 +2683,7 @@ static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *m /** * ixgbe_set_mta - Set bit-vector in multicast table * @hw: pointer to hardware structure - * @hash_value: Multicast address hash value + * @mc_addr: Multicast address * * Sets the bit-vector in the multicast table. **/ @@ -3385,6 +3387,7 @@ s32 ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw /** * prot_autoc_read_generic - Hides MAC differences needed for AUTOC read * @hw: pointer to hardware structure + * @locked: bool to indicate whether the SW/FW lock was taken * @reg_val: Value we read from AUTOC * * The default case requires no protection so just to the register read. @@ -3911,7 +3914,10 @@ s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw) * ixgbe_find_vlvf_slot - find the vlanid or the first empty slot * @hw: pointer to hardware structure * @vlan: VLAN id to write to VLAN filter + * @vlvf_bypass: TRUE to find vlanid only, FALSE returns first empty slot if + * vlanid not found * + * * return the VLVF index where this VLAN id should be placed * **/ @@ -4253,9 +4259,8 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, case IXGBE_LINKS_SPEED_10_X550EM_A: *speed = IXGBE_LINK_SPEED_UNKNOWN; if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T || - hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) { + hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) *speed = IXGBE_LINK_SPEED_10_FULL; - } break; default: *speed = IXGBE_LINK_SPEED_UNKNOWN; @@ -4583,10 +4588,11 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 length, u32 timeout, bool return_data) { u32 hdr_size = sizeof(struct ixgbe_hic_hdr); - u16 dword_len; + struct ixgbe_hic_hdr *resp = (struct ixgbe_hic_hdr *)buffer; u16 buf_len; s32 status; u32 bi; + u32 dword_len; DEBUGFUNC("ixgbe_host_interface_command"); @@ -4616,8 +4622,23 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, IXGBE_LE32_TO_CPUS(&buffer[bi]); } - /* If there is any thing in data position pull it in */ - buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len; + /* + * If there is any thing in data position pull it in + * Read Flash command requires reading buffer length from + * two byes instead of one byte + */ + if (resp->cmd == 0x30) { + for (; bi < dword_len + 2; bi++) { + buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, + bi); + IXGBE_LE32_TO_CPUS(&buffer[bi]); + } + buf_len = (((u16)(resp->cmd_or_resp.ret_status) << 3) + & 0xF00) | resp->buf_len; + hdr_size += (2 << 2); + } else { + buf_len = resp->buf_len; + } if (!buf_len) goto rel_out; @@ -4649,6 +4670,8 @@ rel_out: * @min: driver version minor number * @build: driver version build number * @sub: driver version sub build number + * @len: unused + * @driver_ver: unused * * Sends driver version number to firmware through the manageability * block. On success return IXGBE_SUCCESS @@ -4675,10 +4698,10 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, fw_cmd.ver_build = build; fw_cmd.ver_sub = sub; fw_cmd.hdr.checksum = 0; - fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd, - (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); fw_cmd.pad = 0; fw_cmd.pad2 = 0; + fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd, + (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) { ret_val = ixgbe_host_interface_command(hw, (u32 *)&fw_cmd, @@ -5067,8 +5090,119 @@ s32 ixgbe_bypass_rd_eep_generic(struct ixgbe_hw *hw, u return IXGBE_SUCCESS; } +/** + * ixgbe_get_orom_version - Return option ROM from EEPROM + * + * @hw: pointer to hardware structure + * @nvm_ver: pointer to output structure + * + * if valid option ROM version, nvm_ver->or_valid set to TRUE + * else nvm_ver->or_valid is FALSE. + **/ +void ixgbe_get_orom_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver) +{ + u16 offset, eeprom_cfg_blkh, eeprom_cfg_blkl; + nvm_ver->or_valid = FALSE; + /* Option Rom may or may not be present. Start with pointer */ + hw->eeprom.ops.read(hw, NVM_OROM_OFFSET, &offset); + + /* make sure offset is valid */ + if ((offset == 0x0) || (offset == NVM_INVALID_PTR)) + return; + + hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_HI, &eeprom_cfg_blkh); + hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_LOW, &eeprom_cfg_blkl); + + /* option rom exists and is valid */ + if ((eeprom_cfg_blkl | eeprom_cfg_blkh) == 0x0 || + eeprom_cfg_blkl == NVM_VER_INVALID || + eeprom_cfg_blkh == NVM_VER_INVALID) + return; + + nvm_ver->or_valid = TRUE; + nvm_ver->or_major = eeprom_cfg_blkl >> NVM_OROM_SHIFT; + nvm_ver->or_build = (eeprom_cfg_blkl << NVM_OROM_SHIFT) | + (eeprom_cfg_blkh >> NVM_OROM_SHIFT); + nvm_ver->or_patch = eeprom_cfg_blkh & NVM_OROM_PATCH_MASK; +} + /** + * ixgbe_get_oem_prod_version - Return OEM Product version + * + * @hw: pointer to hardware structure + * @nvm_ver: pointer to output structure + * + * if valid OEM product version, nvm_ver->oem_valid set to TRUE + * else nvm_ver->oem_valid is FALSE. + **/ +void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver) +{ + u16 rel_num, prod_ver, mod_len, cap, offset; + + nvm_ver->oem_valid = FALSE; + hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, &offset); + + /* Return is offset to OEM Product Version block is invalid */ + if (offset == 0x0 && offset == NVM_INVALID_PTR) + return; + + /* Read product version block */ + hw->eeprom.ops.read(hw, offset, &mod_len); + hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_CAP_OFF, &cap); + + /* Return if OEM product version block is invalid */ + if (mod_len != NVM_OEM_PROD_VER_MOD_LEN || + (cap & NVM_OEM_PROD_VER_CAP_MASK) != 0x0) + return; + + hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_L, &prod_ver); + hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_H, &rel_num); + + /* Return if version is invalid */ + if ((rel_num | prod_ver) == 0x0 || + rel_num == NVM_VER_INVALID || prod_ver == NVM_VER_INVALID) + return; + + nvm_ver->oem_major = prod_ver >> NVM_VER_SHIFT; + nvm_ver->oem_minor = prod_ver & NVM_VER_MASK; + nvm_ver->oem_release = rel_num; + nvm_ver->oem_valid = TRUE; +} + +/** + * ixgbe_get_etk_id - Return Etrack ID from EEPROM + * + * @hw: pointer to hardware structure + * @nvm_ver: pointer to output structure + * + * word read errors will return 0xFFFF + **/ +void ixgbe_get_etk_id(struct ixgbe_hw *hw, struct ixgbe_nvm_version *nvm_ver) +{ + u16 etk_id_l, etk_id_h; + + if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_LOW, &etk_id_l)) + etk_id_l = NVM_VER_INVALID; + if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_HI, &etk_id_h)) + etk_id_h = NVM_VER_INVALID; + + /* The word order for the version format is determined by high order + * word bit 15. + */ + if ((etk_id_h & NVM_ETK_VALID) == 0) { + nvm_ver->etk_id = etk_id_h; + nvm_ver->etk_id |= (etk_id_l << NVM_ETK_SHIFT); + } else { + nvm_ver->etk_id = etk_id_l; + nvm_ver->etk_id |= (etk_id_h << NVM_ETK_SHIFT); + } +} + + +/** * ixgbe_dcb_get_rtrup2tc_generic - read rtrup2tc reg * @hw: pointer to hardware structure * @map: pointer to u8 arr for returning map @@ -5138,8 +5272,8 @@ bool ixgbe_mng_present(struct ixgbe_hw *hw) return FALSE; fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM_BY_MAC(hw)); - fwsm &= IXGBE_FWSM_MODE_MASK; - return fwsm == IXGBE_FWSM_FW_MODE_PT; + + return !!(fwsm & IXGBE_FWSM_FW_MODE_PT); } /** Modified: head/sys/dev/ixgbe/ixgbe_common.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe_common.h Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_common.h Mon Mar 19 20:55:05 2018 (r331224) @@ -180,6 +180,12 @@ extern void ixgbe_stop_mac_link_on_d3_82599(struct ixg bool ixgbe_mng_present(struct ixgbe_hw *hw); bool ixgbe_mng_enabled(struct ixgbe_hw *hw); + +void ixgbe_get_etk_id(struct ixgbe_hw *hw, struct ixgbe_nvm_version *nvm_ver); +void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver); +void ixgbe_get_orom_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver); void ixgbe_disable_rx_generic(struct ixgbe_hw *hw); void ixgbe_enable_rx_generic(struct ixgbe_hw *hw); s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, Modified: head/sys/dev/ixgbe/ixgbe_dcb.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_dcb.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_dcb.c Mon Mar 19 20:55:05 2018 (r331224) @@ -45,6 +45,10 @@ * are the smallest unit programmable into the underlying * hardware. The IEEE 802.1Qaz specification do not use bandwidth * groups so this is much simplified from the CEE case. + * @bw: bandwidth index by traffic class + * @refill: refill credits index by traffic class + * @max: max credits by traffic class + * @max_frame_size: maximum frame size */ s32 ixgbe_dcb_calculate_tc_credits(u8 *bw, u16 *refill, u16 *max, int max_frame_size) @@ -79,8 +83,10 @@ s32 ixgbe_dcb_calculate_tc_credits(u8 *bw, u16 *refill /** * ixgbe_dcb_calculate_tc_credits_cee - Calculates traffic class credits - * @ixgbe_dcb_config: Struct containing DCB settings. - * @direction: Configuring either Tx or Rx. + * @hw: pointer to hardware structure + * @dcb_config: Struct containing DCB settings + * @max_frame_size: Maximum frame size + * @direction: Configuring either Tx or Rx * * This function calculates the credits allocated to each traffic class. * It should be called only after the rules are checked by Modified: head/sys/dev/ixgbe/ixgbe_dcb_82598.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_dcb_82598.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_dcb_82598.c Mon Mar 19 20:55:05 2018 (r331224) @@ -112,7 +112,9 @@ s32 ixgbe_dcb_get_pfc_stats_82598(struct ixgbe_hw *hw, /** * ixgbe_dcb_config_rx_arbiter_82598 - Config Rx data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Rx Data Arbiter and credits for each traffic class. */ @@ -167,7 +169,10 @@ s32 ixgbe_dcb_config_rx_arbiter_82598(struct ixgbe_hw /** * ixgbe_dcb_config_tx_desc_arbiter_82598 - Config Tx Desc. arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Tx Descriptor Arbiter and credits for each traffic class. */ @@ -211,7 +216,10 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgb /** * ixgbe_dcb_config_tx_data_arbiter_82598 - Config Tx data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Tx Data Arbiter and credits for each traffic class. */ @@ -256,7 +264,7 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82598(struct ixgb /** * ixgbe_dcb_config_pfc_82598 - Config priority flow control * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @pfc_en: enabled pfc bitmask * * Configure Priority Flow Control for each traffic class. */ @@ -340,7 +348,11 @@ s32 ixgbe_dcb_config_tc_stats_82598(struct ixgbe_hw *h /** * ixgbe_dcb_hw_config_82598 - Config and enable DCB * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @link_speed: unused + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure dcb settings and enable dcb mode. */ Modified: head/sys/dev/ixgbe/ixgbe_dcb_82599.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_dcb_82599.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_dcb_82599.c Mon Mar 19 20:55:05 2018 (r331224) @@ -111,7 +111,11 @@ s32 ixgbe_dcb_get_pfc_stats_82599(struct ixgbe_hw *hw, /** * ixgbe_dcb_config_rx_arbiter_82599 - Config Rx Data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class + * @map: priority to tc assignments indexed by priority * * Configure Rx Packet Arbiter and credits for each traffic class. */ @@ -170,7 +174,10 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw /** * ixgbe_dcb_config_tx_desc_arbiter_82599 - Config Tx Desc. arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Tx Descriptor Arbiter and credits for each traffic class. */ @@ -215,7 +222,11 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgb /** * ixgbe_dcb_config_tx_data_arbiter_82599 - Config Tx Data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class + * @map: priority to tc assignments indexed by priority * * Configure Tx Packet Arbiter and credits for each traffic class. */ @@ -363,6 +374,7 @@ s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, u8 /** * ixgbe_dcb_config_tc_stats_82599 - Config traffic class statistics * @hw: pointer to hardware structure + * @dcb_config: pointer to ixgbe_dcb_config structure * * Configure queue statistics registers, all queues belonging to same traffic * class uses a single set of queue statistics counters. @@ -573,7 +585,12 @@ s32 ixgbe_dcb_config_82599(struct ixgbe_hw *hw, /** * ixgbe_dcb_hw_config_82599 - Configure and enable DCB * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @link_speed: unused + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class + * @map: priority to tc assignments indexed by priority * * Configure dcb settings and enable dcb mode. */ Modified: head/sys/dev/ixgbe/ixgbe_phy.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_phy.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_phy.c Mon Mar 19 20:55:05 2018 (r331224) @@ -88,8 +88,8 @@ static s32 ixgbe_in_i2c_byte_ack(struct ixgbe_hw *hw, /** * ixgbe_ones_comp_byte_add - Perform one's complement addition - * @add1 - addend 1 - * @add2 - addend 2 + * @add1: addend 1 + * @add2: addend 2 * * Returns one's complement 8-bit sum. */ @@ -400,6 +400,7 @@ s32 ixgbe_check_reset_blocked(struct ixgbe_hw *hw) /** * ixgbe_validate_phy_addr - Determines phy address is valid * @hw: pointer to hardware structure + * @phy_addr: PHY address * **/ bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr) @@ -577,6 +578,7 @@ out: * the SWFW lock * @hw: pointer to hardware structure * @reg_addr: 32 bit address of PHY register to read + * @device_type: 5 bit device type * @phy_data: Pointer to read data from PHY register **/ s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, @@ -658,6 +660,7 @@ s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 re * using the SWFW lock - this function is needed in most cases * @hw: pointer to hardware structure * @reg_addr: 32 bit address of PHY register to read + * @device_type: 5 bit device type * @phy_data: Pointer to read data from PHY register **/ s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, @@ -874,6 +877,7 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw) * ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: unused **/ s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, ixgbe_link_speed speed, @@ -979,6 +983,8 @@ s32 ixgbe_get_copper_link_capabilities_generic(struct /** * ixgbe_check_phy_link_tnx - Determine link and speed status * @hw: pointer to hardware structure + * @speed: current link speed + * @link_up: TRUE is link is up, FALSE otherwise * * Reads the VS1 register to determine if link is up and the current speed for * the PHY. @@ -1934,7 +1940,7 @@ s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, * ixgbe_read_i2c_sff8472_generic - Reads 8 bit word over I2C interface * @hw: pointer to hardware structure * @byte_offset: byte offset at address 0xA2 - * @eeprom_data: value read + * @sff8472_data: value read * * Performs byte read operation to SFP module's SFF-8472 data over I2C **/ @@ -1983,6 +1989,7 @@ static bool ixgbe_is_sfp_probe(struct ixgbe_hw *hw, u8 * ixgbe_read_i2c_byte_generic_int - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * @lock: TRUE if to take and release semaphore * @@ -2074,6 +2081,7 @@ fail: * ixgbe_read_i2c_byte_generic - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * * Performs byte read operation to SFP module's EEPROM over I2C interface at @@ -2090,6 +2098,7 @@ s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u * ixgbe_read_i2c_byte_generic_unlocked - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * * Performs byte read operation to SFP module's EEPROM over I2C interface at @@ -2106,6 +2115,7 @@ s32 ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_ * ixgbe_write_i2c_byte_generic_int - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to write to * @data: value to write * @lock: TRUE if to take and release semaphore * @@ -2177,6 +2187,7 @@ fail: * ixgbe_write_i2c_byte_generic - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to write to * @data: value to write * * Performs byte write operation to SFP module's EEPROM over I2C interface at @@ -2193,6 +2204,7 @@ s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, * ixgbe_write_i2c_byte_generic_unlocked - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to write to * @data: value to write * * Performs byte write operation to SFP module's EEPROM over I2C interface at @@ -2575,6 +2587,7 @@ static bool ixgbe_get_i2c_data(struct ixgbe_hw *hw, u3 { u32 data_oe_bit = IXGBE_I2C_DATA_OE_N_EN_BY_MAC(hw); bool data; + UNREFERENCED_1PARAMETER(hw); DEBUGFUNC("ixgbe_get_i2c_data"); Modified: head/sys/dev/ixgbe/ixgbe_type.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe_type.h Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_type.h Mon Mar 19 20:55:05 2018 (r331224) @@ -274,7 +274,6 @@ #define IXGBE_I2C_BB_EN_X550 0x00000100 #define IXGBE_I2C_BB_EN_X550EM_x IXGBE_I2C_BB_EN_X550 #define IXGBE_I2C_BB_EN_X550EM_a IXGBE_I2C_BB_EN_X550 - #define IXGBE_I2C_BB_EN_BY_MAC(_hw) IXGBE_BY_MAC((_hw), I2C_BB_EN) #define IXGBE_I2C_CLK_OE_N_EN 0 @@ -286,6 +285,47 @@ #define IXGBE_I2C_CLOCK_STRETCHING_TIMEOUT 500 + +#define NVM_OROM_OFFSET 0x17 +#define NVM_OROM_BLK_LOW 0x83 +#define NVM_OROM_BLK_HI 0x84 +#define NVM_OROM_PATCH_MASK 0xFF +#define NVM_OROM_SHIFT 8 + +#define NVM_VER_MASK 0x00FF /* version mask */ +#define NVM_VER_SHIFT 8 /* version bit shift */ +#define NVM_OEM_PROD_VER_PTR 0x1B /* OEM Product version block pointer */ +#define NVM_OEM_PROD_VER_CAP_OFF 0x1 /* OEM Product version format offset */ +#define NVM_OEM_PROD_VER_OFF_L 0x2 /* OEM Product version offset low */ +#define NVM_OEM_PROD_VER_OFF_H 0x3 /* OEM Product version offset high */ +#define NVM_OEM_PROD_VER_CAP_MASK 0xF /* OEM Product version cap mask */ +#define NVM_OEM_PROD_VER_MOD_LEN 0x3 /* OEM Product version module length */ +#define NVM_ETK_OFF_LOW 0x2D /* version low order word */ +#define NVM_ETK_OFF_HI 0x2E /* version high order word */ +#define NVM_ETK_SHIFT 16 /* high version word shift */ +#define NVM_VER_INVALID 0xFFFF +#define NVM_ETK_VALID 0x8000 +#define NVM_INVALID_PTR 0xFFFF +#define NVM_VER_SIZE 32 /* version sting size */ + +struct ixgbe_nvm_version { + u32 etk_id; + u8 nvm_major; + u16 nvm_minor; + u8 nvm_id; + + bool oem_valid; + u8 oem_major; + u8 oem_minor; + u16 oem_release; + + bool or_valid; + u8 or_major; + u16 or_build; + u8 or_patch; + +}; + /* Interrupt Registers */ #define IXGBE_EICR 0x00800 #define IXGBE_EICS 0x00808 @@ -553,7 +593,6 @@ #define IXGBE_VXLANCTRL_VXLAN_UDPPORT_MASK 0x0000ffff /* VXLAN port */ #define IXGBE_VXLANCTRL_GENEVE_UDPPORT_MASK 0xffff0000 /* GENEVE port */ #define IXGBE_VXLANCTRL_ALL_UDPPORT_MASK 0xffffffff /* GENEVE/VXLAN */ - #define IXGBE_VXLANCTRL_GENEVE_UDPPORT_SHIFT 16 #define IXGBE_FHFT(_n) (0x09000 + ((_n) * 0x100)) /* Flex host filter table */ @@ -563,7 +602,6 @@ /* Four Flexible Filters are supported */ #define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4 - /* Six Flexible Filters are supported */ #define IXGBE_FLEXIBLE_FILTER_COUNT_MAX_6 6 /* Eight Flexible Filters are supported */ @@ -711,8 +749,6 @@ struct ixgbe_dmac_config { #define IXGBE_EEE_RX_LPI_STATUS 0x40000000 /* RX Link in LPI status */ #define IXGBE_EEE_TX_LPI_STATUS 0x80000000 /* TX Link in LPI status */ - - /* Security Control Registers */ #define IXGBE_SECTXCTRL 0x08800 #define IXGBE_SECTXSTAT 0x08804 @@ -850,7 +886,6 @@ struct ixgbe_dmac_config { #define IXGBE_RTTBCNRTT 0x05150 #define IXGBE_RTTBCNRD 0x0498C - /* FCoE DMA Context Registers */ /* FCoE Direct DMA Context */ #define IXGBE_FCDDC(_i, _j) (0x20000 + ((_i) * 0x4) + ((_j) * 0x10)) @@ -4274,7 +4309,6 @@ struct ixgbe_bypass_eeprom { #define BYPASS_LOG_EVENT_SHIFT 28 #define BYPASS_LOG_CLEAR_SHIFT 24 /* bit offset */ - #define IXGBE_FUSES0_GROUP(_i) (0x11158 + ((_i) * 4)) #define IXGBE_FUSES0_300MHZ (1 << 5) Modified: head/sys/dev/ixgbe/ixgbe_vf.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_vf.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_vf.c Mon Mar 19 20:55:05 2018 (r331224) @@ -376,6 +376,7 @@ s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u * @mc_addr_list: array of multicast addresses to program * @mc_addr_count: number of multicast addresses to program * @next: caller supplied function to return next address in list + * @clear: unused * * Updates the Multicast Table Array. **/ @@ -509,8 +510,9 @@ u32 ixgbe_get_num_of_rx_queues_vf(struct ixgbe_hw *hw) } /** - * ixgbe_get_mac_addr_vf - Read device MAC address - * @hw: pointer to the HW structure + * ixgbe_get_mac_addr_vf - Read device MAC address + * @hw: pointer to the HW structure + * @mac_addr: the MAC address **/ s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr) { @@ -556,7 +558,6 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 in * ixgbe_setup_mac_link_vf - Setup MAC link settings * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg: TRUE if autonegotiation enabled * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Set the link speed in the AUTOC register and restarts link. Modified: head/sys/dev/ixgbe/ixgbe_x540.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_x540.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_x540.c Mon Mar 19 20:55:05 2018 (r331224) @@ -785,6 +785,9 @@ s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, swmask |= swi2c_mask; fwmask |= swi2c_mask << 2; + if (hw->mac.type >= ixgbe_mac_X550) + timeout = 1000; + for (i = 0; i < timeout; i++) { /* SW NVM semaphore bit is used for access to all * SW_FW_SYNC bits (not just NVM) Modified: head/sys/dev/ixgbe/ixgbe_x550.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_x550.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_x550.c Mon Mar 19 20:55:05 2018 (r331224) @@ -337,98 +337,6 @@ static void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw) } /** - * ixgbe_read_phy_reg_mdi_22 - Read from a clause 22 PHY register without lock - * @hw: pointer to hardware structure - * @reg_addr: 32 bit address of PHY register to read - * @dev_type: always unused - * @phy_data: Pointer to read data from PHY register - */ -static s32 ixgbe_read_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr, - u32 dev_type, u16 *phy_data) -{ - u32 i, data, command; - UNREFERENCED_1PARAMETER(dev_type); - - /* Setup and write the read command */ - command = (reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) | - (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) | - IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_READ_AUTOINC | - IXGBE_MSCA_MDI_COMMAND; - - IXGBE_WRITE_REG(hw, IXGBE_MSCA, command); - - /* Check every 10 usec to see if the access completed. - * The MDI Command bit will clear when the operation is - * complete - */ - for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) { - usec_delay(10); - - command = IXGBE_READ_REG(hw, IXGBE_MSCA); - if (!(command & IXGBE_MSCA_MDI_COMMAND)) - break; - } - - if (command & IXGBE_MSCA_MDI_COMMAND) { - ERROR_REPORT1(IXGBE_ERROR_POLLING, - "PHY read command did not complete.\n"); - return IXGBE_ERR_PHY; - } - - /* Read operation is complete. Get the data from MSRWD */ - data = IXGBE_READ_REG(hw, IXGBE_MSRWD); - data >>= IXGBE_MSRWD_READ_DATA_SHIFT; - *phy_data = (u16)data; - - return IXGBE_SUCCESS; -} - -/** - * ixgbe_write_phy_reg_mdi_22 - Write to a clause 22 PHY register without lock - * @hw: pointer to hardware structure - * @reg_addr: 32 bit PHY register to write - * @dev_type: always unused - * @phy_data: Data to write to the PHY register - */ -static s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr, - u32 dev_type, u16 phy_data) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Mar 19 21:13:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89567F46B48; Mon, 19 Mar 2018 21:13:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C57585EAB; Mon, 19 Mar 2018 21:13:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3732313B5A; Mon, 19 Mar 2018 21:13:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JLDPr0033956; Mon, 19 Mar 2018 21:13:25 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JLDP85033955; Mon, 19 Mar 2018 21:13:25 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803192113.w2JLDP85033955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Mon, 19 Mar 2018 21:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331225 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 331225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 21:13:26 -0000 Author: kp Date: Mon Mar 19 21:13:25 2018 New Revision: 331225 URL: https://svnweb.freebsd.org/changeset/base/331225 Log: pf: Fix memory leak in DIOCRADDTABLES If a user attempts to add two tables with the same name the duplicate table will not be added, but we forgot to free the duplicate table, leaking memory. Ensure we free the duplicate table in the error path. Reported by: Coverity CID: 1382111 MFC after: 3 weeks Modified: head/sys/netpfil/pf/pf_table.c Modified: head/sys/netpfil/pf/pf_table.c ============================================================================== --- head/sys/netpfil/pf/pf_table.c Mon Mar 19 20:55:05 2018 (r331224) +++ head/sys/netpfil/pf/pf_table.c Mon Mar 19 21:13:25 2018 (r331225) @@ -1131,8 +1131,10 @@ pfr_add_tables(struct pfr_table *tbl, int size, int *n if (p == NULL) senderr(ENOMEM); SLIST_FOREACH(q, &addq, pfrkt_workq) { - if (!pfr_ktable_compare(p, q)) + if (!pfr_ktable_compare(p, q)) { + pfr_destroy_ktable(p, 0); goto _skip; + } } SLIST_INSERT_HEAD(&addq, p, pfrkt_workq); xadd++; From owner-svn-src-all@freebsd.org Mon Mar 19 21:26:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8373F4AA54; Mon, 19 Mar 2018 21:26: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56ABD866FB; Mon, 19 Mar 2018 21:26:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5193113CD4; Mon, 19 Mar 2018 21:26:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JLQX0T039362; Mon, 19 Mar 2018 21:26:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JLQW0N039356; Mon, 19 Mar 2018 21:26:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803192126.w2JLQW0N039356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Mar 2018 21:26:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 21:26:33 -0000 Author: emaste Date: Mon Mar 19 21:26:32 2018 New Revision: 331226 URL: https://svnweb.freebsd.org/changeset/base/331226 Log: Rename linuxulator functions with linux_ prefix It's preferable to have a consistent prefix. This also reduces differences between the three linux*_sysvec.c files. Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) @@ -119,14 +119,14 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static register_t * linux_copyout_strings(struct image_params *imgp); -static int elf_linux_fixup(register_t **stack_base, +static int linux_elf_fixup(register_t **stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); -static int exec_linux_imgact_try(struct image_params *iparams); +static int linux_exec_imgact_try(struct image_params *iparams); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static int linux_vsyscall(struct thread *td); @@ -180,7 +180,7 @@ LINUX_VDSO_SYM_CHAR(linux_platform); * MPSAFE */ static int -translate_traps(int signal, int trap_code) +linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) @@ -245,7 +245,7 @@ linux_set_syscall_retval(struct thread *td, int error) } static int -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) { Elf_Auxargs *args; Elf_Addr *base; @@ -258,7 +258,7 @@ elf_linux_fixup(register_t **stack_base, struct image_ arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; KASSERT(curthread->td_proc == imgp->proc, - ("unsafe elf_linux_fixup(), should be curproc")); + ("unsafe linux_fixup_elf(), should be curproc")); base = (Elf64_Addr *)*stack_base; args = (Elf64_Auxargs *)imgp->auxargs; pos = base + (imgp->args->argc + imgp->args->envc + 2); @@ -671,7 +671,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse * binary is doing the exec, so we do not create an EXEC module for it. */ static int -exec_linux_imgact_try(struct image_params *imgp) +linux_exec_imgact_try(struct image_params *imgp) { const char *head = (const char *)imgp->image_header; char *rpath; @@ -753,14 +753,14 @@ struct sysentvec elf_linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, - .sv_fixup = elf_linux_fixup, + .sv_transtrap = linux_translate_traps, + .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_rt_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux ELF64", .sv_coredump = elf64_coredump, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/amd64/linux32/linux.h Mon Mar 19 21:26:32 2018 (r331226) @@ -116,7 +116,7 @@ typedef struct { */ #define LINUX_AT_COUNT 20 /* Count of used aux entry types. * Keep this synchronized with - * elf_linux_fixup() code. + * linux_fixup_elf() code. */ struct l___sysctl_args { Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) @@ -120,12 +120,12 @@ extern struct sysent linux32_sysent[LINUX32_SYS_MAXSYS SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -static int elf_linux_fixup(register_t **stack_base, +static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static register_t *linux_copyout_strings(struct image_params *imgp); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static int exec_linux_imgact_try(struct image_params *iparams); -static void exec_linux_setregs(struct thread *td, +static int linux_exec_imgact_try(struct image_params *iparams); +static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static void linux32_fixlimit(struct rlimit *rl, int which); static bool linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -190,7 +190,7 @@ LINUX_VDSO_SYM_CHAR(linux_platform); * MPSAFE */ static int -translate_traps(int signal, int trap_code) +linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) return signal; @@ -206,7 +206,7 @@ translate_traps(int signal, int trap_code) } static int -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) { Elf32_Auxargs *args; Elf32_Addr *base; @@ -217,7 +217,7 @@ elf_linux_fixup(register_t **stack_base, struct image_ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; KASSERT(curthread->td_proc == imgp->proc, - ("unsafe elf_linux_fixup(), should be curproc")); + ("unsafe linux_fixup_elf(), should be curproc")); base = (Elf32_Addr *)*stack_base; args = (Elf32_Auxargs *)imgp->auxargs; pos = base + (imgp->args->argc + imgp->args->envc + 2); @@ -724,7 +724,7 @@ linux32_fetch_syscall_args(struct thread *td) * binary is doing the exec, so we do not create an EXEC module for it. */ static int -exec_linux_imgact_try(struct image_params *imgp) +linux_exec_imgact_try(struct image_params *imgp) { const char *head = (const char *)imgp->image_header; char *rpath; @@ -758,7 +758,7 @@ exec_linux_imgact_try(struct image_params *imgp) * XXX copied from ia32_signal.c. */ static void -exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack) +linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -953,14 +953,14 @@ struct sysentvec elf_linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, - .sv_fixup = elf_linux_fixup, + .sv_transtrap = linux_translate_traps, + .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux32_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux ELF32", .sv_coredump = elf32_coredump, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, @@ -969,7 +969,7 @@ struct sysentvec elf_linux_sysvec = { .sv_psstrings = LINUX32_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = linux_copyout_strings, - .sv_setregs = exec_linux_setregs, + .sv_setregs = linux_exec_setregs, .sv_fixlimit = linux32_fixlimit, .sv_maxssiz = &linux32_maxssiz, .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 | SV_SHP, Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/i386/linux/linux.h Mon Mar 19 21:26:32 2018 (r331226) @@ -110,7 +110,7 @@ typedef struct { */ #define LINUX_AT_COUNT 20 /* Count of used aux entry types. * Keep this synchronized with - * elf_linux_fixup() code. + * linux_fixup_elf() code. */ struct l___sysctl_args { Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/i386/linux/linux_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) @@ -109,11 +109,11 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioct static int linux_fixup(register_t **stack_base, struct image_params *iparams); -static int elf_linux_fixup(register_t **stack_base, +static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static int exec_linux_imgact_try(struct image_params *iparams); -static void exec_linux_setregs(struct thread *td, +static int linux_exec_imgact_try(struct image_params *iparams); +static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static register_t *linux_copyout_strings(struct image_params *imgp); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -177,7 +177,7 @@ LINUX_VDSO_SYM_INTPTR(linux_vsyscall); * MPSAFE */ static int -translate_traps(int signal, int trap_code) +linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) return (signal); @@ -209,7 +209,7 @@ linux_fixup(register_t **stack_base, struct image_para } static int -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) { struct proc *p; Elf32_Auxargs *args; @@ -219,7 +219,7 @@ elf_linux_fixup(register_t **stack_base, struct image_ int issetugid; KASSERT(curthread->td_proc == imgp->proc, - ("unsafe elf_linux_fixup(), should be curproc")); + ("unsafe linux_fixup_elf(), should be curproc")); p = imgp->proc; issetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0; @@ -821,7 +821,7 @@ linux_fetch_syscall_args(struct thread *td) * binary is doing the exec, so we do not create an EXEC module for it. */ static int -exec_linux_imgact_try(struct image_params *imgp) +linux_exec_imgact_try(struct image_params *imgp) { const char *head = (const char *)imgp->image_header; char *rpath; @@ -856,7 +856,7 @@ exec_linux_imgact_try(struct image_params *imgp) * override the exec_setregs default(s) here. */ static void -exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack) +linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct pcb *pcb = td->td_pcb; @@ -894,14 +894,14 @@ struct sysentvec linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, + .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup, .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux a.out", .sv_coredump = NULL, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, @@ -910,7 +910,7 @@ struct sysentvec linux_sysvec = { .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = exec_copyout_strings, - .sv_setregs = exec_linux_setregs, + .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32, @@ -931,14 +931,14 @@ struct sysentvec elf_linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, - .sv_fixup = elf_linux_fixup, + .sv_transtrap = linux_translate_traps, + .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux ELF", .sv_coredump = elf32_coredump, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, @@ -947,7 +947,7 @@ struct sysentvec elf_linux_sysvec = { .sv_psstrings = LINUX_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = linux_copyout_strings, - .sv_setregs = exec_linux_setregs, + .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 | SV_SHP, From owner-svn-src-all@freebsd.org Mon Mar 19 21:32:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28817F4B2D7; Mon, 19 Mar 2018 21:32:44 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B1F2186D83; Mon, 19 Mar 2018 21:32:43 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x234.google.com with SMTP id y20-v6so12092726itc.5; Mon, 19 Mar 2018 14:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=GWqjTlj7+CLLF7JZ8BVMglGqb9HMOR5aOazEYobe66E=; b=AJu9wen5nJzjq0EIIDQOd8sqQrU+ni+cQLtXm/Zc5jUnO+egDTeio5M1UfrxwN2I+O rndznF083dX0OsshRuaw55LKrsYn7dliWy6BV05tTOW23XyDU/DRHlMAX29JW83GTu5i bYSOXrvt8dszkrGBwKVHgmUeuWmX7Obg+OEdeYLk35AYcNuZ7Zv9qMY3GS0GheeISuRr CmqGQVVOt5MWmLqchJdNTUJT3jcPAewCtgq9i+E+BbmSzwssvLrWyZ1GJCxhkIi3N69D wSJmTvdb1uxG0iIccBn3zCsynbL64ezEvOJbDLCQl9RUY2E2qomIfeff1IWWs80ZgT9K WlYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=GWqjTlj7+CLLF7JZ8BVMglGqb9HMOR5aOazEYobe66E=; b=K+c+uhch9vZ8ApKqE/6D4Dc9wIWGfKlHYbW1RXXvgkOiL4CEAuisGRVjWXr/5XOk7Y 8GBksA/o01YdRJTjkSt5DGWVKUdkhdq1IoieN+0MTiHPN0jP0tC4SEsmDo5ZSMSCAab7 CuMTQgK0Sj/jzduC6H5i95tul1NB39lhD8gDknRSVTxyW44E//mc/EZVq8w3qUBzbl22 4LswSQWQUu+ncl7847PPvdvqKpXyDTBOv2YCmjGXe4XtUwhkCFVUE9GUVW0wfN716BcA PZSUBj3FJ8VDIHq8Qav824bT7/SDhSdyrnm5wWtZc1CaZgPQvJ3gpXs6206jI9Qm5Wi6 VlIQ== X-Gm-Message-State: AElRT7EILdmgRu+xHmqraaTn0di+y6OWOn3zqav4c+R886YRREaL++ii O7cHEpIIcKUwUXxFYX0T5aw/W5bv88KG6vb2ogWcOQ== X-Google-Smtp-Source: AG47ELv3pIujZ2RglMkpphkGFCAcYbFYj/nnBLWc8TLjgny9sfRhjISbpuC6obonZBcBK3JQmniNxv1Vuif7Z+T2Ers= X-Received: by 2002:a24:7c6:: with SMTP id f189-v6mr334724itf.114.1521495162730; Mon, 19 Mar 2018 14:32:42 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Mon, 19 Mar 2018 14:32:22 -0700 (PDT) In-Reply-To: <1806390.PUHUxB7aSs@ralph.baldwin.cx> References: <201803161451.w2GEpl3T053141@repo.freebsd.org> <1806390.PUHUxB7aSs@ralph.baldwin.cx> From: Ed Maste Date: Mon, 19 Mar 2018 17:32:22 -0400 X-Google-Sender-Auth: KAvOUy35hpxRfThy7yor2V2eQrU Message-ID: Subject: Re: svn commit: r331057 - head/sys/compat/linux To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 21:32:44 -0000 On 16 March 2018 at 17:08, John Baldwin wrote: > On Friday, March 16, 2018 02:51:47 PM Ed Maste wrote: >> Author: emaste >> Date: Fri Mar 16 14:51:47 2018 >> New Revision: 331057 >> URL: https://svnweb.freebsd.org/changeset/base/331057 >> >> Log: >> linux_errno.c: add newer errno values > > Could you move the table to a header perhaps so it can also be shared > with lib/libsysdecode/errno.c (which has another copy of this table)? I found that copy shortly after I made this change (and then updated it to match). We could just add linux_errno.c to libsysdecode though? From owner-svn-src-all@freebsd.org Mon Mar 19 22:43:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E3C7F50575; Mon, 19 Mar 2018 22:43:28 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DB9A69FDE; Mon, 19 Mar 2018 22:43:28 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47B4D1491D; Mon, 19 Mar 2018 22:43:28 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JMhSaU079313; Mon, 19 Mar 2018 22:43:28 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JMhS6N079312; Mon, 19 Mar 2018 22:43:28 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201803192243.w2JMhS6N079312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Mon, 19 Mar 2018 22:43:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331227 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 22:43:28 -0000 Author: mjoras Date: Mon Mar 19 22:43:27 2018 New Revision: 331227 URL: https://svnweb.freebsd.org/changeset/base/331227 Log: Fix initialization of eventhandler mutex. mtx_init does not do a copy of the name string it is passed. The eventhandler code incorrectly passed the parameter string directly to mtx_init instead of using the copy it makes. This was an existing problem with the code that I dutifully copied over in my changes in r325621. Reported by: Anton Rang Reviewed by: rstone, markj Approved by: rstone (mentor) MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14764 Modified: head/sys/kern/subr_eventhandler.c Modified: head/sys/kern/subr_eventhandler.c ============================================================================== --- head/sys/kern/subr_eventhandler.c Mon Mar 19 21:26:32 2018 (r331226) +++ head/sys/kern/subr_eventhandler.c Mon Mar 19 22:43:27 2018 (r331227) @@ -90,9 +90,10 @@ eventhandler_find_or_create_list(const char *name) CTR2(KTR_EVH, "%s: creating list \"%s\"", __func__, name); list = new_list; TAILQ_INIT(&list->el_entries); - mtx_init(&list->el_lock, name, "eventhandler list", MTX_DEF); list->el_name = (char *)(list + 1); strcpy(list->el_name, name); + mtx_init(&list->el_lock, list->el_name, "eventhandler list", + MTX_DEF); TAILQ_INSERT_HEAD(&eventhandler_lists, list, el_link); } } From owner-svn-src-all@freebsd.org Mon Mar 19 23:21:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77626F53398; Mon, 19 Mar 2018 23:21:46 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C96C6BC5A; Mon, 19 Mar 2018 23:21:46 +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 275E014F21; Mon, 19 Mar 2018 23:21:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JNLkY2097548; Mon, 19 Mar 2018 23:21:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JNLj7h097538; Mon, 19 Mar 2018 23:21:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803192321.w2JNLj7h097538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Mar 2018 23:21:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331228 - in head/sys/dev/mpr: . mpi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev/mpr: . mpi X-SVN-Commit-Revision: 331228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 23:21:46 -0000 Author: mav Date: Mon Mar 19 23:21:45 2018 New Revision: 331228 URL: https://svnweb.freebsd.org/changeset/base/331228 Log: Update mpr(4) driver from v15 to v18 from Broadcom site. Version 16 is just a number bump, since we already had those changes. Version 17 introduces new AdapterType value, that allows new user-space tools from Broadcom to differentiate adapter generations 3 and 3.5. Version 18 updates headers and adds SAS_DEVICE_DISCOVERY_ERROR reporting. MFC after: 2 weeks Modified: head/sys/dev/mpr/mpi/mpi2.h head/sys/dev/mpr/mpi/mpi2_cnfg.h head/sys/dev/mpr/mpi/mpi2_history.txt head/sys/dev/mpr/mpi/mpi2_ioc.h head/sys/dev/mpr/mpr_ioctl.h head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mpr/mpr_user.c head/sys/dev/mpr/mprvar.h Modified: head/sys/dev/mpr/mpi/mpi2.h ============================================================================== --- head/sys/dev/mpr/mpi/mpi2.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2.h Mon Mar 19 23:21:45 2018 (r331228) @@ -44,7 +44,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.46 + * mpi2.h Version: 02.00.48 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -151,6 +151,8 @@ * 04-10-16 02.00.44 Bumped MPI2_HEADER_VERSION_UNIT. * 07-06-16 02.00.45 Bumped MPI2_HEADER_VERSION_UNIT. * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. + * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- */ @@ -194,7 +196,7 @@ /* Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT (0x2E) +#define MPI2_HEADER_VERSION_UNIT (0x30) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) Modified: head/sys/dev/mpr/mpi/mpi2_cnfg.h ============================================================================== --- head/sys/dev/mpr/mpi/mpi2_cnfg.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2_cnfg.h Mon Mar 19 23:21:45 2018 (r331228) @@ -42,7 +42,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.39 + * mpi2_cnfg.h Version: 02.00.40 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -255,6 +255,10 @@ * 09-01-16 02.00.39 Added MPI26_CONFIG_PAGE_ENCLOSURE_0 and related defines. * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * 02-02-17 02.00.40 Added MPI2_MANPAGE7_SLOT_UNKNOWN. + * Added ChassisSlot field to SAS Enclosure Page 0. + * Added ChassisSlot Valid bit (bit 5) to the Flags field + * in SAS Enclosure Page 0. * -------------------------------------------------------------------------- */ @@ -853,6 +857,9 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_INFO #define MPI2_MANPAGE7_LOCATION_NOT_PRESENT (0x20) #define MPI2_MANPAGE7_LOCATION_NOT_CONNECTED (0x80) +/* defines for the Slot field */ +#define MPI2_MANPAGE7_SLOT_UNKNOWN (0xFFFF) + /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to * one and check the value returned for NumPhys at runtime. @@ -3092,11 +3099,11 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 U16 EnclosureHandle; /* 0x16 */ U16 NumSlots; /* 0x18 */ U16 StartSlot; /* 0x1A */ - U8 Reserved2; /* 0x1C */ + U8 ChassisSlot; /* 0x1C */ U8 EnclosureLevel; /* 0x1D */ U16 SEPDevHandle; /* 0x1E */ - U32 Reserved3; /* 0x20 */ - U32 Reserved4; /* 0x24 */ + U32 Reserved2; /* 0x20 */ + U32 Reserved3; /* 0x24 */ } MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, Mpi2SasEnclosurePage0_t, MPI2_POINTER pMpi2SasEnclosurePage0_t, @@ -3107,6 +3114,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI2_SASENCLOSURE0_PAGEVERSION (0x04) /* values for SAS Enclosure Page 0 Flags field */ +#define MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI2_SAS_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI2_SAS_ENCLS0_FLAGS_MNG_MASK (0x000F) #define MPI2_SAS_ENCLS0_FLAGS_MNG_UNKNOWN (0x0000) @@ -3119,6 +3127,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI26_ENCLOSURE0_PAGEVERSION (0x04) /* Values for Enclosure Page 0 Flags field */ +#define MPI26_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI26_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI26_ENCLS0_FLAGS_MNG_MASK (0x000F) #define MPI26_ENCLS0_FLAGS_MNG_UNKNOWN (0x0000) Modified: head/sys/dev/mpr/mpi/mpi2_history.txt ============================================================================== --- head/sys/dev/mpr/mpi/mpi2_history.txt Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2_history.txt Mon Mar 19 23:21:45 2018 (r331228) @@ -41,16 +41,16 @@ All rights reserved. --------------------------------------- - Header Set Release Version: 02.00.46 - Header Set Release Date: 09-07-16 + Header Set Release Version: 02.00.48 + Header Set Release Date: 02-03-17 --------------------------------------- Filename Current version Prior version ---------- --------------- ------------- - mpi2.h 02.00.46 02.00.45 - mpi2_cnfg.h 02.00.39 02.00.38 + mpi2.h 02.00.48 02.00.47 + mpi2_cnfg.h 02.00.40 02.00.39 mpi2_init.h 02.00.21 02.00.21 - mpi2_ioc.h 02.00.30 02.00.29 + mpi2_ioc.h 02.00.32 02.00.31 mpi2_raid.h 02.00.11 02.00.11 mpi2_sas.h 02.00.10 02.00.10 mpi2_targ.h 02.00.09 02.00.09 @@ -59,7 +59,7 @@ mpi2_ra.h 02.00.01 02.00.01 mpi2_hbd.h 02.00.04 02.00.04 mpi2_pci.h 02.00.02 02.00.02 - mpi2_history.txt 02.00.43 02.00.43 + mpi2_history.txt 02.00.45 02.00.44 * Date Version Description @@ -161,6 +161,8 @@ mpi2.h * 04-10-16 02.00.44 Bumped MPI2_HEADER_VERSION_UNIT. * 07-06-16 02.00.45 Bumped MPI2_HEADER_VERSION_UNIT. * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. + * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- mpi2_cnfg.h @@ -363,8 +365,12 @@ mpi2_cnfg.h * phy data. * Added InitStatus to PCIe IO Unit Page 1 header. * 09-01-16 02.00.39 Added MPI26_CONFIG_PAGE_ENCLOSURE_0 and related defines. - * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and - * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and + * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * 02-02-17 02.00.40 Added MPI2_MANPAGE7_SLOT_UNKNOWN. + * Added ChassisSlot field to SAS Enclosure Page 0. + * Added ChassisSlot Valid bit (bit 5) to the Flags field + * in SAS Enclosure Page 0. * -------------------------------------------------------------------------- mpi2_init.h @@ -551,10 +557,15 @@ mpi2_ioc.h * Request Message. * Added new values for the RegionType field in the Layout * Data sections of the FLASH Layout Extended Image Data. - * Added new defines for the ReasonCode field of + * Added new defines for the ReasonCode field of * Active Cable Exception Event. - * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and - * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and + * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * 11-23-16 02.00.31 Added MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR and + * MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR. + * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. + * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related + * defines for the ReasonCode field. * -------------------------------------------------------------------------- mpi2_raid.h @@ -676,20 +687,35 @@ mpi2_pci.h mpi2_history.txt Parts list history -Filename 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 ----------- -------- -------- -------- -------- -------- -mpi2.h 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 -mpi2_cnfg.h 02.00.39 02.00.38 02.00.37 02.00.36 02.00.35 -mpi2_init.h 02.00.21 02.00.21 02.00.21 02.00.21 02.00.20 -mpi2_ioc.h 02.00.30 02.00.29 02.00.28 02.00.28 02.00.27 -mpi2_raid.h 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 -mpi2_sas.h 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 -mpi2_targ.h 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 -mpi2_tool.h 02.00.14 02.00.13 02.00.13 02.00.13 02.00.13 -mpi2_type.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 -mpi2_ra.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 -mpi2_hbd.h 02.00.04 02.00.04 02.00.04 02.00.04 02.00.03 -mpi2_pci.h 02.00.02 02.00.02 02.00.01 02.00.01 02.00.00 +Filename 02.00.48 +---------- -------- +mpi2.h 02.00.48 +mpi2_cnfg.h 02.00.40 +mpi2_init.h 02.00.21 +mpi2_ioc.h 02.00.32 +mpi2_raid.h 02.00.11 +mpi2_sas.h 02.00.10 +mpi2_targ.h 02.00.09 +mpi2_tool.h 02.00.14 +mpi2_type.h 02.00.01 +mpi2_ra.h 02.00.01 +mpi2_hbd.h 02.00.04 +mpi2_pci.h 02.00.02 + +Filename 02.00.47 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 +---------- -------- -------- -------- -------- -------- -------- +mpi2.h 02.00.47 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 +mpi2_cnfg.h 02.00.39 02.00.39 02.00.38 02.00.37 02.00.36 02.00.35 +mpi2_init.h 02.00.21 02.00.21 02.00.21 02.00.21 02.00.21 02.00.20 +mpi2_ioc.h 02.00.31 02.00.30 02.00.29 02.00.28 02.00.28 02.00.27 +mpi2_raid.h 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 +mpi2_sas.h 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 +mpi2_targ.h 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 +mpi2_tool.h 02.00.14 02.00.14 02.00.13 02.00.13 02.00.13 02.00.13 +mpi2_type.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 +mpi2_ra.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 +mpi2_hbd.h 02.00.04 02.00.04 02.00.04 02.00.04 02.00.04 02.00.03 +mpi2_pci.h 02.00.02 02.00.02 02.00.02 02.00.01 02.00.01 02.00.00 Filename 02.00.41 02.00.40 02.00.39 02.00.38 02.00.37 02.00.36 ---------- -------- -------- -------- -------- -------- -------- Modified: head/sys/dev/mpr/mpi/mpi2_ioc.h ============================================================================== --- head/sys/dev/mpr/mpi/mpi2_ioc.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2_ioc.h Mon Mar 19 23:21:45 2018 (r331228) @@ -42,7 +42,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: October 11, 2006 * - * mpi2_ioc.h Version: 02.00.30 + * mpi2_ioc.h Version: 02.00.32 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -200,6 +200,11 @@ * Active Cable Exception Event. * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * 11-23-16 02.00.31 Added MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR and + * MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR. + * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. + * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related + * defines for the ReasonCode field. * -------------------------------------------------------------------------- */ @@ -610,6 +615,7 @@ typedef struct _MPI2_EVENT_NOTIFICATION_REPLY #define MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST (0x0032) /* MPI v2.6 and later */ #define MPI2_EVENT_PCIE_LINK_COUNTER (0x0033) /* MPI v2.6 and later */ #define MPI2_EVENT_ACTIVE_CABLE_EXCEPTION (0x0034) /* MPI v2.6 and later */ +#define MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR (0x0035) /* MPI v2.5 and later */ #define MPI2_EVENT_MIN_PRODUCT_SPECIFIC (0x006E) #define MPI2_EVENT_MAX_PRODUCT_SPECIFIC (0x007F) @@ -715,12 +721,21 @@ typedef struct _MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT U8 ReasonCode; /* 0x04 */ U8 ReceptacleID; /* 0x05 */ U16 Reserved1; /* 0x06 */ -} MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, +} MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT, + MPI2_POINTER PTR_MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT, + Mpi25EventDataActiveCableExcept_t, + MPI2_POINTER pMpi25EventDataActiveCableExcept_t, + MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, MPI2_POINTER PTR_MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, Mpi26EventDataActiveCableExcept_t, MPI2_POINTER pMpi26EventDataActiveCableExcept_t; -/* defines for ReasonCode field */ +/* MPI2.5 defines for the ReasonCode field */ +#define MPI25_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00) +#define MPI25_EVENT_ACTIVE_CABLE_PRESENT (0x01) +#define MPI25_EVENT_ACTIVE_CABLE_DEGRADED (0x02) + +/* MPI2.6 defines for the ReasonCode field */ #define MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00) #define MPI26_EVENT_ACTIVE_CABLE_PRESENT (0x01) #define MPI26_EVENT_ACTIVE_CABLE_DEGRADED (0x02) @@ -1168,6 +1183,24 @@ typedef struct _MPI2_EVENT_DATA_SAS_QUIESCE #define MPI2_EVENT_SAS_QUIESCE_RC_COMPLETED (0x02) +typedef struct _MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR +{ + U16 DevHandle; /* 0x00 */ + U8 ReasonCode; /* 0x02 */ + U8 PhysicalPort; /* 0x03 */ + U32 Reserved1[2]; /* 0x04 */ + U64 SASAddress; /* 0x0C */ + U32 Reserved2[2]; /* 0x14 */ +} MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR, + MPI2_POINTER PTR_MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR, + Mpi25EventDataSasDeviceDiscoveryError_t, + MPI2_POINTER pMpi25EventDataSasDeviceDiscoveryError_t; + +/* SAS Device Discovery Error Event data ReasonCode values */ +#define MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED (0x01) +#define MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT (0x02) + + /* Host Based Discovery Phy Event data */ typedef struct _MPI2_EVENT_HBD_PHY_SAS @@ -1493,6 +1526,7 @@ typedef struct _MPI2_FW_DOWNLOAD_REQUEST #define MPI2_FW_DOWNLOAD_ITYPE_COMPLETE (0x0A) #define MPI2_FW_DOWNLOAD_ITYPE_COMMON_BOOT_BLOCK (0x0B) #define MPI2_FW_DOWNLOAD_ITYPE_PUBLIC_KEY (0x0C) /* MPI v2.5 and newer */ +#define MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP (0x0D) #define MPI2_FW_DOWNLOAD_ITYPE_SBR (0x0E) #define MPI2_FW_DOWNLOAD_ITYPE_SBR_BACKUP (0x0F) #define MPI2_FW_DOWNLOAD_ITYPE_HIIM (0x10) Modified: head/sys/dev/mpr/mpr_ioctl.h ============================================================================== --- head/sys/dev/mpr/mpr_ioctl.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_ioctl.h Mon Mar 19 23:21:45 2018 (r331228) @@ -149,6 +149,7 @@ typedef struct mpr_pci_bits * */ #define MPRIOCTL_ADAPTER_TYPE_SAS3 6 +#define MPRIOCTL_ADAPTER_TYPE_SAS35 7 typedef struct mpr_adapter_data { uint32_t StructureLength; @@ -202,7 +203,7 @@ typedef struct mpr_pass_thru /* * Event queue defines */ -#define MPR_EVENT_QUEUE_SIZE (50) /* Max Events stored in driver */ +#define MPR_EVENT_QUEUE_SIZE (200) /* Max Events stored in driver */ #define MPR_MAX_EVENT_DATA_LENGTH (48) /* Size of each event in Dwords */ typedef struct mpr_event_query Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_sas.c Mon Mar 19 23:21:45 2018 (r331228) @@ -708,6 +708,7 @@ mprsas_register_events(struct mpr_softc *sc) setbit(events, MPI2_EVENT_IR_PHYSICAL_DISK); setbit(events, MPI2_EVENT_IR_OPERATION_STATUS); setbit(events, MPI2_EVENT_TEMP_THRESHOLD); + setbit(events, MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR); if (sc->facts->MsgVersion >= MPI2_VERSION_02_06) { setbit(events, MPI2_EVENT_ACTIVE_CABLE_EXCEPTION); if (sc->mpr_flags & MPR_FLAGS_GEN35_IOC) { Modified: head/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- head/sys/dev/mpr/mpr_sas_lsi.c Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_sas_lsi.c Mon Mar 19 23:21:45 2018 (r331228) @@ -681,6 +681,41 @@ skip_fp_send: } break; } + case MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR: + { + pMpi25EventDataSasDeviceDiscoveryError_t discovery_error_data; + uint64_t sas_address; + + discovery_error_data = + (pMpi25EventDataSasDeviceDiscoveryError_t) + fw_event->event_data; + + sas_address = discovery_error_data->SASAddress.High; + sas_address = (sas_address << 32) | + discovery_error_data->SASAddress.Low; + + switch(discovery_error_data->ReasonCode) { + case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED: + { + mpr_printf(sc, "SMP command failed during discovery " + "for expander with SAS Address %jx and " + "handle 0x%x.\n", sas_address, + discovery_error_data->DevHandle); + break; + } + case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT: + { + mpr_printf(sc, "SMP command timed out during " + "discovery for expander with SAS Address %jx and " + "handle 0x%x.\n", sas_address, + discovery_error_data->DevHandle); + break; + } + default: + break; + } + break; + } case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST: { MPI26_EVENT_DATA_PCIE_TOPOLOGY_CHANGE_LIST *data; Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_user.c Mon Mar 19 23:21:45 2018 (r331228) @@ -1189,7 +1189,10 @@ mpr_user_get_adapter_data(struct mpr_softc *sc, mpr_ad /* * General device info. */ - data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS3; + if (sc->mpr_flags & MPR_FLAGS_GEN35_IOC) + data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS35; + else + data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS3; data->PCIDeviceHwId = pci_get_device(sc->mpr_dev); data->PCIDeviceHwRev = pci_read_config(sc->mpr_dev, PCIR_REVID, 1); data->SubSystemId = pci_get_subdevice(sc->mpr_dev); Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mprvar.h Mon Mar 19 23:21:45 2018 (r331228) @@ -33,7 +33,7 @@ #ifndef _MPRVAR_H #define _MPRVAR_H -#define MPR_DRIVER_VERSION "15.03.00.00-fbsd" +#define MPR_DRIVER_VERSION "18.03.00.00-fbsd" #define MPR_DB_MAX_WAIT 2500 From owner-svn-src-all@freebsd.org Mon Mar 19 23:53:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB068F55337; Mon, 19 Mar 2018 23:53:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f175.google.com (mail-io0-f175.google.com [209.85.223.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75AE96CE48; Mon, 19 Mar 2018 23:53:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f175.google.com with SMTP id m83so122462ioi.8; Mon, 19 Mar 2018 16:53:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=wGwQHXxcGE4+HoAtz+2nq9c6LcKsfj0dAqotas0GGSo=; b=jhutZ9ttU3tYL93b7qFthsKOhXTIErG7zmGDMvX0bxrEETnyJHt5VF2nvZajMbCai9 5VKasEI7k0oKNvULdrbGYrBJDf6WLqE1zjHkp+9kCKvv2tb3tCH1UN0/+pcvgX80+omr P1aPIvI3E/QsUnyY8u96oqMpIfedaBxSNc2y8PU4utV5MZyFXox4RaDFFwjI9WKQOWmD fhOrEpyUDt7pbNJAICkXWr19Yc+P73Ooxv2pV/g5kmNIObxPQ38vNeyN+t25RMiVWd7+ e7CN5lowpNAeOzg/GIW5VvgER2wf5CM/QmL4fHRNY449L5raICrMRfCQwpSLtb/+Cry+ Q0SA== X-Gm-Message-State: AElRT7HgZf7XoDw2wGX+q/mCTZPC4jY7WgsdzIvi2yhqLg/IQoGGZDC7 qNVb9Ssl25G3f5BVoxWhh96chFd+ X-Google-Smtp-Source: AG47ELuxUQAfIfIffPvKw/ERN/KqIDMIk9xRuGnHD5gZIcONTJe5OiY9qoP8YK7eXOo3Rb01J+dJ8Q== X-Received: by 10.107.136.202 with SMTP id s71mr14389413ioi.45.1521503237188; Mon, 19 Mar 2018 16:47:17 -0700 (PDT) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com. [209.85.214.50]) by smtp.gmail.com with ESMTPSA id h131-v6sm193219itc.12.2018.03.19.16.47.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 16:47:16 -0700 (PDT) Received: by mail-it0-f50.google.com with SMTP id v194-v6so128810itb.0; Mon, 19 Mar 2018 16:47:16 -0700 (PDT) X-Received: by 2002:a24:b145:: with SMTP id c5-v6mr686634itj.135.1521503236335; Mon, 19 Mar 2018 16:47:16 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Mon, 19 Mar 2018 16:47:15 -0700 (PDT) In-Reply-To: <201803192243.w2JMhS6N079312@repo.freebsd.org> References: <201803192243.w2JMhS6N079312@repo.freebsd.org> From: Conrad Meyer Date: Mon, 19 Mar 2018 16:47:15 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331227 - head/sys/kern To: Matt Joras Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 23:53:07 -0000 On Mon, Mar 19, 2018 at 3:43 PM, Matt Joras wrote: > Author: mjoras > Date: Mon Mar 19 22:43:27 2018 > New Revision: 331227 > URL: https://svnweb.freebsd.org/changeset/base/331227 > > Log: > Fix initialization of eventhandler mutex. > > mtx_init does not do a copy of the name string it is passed. The > eventhandler code incorrectly passed the parameter string directly to > mtx_init instead of using the copy it makes. This was an existing > problem with the code that I dutifully copied over in my changes in r325621. For those without context: The problem here is that the name string comes from rodata of whatever module *registers* an eventhandler listener, but isn't tied to the lifetime of that module. So for example, filemon.ko or hwpmc.ko. If those modules are subsequently unloaded, the kernel eventhandler lock lo_names continue to point to the (now stale) module memory, resulting in kernel page fault crashes if/when those names are eventually dereferenced (we hit it with "sysctl kern.proc.all" after one of those modules was unloaded). Best, Conrad From owner-svn-src-all@freebsd.org Tue Mar 20 00:03:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 992E9F56127; Tue, 20 Mar 2018 00:03:52 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C2F26D545; Tue, 20 Mar 2018 00:03:52 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 339391557D; Tue, 20 Mar 2018 00:03:52 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K03q54019054; Tue, 20 Mar 2018 00:03:52 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K03oxD019032; Tue, 20 Mar 2018 00:03:50 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201803200003.w2K03oxD019032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 20 Mar 2018 00:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331229 - in head/sys: arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/freescale arm/freescale/vybrid arm/mv arm/samsung/exynos arm/ti/am335x dev/fdt dev/ofw dev/ow de... X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/freescale arm/freescale/vybrid arm/mv arm/samsung/exynos arm/ti/am335x dev/fdt dev/ofw dev/ow dev/vnic powerpc/cpufreq po... X-SVN-Commit-Revision: 331229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 00:03:52 -0000 Author: gonzo Date: Tue Mar 20 00:03:49 2018 New Revision: 331229 URL: https://svnweb.freebsd.org/changeset/base/331229 Log: [ofw] fix errneous checks for OF_finddevice(9) return value OF_finddevices returns ((phandle_t)-1) in case of failure. Some code in existing drivers checked return value to be equal to 0 or less/equal to 0 which is also wrong because phandle_t is unsigned type. Most of these checks were for negative cases that were never triggered so trhere was no impact on functionality. Reviewed by: nwhitehorn MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14645 Modified: head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c head/sys/arm/amlogic/aml8726/aml8726_mp.c head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c head/sys/arm/annapurna/alpine/alpine_machdep.c head/sys/arm/broadcom/bcm2835/bcm2835_fb.c head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c head/sys/arm/freescale/fsl_ocotp.c head/sys/arm/freescale/vybrid/vf_machdep.c head/sys/arm/mv/mv_common.c head/sys/arm/samsung/exynos/chrome_ec.c head/sys/arm/samsung/exynos/exynos5_ehci.c head/sys/arm/ti/am335x/am335x_lcd.c head/sys/arm/ti/am335x/am335x_lcd_syscons.c head/sys/dev/fdt/fdt_common.c head/sys/dev/ofw/ofw_subr.c head/sys/dev/ofw/openfirmio.c head/sys/dev/ow/owc_gpiobus.c head/sys/dev/vnic/thunder_bgx_fdt.c head/sys/powerpc/cpufreq/mpc85xx_jog.c head/sys/powerpc/pseries/platform_chrp.c Modified: head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c Tue Mar 20 00:03:49 2018 (r331229) @@ -255,14 +255,14 @@ aml8726_clkmsr_bus_frequency() * Try to access the clkmsr node directly i.e. through /aliases/. */ - if ((node = OF_finddevice("clkmsr")) != 0) + if ((node = OF_finddevice("clkmsr")) != -1) if (fdt_is_compatible_strict(node, "amlogic,aml8726-clkmsr")) goto moveon; /* * Find the node the long way. */ - if ((node = OF_finddevice("/soc")) == 0) + if ((node = OF_finddevice("/soc")) == -1) return (0); if ((node = fdt_find_compatible(node, Modified: head/sys/arm/amlogic/aml8726/aml8726_mp.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_mp.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/amlogic/aml8726/aml8726_mp.c Tue Mar 20 00:03:49 2018 (r331229) @@ -178,7 +178,7 @@ find_node_for_device(const char *device, const char ** * Try to access the node directly i.e. through /aliases/. */ - if ((node = OF_finddevice(device)) != 0) + if ((node = OF_finddevice(device)) != -1) for (i = 0; compatible[i]; i++) if (fdt_is_compatible_strict(node, compatible[i])) return node; @@ -188,7 +188,7 @@ find_node_for_device(const char *device, const char ** */ for (i = 0; compatible[i]; i++) { - if ((node = OF_finddevice("/soc")) == 0) + if ((node = OF_finddevice("/soc")) == -1) return (0); if ((node = fdt_find_compatible(node, compatible[i], 1)) != 0) Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Tue Mar 20 00:03:49 2018 (r331229) @@ -117,7 +117,7 @@ aml8726_usb_phy_mode(const char *dwcotg_path, uint32_t phandle_t node; ssize_t len; - if ((node = OF_finddevice(dwcotg_path)) == 0) + if ((node = OF_finddevice(dwcotg_path)) == -1) return (ENXIO); if (fdt_is_compatible_strict(node, "synopsys,designware-hs-otg2") == 0) Modified: head/sys/arm/annapurna/alpine/alpine_machdep.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_machdep.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/annapurna/alpine/alpine_machdep.c Tue Mar 20 00:03:49 2018 (r331229) @@ -71,7 +71,7 @@ alpine_get_devmap_base(bus_addr_t *pa, bus_addr_t *siz { phandle_t node; - if ((node = OF_finddevice("/")) == 0) + if ((node = OF_finddevice("/")) == -1) return (ENXIO); if ((node = fdt_find_compatible(node, "simple-bus", 1)) == 0) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Tue Mar 20 00:03:49 2018 (r331229) @@ -452,7 +452,7 @@ bcmfb_configure(int flags) * finally go with defaults if everything else has failed. */ chosen = OF_finddevice("/chosen"); - if (chosen != 0 && + if (chosen != -1 && OF_getprop(chosen, "bootargs", &bootargs, sizeof(bootargs)) > 0) { p = bootargs; while ((v = strsep(&p, " ")) != NULL) { @@ -472,7 +472,7 @@ bcmfb_configure(int flags) } root = OF_finddevice("/"); - if ((root != 0) && + if ((root != -1) && (display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) { if (sc->width == 0) { if ((OF_getencprop(display, "broadcom,width", Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Tue Mar 20 00:03:49 2018 (r331229) @@ -223,7 +223,7 @@ bcm_fb_attach(device_t dev) /* Newer firmware versions needs an inverted color palette. */ sc->fbswap = 0; chosen = OF_finddevice("/chosen"); - if (chosen != 0 && + if (chosen != -1 && OF_getprop(chosen, "bootargs", &bootargs, sizeof(bootargs)) > 0) { p = bootargs; while ((v = strsep(&p, " ")) != NULL) { Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Tue Mar 20 00:03:49 2018 (r331229) @@ -81,7 +81,7 @@ bcm2835_late_init(platform_t plat) int len; system = OF_finddevice("/system"); - if (system != 0) { + if (system != -1) { len = OF_getencprop(system, "linux,serial", cells, sizeof(cells)); if (len > 0) Modified: head/sys/arm/freescale/fsl_ocotp.c ============================================================================== --- head/sys/arm/freescale/fsl_ocotp.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/freescale/fsl_ocotp.c Tue Mar 20 00:03:49 2018 (r331229) @@ -72,7 +72,7 @@ fsl_ocotp_devmap(void) phandle_t child, root; u_long base, size; - if ((root = OF_finddevice("/")) == 0) + if ((root = OF_finddevice("/")) == -1) goto fatal; if ((child = fdt_depth_search_compatible(root, "fsl,imx6q-ocotp", 0)) == 0) goto fatal; Modified: head/sys/arm/freescale/vybrid/vf_machdep.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_machdep.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/freescale/vybrid/vf_machdep.c Tue Mar 20 00:03:49 2018 (r331229) @@ -68,7 +68,7 @@ vf_cpu_reset(platform_t plat) goto end; src = OF_finddevice("src"); - if ((src != 0) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) { + if ((src != -1) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) { if (bus_space_map(fdtbus_bs_tag, paddr, 0x10, 0, &vaddr) == 0) { bus_space_write_4(fdtbus_bs_tag, vaddr, 0x00, SW_RST); } Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/mv/mv_common.c Tue Mar 20 00:03:49 2018 (r331229) @@ -2367,7 +2367,7 @@ win_cpu_from_dt(void) if (ofw_bus_node_is_compatible(node, "mrvl,cesa-sram")) goto moveon; - if ((node = OF_finddevice("/")) == 0) + if ((node = OF_finddevice("/")) == -1) return (ENXIO); if ((node = fdt_find_compatible(node, "mrvl,cesa-sram", 0)) == 0) @@ -2551,7 +2551,7 @@ fdt_fixup_busfreq(phandle_t root) /* * Fix bus speed in cpu node */ - if ((sb = OF_finddevice("cpu")) != 0) + if ((sb = OF_finddevice("cpu")) != -1) if (fdt_is_compatible_strict(sb, "ARM,88VS584")) OF_setprop(sb, "bus-frequency", (void *)&freq, sizeof(freq)); Modified: head/sys/arm/samsung/exynos/chrome_ec.c ============================================================================== --- head/sys/arm/samsung/exynos/chrome_ec.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/samsung/exynos/chrome_ec.c Tue Mar 20 00:03:49 2018 (r331229) @@ -225,7 +225,7 @@ configure_i2c_arbitrator(struct ec_softc *sc) /* TODO: look for compatible entry instead of hard-coded path */ arbitrator = OF_finddevice("/i2c-arbitrator"); - if (arbitrator > 0 && + if (arbitrator != -1 && OF_hasprop(arbitrator, "freebsd,our-gpio") && OF_hasprop(arbitrator, "freebsd,ec-gpio")) { sc->have_arbitrator = 1; Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_ehci.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/samsung/exynos/exynos5_ehci.c Tue Mar 20 00:03:49 2018 (r331229) @@ -240,7 +240,7 @@ phy_init(struct exynos_ehci_softc *esc) reg &= ~(HOST_CTRL_RESET_LINK); bus_space_write_4(esc->host_bst, esc->host_bsh, 0x0, reg); - if ((hub = OF_finddevice("/hsichub")) != 0) { + if ((hub = OF_finddevice("/hsichub")) != -1) { reset_hsic_hub(esc, hub); } Modified: head/sys/arm/ti/am335x/am335x_lcd.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_lcd.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/ti/am335x/am335x_lcd.c Tue Mar 20 00:03:49 2018 (r331229) @@ -961,7 +961,7 @@ am335x_lcd_attach(device_t dev) am335x_read_hdmi_property(dev); root = OF_finddevice("/"); - if (root == 0) { + if (root == -1) { device_printf(dev, "failed to get FDT root node\n"); return (ENXIO); } Modified: head/sys/arm/ti/am335x/am335x_lcd_syscons.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_lcd_syscons.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/ti/am335x/am335x_lcd_syscons.c Tue Mar 20 00:03:49 2018 (r331229) @@ -382,7 +382,7 @@ am335x_syscons_configure(int flags) * to fetch data from FDT and go with defaults if failed */ root = OF_finddevice("/"); - if ((root != 0) && + if ((root != -1) && (display = am335x_syscons_find_panel_node(root))) { if ((OF_getencprop(display, "panel_width", &cell, sizeof(cell))) > 0) Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/fdt/fdt_common.c Tue Mar 20 00:03:49 2018 (r331229) @@ -215,13 +215,13 @@ fdt_immr_addr(vm_offset_t immr_va) /* * Try to access the SOC node directly i.e. through /aliases/. */ - if ((node = OF_finddevice("soc")) != 0) + if ((node = OF_finddevice("soc")) != -1) if (fdt_is_compatible(node, "simple-bus")) goto moveon; /* * Find the node the long way. */ - if ((node = OF_finddevice("/")) == 0) + if ((node = OF_finddevice("/")) == -1) return (ENXIO); if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0) Modified: head/sys/dev/ofw/ofw_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_subr.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/ofw/ofw_subr.c Tue Mar 20 00:03:49 2018 (r331229) @@ -232,7 +232,7 @@ ofw_parse_bootargs(void) int err; chosen = OF_finddevice("/chosen"); - if (chosen <= 0) + if (chosen == -1) return (chosen); if ((err = OF_getprop(chosen, "bootargs", buf, sizeof(buf))) != -1) { Modified: head/sys/dev/ofw/openfirmio.c ============================================================================== --- head/sys/dev/ofw/openfirmio.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/ofw/openfirmio.c Tue Mar 20 00:03:49 2018 (r331229) @@ -247,7 +247,7 @@ openfirm_ioctl(struct cdev *dev, u_long cmd, caddr_t d if (error) break; node = OF_finddevice(name); - if (node == 0 || node == -1) { + if (node == -1) { error = ENOENT; break; } Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/ow/owc_gpiobus.c Tue Mar 20 00:03:49 2018 (r331229) @@ -85,7 +85,7 @@ owc_gpiobus_identify(driver_t *driver, device_t bus) * bus overwrites the description. */ root = OF_finddevice("/"); - if (root == 0) + if (root == -1) return; for (w1 = OF_child(root); w1 != 0; w1 = OF_peer(w1)) { if (!fdt_is_compatible_strict(w1, "w1-gpio")) Modified: head/sys/dev/vnic/thunder_bgx_fdt.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx_fdt.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/vnic/thunder_bgx_fdt.c Tue Mar 20 00:03:49 2018 (r331229) @@ -336,7 +336,7 @@ bgx_fdt_find_node(struct bgx *bgx) snprintf(bgx_sel, len + 1, "/"BGX_NODE_NAME"%d", bgx->bgx_id); /* First try the root node */ node = OF_finddevice(bgx_sel); - if ((int)node > 0) { + if (node != -1) { /* Found relevant node */ goto out; } Modified: head/sys/powerpc/cpufreq/mpc85xx_jog.c ============================================================================== --- head/sys/powerpc/cpufreq/mpc85xx_jog.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/powerpc/cpufreq/mpc85xx_jog.c Tue Mar 20 00:03:49 2018 (r331229) @@ -129,7 +129,7 @@ mpc85xx_jog_devcompat() int i; node = OF_finddevice("/soc"); - if (node <= 0) + if (node == -1) return (NULL); for (i = 0; jog_compat[i].ocd_str != NULL; i++) Modified: head/sys/powerpc/pseries/platform_chrp.c ============================================================================== --- head/sys/powerpc/pseries/platform_chrp.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/powerpc/pseries/platform_chrp.c Tue Mar 20 00:03:49 2018 (r331229) @@ -291,7 +291,7 @@ chrp_timebase_freq(platform_t plat, struct cpuref *cpu char buf[8]; cpus = OF_finddevice("/cpus"); - if (cpus <= 0) + if (cpus == -1) panic("CPU tree not found on Open Firmware\n"); for (cpunode = OF_child(cpus); cpunode != 0; cpunode = OF_peer(cpunode)) { From owner-svn-src-all@freebsd.org Tue Mar 20 00:16:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88862F56E2B; Tue, 20 Mar 2018 00:16:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 334576DBD9; Tue, 20 Mar 2018 00:16:25 +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 2C8A41571B; Tue, 20 Mar 2018 00:16:25 +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 w2K0GPjq023916; Tue, 20 Mar 2018 00:16:25 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K0GPYH023915; Tue, 20 Mar 2018 00:16:25 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803200016.w2K0GPYH023915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 20 Mar 2018 00:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331230 - head/contrib/blacklist/bin X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/contrib/blacklist/bin X-SVN-Commit-Revision: 331230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 00:16:25 -0000 Author: cem Date: Tue Mar 20 00:16:24 2018 New Revision: 331230 URL: https://svnweb.freebsd.org/changeset/base/331230 Log: blacklist: Fix minor memory leak in configuration parsing error case Ordinarily, the continue clause of the for-loop would free 'line.' In this case we instead return early, missing the free. Add an explicit free to avoid the leak. Reported by: Coverity Sponsored by: Dell EMC Isilon Modified: head/contrib/blacklist/bin/conf.c Modified: head/contrib/blacklist/bin/conf.c ============================================================================== --- head/contrib/blacklist/bin/conf.c Tue Mar 20 00:03:49 2018 (r331229) +++ head/contrib/blacklist/bin/conf.c Tue Mar 20 00:16:24 2018 (r331230) @@ -1119,6 +1119,7 @@ conf_parse(const char *f) confset_free(&lc); confset_free(&rc); fclose(fp); + free(line); return; } } From owner-svn-src-all@freebsd.org Tue Mar 20 01:07:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B01BF5A9BA; Tue, 20 Mar 2018 01:07:23 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F20F5704D2; Tue, 20 Mar 2018 01:07:22 +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 E886415EA4; Tue, 20 Mar 2018 01:07:22 +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 w2K17Mqj050900; Tue, 20 Mar 2018 01:07:22 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K17MUw050899; Tue, 20 Mar 2018 01:07:22 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201803200107.w2K17MUw050899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 20 Mar 2018 01:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331231 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 331231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:07:23 -0000 Author: jhibbits Date: Tue Mar 20 01:07:22 2018 New Revision: 331231 URL: https://svnweb.freebsd.org/changeset/base/331231 Log: Fix powerpc Book-E build post-331018/331048. pagedaemon_wakeup() was moved from vm_pageout.h to vm_pagequeue.h. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Mar 20 00:16:24 2018 (r331230) +++ head/sys/powerpc/booke/pmap.c Tue Mar 20 01:07:22 2018 (r331231) @@ -107,6 +107,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include From owner-svn-src-all@freebsd.org Tue Mar 20 01:08:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D8E3F5AA47 for ; Tue, 20 Mar 2018 01:08:02 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x244.google.com (mail-yb0-x244.google.com [IPv6:2607:f8b0:4002:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35F9F7063B for ; Tue, 20 Mar 2018 01:08:02 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x244.google.com with SMTP id t5-v6so751833ybg.13 for ; Mon, 19 Mar 2018 18:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=OZvxCp8/K+G84r+mA9DYtkduiNZeL/fdb3DC4fA6PtU=; b=UdAHiTSmNAn6Ppbh55VVD7fDTygSEnn1Jc6o1bCtbBFtnaqTFOYlUTxt41gKBMWjJN vFPVnWewYSOE9Nu7bdNGiQovP7SZE8liw0RqeC4nuCqV5D3BTQ8exzmgybfIDOzUL7qJ 1LDS4t6T2fJBziG5iwAkgZExetCgwNBtVscqzZTSMRl4fc7Ua40HWJzpRVcvOme9hdK/ SQ/yL+fKsoiYcjWl9FLa+0bhHfq9ZN8eUiLtmYf0FlULauCHkZE9kn/gbDAK29QhxptK MkQZypd15AZLwB+a01Eywjl/7NwNv1NUbU0c6WQC1iIMZzkU2+mupoxagL0PfjEfkqRP Oriw== 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=OZvxCp8/K+G84r+mA9DYtkduiNZeL/fdb3DC4fA6PtU=; b=VFR/N6T3Oen12AGi/ch1gF2FdDhiYrX7o6qw4cfqACNotdFgJRXOxOTZkZu3SsOJ1a Hvnqnlv7MvyZWqKqwWJUVqaBfALeTfibQB+QSQzAhbQfkhJY+jvUqyfK/TzmLAyqYC0K IBHJKJJJiZ3TfKj90pZZ8S6+AO6BAQ0Jr4jc7Vk2yw6ZJGz0Qy0qjfd0iHPFon65Hym7 lDAgvF5HzD9aPz7ssXlGXOk3ccGIKcfoihX6ypmRNzr/fXWH76bMVBJBy1rfxrFFFlMY t+WcUYib6bOQLFaQUCX5BT6KwNBysZ1gDb6eY6+3mvCH09yoR36qXeq1gFYkg+LQdgEN qQ6g== X-Gm-Message-State: AElRT7ErpdnqBHMdVjhEV1NQWJCJglcbqAsQkNH6rOQrCHavARMUsLK7 mNAE4CDK5LYK/IY+2kVHfGUATFMFsPzgpBHIIlX9QA== X-Google-Smtp-Source: AG47ELvuLN6Hx3v+gcM6vmA+UOOL/l3YujHH8yK0cjd9QreEHOoNu5gD4IkKqTKi0dOIdpwq1VKwD1QzkTUPUVOWfrI= X-Received: by 2002:a25:b941:: with SMTP id s1-v6mr8167624ybm.371.1521508081548; Mon, 19 Mar 2018 18:08:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:61c5:0:0:0:0:0 with HTTP; Mon, 19 Mar 2018 18:08:01 -0700 (PDT) In-Reply-To: <201803191616.w2JGGCid083460@repo.freebsd.org> References: <201803191616.w2JGGCid083460@repo.freebsd.org> From: Oliver Pinter Date: Tue, 20 Mar 2018 02:08:01 +0100 Message-ID: Subject: Re: svn commit: r331212 - in head: etc/mtree stand/defaults To: Kyle Evans Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:08:02 -0000 On Monday, March 19, 2018, Kyle Evans wrote: > Author: kevans > Date: Mon Mar 19 16:16:12 2018 > New Revision: 331212 > URL: https://svnweb.freebsd.org/changeset/base/331212 > > Log: > Move /boot/overlays to /boot/dtb/overlays > > Hi! Do you plan to add the old files to ObsoleteFiles.inc? > The former is fairly vague; these are FDT overlays to be applied to the > running system, so /boot/dtb is a sensible location to put it without > cluttering up /boot/dtb even further if desired. > > Modified: > head/etc/mtree/BSD.root.dist > head/stand/defaults/loader.conf > > Modified: head/etc/mtree/BSD.root.dist > ============================================================ > ================== > --- head/etc/mtree/BSD.root.dist Mon Mar 19 15:48:31 2018 > (r331211) > +++ head/etc/mtree/BSD.root.dist Mon Mar 19 16:16:12 2018 > (r331212) > @@ -11,6 +11,8 @@ > defaults > .. > dtb > + overlays tags=package=runtime > + .. > .. > firmware > .. > @@ -19,8 +21,6 @@ > kernel > .. > modules > - .. > - overlays tags=package=runtime > .. > zfs > .. > > Modified: head/stand/defaults/loader.conf > ============================================================ > ================== > --- head/stand/defaults/loader.conf Mon Mar 19 15:48:31 2018 > (r331211) > +++ head/stand/defaults/loader.conf Mon Mar 19 16:16:12 2018 > (r331212) > @@ -80,7 +80,7 @@ bootenv_autolist="YES" # Auto populate > the list of ZF > #comconsole_speed="9600" # Set the current serial console speed > #console="vidconsole" # A comma separated list of console(s) > #currdev="disk1s1a" # Set the current device > -module_path="/boot/modules;/boot/dtb;/boot/overlays" # Set the module > search path > +module_path="/boot/modules;/boot/dtb;/boot/dtb/overlays" # Set the > module search path > #prompt="\\${interpret}" # Set the command prompt > #root_disk_unit="0" # Force the root disk unit number > #rootdev="disk1s1a" # Set the root filesystem > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Tue Mar 20 01:12:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFF14F5B4B6 for ; Tue, 20 Mar 2018 01:12:34 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x229.google.com (mail-yb0-x229.google.com [IPv6:2607:f8b0:4002:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 66BDD70D47 for ; Tue, 20 Mar 2018 01:12:34 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x229.google.com with SMTP id v8-v6so756356ybm.11 for ; Mon, 19 Mar 2018 18:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=q5UyKkzZUCZ9UNXLLuEh+YFCbRxjXt0wZiuyt1mLyUs=; b=VDKJ4qYamKX+jKJ7UGxuWr/68Zsb23LLNrBULnsCC1mkeDKg9t8CNwobg0oB5mo0/W unPYRYdte9qLX99rbV66dN6+BOSoohA/lDpA2SG14l5ZOGVNCQ4iDSYUgQn2UavEmojb VhR3CITd49k5cnjwPCjke4agjf2BozzFcl6Sn/7HIim5QXl44I8Orvxhlgxlk57tFXms GQaJ3/BRXOUZwoB/a+BX1aTcSlJslSprPboyFUoapoMS2z88nNLu3io6yFDQ1iNUTvyP /u8yThei81g6U9DALFSps6AB0fO3zspX5ULXHF2mHJf76a3rpj4Pel/UmS6LDbmSk8sJ d/8g== 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=q5UyKkzZUCZ9UNXLLuEh+YFCbRxjXt0wZiuyt1mLyUs=; b=k6gBv2KYr+yxpcSg7GploktSP+z3HImF8kbRp33i216V0k6/TWQzosl+VFxuYjNxdS FFgHFt3HsMUIJpSOchMR5ireBPY+yoUF3m0Z/0/rLpeVAWJLrZRf8TLczZ0M7hy6tCtA NOdm/MLAmRlneI5Y+3D0hU+2Q1WWL1jQHchwWf1Yvj9Hj4iI4dD/kGuIojdL6KbTt83Y yBlFSvRaWMAkVPBt5A18DG97KHNMq0L76wI//RtugayOrtViS6DevNmg62auuM6cuxhx 2OpmRGZkJy0MHvhyODQUJDQExSX+w7oopOwUd5p1nf79aX3fdWWvQD7S2J5oqmbRnsxe zxNw== X-Gm-Message-State: AElRT7HeT+8xne1pmLIh01mQBknxIcv+zC/Wj4lA216kjbiefRVOOtiM ewXsuahQJgPBoRTvaDInprbVHKQAa3xUWouP3tPH0g== X-Google-Smtp-Source: AG47ELudQ+LWlLLMYJr76MbkcJJk+tUky+xWlD7VljGwy7VwkgU+kH9HpgW3HQ1M8XWyvINAuJwkgIUnPbkbBsk2Ihg= X-Received: by 2002:a25:b10c:: with SMTP id g12-v6mr3706242ybj.331.1521508353967; Mon, 19 Mar 2018 18:12:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:61c5:0:0:0:0:0 with HTTP; Mon, 19 Mar 2018 18:12:33 -0700 (PDT) In-Reply-To: References: <201706030242.v532gni4072040@repo.freebsd.org> From: Oliver Pinter Date: Tue, 20 Mar 2018 02:12:33 +0100 Message-ID: Subject: Re: svn commit: r319510 - head/contrib/xz/src/liblzma/check To: Eitan Adler Cc: Ed Maste , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:12:35 -0000 On Sunday, March 18, 2018, Eitan Adler wrote: > On 2 June 2017 at 19:42, Ed Maste wrote: > > Author: emaste > > Date: Sat Jun 3 02:42:49 2017 > > New Revision: 319510 > > URL: https://svnweb.freebsd.org/changeset/base/319510 > > > > Log: > > xz: set noexec stack flag on FreeBSD > > Heya. Is this one safe to MFC ? I think go for it. > > > > -- > Eitan Adler > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Tue Mar 20 01:33:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9834F5DAC2; Tue, 20 Mar 2018 01:33:04 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B18B720FF; Tue, 20 Mar 2018 01:33:04 +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 5602C163D1; Tue, 20 Mar 2018 01:33:04 +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 w2K1X49K065623; Tue, 20 Mar 2018 01:33:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K1X4gX065622; Tue, 20 Mar 2018 01:33:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803200133.w2K1X4gX065622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 01:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331232 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:33:04 -0000 Author: kevans Date: Tue Mar 20 01:33:04 2018 New Revision: 331232 URL: https://svnweb.freebsd.org/changeset/base/331232 Log: Add /boot/overlays to ObsoleteFiles It has been replaced by /boot/dtb/overlays. We haven't yet populated it with any of our own overlays, so no further damage from here. Reported by: Oliver Pinter Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Mar 20 01:07:22 2018 (r331231) +++ head/ObsoleteFiles.inc Tue Mar 20 01:33:04 2018 (r331232) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays +OLD_DIRS+=boot/overlays # 20180311: remove sys/sys/i386/include/pcaudioio.h .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/pcaudioio.h From owner-svn-src-all@freebsd.org Tue Mar 20 01:52:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73590F5FD0E for ; Tue, 20 Mar 2018 01:52:09 +0000 (UTC) (envelope-from iec05@mysendainfo.top) Received: from mail139-26.mail.alibaba.com (mail139-26.mail.alibaba.com [198.11.139.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 B8EE773183 for ; Tue, 20 Mar 2018 01:52:08 +0000 (UTC) (envelope-from iec05@mysendainfo.top) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.2854414|-1; CH=green; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03301; MF=iec05@mysendainfo.top; NM=1; PH=DS; RN=1; RT=1; SR=0; TI=SMTPD_---.BN6uKPh_1521510688; Received: from Redins-PC(mailfrom:iec05@mysendainfo.top fp:123.146.50.244) by smtp.aliyun-inc.com(10.147.44.145); Tue, 20 Mar 2018 09:51:28 +0800 Message-ID: <20180320095128496.iec05@mysendainfo.top> MIME-Version: 1.0 From: "Reed" To: "Svn-src-all" Reply-To: iec05@globalsenda.com Date: 20 Mar 2018 09:51:28 +0800 Subject: Factory direct signs outdoor advertising Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:52:09 -0000 Hi ,=0D=0AThank you for your time to open this email. There is a = great business opportunity which is waiting for you.=0D=0ADo you = have any interest in Interactive Displaying Equipment? This is Ho= ngbao which is dealing in this kind of requirement. We are lookin= g for local agent for all over the world.=0D=0AIf you have any in= terest, please contact us. We will send you our product catalog.=0D=0A= Wish to hear from you soon.------------------------------Best reg= ards, Mr. ReedSales Manager Chongqing Hongbao Technology Co., Ltd= .Address: Building 9, Area C, Jinglong Industrial Park, Jiulongpo= District, Chongqing, China=0D=0ASKYPE: iec05_1Office: 0086 23 88= 67 0519Whatsapp: +86 17784283905=0D=0AContact of General Manager,= Mr.Alan TanSKYPE: sendaindustryWhatsapp/Cellphone: +86 1800830000= 7=0A=0Ak3LdG8HMdNYVVZtaWT4YAhEXdTwogJVQloud3I61vekhTIKdvDUOmkj2pO= ZMCivtS8zwvf6dM3slXm4v9iTCO7t05rNfIkodJQpK8dHfxH2jRX43JuDjpSFLEyq= 3rQusEfC6WjmVBD575a98mKwdG5NRbE5ANDNGczEClY6q8HIMMyGupiGGkgLzrKVi= dM8XPoUvwxMoE55Zn14CYBauW6mWN4aA2OcmyKWoEaYSwh2ebMcqGijCBE0I2XHrn= cmPTJqC5FYNDiYF47L1SJTJuAKUJdlGtxvjVclrmzl0kvZiFlEVcGyDiCliYvTRji= k5NEJRLjEioTpYBrenzqtMYR1iR3tRGuG1bTu1CN9T1geodmGwgvhTPx7VCqZIQNC= UcnNIWdLMhzKIDD5vmWAbcNcDLzpbNr3eDkcPzYz3JvBfMpiZlulTcqHoa9WnNAZP= ww4iqfVnmxsHbXQmgqQi591dCNEp1bf9vMJglZy5yXxFY0ddjA7nJGJmuRGDAwmah= ibpdA0gRLJ7BleBAr6q4SpP2nLujVu2BnoFPNZJzRvYXCK9C529qV6oTmnQOwXWgH= weXyMMrnQdmrSqCCReSkBFhZMtq8U3TzHf5wb3igH34S2ruWecFJ4W5QXXMimisNj= NKCk6qNVCDyBoXlZtUHoauLafyeh0ToAhzfHRC7LRNsixfyZrjSoKp8iYs5xcwUIe= XjOID7RMWwn2sCZ0eQH00QRrWIpwAzkSJ4zVJhNb1COSLfwP5xXGdHe7snLUIkbmc= uin34gX2vZo1ZGHcAr3CEF2QrtmwTtHqsGgX8L1g0DIIQ6sG4H7T8JxPfxBATr92h= YyipK4OpMC1Wk0l0GrblOhI9rHAarnzuGqSxagkDitm7vSVxfzdZYGtGQ9X2tEYo2= xgU7OQp7x3kUADzL3URaAw0WbH1ih9EvX5YB0prJNRqD8LfvohqJ6es1gYW6P6Qno= PXvEYKDt8mI5nNpsvU0JUoJCXk2tkUH12ejOJQpwNgYRKVTawEjbQEtrdTHDHa8dF= H38uBIEvtWEpRS1rSWFAvbnKSAP9LOC8Lc3RKGVWEGmIP1m1FcPdsCavGnC1TvJFj= wEFPaGc1JWOOFVQeOtyZpF82xbn4T29XHpjnGbvwDcJGlG1sLN42aGTQwDiYi87GN= R7fCtxCX2ldVrGQaVi6Y6N1vsQ3Txeu42TuzLPifs48kGU4WrNnP1IG36K9CuIqOQ= 8Tycgp50Qv2FGOxM6rJQF3jdqs1GFLJDjtx1wKboiPacDopVCQngGXb5zlLNook5M= pldgvflglyPS6z2354PnsWmhrsbZnZTv4qe3cE6A20lpmcsLJKikvHksZVP34mTlF= kOGlYQqYelsBWVfZqfCGyZn5L3hP2wG6ZK1oLpKTSmglSR2Zz4E6hE6kqBzUzAVIF= lBcUQd0vIOcI1dU1hfYSzPlDGYaQPkhqyGwgP5JQEByPUConFTilXQ5wfzdR39Fox= LalHDbcw7eYhvJ4zNaW2WtIAZ0gRRNuW9i9r2G2H5PPC7fKP9hgZImBhsLHCVkEkJ= 17dzDx68fW6D6sKgqIzwudNHRZhYpLLbvS57wgvK9RtquDliWluB4NfOkvIDf7Ita= V8emCJacPnDJmcdDY23h96HChN1xSv190fyv7WjBkpfpC4Xju0h5Ec1OqB5PICkkl= uJ7DIv2IsWKRh0cPH3SdVuOeK4wRuTH4V48kPFMufncfgX9ASZ0zs6qZVTTDZbeyf= GWdSSZ2hnYyiyXNVVYuS8COD8pWL8v49D0A0VI0ZYi47RHmV6H3cJG637zJs3g8SU= pEynM0cYuTQyHMr20FrrSpXTxSlZxWH9bdr2OykHQdeMguqNhq2BHq20HEPTEcryc= GmukodskJBEaaD2syI6T6sLarl9Iq2DLGAz8WsTcAgXPnQw1Nr6ulE6eBjT24JUHX= TtA3Tv5OTjPvVMBO7UYV9q2ulwCzQ8QlfRumWYTW0FrkgJFwhdWPWLOsr5InSwYLt= tf3ifS902VtZHdCR6hCc1pu31UQfw3tHGQMtBd2lMOUQltJS5vMfmys4L0hk1TtYr= LiQq8fSegqcvEIxaYa1gek7oIIBWIjSkVozaSrXfT158fz7hJ92JsIdrbsIqEVwWx= Szf9mhxcLmcfY89Bjdyh9Rda8ZqIwBYv8BnZR8mRvwHl0bcjzPlIXFo0m51nRPG9o= H6nL9JaQHLCaR9WM68GgfxscmCM7ZZGQxWj4Oyp5aSgTMPuV4ALGZT99DapwX3QH5= MDVQRYyJB6nhzqw7R2pe0QDN9rD9S861zOZcz4dCdXoNLS4JSp61rs5VZ7HqkpQsZ= lIKqjyMPN13sQ1hmTgt25z6I4drnMhO6VNp9jjyRjcEr2s86p3q8mqUMB1m66p2vd= Ww2C82AHCJTVFGB4lXIRFKvTDxiWsKU99e6W5uh1PqJH1RWlK1KrjDxb19YAKDfRO= JLrAFYRGH2e0OSMBWcqZsQvGUUWvHgbaRSi5vK42TKBBibcgcYNrPSmSfLGK2mZqQ= 48WAH6c8n6HeUnJIGjIsKlZvpPJ4j0xLbKe2gGvSBirLEDlnX2l2hX6I9qaRm7Ony= W3a8GrZNPRrTdRLum7gEutdDvSQvDwut4cHAbfgBler6FPVyon00yI4sQwCNAuajm= XP09bi7RFif26YGXh6gwtVm8fKFCs0R48JI0Upd4S9TpOqJyWQjnTNT1sSUrDvoEq= aTmfG2STcDk1WjO07FBHualQGx2uMqnKeYEwmigOqtH9yZvy5qwPMXWZywy8Zo7Lf= zNYFhDOpNg0tbhH1tolTxXh2EYQJ7O2mWTYcxTNNHqZGVwmeR6vZLRHCvW0jM5hZe= EwiiuuAAxb7YB78CBR1i2B4bmHASu0C9ZrgZ4VnCVodGADTPSHaegGb3s6VNTH6xz= YZ9Q8xGtonEnoBJNL0NPoTifdxXZAJdiG6CEJZK9uKRjxF3ucZ7HjIb4GUCBAGTF9= lHhZ53MfEkD1ZHyttNBBvZXVxYPn8zOQc9bYMv7VlrEnx3Hc386Si3EmJmr7ep74w= MPPwAGXFFg4kAougDj0sVy8vPep40HVkzRKdSGtr9dDNA28YXQA66CAeHjHlhTFXk= JKJDgoXPyiIVkVM5r697PdXgwwyY8agxFtQipkGrDhykSimnUfPMvQuvNs7KPYGo1= agR5uG7pIuyFDod9b4Tlt1OYkvXcWCEA9iH2viqzHmNmVQa4TAEUN3x9rSKZIUt6P= YvkHaESEkD7es2tlTjlXKN6KyBCxqQNTHwXlPmIVMgtpqUYPgEPB785aoA8z2kdtP= exV58vwApatkGjDCMhM1cLyrMWee9Tr2Zzcn2K88i1HXBQIhvWg3rsDsYuichiqwJ= rk67gA18DIa3APWdXJcDnBxWJoxsVR0AbeavB9emeUNJsooFlYjzdSlQNanR2zdMH= ASmFqCNuQptNNtl0S6XxrmiSjHqMnjFH11Sw10Vmw4ntS30H1QasgegeAtlJb07wJ= LLLAPYSbA0mYO0gHJLw9cqMLDVyFbavXQK6hf6cRhgFeUfLt41sfAnwkY0XTqdZqu= o84TYsCyERWLyQo94AaIgntdMje9jr4hfJw6HA5zPHVvAzq9yJlCPHe1FQ7FdsfdM= EwPkhruuASzrXCcT5Bz5srxuvrRtplmrIIV3AOhhR7eOFzHdUM7RG8kcYkPPA15fv= 7JeG9igjheldIOVJDyDevLzoJ4fZrHP2ZjyQsxLuQyoUZZgwU5Xtr10l9QX52hSAo= iepg4h6N8nXmFpJNJ4lJmAYicHCzGrzGOvGLRfQORFjD3YtrehicwQ2Hf73mFw7GN= hyaIYWuexSGhkedeblp9m9YsYvKbt9kyCQMqiIfkOYYXlqVSP8tbIxr7zHJsciKoy= 7FusNVs54koa06yzRllF8Q4pFQAYN7wdApeLrp2c16Dd2WyBbSkWoIqhA4NWkuiXO= azBSN8sj9E1dRmIiZMUMzOSYWamC6SwOFpRmXIoKSDf4o3JI4EkHoaemHDVCMPcg7= dxsvmkho9TWyNASrExrxPqvavEkMLY3qYXawhdIj3jehiNU23b8hKJiN2hZH0uCbQ= vAQpm9qO From owner-svn-src-all@freebsd.org Tue Mar 20 02:01:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F00FBF60C75; Tue, 20 Mar 2018 02:01: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9EB5C73857; Tue, 20 Mar 2018 02:01:30 +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 99989168E2; Tue, 20 Mar 2018 02:01:30 +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 w2K21UPD079590; Tue, 20 Mar 2018 02:01:30 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K21UgY079589; Tue, 20 Mar 2018 02:01:30 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201803200201.w2K21UgY079589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 20 Mar 2018 02:01:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331233 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 02:01:31 -0000 Author: jhibbits Date: Tue Mar 20 02:01:30 2018 New Revision: 331233 URL: https://svnweb.freebsd.org/changeset/base/331233 Log: Cast through uintptr_t to narrow the buf domain pointer on 32-bit archs arg2 is an intmax_t, which on 32-bit architectures is 64 bits, wider than a pointer. When &bdomain[i] is added to arg2 it widens from uintptr_t to intmax_t, then gcc whines when it gets cast to a pointer. Casting through uintptr_t silences this warning. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 20 01:33:04 2018 (r331232) +++ head/sys/kern/vfs_bio.c Tue Mar 20 02:01:30 2018 (r331233) @@ -435,7 +435,7 @@ sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS) return (error); *(int *)arg1 = value; for (i = 0; i < buf_domains; i++) - *(int *)(((uintptr_t)&bdomain[i]) + arg2) = + *(int *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = value / buf_domains; return (error); @@ -454,7 +454,7 @@ sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS) return (error); *(long *)arg1 = value; for (i = 0; i < buf_domains; i++) - *(long *)(((uintptr_t)&bdomain[i]) + arg2) = + *(long *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = value / buf_domains; return (error); From owner-svn-src-all@freebsd.org Tue Mar 20 02:50:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80AC8F669CF; Tue, 20 Mar 2018 02:50:12 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36EC4771F3; Tue, 20 Mar 2018 02:50:12 +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 17F24170EB; Tue, 20 Mar 2018 02:50:12 +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 w2K2oBZa002045; Tue, 20 Mar 2018 02:50:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K2oBFT002044; Tue, 20 Mar 2018 02:50:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803200250.w2K2oBFT002044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 02:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331234 - head/sys/i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/linux X-SVN-Commit-Revision: 331234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 02:50:12 -0000 Author: emaste Date: Tue Mar 20 02:50:11 2018 New Revision: 331234 URL: https://svnweb.freebsd.org/changeset/base/331234 Log: Rationalize license text on Linuxolator files i386 linux.h missed in r330239. Approved by: sos MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/linux/linux.h Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Tue Mar 20 02:01:30 2018 (r331233) +++ head/sys/i386/linux/linux.h Tue Mar 20 02:50:11 2018 (r331234) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1994-1996 Søren Schmidt * All rights reserved. @@ -8,25 +8,22 @@ * 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. + * 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. 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. - * + * 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$ */ From owner-svn-src-all@freebsd.org Tue Mar 20 02:54:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC15DF672F8; Tue, 20 Mar 2018 02:54:32 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CF7E77B30; Tue, 20 Mar 2018 02:54: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 74F351727B; Tue, 20 Mar 2018 02:54: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 w2K2sWa2007445; Tue, 20 Mar 2018 02:54:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K2sWAH007443; Tue, 20 Mar 2018 02:54:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803200254.w2K2sWAH007443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 02:54:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331235 - stable/11/contrib/xz/src/liblzma/check X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/xz/src/liblzma/check X-SVN-Commit-Revision: 331235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 02:54:33 -0000 Author: emaste Date: Tue Mar 20 02:54:32 2018 New Revision: 331235 URL: https://svnweb.freebsd.org/changeset/base/331235 Log: MFC r319510: xz: set noexec stack flag on FreeBSD Modified: stable/11/contrib/xz/src/liblzma/check/crc32_x86.S stable/11/contrib/xz/src/liblzma/check/crc64_x86.S Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/xz/src/liblzma/check/crc32_x86.S ============================================================================== --- stable/11/contrib/xz/src/liblzma/check/crc32_x86.S Tue Mar 20 02:50:11 2018 (r331234) +++ stable/11/contrib/xz/src/liblzma/check/crc32_x86.S Tue Mar 20 02:54:32 2018 (r331235) @@ -299,6 +299,6 @@ LZMA_CRC32: * use __linux__ here, but I don't know a way to detect when * we are using GNU assembler. */ -#if defined(__ELF__) && defined(__linux__) +#if defined(__ELF__) && (defined(__FreeBSD__) || defined(__linux__)) .section .note.GNU-stack,"",@progbits #endif Modified: stable/11/contrib/xz/src/liblzma/check/crc64_x86.S ============================================================================== --- stable/11/contrib/xz/src/liblzma/check/crc64_x86.S Tue Mar 20 02:50:11 2018 (r331234) +++ stable/11/contrib/xz/src/liblzma/check/crc64_x86.S Tue Mar 20 02:54:32 2018 (r331235) @@ -282,6 +282,6 @@ LZMA_CRC64: * use __linux__ here, but I don't know a way to detect when * we are using GNU assembler. */ -#if defined(__ELF__) && defined(__linux__) +#if defined(__ELF__) && (defined(__FreeBSD__) || defined(__linux__)) .section .note.GNU-stack,"",@progbits #endif From owner-svn-src-all@freebsd.org Tue Mar 20 02:56:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4428F67673; Tue, 20 Mar 2018 02:56:12 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BC7577DA2; Tue, 20 Mar 2018 02:56:12 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x231.google.com with SMTP id 19-v6so498340itw.3; Mon, 19 Mar 2018 19:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kE9Y8l0O6Cy1cjTi84sRL876Md47m9LKhlfOROHgAOs=; b=o2S5+JKvhNjLsYy/oyljCFzXwtVRNnVa4xz9lDAoolHXaO8/W8aXeFGJ/yaAJ83ayn L7MXUl3iU+9lKmNb1SwOWBaai5Rf654O8Xwo/Bdvv9NJ9IGzzQhiXPqdm3rmn2thPN5Y 1iQXGGMjrP+RY4slipBXKTHD6D76TETK48I+OvjTaIL1Lt24jMcepw7eWAOSS1cMszyT uwYMd7l+WuNzqHZXLNT6rYml/+FMP3akaprEVdbVOAhaFSLAjxcLjKJ5h0SA+j+h7Rq8 ++U6gkLvmjbxsQCqET0W2jvVjdhA/tjrnxHW5wQ5x9EhiezWtgzW5ul+H4zgT8v52a/w LGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=kE9Y8l0O6Cy1cjTi84sRL876Md47m9LKhlfOROHgAOs=; b=Pf8xUDRXc2jN6ZuvM1oy5429J9FfACVNMiQxl0cSXDHYQP97vRgZFpYLG4zvkMjhPs Hb17PzFrzh1ZpHNhwyhHi7t2AivpJzmnPJOMnOIRIcUCq5FbA5cC5Zz4Rc09RKPSV1GE 7XNeBhxqO11CrTAgH/T0PBC7h6gZuZFh8wrDjOfsl174OPCvBeopDOXKOSsnjQMak5Lr BmHMoYTwGzfz0Og5Wf/UEmHpqCLCzHEmQF4yfNrw4TUh6alB6DXb/y9CDca/tCj09x6E uCQfMa1BECTRFITGBVCkMEivxkDclgp0z5w0jVeiYbLpHQPk4S0qN13qJiJsiEq3DZfj +VVg== X-Gm-Message-State: AElRT7HSHcHHHEaqJGTIOS8CyyFkE9lebU+YXwrihAmnhPkGAfO7L4Zo GFCjMptCL3Xo1Q5py7ZvQZaoJKx6kA2VY3H40VLfR/7V X-Google-Smtp-Source: AG47ELsHXhzCZ9OOBkGAJW6+AWWI8v5gr0WI9ihnI/5alidSmGNfvFwLkJ6cCR5qnuoGr1YFA2BWZNOsSaH1ea4BHw4= X-Received: by 2002:a24:d241:: with SMTP id z62-v6mr1010694itf.49.1521514571899; Mon, 19 Mar 2018 19:56:11 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Mon, 19 Mar 2018 19:55:51 -0700 (PDT) In-Reply-To: References: <201706030242.v532gni4072040@repo.freebsd.org> From: Ed Maste Date: Mon, 19 Mar 2018 22:55:51 -0400 X-Google-Sender-Auth: uckUeVPvROa8taK8Zr0Sj_YKqq4 Message-ID: Subject: Re: svn commit: r319510 - head/contrib/xz/src/liblzma/check To: Eitan Adler Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 02:56:13 -0000 On 18 March 2018 at 18:25, Eitan Adler wrote: > On 2 June 2017 at 19:42, Ed Maste wrote: >> Author: emaste >> Date: Sat Jun 3 02:42:49 2017 >> New Revision: 319510 >> URL: https://svnweb.freebsd.org/changeset/base/319510 >> >> Log: >> xz: set noexec stack flag on FreeBSD > > Heya. Is this one safe to MFC ? Done in r331235 From owner-svn-src-all@freebsd.org Tue Mar 20 03:36:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 333F0F0E; Tue, 20 Mar 2018 03:36:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9B827A78A; Tue, 20 Mar 2018 03:36:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4B5717A4C; Tue, 20 Mar 2018 03:36:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K3apUH028354; Tue, 20 Mar 2018 03:36:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3ap6k028353; Tue, 20 Mar 2018 03:36:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200336.w2K3ap6k028353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331236 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:36:52 -0000 Author: imp Date: Tue Mar 20 03:36:51 2018 New Revision: 331236 URL: https://svnweb.freebsd.org/changeset/base/331236 Log: Note: this isn't a general thing. It only affects u-boot-based arm64 systems. Make sure the note says that specific case only. Also, provide a recipe to do it. Sponsored by: Netflix Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Mar 20 02:54:32 2018 (r331235) +++ head/UPDATING Tue Mar 20 03:36:51 2018 (r331236) @@ -52,11 +52,22 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** 20180319: - For UEFI systems: the UEFI loader(8), loader.efi, should be updated in - conjunction with installing a new kernel after r330868. The kernel, - after this revision, will be more lenient when mapping addresses for - UEFI Runtime Services and this may result in a kernel panic without the - corresponding loader(8) update. + For u-boot based arm64 UEFI systems: the UEFI loader(8), loader.efi, + should be updated in conjunction with installing a new kernel after + r330868. The kernel, after this revision, will be more lenient when + mapping addresses for UEFI Runtime Services and this may result in a + kernel panic without the corresponding loader(8) update. If you have a + recent kernel, you can do a installkernel / installworld and then reboot + as there's no recent syscall changes. If you have an older kernel and/or + a 11.x system, the following sequence is safe: + % make buildworld + % make buildkernel + % sudo make installkernel + % cd stand + % sudo make install + % sudo reboot + ... + % sudo make installworld 20180212: FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for From owner-svn-src-all@freebsd.org Tue Mar 20 03:37:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BB80F96; Tue, 20 Mar 2018 03:37:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E579E7A887; Tue, 20 Mar 2018 03:37:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C659B17A4F; Tue, 20 Mar 2018 03:37:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K3b4HA028425; Tue, 20 Mar 2018 03:37:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3b4l6028424; Tue, 20 Mar 2018 03:37:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200337.w2K3b4l6028424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331237 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 331237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:37:05 -0000 Author: imp Date: Tue Mar 20 03:37:04 2018 New Revision: 331237 URL: https://svnweb.freebsd.org/changeset/base/331237 Log: Remove some redundant MPSAFE flags. This was pointed out in a code review I'm having trouble finding right now, but go ahead and eliminate these. Sponsored by: Netfix Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:36:51 2018 (r331236) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:04 2018 (r331237) @@ -626,25 +626,20 @@ ndasysctlinit(void *context, int pending) } SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "unmapped_io", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->unmappedio, 0, "Unmapped I/O leaf"); + OID_AUTO, "unmapped_io", CTLFLAG_RD, + &softc->unmappedio, 0, "Unmapped I/O leaf"); SYSCTL_ADD_QUAD(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "deletes", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->deletes, "Number of BIO_DELETE requests"); + OID_AUTO, "deletes", CTLFLAG_RD, + &softc->deletes, "Number of BIO_DELETE requests"); SYSCTL_ADD_QUAD(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "dsm_req", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->dsm_req, "Number of DSM requests sent to SIM"); + OID_AUTO, "dsm_req", CTLFLAG_RD, + &softc->dsm_req, "Number of DSM requests sent to SIM"); - SYSCTL_ADD_INT(&softc->sysctl_ctx, - SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, - "rotating", - CTLFLAG_RD | CTLFLAG_MPSAFE, - &nda_rotating_media, - 0, - "Rotating media"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "rotating", CTLFLAG_RD, &nda_rotating_media, 1, + "Rotating media"); #ifdef CAM_IO_STATS softc->sysctl_stats_tree = SYSCTL_ADD_NODE(&softc->sysctl_stats_ctx, @@ -657,17 +652,17 @@ ndasysctlinit(void *context, int pending) } SYSCTL_ADD_INT(&softc->sysctl_stats_ctx, SYSCTL_CHILDREN(softc->sysctl_stats_tree), - OID_AUTO, "timeouts", CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, "timeouts", CTLFLAG_RD, &softc->timeouts, 0, "Device timeouts reported by the SIM"); SYSCTL_ADD_INT(&softc->sysctl_stats_ctx, SYSCTL_CHILDREN(softc->sysctl_stats_tree), - OID_AUTO, "errors", CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, "errors", CTLFLAG_RD, &softc->errors, 0, "Transport errors reported by the SIM."); SYSCTL_ADD_INT(&softc->sysctl_stats_ctx, SYSCTL_CHILDREN(softc->sysctl_stats_tree), - OID_AUTO, "pack_invalidations", CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, "pack_invalidations", CTLFLAG_RD, &softc->invalidations, 0, "Device pack invalidations."); #endif From owner-svn-src-all@freebsd.org Tue Mar 20 03:37:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD637FDD; Tue, 20 Mar 2018 03:37:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D8DC7A8FE; Tue, 20 Mar 2018 03:37:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E528017A50; Tue, 20 Mar 2018 03:37:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K3b9FX028483; Tue, 20 Mar 2018 03:37:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3b9fL028482; Tue, 20 Mar 2018 03:37:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200337.w2K3b9fL028482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:37:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331238 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 331238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:37:12 -0000 Author: imp Date: Tue Mar 20 03:37:09 2018 New Revision: 331238 URL: https://svnweb.freebsd.org/changeset/base/331238 Log: Make kern.cam.nda.num_trim tunable to limit the number of BIO_DELETE requests that we'll collapse into one DSM_TRIM. By default it is a 256, which is the max that will fit into a 4k page. Sponsored by: Netflix Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:04 2018 (r331237) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:09 2018 (r331238) @@ -167,19 +167,22 @@ static void ndasuspend(void *arg); #define NDA_MAX_TRIM_ENTRIES 256 /* Number of DSM trims to use, max 256 */ #endif +static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, + "CAM Direct Access Disk driver"); + //static int nda_retry_count = NDA_DEFAULT_RETRY; static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED; static int nda_default_timeout = NDA_DEFAULT_TIMEOUT; static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES; +SYSCTL_INT(_kern_cam_nda, OID_AUTO, max_trim, CTLFLAG_RDTUN, + &nda_max_trim_entries, NDA_MAX_TRIM_ENTRIES, + "Maximum number of BIO_DELETE to send down as a DSM TRIM."); /* * All NVMe media is non-rotational, so all nvme device instances * share this to implement the sysctl. */ static int nda_rotating_media = 0; - -static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, - "CAM Direct Access Disk driver"); static struct periph_driver ndadriver = { From owner-svn-src-all@freebsd.org Tue Mar 20 03:37:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E7BDF42043; Tue, 20 Mar 2018 03:37:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DAA87A9AB; Tue, 20 Mar 2018 03:37:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECE5B17A53; Tue, 20 Mar 2018 03:37:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K3bEUX028539; Tue, 20 Mar 2018 03:37:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3bE9N028537; Tue, 20 Mar 2018 03:37:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200337.w2K3bE9N028537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331239 - in head/sys: cam/nvme dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam/nvme dev/nvme X-SVN-Commit-Revision: 331239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:37:17 -0000 Author: imp Date: Tue Mar 20 03:37:14 2018 New Revision: 331239 URL: https://svnweb.freebsd.org/changeset/base/331239 Log: Starting LBA is a 64bit number, so use htole64 instead of htole32. The latter casts the LBA to a 32-bit number before assigning it to the 64 bit structure entity. This works fine on the first 2TB of TRIMs, but terrible beyond that due to trucation. Also, add an assert to make sure we don't end too many DSM TRIM entries in one request. Sponsored by: Netflix Modified: head/sys/cam/nvme/nvme_da.c head/sys/dev/nvme/nvme.h Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:09 2018 (r331238) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:14 2018 (r331239) @@ -164,7 +164,7 @@ static void ndasuspend(void *arg); #define NDA_DEFAULT_RETRY 4 #endif #ifndef NDA_MAX_TRIM_ENTRIES -#define NDA_MAX_TRIM_ENTRIES 256 /* Number of DSM trims to use, max 256 */ +#define NDA_MAX_TRIM_ENTRIES (NVME_MAX_DSM_TRIM / sizeof(struct nvme_dsm_range))/* Number of DSM trims to use, max 256 */ #endif static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, @@ -218,6 +218,8 @@ static void nda_nvme_trim(struct nda_softc *softc, struct ccb_nvmeio *nvmeio, void *payload, uint32_t num_ranges) { + KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); + cam_fill_nvmeio(nvmeio, 0, /* retries */ ndadone, /* cbfcnp */ @@ -957,7 +959,7 @@ ndastart(struct cam_periph *periph, union ccb *start_c dsm_range->length = htole32(bp1->bio_bcount / softc->disk->d_sectorsize); dsm_range->starting_lba = - htole32(bp1->bio_offset / softc->disk->d_sectorsize); + htole64(bp1->bio_offset / softc->disk->d_sectorsize); dsm_range++; if (dsm_range >= dsm_end) break; Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Tue Mar 20 03:37:09 2018 (r331238) +++ head/sys/dev/nvme/nvme.h Tue Mar 20 03:37:14 2018 (r331239) @@ -478,7 +478,6 @@ struct nvme_completion { _Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for nvme_completion"); struct nvme_dsm_range { - uint32_t attributes; uint32_t length; uint64_t starting_lba; From owner-svn-src-all@freebsd.org Tue Mar 20 05:23:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE600F53233; Tue, 20 Mar 2018 05:23:50 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F7927FBD6; Tue, 20 Mar 2018 05:23:49 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from freyja.zeit4.iv.bundesimmobilien.de ([87.138.105.249]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MSY2q-1f8A5q48xQ-00Rcha; Tue, 20 Mar 2018 06:18:31 +0100 Date: Tue, 20 Mar 2018 06:18:25 +0100 From: "O. Hartmann" To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331238 - head/sys/cam/nvme Message-ID: <20180320061825.3c11090f@freyja.zeit4.iv.bundesimmobilien.de> In-Reply-To: <201803200337.w2K3b9fL028482@repo.freebsd.org> References: <201803200337.w2K3b9fL028482@repo.freebsd.org> Organization: Walstatt MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:GWKDJkKVpzJIcdPLq/JjaMgZz5065GatdNDkIF5WwiRr5MBWe3k fBuQENYz0t5pRzonxU+aeDJTFPcV68WBEQutO3U0h2oP5BdLOWaInoP2uH/dAszb5q95yOo tlK+hJFGVI1ujldIAmNMpt9JGRYivaD91M8grxNCC+x/o3pmFevaN46vAJFD6VrNgXbf/k2 NUO1e3zV+lBHwRRGohe4g== X-UI-Out-Filterresults: notjunk:1;V01:K0:2wyxAliJBVI=:B8Rwu//6UnifPzytMBwaWT pQMhV6DoYsWwGT7v62LwFTlECztdSv7e6uW38XfvCCTG6VgqsN97lKneDIs32wEtGcW8tR4BT t5kEWePQnj0yuf1hZ3EBrHWMCS0FQ5mPpK0Rw5VKOflSfQkU5mRgHWQu+CVU1Ter6NS9eZk3+ lHfzGDRKwIp5Dpiazz5c8Kb4BuOjT81hr5tto1BTMiOx9jBf2I4XZCQx9YIB9JFeqSHqz/mAK Fo8ZsU/AgQLYrn/qhssAzUNJJn6JHN+mhcp6zt43po7i6IIwryg3ba8d4s7tgf+SR/jnE/wSL LJAndCIHpPwPW4Rchq/c4V/9e4kAkwIC1EAR9vpm87jr4jDv61uzEMstgNL6cbQfwx2qWIfa5 GYTXaMge+gK4/7fb0EpMn/6QXEBIjiAFVo/i5dCKVXogZqbqwWaQvdSN4gJVB4k5hnMNxscPh MWNx5QRL9vaWhg3oUNMb+ZePJ3CzpGZmFtKxr2+nxTBhwJxM3u/8TYWUr6PcxLKvUxtzSo5Gl Gko9E7eSqLi039obgSZa2A9zjlD45Y9Lh69bzWXlrN4Xv4W6N0ulOz6ak4vHxqIzb9XvtOHMg 6biHhQw90/V0iXg8vG3NR0hGRRDtn9uX12xgz2/ChGbRtW8Ok9idO1R9gdnf06mIuEbYHaYRg z+bLf7o9ZWnLY+0eHj9K02En3geRvYFL5L7oA3jncM8HcyzPfM4f8aA95anw0ZYT8ZqjjXfNh Btu6HuqT/XnKdDbXdt7iXIceXPdtkOeM1c0HuRN3uX6tM7mZ3eh9iztAmrTIrYSs2Hg1gO/cd 5wS9JyL4/gmoE4dHcEJlnJF6Cg/kwcnYRY0fbbinfcFEg+wnkE= X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 05:23:51 -0000 On Tue, 20 Mar 2018 03:37:09 +0000 (UTC) Warner Losh wrote: > Author: imp > Date: Tue Mar 20 03:37:09 2018 > New Revision: 331238 > URL: https://svnweb.freebsd.org/changeset/base/331238 > > Log: > Make kern.cam.nda.num_trim tunable to limit the number of BIO_DELETE > requests that we'll collapse into one DSM_TRIM. By default it is a > 256, which is the max that will fit into a 4k page. > > Sponsored by: Netflix > > Modified: > head/sys/cam/nvme/nvme_da.c > > Modified: head/sys/cam/nvme/nvme_da.c > ============================================================================== > --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:04 2018 > (r331237) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:09 > 2018 (r331238) @@ -167,19 +167,22 @@ static void > ndasuspend(void *arg); #define NDA_MAX_TRIM_ENTRIES 256 /* Number of > DSM trims to use, max 256 */ #endif > > +static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, > + "CAM Direct Access Disk driver"); > + > //static int nda_retry_count = NDA_DEFAULT_RETRY; > static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED; > static int nda_default_timeout = NDA_DEFAULT_TIMEOUT; > static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES; > +SYSCTL_INT(_kern_cam_nda, OID_AUTO, max_trim, CTLFLAG_RDTUN, > + &nda_max_trim_entries, NDA_MAX_TRIM_ENTRIES, > + "Maximum number of BIO_DELETE to send down as a DSM TRIM."); > > /* > * All NVMe media is non-rotational, so all nvme device instances > * share this to implement the sysctl. > */ > static int nda_rotating_media = 0; > - > -static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, > - "CAM Direct Access Disk driver"); > > static struct periph_driver ndadriver = > { > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" Buildkernel on CURRENT fails with the error shown below sinde this commit: [...] --- nvme_da.o --- /usr/src/sys/cam/nvme/nvme_da.c:221:72: error: too few arguments provided to function-like macro invocation KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); ^ /usr/src/sys/sys/systm.h:99:9: note: macro 'KASSERT' defined here #define KASSERT(exp,msg) do { \ ^ /usr/src/sys/cam/nvme/nvme_da.c:221:2: error: use of undeclared identifier 'KASSERT' KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); ^ 2 errors generated. *** [nvme_da.o] Error code 1 From owner-svn-src-all@freebsd.org Tue Mar 20 05:58:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D318F5532F for ; Tue, 20 Mar 2018 05:58:53 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7E1280E99 for ; Tue, 20 Mar 2018 05:58:52 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-it0-x22c.google.com with SMTP id k79-v6so885886ita.2 for ; Mon, 19 Mar 2018 22:58:52 -0700 (PDT) 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=IHZtAcWWWKFsuEI4vvZFyIlkhMM9m3BLA4TCB4R0s5g=; b=B9KZ61oXAfE5l8Kq6zc6NQ6N1ri7a0e6xDyhWdNkuVmQSbmyZFU2Nez26WphOjlClC yayZI0YoijYFznaM8kh24v4NkWFgO0CXgcu97wMnhEypX607xT/WaKWz0deyN8O3P4Qb o0fmupEKKGoeSWVVcZXbUTRGxfUk7UBLsmKIyEVcvjf6jyLNTXn23ZOvInnBaG6/cgEw GiXeS+SYhn5w0al1H+Pz/auHTQJClE9TR6VdGxy2fcI6bQ/ul1DvjjLxOae7WHpIRi67 Xt9ABsimWkUK011jebsm2Sfzb2eZBR1t83p3UItKY6OYjSz41UbHwS86I+eHuQm/mvMd gZKA== 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=IHZtAcWWWKFsuEI4vvZFyIlkhMM9m3BLA4TCB4R0s5g=; b=M0UGhPJwCExWy8NyQA4PzweV9Rk0OPlOWjoKZ8ieNJR46QsO1rWGloX7Mt4HSJLN/1 SwmOl/GXZ3A9odrTbFsvQpZ25b9K3FXGsvyKlaO9naYS3anzlWbLlxHisWkgPP/mJcdQ LvTqScp2nstO5feMwBSzuPXao4Xl8WzzqsWeFrARdHdohR8b5Fl1f2Dub8Sq42+RzX1z TiVh1EIpEd1OGeRzK0796nF4m4wnej5+tLl+PWypvg6EnD7DXh8BOkH2e7/r45iRI9tq 0aFSzOorNhkQ0QXzqBy/jNojeT3+Egq53st/xvEtmGIm9NeE07aqzYaJoraVSDHOeHrH DHPw== X-Gm-Message-State: AElRT7H7R3QpzzBWdJWz7h5JgL0F1SzqUS8U16MFKnluTBvdfqYTl9uN VEMnfTqMXAa1hhk4Ypt/idnptQ== X-Google-Smtp-Source: AG47ELv3sbN1xBm0m2hCUoijgIApQ+BXl4rNy/ezRg7qALtajzcboefyswJwgPQAY5TKbnTdSGXl3A== X-Received: by 2002:a24:d8f:: with SMTP id 137-v6mr1548227itx.30.1521525532141; Mon, 19 Mar 2018 22:58:52 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id y3-v6sm527872itg.3.2018.03.19.22.58.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 22:58:51 -0700 (PDT) Date: Mon, 19 Mar 2018 19:57:57 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Justin Hibbits cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331233 - head/sys/kern In-Reply-To: <201803200201.w2K21UgY079589@repo.freebsd.org> Message-ID: References: <201803200201.w2K21UgY079589@repo.freebsd.org> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 05:58:53 -0000 Thanks for fixing my bug. Sorry I didn't build universe for this one. Thanks, Jeff On Tue, 20 Mar 2018, Justin Hibbits wrote: > Author: jhibbits > Date: Tue Mar 20 02:01:30 2018 > New Revision: 331233 > URL: https://svnweb.freebsd.org/changeset/base/331233 > > Log: > Cast through uintptr_t to narrow the buf domain pointer on 32-bit archs > > arg2 is an intmax_t, which on 32-bit architectures is 64 bits, wider than a > pointer. When &bdomain[i] is added to arg2 it widens from uintptr_t to > intmax_t, then gcc whines when it gets cast to a pointer. Casting through > uintptr_t silences this warning. > > Modified: > head/sys/kern/vfs_bio.c > > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Tue Mar 20 01:33:04 2018 (r331232) > +++ head/sys/kern/vfs_bio.c Tue Mar 20 02:01:30 2018 (r331233) > @@ -435,7 +435,7 @@ sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS) > return (error); > *(int *)arg1 = value; > for (i = 0; i < buf_domains; i++) > - *(int *)(((uintptr_t)&bdomain[i]) + arg2) = > + *(int *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = > value / buf_domains; > > return (error); > @@ -454,7 +454,7 @@ sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS) > return (error); > *(long *)arg1 = value; > for (i = 0; i < buf_domains; i++) > - *(long *)(((uintptr_t)&bdomain[i]) + arg2) = > + *(long *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = > value / buf_domains; > > return (error); > From owner-svn-src-all@freebsd.org Tue Mar 20 08:50:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA3C1F5EE8C; Tue, 20 Mar 2018 08:50:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9C587C73; Tue, 20 Mar 2018 08:50:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id D30E4D705F5; Tue, 20 Mar 2018 19:19:01 +1100 (AEDT) Date: Tue, 20 Mar 2018 19:19:01 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux In-Reply-To: <201803192126.w2JLQW0N039356@repo.freebsd.org> Message-ID: <20180320183744.S950@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=cb1CRZbu697s9Y3qxmIA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 08:50:30 -0000 On Mon, 19 Mar 2018, Ed Maste wrote: > Log: > Rename linuxulator functions with linux_ prefix > > It's preferable to have a consistent prefix. This also reduces > differences between the three linux*_sysvec.c files. It is preferable to have a well-chosen (short...) prefix. The linux emulator mostly uses l_ for internal names. That is a bit too short for external names. > Modified: head/sys/amd64/linux/linux_sysvec.c > ============================================================================== > --- head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) > +++ head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) > @@ -119,14 +119,14 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL > SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); > > static register_t * linux_copyout_strings(struct image_params *imgp); > -static int elf_linux_fixup(register_t **stack_base, > +static int linux_elf_fixup(register_t **stack_base, > struct image_params *iparams); 'elf_' is an example of a well-chosen prefix. I don't like the style of putting the verb last in names, but it goes well with putting prefixes first. Here the verb placement style is random -- the verb is last in ...handler_set and ...elf_fixup, but not last in ...copyout_strings. > @@ -180,7 +180,7 @@ LINUX_VDSO_SYM_CHAR(linux_platform); > * MPSAFE > */ > static int > -translate_traps(int signal, int trap_code) > +linux_translate_traps(int signal, int trap_code) Names without any prefix are likely to have had the verb first, and now in the middle. > @@ -245,7 +245,7 @@ linux_set_syscall_retval(struct thread *td, int error) > } > > static int > -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) > +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) > { > Elf_Auxargs *args; > Elf_Addr *base; The elf_ prefix was first, but is now last (after the verb, unlike elsewhere for linux_elf_*. > Modified: head/sys/amd64/linux32/linux32_sysvec.c > ... > static void linux32_fixlimit(struct rlimit *rl, int which); The random verb order is especially confsing for 'fix' and 'fixup'. 'fixup' is a noun, but is sometimes abused as a verb and adverb instead of the correct verb and adverb 'fix up'. When it is placed at the end, e.g., for limit_fixup(), it is unclear if it is a noun or a verb. The noun form would mean a function returning a fixup and the verb form would mean a function fixing up something. Using 'fix' instead of fix as a verb at the end is even worse since 'fix' really is both a noun and a verb. The normal order in fixlimit makes it clear that it is used as a verb. Bruce From owner-svn-src-all@freebsd.org Tue Mar 20 12:55:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66489F4AE90; Tue, 20 Mar 2018 12:55:27 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4CEB71708; Tue, 20 Mar 2018 12:55:26 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id j68-v6so2339862lfg.13; Tue, 20 Mar 2018 05:55:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=m4B3+zECkMeHeUVOZyhTVThpX4XEZhggAOA1pZYRTn0=; b=Tdo4pKegDgEvyuqqTXc7TsQVI+0R1rzz8HVIHWP8XZQenKmjWX8y9hYSeoLAUxOB2M gpt5Deyplul1bK3L8mEfJd5L4giVPY/YajZCCCAqdoMicPL01HZTxDipBMl/FpoFDphi nCsGx8cZbvOO9wnp0r0XQxlRdtr379Eu/5GrD+mZQZUkfVWbcd93LwaFYw3AYTJKHuhJ lUba5xf/hkPO0+4VaCDvNl6h5LFUTEIZPZhXVUMJoQZX1s/NuMRi/pDUrD4tt8nUcxd7 LGcW5079cuK0rN+J7vCXgtZOBZawQX4Qd1QnRcc+Mptl9t6NPk3lz8HWj/7HNEnz3hMN /aZA== X-Gm-Message-State: AElRT7EcFY4TNJA4D6wxu9NS9ayre5S7gJKM77uz71DFAqSf0ZMQkqig JdG0inacv9ygibw+aZMBFHLkeA0L X-Google-Smtp-Source: AG47ELvvAng7fSMqaYWCMNHvEVkfwkd7ufL7F32rpk4nhMZpDNIJMeAy6vKkK8yIeX3cvMyAyZACCg== X-Received: by 10.46.135.74 with SMTP id q10mr10378331ljj.73.1521550511425; Tue, 20 Mar 2018 05:55:11 -0700 (PDT) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com. [209.85.215.52]) by smtp.gmail.com with ESMTPSA id o21-v6sm428084lfi.3.2018.03.20.05.55.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 05:55:11 -0700 (PDT) Received: by mail-lf0-f52.google.com with SMTP id z143-v6so2363460lff.3; Tue, 20 Mar 2018 05:55:11 -0700 (PDT) X-Received: by 2002:a19:114f:: with SMTP id g76-v6mr6548076lfi.108.1521550511114; Tue, 20 Mar 2018 05:55:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Tue, 20 Mar 2018 05:54:50 -0700 (PDT) In-Reply-To: References: <201803191616.w2JGGCid083460@repo.freebsd.org> From: Kyle Evans Date: Tue, 20 Mar 2018 07:54:50 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331212 - in head: etc/mtree stand/defaults To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 12:55:27 -0000 On Mon, Mar 19, 2018 at 8:08 PM, Oliver Pinter wrote: > > > On Monday, March 19, 2018, Kyle Evans wrote: >> >> Author: kevans >> Date: Mon Mar 19 16:16:12 2018 >> New Revision: 331212 >> URL: https://svnweb.freebsd.org/changeset/base/331212 >> >> Log: >> Move /boot/overlays to /boot/dtb/overlays >> > > Hi! > > Do you plan to add the old files to ObsoleteFiles.inc? > Hi, Done in r331232. Thanks! Kyle Evans From owner-svn-src-all@freebsd.org Tue Mar 20 13:14:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90490F4C90B; Tue, 20 Mar 2018 13:14:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 42FEF72467; Tue, 20 Mar 2018 13:14:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B08C1D518; Tue, 20 Mar 2018 13:14:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KDEB6f019199; Tue, 20 Mar 2018 13:14:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KDEBtc019198; Tue, 20 Mar 2018 13:14:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803201314.w2KDEBtc019198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 13:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331240 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 331240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 13:14:11 -0000 Author: imp Date: Tue Mar 20 13:14:10 2018 New Revision: 331240 URL: https://svnweb.freebsd.org/changeset/base/331240 Log: Kill assert I shouldn't have committed Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:14 2018 (r331239) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 13:14:10 2018 (r331240) @@ -218,8 +218,6 @@ static void nda_nvme_trim(struct nda_softc *softc, struct ccb_nvmeio *nvmeio, void *payload, uint32_t num_ranges) { - KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); - cam_fill_nvmeio(nvmeio, 0, /* retries */ ndadone, /* cbfcnp */ From owner-svn-src-all@freebsd.org Tue Mar 20 13:35:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C75DAF4E1A3; Tue, 20 Mar 2018 13:35:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77C4973055; Tue, 20 Mar 2018 13:35:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 729511D823; Tue, 20 Mar 2018 13:35:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KDZKii029316; Tue, 20 Mar 2018 13:35:20 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KDZKs1029315; Tue, 20 Mar 2018 13:35:20 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803201335.w2KDZKs1029315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 20 Mar 2018 13:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331241 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 331241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 13:35:21 -0000 Author: andrew Date: Tue Mar 20 13:35:20 2018 New Revision: 331241 URL: https://svnweb.freebsd.org/changeset/base/331241 Log: Check if the gettime runtime service is valid. The U-Boot efi runtime service expects us to set the address map before calling any runtime services. It will then remap a few functions to their runtime version. One of these is the gettime function. If we call into this without having set a runtime map we get a page fault. Add a check to see if this is valid in efi_init() so we don't try to use the possibly invalid pointer. Reviewed by: imp, kevans (both previous version) X-MFC-With: r330868 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14759 Modified: head/sys/dev/efidev/efirt.c Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Tue Mar 20 13:14:10 2018 (r331240) +++ head/sys/dev/efidev/efirt.c Tue Mar 20 13:35:20 2018 (r331241) @@ -99,6 +99,25 @@ efi_status_to_errno(efi_status status) static struct mtx efi_lock; +static bool +efi_is_in_map(struct efi_md *map, int ndesc, int descsz, vm_offset_t addr) +{ + struct efi_md *p; + int i; + + for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, + descsz)) { + if ((p->md_attr & EFI_MD_ATTR_RT) == 0) + continue; + + if (addr >= (uintptr_t)p->md_virt && + addr < (uintptr_t)p->md_virt + p->md_pages * PAGE_SIZE) + return (true); + } + + return (false); +} + static int efi_init(void) { @@ -160,6 +179,24 @@ efi_init(void) if (efi_runtime == NULL) { if (bootverbose) printf("EFI runtime services table is not present\n"); + efi_destroy_1t1_map(); + return (ENXIO); + } + + /* + * Some UEFI implementations have multiple implementations of the + * RS->GetTime function. They switch from one we can only use early + * in the boot process to one valid as a RunTime service only when we + * call RS->SetVirtualAddressMap. As this is not always the case, e.g. + * with an old loader.efi, check if the RS->GetTime function is within + * the EFI map, and fail to attach if not. + */ + if (!efi_is_in_map(map, efihdr->memory_size / efihdr->descriptor_size, + efihdr->descriptor_size, (vm_offset_t)efi_runtime->rt_gettime)) { + if (bootverbose) + printf( + "EFI runtime services table has an invalid pointer\n"); + efi_runtime = NULL; efi_destroy_1t1_map(); return (ENXIO); } From owner-svn-src-all@freebsd.org Tue Mar 20 13:39:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72051F4E654; Tue, 20 Mar 2018 13:39:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1862873622; Tue, 20 Mar 2018 13:39:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 041DC1D828; Tue, 20 Mar 2018 13:39:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KDdfpB029567; Tue, 20 Mar 2018 13:39:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KDdfbe029566; Tue, 20 Mar 2018 13:39:41 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803201339.w2KDdfbe029566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 20 Mar 2018 13:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331242 - head X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 13:39:42 -0000 Author: andrew Date: Tue Mar 20 13:39:41 2018 New Revision: 331242 URL: https://svnweb.freebsd.org/changeset/base/331242 Log: Remove the entry about loader.efi needing to be updated before the kernel. The kernel now handles the situation it's warning against as of r331241. Sponsored by: DARPA, AFRL Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Mar 20 13:35:20 2018 (r331241) +++ head/UPDATING Tue Mar 20 13:39:41 2018 (r331242) @@ -51,24 +51,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** -20180319: - For u-boot based arm64 UEFI systems: the UEFI loader(8), loader.efi, - should be updated in conjunction with installing a new kernel after - r330868. The kernel, after this revision, will be more lenient when - mapping addresses for UEFI Runtime Services and this may result in a - kernel panic without the corresponding loader(8) update. If you have a - recent kernel, you can do a installkernel / installworld and then reboot - as there's no recent syscall changes. If you have an older kernel and/or - a 11.x system, the following sequence is safe: - % make buildworld - % make buildkernel - % sudo make installkernel - % cd stand - % sudo make install - % sudo reboot - ... - % sudo make installworld - 20180212: FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf. From owner-svn-src-all@freebsd.org Tue Mar 20 15:29:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34173F56029 for ; Tue, 20 Mar 2018 15:29:12 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 AD16377B91 for ; Tue, 20 Mar 2018 15:29:11 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 473cd9f9-2c53-11e8-b951-f99fef315fd9 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 outbound2.ore.mailhop.org (Halon) with ESMTPSA id 473cd9f9-2c53-11e8-b951-f99fef315fd9; Tue, 20 Mar 2018 15:28:03 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w2KFT2wT040201; Tue, 20 Mar 2018 09:29:02 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1521559742.99081.110.camel@freebsd.org> Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux From: Ian Lepore To: Bruce Evans , Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 20 Mar 2018 09:29:02 -0600 In-Reply-To: <20180320183744.S950@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> <20180320183744.S950@besplex.bde.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:29:12 -0000 On Tue, 2018-03-20 at 19:19 +1100, Bruce Evans wrote: > The random verb order is especially confsing for 'fix' and 'fixup'. > 'fixup' is a noun, but is sometimes abused as a verb and adverb instead > of the correct verb and adverb 'fix up'.  When it is placed at the > end, e.g., for limit_fixup(), it is unclear if it is a noun or a verb. > The noun form would mean a function returning a fixup and the verb > form would mean a function fixing up something.  Using 'fix' instead > of fix as a verb at the end is even worse since 'fix' really is both > a noun and a verb.  The normal order in fixlimit makes it clear that > it is used as a verb. This stuff all becomes easier if you remember one simple rule:     In English, there is no noun which cannot be verbed. -- Ian From owner-svn-src-all@freebsd.org Tue Mar 20 15:44:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B20C9F57160; Tue, 20 Mar 2018 15:44:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6256F789B2; Tue, 20 Mar 2018 15:44:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CF641EBFD; Tue, 20 Mar 2018 15:44:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KFiIpu094026; Tue, 20 Mar 2018 15:44:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KFiHht094018; Tue, 20 Mar 2018 15:44:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803201544.w2KFiHht094018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Mar 2018 15:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331244 - in head: contrib/llvm/projects/libunwind/include contrib/llvm/projects/libunwind/src share/mk X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: contrib/llvm/projects/libunwind/include contrib/llvm/projects/libunwind/src share/mk X-SVN-Commit-Revision: 331244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:44:19 -0000 Author: jhb Date: Tue Mar 20 15:44:17 2018 New Revision: 331244 URL: https://svnweb.freebsd.org/changeset/base/331244 Log: Add support for MIPS to LLVM's libunwind. This is originally based on a patch from David Chisnall for soft-float N64 but has since been updated to support O32, N32, and hard-float ABIs. The soft-float O32, N32, and N64 support has been committed upstream. The hard-float changes are still in review upstream. Enable LLVM_LIBUNWIND on mips when building with a suitable (C+11-capable) toolchain. This has been tested with external GCC for all ABIs and O32 and N64 with clang. Reviewed by: emaste Obtained from: CheriBSD (original N64 patch) Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14701 Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h head/contrib/llvm/projects/libunwind/include/libunwind.h head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp head/contrib/llvm/projects/libunwind/src/Registers.hpp head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S head/contrib/llvm/projects/libunwind/src/config.h head/contrib/llvm/projects/libunwind/src/libunwind.cpp head/share/mk/src.opts.mk Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Tue Mar 20 15:44:17 2018 (r331244) @@ -53,6 +53,38 @@ # define _LIBUNWIND_CONTEXT_SIZE 64 # define _LIBUNWIND_CURSOR_SIZE 76 # define _LIBUNWIND_MAX_REGISTER 96 +# elif defined(__mips__) +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 +# define _LIBUNWIND_TARGET_MIPS_O32 1 +# if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 50 +# define _LIBUNWIND_CURSOR_SIZE 61 +# else +# define _LIBUNWIND_CONTEXT_SIZE 18 +# define _LIBUNWIND_CURSOR_SIZE 29 +# endif +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 +# define _LIBUNWIND_TARGET_MIPS_NEWABI 1 +# if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 67 +# define _LIBUNWIND_CURSOR_SIZE 78 +# else +# define _LIBUNWIND_CONTEXT_SIZE 35 +# define _LIBUNWIND_CURSOR_SIZE 46 +# endif +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 +# define _LIBUNWIND_TARGET_MIPS_NEWABI 1 +# if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 67 +# define _LIBUNWIND_CURSOR_SIZE 79 +# else +# define _LIBUNWIND_CONTEXT_SIZE 35 +# define _LIBUNWIND_CURSOR_SIZE 47 +# endif +# else +# error "Unsupported MIPS ABI and/or environment" +# endif +# define _LIBUNWIND_MAX_REGISTER 66 # else # error "Unsupported architecture." # endif @@ -63,6 +95,8 @@ # define _LIBUNWIND_TARGET_AARCH64 1 # define _LIBUNWIND_TARGET_ARM 1 # define _LIBUNWIND_TARGET_OR1K 1 +# define _LIBUNWIND_TARGET_MIPS_O32 1 +# define _LIBUNWIND_TARGET_MIPS_NEWABI 1 # define _LIBUNWIND_CONTEXT_SIZE 128 # define _LIBUNWIND_CURSOR_SIZE 140 # define _LIBUNWIND_MAX_REGISTER 120 Modified: head/contrib/llvm/projects/libunwind/include/libunwind.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/libunwind.h Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/include/libunwind.h Tue Mar 20 15:44:17 2018 (r331244) @@ -604,4 +604,74 @@ enum { UNW_RISCV_D31 = 95, }; +// MIPS registers +enum { + UNW_MIPS_R0 = 0, + UNW_MIPS_R1 = 1, + UNW_MIPS_R2 = 2, + UNW_MIPS_R3 = 3, + UNW_MIPS_R4 = 4, + UNW_MIPS_R5 = 5, + UNW_MIPS_R6 = 6, + UNW_MIPS_R7 = 7, + UNW_MIPS_R8 = 8, + UNW_MIPS_R9 = 9, + UNW_MIPS_R10 = 10, + UNW_MIPS_R11 = 11, + UNW_MIPS_R12 = 12, + UNW_MIPS_R13 = 13, + UNW_MIPS_R14 = 14, + UNW_MIPS_R15 = 15, + UNW_MIPS_R16 = 16, + UNW_MIPS_R17 = 17, + UNW_MIPS_R18 = 18, + UNW_MIPS_R19 = 19, + UNW_MIPS_R20 = 20, + UNW_MIPS_R21 = 21, + UNW_MIPS_R22 = 22, + UNW_MIPS_R23 = 23, + UNW_MIPS_R24 = 24, + UNW_MIPS_R25 = 25, + UNW_MIPS_R26 = 26, + UNW_MIPS_R27 = 27, + UNW_MIPS_R28 = 28, + UNW_MIPS_R29 = 29, + UNW_MIPS_R30 = 30, + UNW_MIPS_R31 = 31, + UNW_MIPS_F0 = 32, + UNW_MIPS_F1 = 33, + UNW_MIPS_F2 = 34, + UNW_MIPS_F3 = 35, + UNW_MIPS_F4 = 36, + UNW_MIPS_F5 = 37, + UNW_MIPS_F6 = 38, + UNW_MIPS_F7 = 39, + UNW_MIPS_F8 = 40, + UNW_MIPS_F9 = 41, + UNW_MIPS_F10 = 42, + UNW_MIPS_F11 = 43, + UNW_MIPS_F12 = 44, + UNW_MIPS_F13 = 45, + UNW_MIPS_F14 = 46, + UNW_MIPS_F15 = 47, + UNW_MIPS_F16 = 48, + UNW_MIPS_F17 = 49, + UNW_MIPS_F18 = 50, + UNW_MIPS_F19 = 51, + UNW_MIPS_F20 = 52, + UNW_MIPS_F21 = 53, + UNW_MIPS_F22 = 54, + UNW_MIPS_F23 = 55, + UNW_MIPS_F24 = 56, + UNW_MIPS_F25 = 57, + UNW_MIPS_F26 = 58, + UNW_MIPS_F27 = 59, + UNW_MIPS_F28 = 60, + UNW_MIPS_F29 = 61, + UNW_MIPS_F30 = 62, + UNW_MIPS_F31 = 63, + UNW_MIPS_HI = 64, + UNW_MIPS_LO = 65, +}; + #endif Modified: head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -148,6 +148,7 @@ class __attribute__((visibility("hidden"))) LocalAddre return val; } uintptr_t getP(pint_t addr); + uint64_t getRegister(pint_t addr); static uint64_t getULEB128(pint_t &addr, pint_t end); static int64_t getSLEB128(pint_t &addr, pint_t end); @@ -169,6 +170,14 @@ inline uintptr_t LocalAddressSpace::getP(pint_t addr) #endif } +inline uint64_t LocalAddressSpace::getRegister(pint_t addr) { +#if defined(__LP64__) || defined(__mips64) + return get64(addr); +#else + return get32(addr); +#endif +} + /// Read a ULEB128 into a 64-bit word. inline uint64_t LocalAddressSpace::getULEB128(pint_t &addr, pint_t end) { const uint8_t *p = (uint8_t *)addr; @@ -496,6 +505,7 @@ class OtherAddressSpace { (public) uint32_t get32(pint_t addr); uint64_t get64(pint_t addr); pint_t getP(pint_t addr); + uint64_t getRegister(pint_t addr); uint64_t getULEB128(pint_t &addr, pint_t end); int64_t getSLEB128(pint_t &addr, pint_t end); pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding, @@ -529,6 +539,11 @@ template uint64_t OtherAddressSpace

::g template typename P::uint_t OtherAddressSpace

::getP(pint_t addr) { return P::getP(*(uint64_t *)localCopy(addr)); +} + +template +typename P::uint_t OtherAddressSpace

::getRegister(pint_t addr) { + return P::getRegister(*(uint64_t *)localCopy(addr)); } template Modified: head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -83,10 +83,10 @@ typename A::pint_t DwarfInstructions::getSavedRe const RegisterLocation &savedReg) { switch (savedReg.location) { case CFI_Parser::kRegisterInCFA: - return addressSpace.getP(cfa + (pint_t)savedReg.value); + return addressSpace.getRegister(cfa + (pint_t)savedReg.value); case CFI_Parser::kRegisterAtExpression: - return addressSpace.getP( + return addressSpace.getRegister( evaluateExpression((pint_t)savedReg.value, addressSpace, registers, cfa)); Modified: head/contrib/llvm/projects/libunwind/src/Registers.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/Registers.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/Registers.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -2168,6 +2168,612 @@ inline void Registers_riscv::setVectorRegister(int, v1 _LIBUNWIND_ABORT("no riscv vector register support yet"); } #endif // _LIBUNWIND_TARGET_RISCV + +#if defined(_LIBUNWIND_TARGET_MIPS_O32) +/// Registers_mips_o32 holds the register state of a thread in a 32-bit MIPS +/// process. +class _LIBUNWIND_HIDDEN Registers_mips_o32 { +public: + Registers_mips_o32(); + Registers_mips_o32(const void *registers); + + bool validRegister(int num) const; + uint32_t getRegister(int num) const; + void setRegister(int num, uint32_t value); + bool validFloatRegister(int num) const; + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); + bool validVectorRegister(int num) const; + v128 getVectorRegister(int num) const; + void setVectorRegister(int num, v128 value); + const char *getRegisterName(int num); + void jumpto(); + static int lastDwarfRegNum() { return 65; } + + uint32_t getSP() const { return _registers.__r[29]; } + void setSP(uint32_t value) { _registers.__r[29] = value; } + uint32_t getIP() const { return _registers.__pc; } + void setIP(uint32_t value) { _registers.__pc = value; } + +private: + struct mips_o32_thread_state_t { + uint32_t __r[32]; + uint32_t __pc; + uint32_t __hi; + uint32_t __lo; + }; + + mips_o32_thread_state_t _registers; +#ifdef __mips_hard_float + /// O32 with 32-bit floating point registers only uses half of this + /// space. However, using the same layout for 32-bit vs 64-bit + /// floating point registers results in a single context size for + /// O32 with hard float. + uint32_t _padding; + double _floats[32]; +#endif +}; + +inline Registers_mips_o32::Registers_mips_o32(const void *registers) { + static_assert((check_fit::does_fit), + "mips_o32 registers do not fit into unw_context_t"); + memcpy(&_registers, static_cast(registers), + sizeof(_registers)); +} + +inline Registers_mips_o32::Registers_mips_o32() { + memset(&_registers, 0, sizeof(_registers)); +} + +inline bool Registers_mips_o32::validRegister(int regNum) const { + if (regNum == UNW_REG_IP) + return true; + if (regNum == UNW_REG_SP) + return true; + if (regNum < 0) + return false; + if (regNum <= UNW_MIPS_R31) + return true; + if (regNum == UNW_MIPS_HI) + return true; + if (regNum == UNW_MIPS_LO) + return true; +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; +#endif + // FIXME: DSP accumulator registers, MSA registers + return false; +} + +inline uint32_t Registers_mips_o32::getRegister(int regNum) const { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) + return _registers.__r[regNum - UNW_MIPS_R0]; +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) { + uint32_t *p; + + if (regNum % 2 == 0) + p = (uint32_t *)&_floats[regNum - UNW_MIPS_F0]; + else + p = (uint32_t *)&_floats[(regNum - 1) - UNW_MIPS_F0] + 1; + return *p; + } +#endif + + switch (regNum) { + case UNW_REG_IP: + return _registers.__pc; + case UNW_REG_SP: + return _registers.__r[29]; + case UNW_MIPS_HI: + return _registers.__hi; + case UNW_MIPS_LO: + return _registers.__lo; + } + _LIBUNWIND_ABORT("unsupported mips_o32 register"); +} + +inline void Registers_mips_o32::setRegister(int regNum, uint32_t value) { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) { + _registers.__r[regNum - UNW_MIPS_R0] = value; + return; + } +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) { + uint32_t *p; + + if (regNum % 2 == 0) + p = (uint32_t *)&_floats[regNum - UNW_MIPS_F0]; + else + p = (uint32_t *)&_floats[(regNum - 1) - UNW_MIPS_F0] + 1; + *p = value; + return; + } +#endif + + switch (regNum) { + case UNW_REG_IP: + _registers.__pc = value; + return; + case UNW_REG_SP: + _registers.__r[29] = value; + return; + case UNW_MIPS_HI: + _registers.__hi = value; + return; + case UNW_MIPS_LO: + _registers.__lo = value; + return; + } + _LIBUNWIND_ABORT("unsupported mips_o32 register"); +} + +inline bool Registers_mips_o32::validFloatRegister(int regNum) const { +#if defined(__mips_hard_float) && __mips_fpr == 64 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; +#endif + return false; +} + +inline double Registers_mips_o32::getFloatRegister(int regNum) const { +#if defined(__mips_hard_float) && __mips_fpr == 64 + assert(validFloatRegister(regNum)); + return _floats[regNum - UNW_MIPS_F0]; +#else + _LIBUNWIND_ABORT("mips_o32 float support not implemented"); +#endif +} + +inline void Registers_mips_o32::setFloatRegister(int regNum, + double value) { +#if defined(__mips_hard_float) && __mips_fpr == 64 + assert(validFloatRegister(regNum)); + _floats[regNum - UNW_MIPS_F0] = value; +#else + _LIBUNWIND_ABORT("mips_o32 float support not implemented"); +#endif +} + +inline bool Registers_mips_o32::validVectorRegister(int /* regNum */) const { + return false; +} + +inline v128 Registers_mips_o32::getVectorRegister(int /* regNum */) const { + _LIBUNWIND_ABORT("mips_o32 vector support not implemented"); +} + +inline void Registers_mips_o32::setVectorRegister(int /* regNum */, v128 /* value */) { + _LIBUNWIND_ABORT("mips_o32 vector support not implemented"); +} + +inline const char *Registers_mips_o32::getRegisterName(int regNum) { + switch (regNum) { + case UNW_MIPS_R0: + return "$0"; + case UNW_MIPS_R1: + return "$1"; + case UNW_MIPS_R2: + return "$2"; + case UNW_MIPS_R3: + return "$3"; + case UNW_MIPS_R4: + return "$4"; + case UNW_MIPS_R5: + return "$5"; + case UNW_MIPS_R6: + return "$6"; + case UNW_MIPS_R7: + return "$7"; + case UNW_MIPS_R8: + return "$8"; + case UNW_MIPS_R9: + return "$9"; + case UNW_MIPS_R10: + return "$10"; + case UNW_MIPS_R11: + return "$11"; + case UNW_MIPS_R12: + return "$12"; + case UNW_MIPS_R13: + return "$13"; + case UNW_MIPS_R14: + return "$14"; + case UNW_MIPS_R15: + return "$15"; + case UNW_MIPS_R16: + return "$16"; + case UNW_MIPS_R17: + return "$17"; + case UNW_MIPS_R18: + return "$18"; + case UNW_MIPS_R19: + return "$19"; + case UNW_MIPS_R20: + return "$20"; + case UNW_MIPS_R21: + return "$21"; + case UNW_MIPS_R22: + return "$22"; + case UNW_MIPS_R23: + return "$23"; + case UNW_MIPS_R24: + return "$24"; + case UNW_MIPS_R25: + return "$25"; + case UNW_MIPS_R26: + return "$26"; + case UNW_MIPS_R27: + return "$27"; + case UNW_MIPS_R28: + return "$28"; + case UNW_MIPS_R29: + return "$29"; + case UNW_MIPS_R30: + return "$30"; + case UNW_MIPS_R31: + return "$31"; + case UNW_MIPS_F0: + return "$f0"; + case UNW_MIPS_F1: + return "$f1"; + case UNW_MIPS_F2: + return "$f2"; + case UNW_MIPS_F3: + return "$f3"; + case UNW_MIPS_F4: + return "$f4"; + case UNW_MIPS_F5: + return "$f5"; + case UNW_MIPS_F6: + return "$f6"; + case UNW_MIPS_F7: + return "$f7"; + case UNW_MIPS_F8: + return "$f8"; + case UNW_MIPS_F9: + return "$f9"; + case UNW_MIPS_F10: + return "$f10"; + case UNW_MIPS_F11: + return "$f11"; + case UNW_MIPS_F12: + return "$f12"; + case UNW_MIPS_F13: + return "$f13"; + case UNW_MIPS_F14: + return "$f14"; + case UNW_MIPS_F15: + return "$f15"; + case UNW_MIPS_F16: + return "$f16"; + case UNW_MIPS_F17: + return "$f17"; + case UNW_MIPS_F18: + return "$f18"; + case UNW_MIPS_F19: + return "$f19"; + case UNW_MIPS_F20: + return "$f20"; + case UNW_MIPS_F21: + return "$f21"; + case UNW_MIPS_F22: + return "$f22"; + case UNW_MIPS_F23: + return "$f23"; + case UNW_MIPS_F24: + return "$f24"; + case UNW_MIPS_F25: + return "$f25"; + case UNW_MIPS_F26: + return "$f26"; + case UNW_MIPS_F27: + return "$f27"; + case UNW_MIPS_F28: + return "$f28"; + case UNW_MIPS_F29: + return "$f29"; + case UNW_MIPS_F30: + return "$f30"; + case UNW_MIPS_F31: + return "$f31"; + case UNW_MIPS_HI: + return "$hi"; + case UNW_MIPS_LO: + return "$lo"; + default: + return "unknown register"; + } +} +#endif // _LIBUNWIND_TARGET_MIPS_O32 + +#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI) +/// Registers_mips_newabi holds the register state of a thread in a +/// MIPS process using NEWABI (the N32 or N64 ABIs). +class _LIBUNWIND_HIDDEN Registers_mips_newabi { +public: + Registers_mips_newabi(); + Registers_mips_newabi(const void *registers); + + bool validRegister(int num) const; + uint64_t getRegister(int num) const; + void setRegister(int num, uint64_t value); + bool validFloatRegister(int num) const; + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); + bool validVectorRegister(int num) const; + v128 getVectorRegister(int num) const; + void setVectorRegister(int num, v128 value); + const char *getRegisterName(int num); + void jumpto(); + static int lastDwarfRegNum() { return 65; } + + uint64_t getSP() const { return _registers.__r[29]; } + void setSP(uint64_t value) { _registers.__r[29] = value; } + uint64_t getIP() const { return _registers.__pc; } + void setIP(uint64_t value) { _registers.__pc = value; } + +private: + struct mips_newabi_thread_state_t { + uint64_t __r[32]; + uint64_t __pc; + uint64_t __hi; + uint64_t __lo; + }; + + mips_newabi_thread_state_t _registers; +#ifdef __mips_hard_float + double _floats[32]; +#endif +}; + +inline Registers_mips_newabi::Registers_mips_newabi(const void *registers) { + static_assert((check_fit::does_fit), + "mips_newabi registers do not fit into unw_context_t"); + memcpy(&_registers, static_cast(registers), + sizeof(_registers)); +} + +inline Registers_mips_newabi::Registers_mips_newabi() { + memset(&_registers, 0, sizeof(_registers)); +} + +inline bool Registers_mips_newabi::validRegister(int regNum) const { + if (regNum == UNW_REG_IP) + return true; + if (regNum == UNW_REG_SP) + return true; + if (regNum < 0) + return false; + if (regNum <= UNW_MIPS_R31) + return true; + if (regNum == UNW_MIPS_HI) + return true; + if (regNum == UNW_MIPS_LO) + return true; + // FIXME: Hard float, DSP accumulator registers, MSA registers + return false; +} + +inline uint64_t Registers_mips_newabi::getRegister(int regNum) const { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) + return _registers.__r[regNum - UNW_MIPS_R0]; + + switch (regNum) { + case UNW_REG_IP: + return _registers.__pc; + case UNW_REG_SP: + return _registers.__r[29]; + case UNW_MIPS_HI: + return _registers.__hi; + case UNW_MIPS_LO: + return _registers.__lo; + } + _LIBUNWIND_ABORT("unsupported mips_newabi register"); +} + +inline void Registers_mips_newabi::setRegister(int regNum, uint64_t value) { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) { + _registers.__r[regNum - UNW_MIPS_R0] = value; + return; + } + + switch (regNum) { + case UNW_REG_IP: + _registers.__pc = value; + return; + case UNW_REG_SP: + _registers.__r[29] = value; + return; + case UNW_MIPS_HI: + _registers.__hi = value; + return; + case UNW_MIPS_LO: + _registers.__lo = value; + return; + } + _LIBUNWIND_ABORT("unsupported mips_newabi register"); +} + +inline bool Registers_mips_newabi::validFloatRegister(int regNum) const { +#ifdef __mips_hard_float + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; +#endif + return false; +} + +inline double Registers_mips_newabi::getFloatRegister(int regNum) const { +#ifdef __mips_hard_float + assert(validFloatRegister(regNum)); + return _floats[regNum - UNW_MIPS_F0]; +#else + _LIBUNWIND_ABORT("mips_newabi float support not implemented"); +#endif +} + +inline void Registers_mips_newabi::setFloatRegister(int regNum, + double value) { +#ifdef __mips_hard_float + assert(validFloatRegister(regNum)); + _floats[regNum - UNW_MIPS_F0] = value; +#else + _LIBUNWIND_ABORT("mips_newabi float support not implemented"); +#endif +} + +inline bool Registers_mips_newabi::validVectorRegister(int /* regNum */) const { + return false; +} + +inline v128 Registers_mips_newabi::getVectorRegister(int /* regNum */) const { + _LIBUNWIND_ABORT("mips_newabi vector support not implemented"); +} + +inline void Registers_mips_newabi::setVectorRegister(int /* regNum */, v128 /* value */) { + _LIBUNWIND_ABORT("mips_newabi vector support not implemented"); +} + +inline const char *Registers_mips_newabi::getRegisterName(int regNum) { + switch (regNum) { + case UNW_MIPS_R0: + return "$0"; + case UNW_MIPS_R1: + return "$1"; + case UNW_MIPS_R2: + return "$2"; + case UNW_MIPS_R3: + return "$3"; + case UNW_MIPS_R4: + return "$4"; + case UNW_MIPS_R5: + return "$5"; + case UNW_MIPS_R6: + return "$6"; + case UNW_MIPS_R7: + return "$7"; + case UNW_MIPS_R8: + return "$8"; + case UNW_MIPS_R9: + return "$9"; + case UNW_MIPS_R10: + return "$10"; + case UNW_MIPS_R11: + return "$11"; + case UNW_MIPS_R12: + return "$12"; + case UNW_MIPS_R13: + return "$13"; + case UNW_MIPS_R14: + return "$14"; + case UNW_MIPS_R15: + return "$15"; + case UNW_MIPS_R16: + return "$16"; + case UNW_MIPS_R17: + return "$17"; + case UNW_MIPS_R18: + return "$18"; + case UNW_MIPS_R19: + return "$19"; + case UNW_MIPS_R20: + return "$20"; + case UNW_MIPS_R21: + return "$21"; + case UNW_MIPS_R22: + return "$22"; + case UNW_MIPS_R23: + return "$23"; + case UNW_MIPS_R24: + return "$24"; + case UNW_MIPS_R25: + return "$25"; + case UNW_MIPS_R26: + return "$26"; + case UNW_MIPS_R27: + return "$27"; + case UNW_MIPS_R28: + return "$28"; + case UNW_MIPS_R29: + return "$29"; + case UNW_MIPS_R30: + return "$30"; + case UNW_MIPS_R31: + return "$31"; + case UNW_MIPS_F0: + return "$f0"; + case UNW_MIPS_F1: + return "$f1"; + case UNW_MIPS_F2: + return "$f2"; + case UNW_MIPS_F3: + return "$f3"; + case UNW_MIPS_F4: + return "$f4"; + case UNW_MIPS_F5: + return "$f5"; + case UNW_MIPS_F6: + return "$f6"; + case UNW_MIPS_F7: + return "$f7"; + case UNW_MIPS_F8: + return "$f8"; + case UNW_MIPS_F9: + return "$f9"; + case UNW_MIPS_F10: + return "$f10"; + case UNW_MIPS_F11: + return "$f11"; + case UNW_MIPS_F12: + return "$f12"; + case UNW_MIPS_F13: + return "$f13"; + case UNW_MIPS_F14: + return "$f14"; + case UNW_MIPS_F15: + return "$f15"; + case UNW_MIPS_F16: + return "$f16"; + case UNW_MIPS_F17: + return "$f17"; + case UNW_MIPS_F18: + return "$f18"; + case UNW_MIPS_F19: + return "$f19"; + case UNW_MIPS_F20: + return "$f20"; + case UNW_MIPS_F21: + return "$f21"; + case UNW_MIPS_F22: + return "$f22"; + case UNW_MIPS_F23: + return "$f23"; + case UNW_MIPS_F24: + return "$f24"; + case UNW_MIPS_F25: + return "$f25"; + case UNW_MIPS_F26: + return "$f26"; + case UNW_MIPS_F27: + return "$f27"; + case UNW_MIPS_F28: + return "$f28"; + case UNW_MIPS_F29: + return "$f29"; + case UNW_MIPS_F30: + return "$f30"; + case UNW_MIPS_F31: + return "$f31"; + case UNW_MIPS_HI: + return "$hi"; + case UNW_MIPS_LO: + return "$lo"; + default: + return "unknown register"; + } +} +#endif // _LIBUNWIND_TARGET_MIPS_NEWABI } // namespace libunwind #endif // __REGISTERS_HPP__ Modified: head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -508,6 +508,18 @@ class UnwindCursor : public AbstractUnwindCursor{ (pri } #endif +#if defined(_LIBUNWIND_TARGET_MIPS_O32) + int stepWithCompactEncoding(Registers_mips_o32 &) { + return UNW_EINVAL; + } +#endif + +#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI) + int stepWithCompactEncoding(Registers_mips_newabi &) { + return UNW_EINVAL; + } +#endif + bool compactSaysUseDwarf(uint32_t *offset=NULL) const { R dummy; return compactSaysUseDwarf(dummy, offset); @@ -551,6 +563,18 @@ class UnwindCursor : public AbstractUnwindCursor{ (pri return false; } #endif + +#if defined(_LIBUNWIND_TARGET_MIPS_O32) + bool compactSaysUseDwarf(Registers_mips_o32 &, uint32_t *) const { + return true; + } +#endif + +#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI) + bool compactSaysUseDwarf(Registers_mips_newabi &, uint32_t *) const { + return true; + } +#endif #endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND #if _LIBUNWIND_SUPPORT_DWARF_UNWIND @@ -591,6 +615,18 @@ class UnwindCursor : public AbstractUnwindCursor{ (pri #if defined (_LIBUNWIND_TARGET_RISCV) compact_unwind_encoding_t dwarfEncoding(Registers_riscv &) const { + return 0; + } +#endif + +#if defined (_LIBUNWIND_TARGET_MIPS_O32) + compact_unwind_encoding_t dwarfEncoding(Registers_mips_o32 &) const { + return 0; + } +#endif + +#if defined (_LIBUNWIND_TARGET_MIPS_NEWABI) + compact_unwind_encoding_t dwarfEncoding(Registers_mips_newabi &) const { return 0; } #endif Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Tue Mar 20 15:44:17 2018 (r331244) @@ -526,6 +526,205 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Regis ret // jump to ra +#elif defined(__mips__) && defined(_ABIO32) && _MIPS_SIM == _ABIO32 + +// +// void libunwind::Registers_mips_o32::jumpto() +// +// On entry: +// thread state pointer is in a0 ($4) +// +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind18Registers_mips_o326jumptoEv) + .set push + .set noat + .set noreorder + .set nomacro +#ifdef __mips_hard_float +#if __mips_fpr == 32 + ldc1 $f0, (4 * 36 + 8 * 0)($4) + ldc1 $f2, (4 * 36 + 8 * 2)($4) + ldc1 $f4, (4 * 36 + 8 * 4)($4) + ldc1 $f6, (4 * 36 + 8 * 6)($4) + ldc1 $f8, (4 * 36 + 8 * 8)($4) + ldc1 $f10, (4 * 36 + 8 * 10)($4) + ldc1 $f12, (4 * 36 + 8 * 12)($4) + ldc1 $f14, (4 * 36 + 8 * 14)($4) + ldc1 $f16, (4 * 36 + 8 * 16)($4) + ldc1 $f18, (4 * 36 + 8 * 18)($4) + ldc1 $f20, (4 * 36 + 8 * 20)($4) + ldc1 $f22, (4 * 36 + 8 * 22)($4) + ldc1 $f24, (4 * 36 + 8 * 24)($4) + ldc1 $f26, (4 * 36 + 8 * 26)($4) + ldc1 $f28, (4 * 36 + 8 * 28)($4) + ldc1 $f30, (4 * 36 + 8 * 30)($4) +#else + ldc1 $f0, (4 * 36 + 8 * 0)($4) + ldc1 $f1, (4 * 36 + 8 * 1)($4) + ldc1 $f2, (4 * 36 + 8 * 2)($4) + ldc1 $f3, (4 * 36 + 8 * 3)($4) + ldc1 $f4, (4 * 36 + 8 * 4)($4) + ldc1 $f5, (4 * 36 + 8 * 5)($4) + ldc1 $f6, (4 * 36 + 8 * 6)($4) + ldc1 $f7, (4 * 36 + 8 * 7)($4) + ldc1 $f8, (4 * 36 + 8 * 8)($4) + ldc1 $f9, (4 * 36 + 8 * 9)($4) + ldc1 $f10, (4 * 36 + 8 * 10)($4) + ldc1 $f11, (4 * 36 + 8 * 11)($4) + ldc1 $f12, (4 * 36 + 8 * 12)($4) + ldc1 $f13, (4 * 36 + 8 * 13)($4) + ldc1 $f14, (4 * 36 + 8 * 14)($4) + ldc1 $f15, (4 * 36 + 8 * 15)($4) + ldc1 $f16, (4 * 36 + 8 * 16)($4) + ldc1 $f17, (4 * 36 + 8 * 17)($4) + ldc1 $f18, (4 * 36 + 8 * 18)($4) + ldc1 $f19, (4 * 36 + 8 * 19)($4) + ldc1 $f20, (4 * 36 + 8 * 20)($4) + ldc1 $f21, (4 * 36 + 8 * 21)($4) + ldc1 $f22, (4 * 36 + 8 * 22)($4) + ldc1 $f23, (4 * 36 + 8 * 23)($4) + ldc1 $f24, (4 * 36 + 8 * 24)($4) + ldc1 $f25, (4 * 36 + 8 * 25)($4) + ldc1 $f26, (4 * 36 + 8 * 26)($4) + ldc1 $f27, (4 * 36 + 8 * 27)($4) + ldc1 $f28, (4 * 36 + 8 * 28)($4) + ldc1 $f29, (4 * 36 + 8 * 29)($4) + ldc1 $f30, (4 * 36 + 8 * 30)($4) + ldc1 $f31, (4 * 36 + 8 * 31)($4) +#endif +#endif + // restore hi and lo + lw $8, (4 * 33)($4) + mthi $8 + lw $8, (4 * 34)($4) + mtlo $8 + // r0 is zero + lw $1, (4 * 1)($4) + lw $2, (4 * 2)($4) + lw $3, (4 * 3)($4) + // skip a0 for now + lw $5, (4 * 5)($4) + lw $6, (4 * 6)($4) + lw $7, (4 * 7)($4) + lw $8, (4 * 8)($4) + lw $9, (4 * 9)($4) + lw $10, (4 * 10)($4) + lw $11, (4 * 11)($4) + lw $12, (4 * 12)($4) + lw $13, (4 * 13)($4) + lw $14, (4 * 14)($4) + lw $15, (4 * 15)($4) + lw $16, (4 * 16)($4) + lw $17, (4 * 17)($4) + lw $18, (4 * 18)($4) + lw $19, (4 * 19)($4) + lw $20, (4 * 20)($4) + lw $21, (4 * 21)($4) + lw $22, (4 * 22)($4) + lw $23, (4 * 23)($4) + lw $24, (4 * 24)($4) + lw $25, (4 * 25)($4) + lw $26, (4 * 26)($4) + lw $27, (4 * 27)($4) + lw $28, (4 * 28)($4) + lw $29, (4 * 29)($4) + lw $30, (4 * 30)($4) + // load new pc into ra + lw $31, (4 * 32)($4) + // jump to ra, load a0 in the delay slot + jr $31 + lw $4, (4 * 4)($4) + .set pop + +#elif defined(__mips64) + +// +// void libunwind::Registers_mips_newabi::jumpto() +// +// On entry: +// thread state pointer is in a0 ($4) +// +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind21Registers_mips_newabi6jumptoEv) + .set push + .set noat + .set noreorder + .set nomacro +#ifdef __mips_hard_float + ldc1 $f0, (8 * 35)($4) + ldc1 $f1, (8 * 36)($4) + ldc1 $f2, (8 * 37)($4) + ldc1 $f3, (8 * 38)($4) + ldc1 $f4, (8 * 39)($4) + ldc1 $f5, (8 * 40)($4) + ldc1 $f6, (8 * 41)($4) + ldc1 $f7, (8 * 42)($4) + ldc1 $f8, (8 * 43)($4) + ldc1 $f9, (8 * 44)($4) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Mar 20 15:51:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7ECFF57960; Tue, 20 Mar 2018 15:51:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82DCE78F95; Tue, 20 Mar 2018 15:51:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DCDE1EC2E; Tue, 20 Mar 2018 15:51:05 +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 w2KFp5xI098666; Tue, 20 Mar 2018 15:51:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KFp5AD098664; Tue, 20 Mar 2018 15:51:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803201551.w2KFp5AD098664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 15:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331245 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 331245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:51:06 -0000 Author: markj Date: Tue Mar 20 15:51:05 2018 New Revision: 331245 URL: https://svnweb.freebsd.org/changeset/base/331245 Log: Drop KTR_CONTENTION. It is incomplete, has not been adopted in the other locking primitives, and we have other means of measuring lock contention (lock_profiling, lockstat, KTR_LOCK). Drop it to slightly de-clutter the mutex code and free up a precious KTR class index. Reviewed by: jhb, mjg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14771 Modified: head/sys/kern/kern_mutex.c head/sys/sys/ktr_class.h Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Tue Mar 20 15:44:17 2018 (r331244) +++ head/sys/kern/kern_mutex.c Tue Mar 20 15:51:05 2018 (r331245) @@ -473,9 +473,6 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) struct turnstile *ts; uintptr_t tid; struct thread *owner; -#ifdef KTR - int cont_logged = 0; -#endif #ifdef LOCK_PROFILING int contested = 0; uint64_t waittime = 0; @@ -629,17 +626,6 @@ retry_turnstile: */ mtx_assert(m, MA_NOTOWNED); -#ifdef KTR - if (!cont_logged) { - CTR6(KTR_CONTENTION, - "contention: %p at %s:%d wants %s, taken by %s:%d", - (void *)tid, file, line, m->lock_object.lo_name, - WITNESS_FILE(&m->lock_object), - WITNESS_LINE(&m->lock_object)); - cont_logged = 1; - } -#endif - /* * Block on the turnstile. */ @@ -657,13 +643,6 @@ retry_turnstile: #endif v = MTX_READ_VALUE(m); } -#ifdef KTR - if (cont_logged) { - CTR4(KTR_CONTENTION, - "contention end: %s acquired by %p at %s:%d", - m->lock_object.lo_name, (void *)tid, file, line); - } -#endif #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) if (__predict_true(!doing_lockprof)) return; Modified: head/sys/sys/ktr_class.h ============================================================================== --- head/sys/sys/ktr_class.h Tue Mar 20 15:44:17 2018 (r331244) +++ head/sys/sys/ktr_class.h Tue Mar 20 15:51:05 2018 (r331245) @@ -65,7 +65,7 @@ #define KTR_VM 0x00100000 /* The virtual memory system */ #define KTR_INET 0x00200000 /* IPv4 stack */ #define KTR_RUNQ 0x00400000 /* Run queue */ -#define KTR_CONTENTION 0x00800000 /* Lock contention */ +#define KTR_SPARE5 0x00800000 #define KTR_UMA 0x01000000 /* UMA slab allocator */ #define KTR_CALLOUT 0x02000000 /* Callouts and timeouts */ #define KTR_GEOM 0x04000000 /* GEOM I/O events */ From owner-svn-src-all@freebsd.org Tue Mar 20 15:54:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2C81F57F30 for ; Tue, 20 Mar 2018 15:54:43 +0000 (UTC) (envelope-from giffunip@yahoo.com) Received: from sonic312-20.consmr.mail.bf2.yahoo.com (sonic312-20.consmr.mail.bf2.yahoo.com [74.6.128.82]) (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 7CAE4792F3 for ; Tue, 20 Mar 2018 15:54:43 +0000 (UTC) (envelope-from giffunip@yahoo.com) X-YMail-OSG: JvJz4DwVM1nsv80lE3LIsANSaYyfmbJkBfGX0KrPfnB.ge3Yi2tJWE8v9Tbsc0F MhApCGddFYXLt5vtdfASIpJO09Ym6jE0rssbjOHN4GW.H0oSng6VJr7ddTYMSVPl9Sc8XltS6Txy fUkYNXBwPNjVzJ4T.dyMgfsS.kZE42ZtvWqtGNIItt_IQB8KikgNG4zRcs20aEv3ISkkBIJcNTMW FpAiBToE3HXUCt1ZNC3kqlce_IhFXmbhauzEyLDv5pCsKdNz2MU2EM1mBGL.4gAlHVEnPsYnbPaO TH.itIHSGMzkcm.wLpnACg.nu24bPSbrIu73EcpWVSeDqZp7Ye6UHgFvaFZ511eJgRYLbypdvt7K onNnt8wZDCRHpgN7I6o7SVYs7j6jhRhcwXxr_N1V6l_uxAV4cD9fTTMljZGmZlMjIPDeKfg81jBL Jo8uM0AAk5uWYYG1QQ.yslauvE8LYhG4RE4lNuINrV0wZfDeRK8t7l4HXj0LCoZnyxbrSriGEqA9 zYY_pHrBPI88fgYFeMgjM9FRB4F8xPzlsTS1DCzk- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.bf2.yahoo.com with HTTP; Tue, 20 Mar 2018 15:54:37 +0000 Received: from 181.52.72.201 (EHLO [192.168.0.4]) ([181.52.72.201]) by smtp425.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 5ddeb1f8a02938b1868d1a6096f738cd; Tue, 20 Mar 2018 15:54:35 +0000 (UTC) Subject: Re: svn commit: r331218 - in vendor/processor-trace: . 24982c1a6fce48f1e416461d42899805f74fbb26 24982c1a6fce48f1e416461d42899805f74fbb26/doc 24982c1a6fce48f1e416461d42899805f74fbb26/doc/man 24982c1a6fc... To: John Baldwin , Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org References: <201803191834.w2JIY8WH053697@repo.freebsd.org> <1956273.kgoNNMadGV@ralph.baldwin.cx> From: Pedro Giffuni Message-ID: Date: Tue, 20 Mar 2018 10:54:33 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1956273.kgoNNMadGV@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:54:44 -0000 On 19/03/2018 14:43, John Baldwin wrote: > On Monday, March 19, 2018 06:34:08 PM Ruslan Bukin wrote: >> Author: br >> Date: Mon Mar 19 18:34:08 2018 >> New Revision: 331218 >> URL: https://svnweb.freebsd.org/changeset/base/331218 >> >> Log: >> Import Intel Processor Trace library. >> >> Git ID 24982c1a6fce48f1e416461d42899805f74fbb26 >> >> Sponsored by: DARPA, AFRL >> Differential Revision: https://reviews.freebsd.org/D12815 > Presumably you meant to import this to vendor/processor-trace/dist and then do an 'svn cp' > to tag it to the git hash? If you do the svn cp from the git hash instead of from dist > I'm not sure if future 'svn merge' requests from the vendor area will work correctly when > you try to merge an update. > The git hash makes a terrible tag. I'd prefer we use snapshot/release dates. Pedro. From owner-svn-src-all@freebsd.org Tue Mar 20 15:57:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7204F58329; Tue, 20 Mar 2018 15:57:53 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 692D879660; Tue, 20 Mar 2018 15:57:53 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F5201ED9C; Tue, 20 Mar 2018 15:57:53 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KFvr70098977; Tue, 20 Mar 2018 15:57:53 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KFvqkC098969; Tue, 20 Mar 2018 15:57:52 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201803201557.w2KFvqkC098969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Tue, 20 Mar 2018 15:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331246 - in stable/11: contrib/bmake contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake X-SVN-Group: stable-11 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/11: contrib/bmake contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake X-SVN-Commit-Revision: 331246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:57:54 -0000 Author: sjg Date: Tue Mar 20 15:57:52 2018 New Revision: 331246 URL: https://svnweb.freebsd.org/changeset/base/331246 Log: MFC bmake-20180222 PR: 226678 Submitted by: sjg Added: stable/11/contrib/bmake/VERSION - copied, changed from r325340, head/contrib/bmake/VERSION stable/11/contrib/bmake/mk/ldorder.mk - copied unchanged from r330260, head/contrib/bmake/mk/ldorder.mk Modified: stable/11/contrib/bmake/ChangeLog stable/11/contrib/bmake/FILES stable/11/contrib/bmake/Makefile stable/11/contrib/bmake/Makefile.config.in stable/11/contrib/bmake/aclocal.m4 stable/11/contrib/bmake/bmake.cat1 stable/11/contrib/bmake/bsd.after-import.mk stable/11/contrib/bmake/configure stable/11/contrib/bmake/configure.in stable/11/contrib/bmake/job.c stable/11/contrib/bmake/machine.sh stable/11/contrib/bmake/main.c stable/11/contrib/bmake/make-bootstrap.sh.in stable/11/contrib/bmake/make.h stable/11/contrib/bmake/meta.c stable/11/contrib/bmake/mk/ChangeLog stable/11/contrib/bmake/mk/FILES stable/11/contrib/bmake/mk/auto.obj.mk stable/11/contrib/bmake/mk/autoconf.mk stable/11/contrib/bmake/mk/dirdeps.mk stable/11/contrib/bmake/mk/dpadd.mk stable/11/contrib/bmake/mk/final.mk stable/11/contrib/bmake/mk/gendirdeps.mk stable/11/contrib/bmake/mk/install-mk stable/11/contrib/bmake/mk/lib.mk stable/11/contrib/bmake/mk/meta.autodep.mk stable/11/contrib/bmake/mk/meta.stage.mk stable/11/contrib/bmake/mk/own.mk stable/11/contrib/bmake/mk/prog.mk stable/11/contrib/bmake/mk/sys.clean-env.mk stable/11/contrib/bmake/mk/sys.mk stable/11/contrib/bmake/mk/sys.vars.mk stable/11/contrib/bmake/mk/whats.mk stable/11/contrib/bmake/os.sh stable/11/contrib/bmake/parse.c stable/11/contrib/bmake/stresep.c stable/11/contrib/bmake/unit-tests/dotwait.exp stable/11/contrib/bmake/unit-tests/dotwait.mk stable/11/contrib/bmake/unit-tests/varcmd.exp stable/11/contrib/bmake/unit-tests/varcmd.mk stable/11/contrib/bmake/var.c stable/11/usr.bin/bmake/Makefile stable/11/usr.bin/bmake/Makefile.config stable/11/usr.bin/bmake/Makefile.inc stable/11/usr.bin/bmake/config.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bmake/ChangeLog ============================================================================== --- stable/11/contrib/bmake/ChangeLog Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/ChangeLog Tue Mar 20 15:57:52 2018 (r331246) @@ -1,3 +1,77 @@ +2018-02-22 Simon J. Gerraty + + * VERSION: 20180222 + Merge with NetBSD make, pick up + o parse.c: avoid calling sysconf for every call to loadfile + +2018-02-18 Simon J. Gerraty + + * VERSION: 20180218 + Merge with NetBSD make, pick up + o var.c: Var_Set handle NULL value anytime. + +2018-02-12 Simon J. Gerraty + + * VERSION: 20180212 + Merge with NetBSD make, pick up + o parse.c: do not treat .info as warning with -W + +2017-12-07 Simon J. Gerraty + + * VERSION: 20171207 + Merge with NetBSD make, pick up + o var.c: Var_Append use Var_Set if var not previously set + so that VAR_CMD is handled correctly. + Add a suitable unit-test. + +2017-11-26 Simon J. Gerraty + + * VERSION (_MAKE_VERSION): 20171126 + + * aclocal.m4: use AC_LINK_IFELSE for AC_C___ATTRIBUTE__ + since AC_TRY_COMPILE puts input inside main() + which upsets modern compilers. + +2017-11-18 Simon J. Gerraty + + * VERSION: 20171118 + Merge with NetBSD make, pick up + o var.c: do not append to variable set on command line + add unit-test to catch this. + +2017-10-28 Simon J. Gerraty + + * VERSION: 20171028 + Merge with NetBSD make, pick up + o main.c: ignore empty MAKEOBJDIR + + * Makefile.config.in: + make @prefix@ @machine*@ and @default_sys_path@ defaults. + +2017-10-05 Simon J. Gerraty + + * VERSION: 20171005 + + * unit-tests/dotwait.mk: redirect stderr through pipe for more + consistent result on some platforms. + +2017-08-13 Simon J. Gerraty + + * machine.sh: entry for AIX + +2017-08-12 Simon J. Gerraty + + * VERSION (_MAKE_VERSION): Move the setting of _MAKE_VERSION + to a file that can be included by configure as well as make. + This allows configure to set set _MAKE_VERSION in make-bootstrap.sh + +2017-08-10 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170810 + Merge with NetBSD make, pick up + o meta.c: if target is in subdir we only need subdir name in + meta_name. + 2017-07-20 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20170720 Modified: stable/11/contrib/bmake/FILES ============================================================================== --- stable/11/contrib/bmake/FILES Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/FILES Tue Mar 20 15:57:52 2018 (r331246) @@ -5,6 +5,7 @@ Makefile.config.in PSD.doc/Makefile PSD.doc/tutorial.ms README +VERSION aclocal.m4 arch.c bmake.1 Modified: stable/11/contrib/bmake/Makefile ============================================================================== --- stable/11/contrib/bmake/Makefile Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/Makefile Tue Mar 20 15:57:52 2018 (r331246) @@ -1,8 +1,5 @@ -# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ +# $Id: Makefile,v 1.99 2017/08/13 20:12:53 sjg Exp $ -# Base version on src date -_MAKE_VERSION= 20170720 - PROG= bmake SRCS= \ @@ -58,6 +55,8 @@ SRCS+= \ lstReplace.c \ lstSucc.c +.-include "VERSION" + # this file gets generated by configure .-include "Makefile.config" @@ -192,11 +191,13 @@ MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man} ${OBJS}: config.h .endif +# start-delete2 for bsd.after-import.mk + # make sure that MAKE_VERSION gets updated. -main.o: ${SRCS} ${MAKEFILE} +main.o: ${SRCS} ${.CURDIR}/VERSION -# start-delete2 for bsd.after-import.mk .if ${MK_AUTOCONF_MK} == "yes" +CONFIGURE_DEPS += ${.CURDIR}/VERSION .include .endif SHARE_MK?=${SHAREDIR}/mk Modified: stable/11/contrib/bmake/Makefile.config.in ============================================================================== --- stable/11/contrib/bmake/Makefile.config.in Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/Makefile.config.in Tue Mar 20 15:57:52 2018 (r331246) @@ -1,11 +1,13 @@ # things set by configure -prefix= @prefix@ +_MAKE_VERSION=@_MAKE_VERSION@ + +prefix?= @prefix@ srcdir= @srcdir@ CC?= @CC@ -MACHINE= @machine@ -MACHINE_ARCH= @machine_arch@ -DEFAULT_SYS_PATH= @default_sys_path@ +MACHINE?= @machine@ +MACHINE_ARCH?= @machine_arch@ +DEFAULT_SYS_PATH?= @default_sys_path@ CPPFLAGS+= @CPPFLAGS@ CFLAGS+= ${CPPFLAGS} @DEFS@ @@ -13,8 +15,7 @@ LDFLAGS= @LDFLAGS@ LIBOBJS= @LIBOBJS@ LDADD= @LIBS@ USE_META= @use_meta@ -FILEMON_H= @filemon_h@ +FILEMON_H?= @filemon_h@ BMAKE_PATH_MAX?= @bmake_path_max@ # used if MAXPATHLEN not defined CPPFLAGS+= -DBMAKE_PATH_MAX=${BMAKE_PATH_MAX} - Copied and modified: stable/11/contrib/bmake/VERSION (from r325340, head/contrib/bmake/VERSION) ============================================================================== --- head/contrib/bmake/VERSION Thu Nov 2 20:08:00 2017 (r325340, copy source) +++ stable/11/contrib/bmake/VERSION Tue Mar 20 15:57:52 2018 (r331246) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20171028 +_MAKE_VERSION=20180222 Modified: stable/11/contrib/bmake/aclocal.m4 ============================================================================== --- stable/11/contrib/bmake/aclocal.m4 Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/aclocal.m4 Tue Mar 20 15:57:52 2018 (r331246) @@ -1,5 +1,5 @@ dnl RCSid: -dnl $Id: aclocal.m4,v 1.5 2003/03/06 21:21:30 sjg Exp $ +dnl $Id: aclocal.m4,v 1.6 2017/11/26 22:39:20 sjg Exp $ dnl dnl @@ -55,16 +55,21 @@ dnl AC_DEFUN(AC_C___ATTRIBUTE__, [ AC_MSG_CHECKING(for __attribute__) AC_CACHE_VAL(ac_cv___attribute__, [ -AC_TRY_COMPILE([ +AC_LINK_IFELSE([ #include -], -[ + static void foo(void) __attribute__ ((noreturn)); static void foo(void) { exit(1); +} + +int +main(int argc, char **argv) +{ + foo(); } ], ac_cv___attribute__=yes, Modified: stable/11/contrib/bmake/bmake.cat1 ============================================================================== --- stable/11/contrib/bmake/bmake.cat1 Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/bmake.cat1 Tue Mar 20 15:57:52 2018 (r331246) @@ -1,73 +1,73 @@ -BMAKE(1) NetBSD General Commands Manual BMAKE(1) +BMAKE(1) FreeBSD General Commands Manual BMAKE(1) -NNAAMMEE - bbmmaakkee -- maintain program dependencies +NAME + bmake -- maintain program dependencies -SSYYNNOOPPSSIISS - bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s] - [--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s] - [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [--vv _v_a_r_i_a_b_l_e] - [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.] +SYNOPSIS + bmake [-BeikNnqrstWwX] [-C directory] [-D variable] [-d flags] + [-f makefile] [-I directory] [-J private] [-j max_jobs] + [-m directory] [-T file] [-V variable] [-v variable] + [variable=value] [target ...] -DDEESSCCRRIIPPTTIIOONN - bbmmaakkee is a program designed to simplify the maintenance of other pro- +DESCRIPTION + bmake is a program designed to simplify the maintenance of other pro- grams. Its input is a list of specifications as to the files upon which - programs and other files depend. If no --ff _m_a_k_e_f_i_l_e makefile option is - given, bbmmaakkee will try to open `_m_a_k_e_f_i_l_e' then `_M_a_k_e_f_i_l_e' in order to find - the specifications. If the file `_._d_e_p_e_n_d' exists, it is read (see + programs and other files depend. If no -f makefile makefile option is + given, bmake will try to open `makefile' then `Makefile' in order to find + the specifications. If the file `.depend' exists, it is read (see mkdep(1)). This manual page is intended as a reference document only. For a more - thorough description of bbmmaakkee and makefiles, please refer to _P_M_a_k_e _- _A - _T_u_t_o_r_i_a_l. + thorough description of bmake and makefiles, please refer to PMake - A + Tutorial. - bbmmaakkee will prepend the contents of the _M_A_K_E_F_L_A_G_S environment variable to + bmake will prepend the contents of the MAKEFLAGS environment variable to the command line arguments before parsing them. The options are as follows: - --BB Try to be backwards compatible by executing a single shell per + -B Try to be backwards compatible by executing a single shell per command and by executing the commands to make the sources of a dependency line in sequence. - --CC _d_i_r_e_c_t_o_r_y - Change to _d_i_r_e_c_t_o_r_y before reading the makefiles or doing any- - thing else. If multiple --CC options are specified, each is inter- - preted relative to the previous one: --CC _/ --CC _e_t_c is equivalent to - --CC _/_e_t_c. + -C directory + Change to directory before reading the makefiles or doing any- + thing else. If multiple -C options are specified, each is inter- + preted relative to the previous one: -C / -C etc is equivalent to + -C /etc. - --DD _v_a_r_i_a_b_l_e - Define _v_a_r_i_a_b_l_e to be 1, in the global context. + -D variable + Define variable to be 1, in the global context. - --dd _[_-_]_f_l_a_g_s - Turn on debugging, and specify which portions of bbmmaakkee are to + -d [-]flags + Turn on debugging, and specify which portions of bmake are to print debugging information. Unless the flags are preceded by - `-' they are added to the _M_A_K_E_F_L_A_G_S environment variable and will + `-' they are added to the MAKEFLAGS environment variable and will be processed by any child make processes. By default, debugging information is printed to standard error, but this can be changed - using the _F debugging flag. The debugging output is always + using the F debugging flag. The debugging output is always unbuffered; in addition, if debugging is enabled but debugging output is not directed to standard output, then the standard out- - put is line buffered. _F_l_a_g_s is one or more of the following: + put is line buffered. Flags is one or more of the following: - _A Print all possible debugging information; equivalent to + A Print all possible debugging information; equivalent to specifying all of the debugging flags. - _a Print debugging information about archive searching and + a Print debugging information about archive searching and caching. - _C Print debugging information about current working direc- + C Print debugging information about current working direc- tory. - _c Print debugging information about conditional evaluation. + c Print debugging information about conditional evaluation. - _d Print debugging information about directory searching and + d Print debugging information about directory searching and caching. - _e Print debugging information about failed commands and + e Print debugging information about failed commands and targets. - _F[++]_f_i_l_e_n_a_m_e + F[+]filename Specify where debugging output is written. This must be the last flag, because it consumes the remainder of the argument. If the character immediately after the `F' @@ -80,80 +80,80 @@ DDEESSCCRRIIPPTTIIOONN named file. If the file name ends `.%d' then the `%d' is replaced by the pid. - _f Print debugging information about loop evaluation. + f Print debugging information about loop evaluation. - _g_1 Print the input graph before making anything. + g1 Print the input graph before making anything. - _g_2 Print the input graph after making everything, or before + g2 Print the input graph after making everything, or before exiting on error. - _g_3 Print the input graph before exiting on error. + g3 Print the input graph before exiting on error. - _j Print debugging information about running multiple + j Print debugging information about running multiple shells. - _l Print commands in Makefiles regardless of whether or not + l Print commands in Makefiles regardless of whether or not they are prefixed by `@' or other "quiet" flags. Also known as "loud" behavior. - _M Print debugging information about "meta" mode decisions + M Print debugging information about "meta" mode decisions about targets. - _m Print debugging information about making targets, includ- + m Print debugging information about making targets, includ- ing modification dates. - _n Don't delete the temporary command scripts created when + n Don't delete the temporary command scripts created when running commands. These temporary scripts are created in the directory referred to by the TMPDIR environment vari- - able, or in _/_t_m_p if TMPDIR is unset or set to the empty + able, or in /tmp if TMPDIR is unset or set to the empty string. The temporary scripts are created by mkstemp(3), - and have names of the form _m_a_k_e_X_X_X_X_X_X. _N_O_T_E: This can - create many files in TMPDIR or _/_t_m_p, so use with care. + and have names of the form makeXXXXXX. NOTE: This can + create many files in TMPDIR or /tmp, so use with care. - _p Print debugging information about makefile parsing. + p Print debugging information about makefile parsing. - _s Print debugging information about suffix-transformation + s Print debugging information about suffix-transformation rules. - _t Print debugging information about target list mainte- + t Print debugging information about target list mainte- nance. - _V Force the --VV option to print raw values of variables, + V Force the -V option to print raw values of variables, overriding the default behavior set via - _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S. + .MAKE.EXPAND_VARIABLES. - _v Print debugging information about variable assignment. + v Print debugging information about variable assignment. - _x Run shell commands with --xx so the actual commands are + x Run shell commands with -x so the actual commands are printed as they are executed. - --ee Specify that environment variables override macro assignments + -e Specify that environment variables override macro assignments within makefiles. - --ff _m_a_k_e_f_i_l_e - Specify a makefile to read instead of the default `_m_a_k_e_f_i_l_e'. If - _m_a_k_e_f_i_l_e is `--', standard input is read. Multiple makefiles may + -f makefile + Specify a makefile to read instead of the default `makefile'. If + makefile is `-', standard input is read. Multiple makefiles may be specified, and are read in the order specified. - --II _d_i_r_e_c_t_o_r_y + -I directory Specify a directory in which to search for makefiles and included makefiles. The system makefile directory (or directories, see - the --mm option) is automatically included as part of this list. + the -m option) is automatically included as part of this list. - --ii Ignore non-zero exit of shell commands in the makefile. Equiva- - lent to specifying `--' before each command line in the makefile. + -i Ignore non-zero exit of shell commands in the makefile. Equiva- + lent to specifying `-' before each command line in the makefile. - --JJ _p_r_i_v_a_t_e - This option should _n_o_t be specified by the user. + -J private + This option should not be specified by the user. - When the _j option is in use in a recursive build, this option is + When the j option is in use in a recursive build, this option is passed by a make to child makes to allow all the make processes in the build to cooperate to avoid overloading the system. - --jj _m_a_x___j_o_b_s - Specify the maximum number of jobs that bbmmaakkee may have running at - any one time. The value is saved in _._M_A_K_E_._J_O_B_S. Turns compati- - bility mode off, unless the _B flag is also specified. When com- + -j max_jobs + Specify the maximum number of jobs that bmake may have running at + any one time. The value is saved in .MAKE.JOBS. Turns compati- + bility mode off, unless the B flag is also specified. When com- patibility mode is off, all commands associated with a target are executed in a single shell invocation as opposed to the tradi- tional one shell invocation per line. This can break traditional @@ -162,90 +162,90 @@ DDEESSCCRRIIPPTTIIOONN It is more efficient to correct the scripts rather than turn backwards compatibility on. - --kk Continue processing after errors are encountered, but only on + -k Continue processing after errors are encountered, but only on those targets that do not depend on the target whose creation caused the error. - --mm _d_i_r_e_c_t_o_r_y + -m directory Specify a directory in which to search for sys.mk and makefiles - included via the <_f_i_l_e>-style include statement. The --mm option + included via the <file>-style include statement. The -m option can be used multiple times to form a search path. This path will override the default system include path: /usr/share/mk. Fur- thermore the system include path will be appended to the search - path used for "_f_i_l_e"-style include statements (see the --II + path used for "file"-style include statements (see the -I option). - If a file or directory name in the --mm argument (or the + If a file or directory name in the -m argument (or the MAKESYSPATH environment variable) starts with the string ".../" - then bbmmaakkee will search for the specified file or directory named + then bmake will search for the specified file or directory named in the remaining part of the argument string. The search starts with the current directory of the Makefile and then works upward towards the root of the file system. If the search is success- ful, then the resulting directory replaces the ".../" specifica- - tion in the --mm argument. If used, this feature allows bbmmaakkee to + tion in the -m argument. If used, this feature allows bmake to easily search in the current source tree for customized sys.mk files (e.g., by using ".../mk/sys.mk" as an argument). - --nn Display the commands that would have been executed, but do not + -n Display the commands that would have been executed, but do not actually execute them unless the target depends on the .MAKE spe- cial source (see below). - --NN Display the commands which would have been executed, but do not + -N Display the commands which would have been executed, but do not actually execute any of them; useful for debugging top-level makefiles without descending into subdirectories. - --qq Do not execute any commands, but exit 0 if the specified targets + -q Do not execute any commands, but exit 0 if the specified targets are up-to-date and 1, otherwise. - --rr Do not use the built-in rules specified in the system makefile. + -r Do not use the built-in rules specified in the system makefile. - --ss Do not echo any commands as they are executed. Equivalent to - specifying `@@' before each command line in the makefile. + -s Do not echo any commands as they are executed. Equivalent to + specifying `@' before each command line in the makefile. - --TT _t_r_a_c_e_f_i_l_e - When used with the --jj flag, append a trace record to _t_r_a_c_e_f_i_l_e + -T tracefile + When used with the -j flag, append a trace record to tracefile for each job started and completed. - --tt Rather than re-building a target as specified in the makefile, + -t Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up- to-date. - --VV _v_a_r_i_a_b_l_e - Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple + -V variable + Print the value of variable. Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or unde- fined variable. The value printed is extracted from the global context after all makefiles have been read. By default, the raw variable contents (which may include additional unexpanded vari- - able references) are shown. If _v_a_r_i_a_b_l_e contains a `$' then the + able references) are shown. If variable contains a `$' then the value will be recursively expanded to its complete resultant text before printing. The expanded value will also be printed if - _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S is set to true and the --ddVV option has not + .MAKE.EXPAND_VARIABLES is set to true and the -dV option has not been used to override it. Note that loop-local and target-local variables, as well as values taken temporarily by global vari- ables during makefile processing, are not accessible via this - option. The --ddvv debug mode can be used to see these at the cost + option. The -dv debug mode can be used to see these at the cost of generating substantial extraneous output. - --vv _v_a_r_i_a_b_l_e - Like --VV but the variable is always expanded to its complete + -v variable + Like -V but the variable is always expanded to its complete value. - --WW Treat any warnings during makefile parsing as errors. + -W Treat any warnings during makefile parsing as errors. - --ww Print entering and leaving directory messages, pre and post pro- + -w Print entering and leaving directory messages, pre and post pro- cessing. - --XX Don't export variables passed on the command line to the environ- + -X Don't export variables passed on the command line to the environ- ment individually. Variables passed on the command line are - still exported via the _M_A_K_E_F_L_A_G_S environment variable. This + still exported via the MAKEFLAGS environment variable. This option may be useful on systems which have a small limit on the size of command arguments. - _v_a_r_i_a_b_l_e_=_v_a_l_u_e - Set the value of the variable _v_a_r_i_a_b_l_e to _v_a_l_u_e. Normally, all + variable=value + Set the value of the variable variable to value. Normally, all values passed on the command line are also exported to sub-makes - in the environment. The --XX flag disables this behavior. Vari- + in the environment. The -X flag disables this behavior. Vari- able assignments should follow options for POSIX compatibility but no ordering is enforced. @@ -257,28 +257,28 @@ DDEESSCCRRIIPPTTIIOONN them with a backslash (`\'). The trailing newline character and initial whitespace on the following line are compressed into a single space. -FFIILLEE DDEEPPEENNDDEENNCCYY SSPPEECCIIFFIICCAATTIIOONNSS +FILE DEPENDENCY SPECIFICATIONS Dependency lines consist of one or more targets, an operator, and zero or more sources. This creates a relationship where the targets ``depend'' on the sources and are usually created from them. The exact relationship between the target and the source is determined by the operator that sep- arates them. The three operators are as follows: - :: A target is considered out-of-date if its modification time is less + : A target is considered out-of-date if its modification time is less than those of any of its sources. Sources for a target accumulate over dependency lines when this operator is used. The target is - removed if bbmmaakkee is interrupted. + removed if bmake is interrupted. - !! Targets are always re-created, but not until all sources have been + ! Targets are always re-created, but not until all sources have been examined and re-created as necessary. Sources for a target accumu- late over dependency lines when this operator is used. The target - is removed if bbmmaakkee is interrupted. + is removed if bmake is interrupted. - :::: If no sources are specified, the target is always re-created. Oth- + :: If no sources are specified, the target is always re-created. Oth- erwise, a target is considered out-of-date if any of its sources has been modified more recently than the target. Sources for a target do not accumulate over dependency lines when this operator - is used. The target will not be removed if bbmmaakkee is interrupted. + is used. The target will not be removed if bmake is interrupted. Targets and sources may contain the shell wildcard values `?', `*', `[]', and `{}'. The values `?', `*', and `[]' may only be used as part of the @@ -287,37 +287,37 @@ FFIILLEE DDEEPPEENNDDEENNCCYY SSPPEEC existing files. Expansion is in directory order, not alphabetically as done in the shell. -SSHHEELLLL CCOOMMMMAANNDDSS +SHELL COMMANDS Each target may have associated with it one or more lines of shell com- mands, normally used to create the target. Each of the lines in this - script _m_u_s_t be preceded by a tab. (For historical reasons, spaces are + script must be preceded by a tab. (For historical reasons, spaces are not accepted.) While targets can appear in many dependency lines if desired, by default only one of these rules may be followed by a creation - script. If the `::::' operator is used, however, all rules may include + script. If the `::' operator is used, however, all rules may include scripts and the scripts are executed in the order found. Each line is treated as a separate shell command, unless the end of line is escaped with a backslash (`\') in which case that line and the next are combined. If the first characters of the command are any combination - of `@@', `++', or `--', the command is treated specially. A `@@' causes the - command not to be echoed before it is executed. A `++' causes the command - to be executed even when --nn is given. This is similar to the effect of + of `@', `+', or `-', the command is treated specially. A `@' causes the + command not to be echoed before it is executed. A `+' causes the command + to be executed even when -n is given. This is similar to the effect of the .MAKE special source, except that the effect can be limited to a sin- - gle line of a script. A `--' in compatibility mode causes any non-zero + gle line of a script. A `-' in compatibility mode causes any non-zero exit status of the command line to be ignored. - When bbmmaakkee is run in jobs mode with --jj _m_a_x___j_o_b_s, the entire script for + When bmake is run in jobs mode with -j max_jobs, the entire script for the target is fed to a single instance of the shell. In compatibility (non-jobs) mode, each command is run in a separate process. If the com- mand contains any shell meta characters (`#=|^(){};&<>*?[]:$`\\n') it - will be passed to the shell; otherwise bbmmaakkee will attempt direct execu- - tion. If a line starts with `--' and the shell has ErrCtl enabled then + will be passed to the shell; otherwise bmake will attempt direct execu- + tion. If a line starts with `-' and the shell has ErrCtl enabled then failure of the command line will be ignored as in compatibility mode. - Otherwise `--' affects the entire job; the script will stop at the first + Otherwise `-' affects the entire job; the script will stop at the first command line that fails, but the target will not be deemed to have failed. - Makefiles should be written so that the mode of bbmmaakkee operation does not + Makefiles should be written so that the mode of bmake operation does not change their behavior. For example, any command which needs to use ``cd'' or ``chdir'' without potentially changing the directory for subse- quent commands should be put in parentheses so it executes in a subshell. @@ -334,35 +334,35 @@ SSHHEELLLL CCOOMMMMAANNDDSS (cd ${.CURDIR} && ${MAKE} $@); \ echo Back in `pwd` - Since bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' before executing any targets, each + Since bmake will chdir(2) to `.OBJDIR' before executing any targets, each child process starts with that as its current working directory. -VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS +VARIABLE ASSIGNMENTS Variables in make are much like variables in the shell, and, by tradi- tion, consist of all upper-case letters. - VVaarriiaabbllee aassssiiggnnmmeenntt mmooddiiffiieerrss + Variable assignment modifiers The five operators that can be used to assign values to variables are as follows: - == Assign the value to the variable. Any previous value is overrid- + = Assign the value to the variable. Any previous value is overrid- den. - ++== Append the value to the current value of the variable. + += Append the value to the current value of the variable. - ??== Assign the value to the variable if it is not already defined. + ?= Assign the value to the variable if it is not already defined. - ::== Assign with expansion, i.e. expand the value before assigning it + := Assign with expansion, i.e. expand the value before assigning it to the variable. Normally, expansion is not done until the vari- - able is referenced. _N_O_T_E: References to undefined variables are - _n_o_t expanded. This can cause problems when variable modifiers + able is referenced. NOTE: References to undefined variables are + not expanded. This can cause problems when variable modifiers are used. - !!== Expand the value and pass it to the shell for execution and + != Expand the value and pass it to the shell for execution and assign the result to the variable. Any newlines in the result are replaced with spaces. - Any white-space before the assigned _v_a_l_u_e is removed; if the value is + Any white-space before the assigned value is removed; if the value is being appended, a single space is inserted between the previous contents of the variable and the appended value. @@ -412,12 +412,12 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT ${b} contains ``${j} ${j} ${j}'' which expands to ``3 3 3'' since after the loop completes ${j} contains ``3''. - VVaarriiaabbllee ccllaasssseess + Variable classes The four different classes of variables (in order of increasing prece- dence) are: Environment variables - Variables defined as part of bbmmaakkee's environment. + Variables defined as part of bmake's environment. Global variables Variables defined in the makefile or in included makefiles. @@ -432,91 +432,91 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT target to target. It is not currently possible to define new local vari- ables. The seven local variables are as follows: - _._A_L_L_S_R_C The list of all sources for this target; also known as - `_>'. + .ALLSRC The list of all sources for this target; also known as + `>'. - _._A_R_C_H_I_V_E The name of the archive file; also known as `_!'. + .ARCHIVE The name of the archive file; also known as `!'. - _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the + .IMPSRC In suffix-transformation rules, the name/path of the source from which the target is to be transformed (the - ``implied'' source); also known as `_<'. It is not + ``implied'' source); also known as `<'. It is not defined in explicit rules. - _._M_E_M_B_E_R The name of the archive member; also known as `_%'. + .MEMBER The name of the archive member; also known as `%'. - _._O_O_D_A_T_E The list of sources for this target that were deemed out- - of-date; also known as `_?'. + .OODATE The list of sources for this target that were deemed out- + of-date; also known as `?'. - _._P_R_E_F_I_X The file prefix of the target, containing only the file + .PREFIX The file prefix of the target, containing only the file portion, no suffix or preceding directory components; - also known as `_*'. The suffix must be one of the known - suffixes declared with ..SSUUFFFFIIXXEESS or it will not be recog- + also known as `*'. The suffix must be one of the known + suffixes declared with .SUFFIXES or it will not be recog- nized. - _._T_A_R_G_E_T The name of the target; also known as `_@'. For compati- - bility with other makes this is an alias for ..AARRCCHHIIVVEE in + .TARGET The name of the target; also known as `@'. For compati- + bility with other makes this is an alias for .ARCHIVE in archive member rules. - The shorter forms (`_>', `_!', `_<', `_%', `_?', `_*', and `_@') are permitted + The shorter forms (`>', `!', `<', `%', `?', `*', and `@') are permitted for backward compatibility with historical makefiles and legacy POSIX make and are not recommended. Variants of these variables with the punctuation followed immediately by - `D' or `F', e.g. `_$_(_@_D_)', are legacy forms equivalent to using the `:H' + `D' or `F', e.g. `$(@D)', are legacy forms equivalent to using the `:H' and `:T' modifiers. These forms are accepted for compatibility with AT&T System V UNIX makefiles and POSIX but are not recommended. Four of the local variables may be used in sources on dependency lines because they expand to the proper value for each target on the line. - These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', and `_._M_E_M_B_E_R'. + These variables are `.TARGET', `.PREFIX', `.ARCHIVE', and `.MEMBER'. - AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess - In addition, bbmmaakkee sets or knows about the following variables: + Additional built-in variables + In addition, bmake sets or knows about the following variables: - _$ A single dollar sign `$', i.e. `$$' expands to a single + $ A single dollar sign `$', i.e. `$$' expands to a single dollar sign. - _._A_L_L_T_A_R_G_E_T_S The list of all targets encountered in the Makefile. If + .ALLTARGETS The list of all targets encountered in the Makefile. If evaluated during Makefile parsing, lists only those tar- gets encountered thus far. - _._C_U_R_D_I_R A path to the directory where bbmmaakkee was executed. Refer + .CURDIR A path to the directory where bmake was executed. Refer to the description of `PWD' for more details. - _._I_N_C_L_U_D_E_D_F_R_O_M_D_I_R + .INCLUDEDFROMDIR The directory of the file this Makefile was included from. - _._I_N_C_L_U_D_E_D_F_R_O_M_F_I_L_E + .INCLUDEDFROMFILE The filename of the file this Makefile was included from. - MAKE The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]). For - compatibility bbmmaakkee also sets _._M_A_K_E with the same value. + MAKE The name that bmake was executed with (argv[0]). For + compatibility bmake also sets .MAKE with the same value. The preferred variable to use is the environment variable MAKE because it is more compatible with other versions of - bbmmaakkee and cannot be confused with the special target with + bmake and cannot be confused with the special target with the same name. - _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E - Names the makefile (default `_._d_e_p_e_n_d') from which gener- + .MAKE.DEPENDFILE + Names the makefile (default `.depend') from which gener- ated dependencies are read. - _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S - A boolean that controls the default behavior of the --VV - option. If true, variable values printed with --VV are + .MAKE.EXPAND_VARIABLES + A boolean that controls the default behavior of the -V + option. If true, variable values printed with -V are fully expanded; if false, the raw variable contents (which may include additional unexpanded variable refer- ences) are shown. - _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. + .MAKE.EXPORTED The list of variables exported by bmake. - _._M_A_K_E_._J_O_B_S The argument to the --jj option. + .MAKE.JOBS The argument to the -j option. - _._M_A_K_E_._J_O_B_._P_R_E_F_I_X - If bbmmaakkee is run with _j then output for each target is + .MAKE.JOB.PREFIX + If bmake is run with j then output for each target is prefixed with a token `--- target ---' the first part of - which can be controlled via _._M_A_K_E_._J_O_B_._P_R_E_F_I_X. If - _._M_A_K_E_._J_O_B_._P_R_E_F_I_X is empty, no token is printed. + which can be controlled via .MAKE.JOB.PREFIX. If + .MAKE.JOB.PREFIX is empty, no token is printed. For example: .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] would produce tokens like `---make[1234] target ---' mak- @@ -524,156 +524,156 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT achieved. MAKEFLAGS The environment variable `MAKEFLAGS' may contain anything - that may be specified on bbmmaakkee's command line. Anything - specified on bbmmaakkee's command line is appended to the + that may be specified on bmake's command line. Anything + specified on bmake's command line is appended to the `MAKEFLAGS' variable which is then entered into the envi- - ronment for all programs which bbmmaakkee executes. + ronment for all programs which bmake executes. - _._M_A_K_E_._L_E_V_E_L The recursion depth of bbmmaakkee. The initial instance of - bbmmaakkee will be 0, and an incremented value is put into the + .MAKE.LEVEL The recursion depth of bmake. The initial instance of + bmake will be 0, and an incremented value is put into the environment to be seen by the next generation. This allows tests like: .if ${.MAKE.LEVEL} == 0 to protect things which should only be evaluated in the initial - instance of bbmmaakkee. + instance of bmake. - _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E - The ordered list of makefile names (default `_m_a_k_e_f_i_l_e', - `_M_a_k_e_f_i_l_e') that bbmmaakkee will look for. + .MAKE.MAKEFILE_PREFERENCE + The ordered list of makefile names (default `makefile', + `Makefile') that bmake will look for. - _._M_A_K_E_._M_A_K_E_F_I_L_E_S - The list of makefiles read by bbmmaakkee, which is useful for + .MAKE.MAKEFILES + The list of makefiles read by bmake, which is useful for tracking dependencies. Each makefile is recorded only once, regardless of the number of times read. - _._M_A_K_E_._M_O_D_E Processed after reading all makefiles. Can affect the - mode that bbmmaakkee runs in. It can contain a number of key- + .MAKE.MODE Processed after reading all makefiles. Can affect the + mode that bmake runs in. It can contain a number of key- words: - _c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" + compat Like -B, puts bmake into "compat" mode. - _m_e_t_a Puts bbmmaakkee into "meta" mode, where + meta Puts bmake into "meta" mode, where meta files are created for each tar- get to capture the command run, the output generated and if filemon(4) is available, the system calls which - are of interest to bbmmaakkee. The cap- + are of interest to bmake. The cap- tured output can be very useful when diagnosing errors. - _c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta - files in `_._C_U_R_D_I_R'. This can be - overridden by setting _b_f to a value + curdirOk= bf Normally bmake will not create .meta + files in `.CURDIR'. This can be + overridden by setting bf to a value which represents True. - _m_i_s_s_i_n_g_-_m_e_t_a_= _b_f If _b_f is True, then a missing .meta + missing-meta= bf If bf is True, then a missing .meta file makes the target out-of-date. - _m_i_s_s_i_n_g_-_f_i_l_e_m_o_n_= _b_f If _b_f is True, then missing filemon + missing-filemon= bf If bf is True, then missing filemon data makes the target out-of-date. - _n_o_f_i_l_e_m_o_n Do not use filemon(4). + nofilemon Do not use filemon(4). - _e_n_v For debugging, it can be useful to + env For debugging, it can be useful to include the environment in the .meta file. - _v_e_r_b_o_s_e If in "meta" mode, print a clue + verbose If in "meta" mode, print a clue about the target being built. This is useful if the build is otherwise running silently. The message printed the value of: - _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. + .MAKE.META.PREFIX. - _i_g_n_o_r_e_-_c_m_d Some makefiles have commands which + ignore-cmd Some makefiles have commands which are simply not stable. This keyword causes them to be ignored for deter- mining whether a target is out of date in "meta" mode. See also - ..NNOOMMEETTAA__CCMMPP. + .NOMETA_CMP. - _s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is - created, mark the target ..SSIILLEENNTT. + silent= bf If bf is True, when a .meta file is + created, mark the target .SILENT. - _._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K + .MAKE.META.BAILIWICK In "meta" mode, provides a list of prefixes which match - the directories controlled by bbmmaakkee. If a file that was - generated outside of _._O_B_J_D_I_R but within said bailiwick is + the directories controlled by bmake. If a file that was + generated outside of .OBJDIR but within said bailiwick is missing, the current target is considered out-of-date. - _._M_A_K_E_._M_E_T_A_._C_R_E_A_T_E_D + .MAKE.META.CREATED In "meta" mode, this variable contains a list of all the meta files updated. If not empty, it can be used to - trigger processing of _._M_A_K_E_._M_E_T_A_._F_I_L_E_S. + trigger processing of .MAKE.META.FILES. - _._M_A_K_E_._M_E_T_A_._F_I_L_E_S + .MAKE.META.FILES In "meta" mode, this variable contains a list of all the meta files used (updated or not). This list can be used to process the meta files to extract dependency informa- tion. - _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_H_S + .MAKE.META.IGNORE_PATHS Provides a list of path prefixes that should be ignored; because the contents are expected to change over time. - The default list includes: `_/_d_e_v _/_e_t_c _/_p_r_o_c _/_t_m_p _/_v_a_r_/_r_u_n - _/_v_a_r_/_t_m_p' + The default list includes: `/dev /etc /proc /tmp /var/run + /var/tmp' - _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_T_E_R_N_S + .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. - _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R + .MAKE.META.IGNORE_FILTER Provides a list of variable modifiers to apply to each pathname. Ignore if the expansion is an empty string. - _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X + .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: Building ${.TARGET:H:tA}/${.TARGET:T} - _._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables + .MAKEOVERRIDES This variable is used to record the names of variables assigned to on the command line, so that they may be exported as part of `MAKEFLAGS'. This behavior can be - disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S' + disabled by assigning an empty value to `.MAKEOVERRIDES' within a makefile. Extra variables can be exported from - a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'. - `MAKEFLAGS' is re-exported whenever `_._M_A_K_E_O_V_E_R_R_I_D_E_S' is + a makefile by appending their names to `.MAKEOVERRIDES'. + `MAKEFLAGS' is re-exported whenever `.MAKEOVERRIDES' is modified. - _._M_A_K_E_._P_A_T_H___F_I_L_E_M_O_N - If bbmmaakkee was built with filemon(4) support, this is set + .MAKE.PATH_FILEMON + If bmake was built with filemon(4) support, this is set to the path of the device node. This allows makefiles to test for this support. - _._M_A_K_E_._P_I_D The process-id of bbmmaakkee. + .MAKE.PID The process-id of bmake. - _._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee. + .MAKE.PPID The parent process-id of bmake. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Mar 20 16:17:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9509F59AFC; Tue, 20 Mar 2018 16:17:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 892A77A271; Tue, 20 Mar 2018 16:17:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82DEB1F096; Tue, 20 Mar 2018 16:17:55 +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 w2KGHtqC009351; Tue, 20 Mar 2018 16:17:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KGHtCi009350; Tue, 20 Mar 2018 16:17:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803201617.w2KGHtCi009350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 16:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331247 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 16:17:56 -0000 Author: kib Date: Tue Mar 20 16:17:55 2018 New Revision: 331247 URL: https://svnweb.freebsd.org/changeset/base/331247 Log: Check for wrap-around in vm_phys_alloc_seg_contig(). It is possible to provide insane values for size in contigmalloc(9) request, which usually not reaches the phys allocator due to failing KVA allocation. But with the forthcoming 4/4 i386, where 32bit architecture has almost 4G KVA, contigmalloc(1G) is not unreasonable outright and KVA might be available sometimes. Then, the calculation of pa_end could wrap around, depending on the physical address, and the checks in vm_phys_alloc_seg_contig() would pass while the iteration in the loop after the 'done' label goes out of the vm_page_array bounds. Fix it by detecting the wrap. Reported and tested by: pho Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14767 Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Tue Mar 20 15:57:52 2018 (r331246) +++ head/sys/vm/vm_phys.c Tue Mar 20 16:17:55 2018 (r331247) @@ -1189,6 +1189,8 @@ vm_phys_alloc_seg_contig(struct vm_phys_seg *seg, u_lo */ pa = VM_PAGE_TO_PHYS(m_ret); pa_end = pa + size; + if (pa_end < pa) + continue; for (;;) { pa += 1 << (PAGE_SHIFT + VM_NFREEORDER - 1); From owner-svn-src-all@freebsd.org Tue Mar 20 16:41:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4BDCF5B470; Tue, 20 Mar 2018 16:41:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55F187B26B; Tue, 20 Mar 2018 16:41:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x22f.google.com with SMTP id e7so3136581iof.2; Tue, 20 Mar 2018 09:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=XNRX24Lr2qNiBKv0vWgq5fOvq9amWmfEWIeFf1/YL5U=; b=usLEvQ5RdDvg+yyBJzV8KsUikG/kNNCPjqQmvzaoM5bf849OhGaohJinWBqxquk/uh 7j+5eJNTaQorNeeq0RFwMWNGgnlt7ta8sS34EDh0ntjEn5jegSse9DG4/sAuo3XlN6MW vlUC6u8UHX3WvVkkMybD0smJ8uvPjYzV+qzBqzPBu9K0+EpjTEgo355ybTntIx7aHNuj 2HmihtmbjAQ3A2T/D1xsUucYBIOT2CI1DUCGrlBeDwig17ypZIlBU83dYUeQv6U9/whl INECy5ACFFZ9J2Za+Y0oIHVtRwFzrDstFAoCfshCDe/GSFLotxWg0Hdp+s1WGGhQKgFe tdwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=XNRX24Lr2qNiBKv0vWgq5fOvq9amWmfEWIeFf1/YL5U=; b=LxP1m1t7HZJ0dxoq4lpXbMEuS8MaBuzLSwmFAViCiaJVKKRIYgyM9NytpGLcX7LqYa fGeWOU9DACzcQIXOSlQEP8iulxflYGpn1Ww2L1B2QD1BZ8KHoD4RRXmTxMKLjjdlx9Fk otIjqjgHR6okbRPIx1DH0f+bTf3l8L+MaaUFbTW4g8LVHXdOi7R0L/AJPSo7lC0FRQ43 mQzoebF8d4ejTZ9dvMVCg1lHYdjQNlwt3zWCg4nE44rmh0Rhn32azrtfEoG/yMU/cs9m T8U98LR8XOd0PLDM2kh1PKIbR4zETNvAjj/SavgwFjsBC3iO4ytfGtGXrY+D6oS3wMPW GQeA== X-Gm-Message-State: AElRT7FpS0Kt6T45258ayikBXb1JKN4OBe3pHGZ+lPjeraTF/G+xi4Nx XRFPv/tOlHogo8WA6S2WpbpZOXftG08QNUg8qQo= X-Google-Smtp-Source: AG47ELtPBEBhLHPPu7H3uCp8lXvZK9+L0SDdNMY7B2sb7H5wSf5we02yZSVH5fS5pdNSkMMDICWnPfITt2hzNUwgCBM= X-Received: by 10.107.134.85 with SMTP id i82mr16444659iod.210.1521564107514; Tue, 20 Mar 2018 09:41:47 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Tue, 20 Mar 2018 09:41:27 -0700 (PDT) In-Reply-To: <20180320183744.S950@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> <20180320183744.S950@besplex.bde.org> From: Ed Maste Date: Tue, 20 Mar 2018 12:41:27 -0400 X-Google-Sender-Auth: uFP1w7WQxSuxF4KDkQWOWAp3MEg Message-ID: Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux To: Bruce Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 16:41:50 -0000 On 20 March 2018 at 04:19, Bruce Evans wrote: > > It is preferable to have a well-chosen (short...) prefix. The linux > emulator mostly uses l_ for internal names. That is a bit too short > for external names. l_ is too short. The only reasonable alternative is probably lnx_ but saving two characters seems does not seem worth it. > 'elf_' is an example of a well-chosen prefix. Not for Linux-specific things. There are currently three copies of these functions, and I'm going to move them so they can be shared by the Linuxulator on all appropriate archs. > I don't like the style of putting the verb last in names, but it goes well > with putting prefixes first. Here the verb placement style is random -- > the verb is last in ...handler_set and ...elf_fixup, but not last in > ...copyout_strings. These names are consistent with the sysentvec names. sv_copyout_strings = linux_strings_copyout seems confusing for no real benefit. > Names without any prefix are likely to have had the verb first, and now > in the middle. It should probably not be plural either. This could be linux_trap_translate instead. From owner-svn-src-all@freebsd.org Tue Mar 20 16:44:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B14C0F5B796; Tue, 20 Mar 2018 16:44:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DB847B60B; Tue, 20 Mar 2018 16:44:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 1ACC810A7DB; Tue, 20 Mar 2018 12:44:30 -0400 (EDT) From: John Baldwin To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331057 - head/sys/compat/linux Date: Tue, 20 Mar 2018 08:54:39 -0700 Message-ID: <2422935.GGHXCazita@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201803161451.w2GEpl3T053141@repo.freebsd.org> <1806390.PUHUxB7aSs@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 20 Mar 2018 12:44:30 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 16:44:31 -0000 On Monday, March 19, 2018 05:32:22 PM Ed Maste wrote: > On 16 March 2018 at 17:08, John Baldwin wrote: > > On Friday, March 16, 2018 02:51:47 PM Ed Maste wrote: > >> Author: emaste > >> Date: Fri Mar 16 14:51:47 2018 > >> New Revision: 331057 > >> URL: https://svnweb.freebsd.org/changeset/base/331057 > >> > >> Log: > >> linux_errno.c: add newer errno values > > > > Could you move the table to a header perhaps so it can also be shared > > with lib/libsysdecode/errno.c (which has another copy of this table)? > > I found that copy shortly after I made this change (and then updated > it to match). We could just add linux_errno.c to libsysdecode though? Probably. I'd like to avoid exporting the symbol if possible. Currently that is done by marking it static in errno.c, but if I compile in linux_errno.c as-is it would be a global symbol (and would need to be exported to errno.c at least). -- John Baldwin From owner-svn-src-all@freebsd.org Tue Mar 20 17:05:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2FF8F5D013; Tue, 20 Mar 2018 17:05:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 969657C762; Tue, 20 Mar 2018 17:05:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 915E41F8B9; Tue, 20 Mar 2018 17:05:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KH5OxN034408; Tue, 20 Mar 2018 17:05:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KH5OT8034404; Tue, 20 Mar 2018 17:05:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803201705.w2KH5OT8034404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Mar 2018 17:05:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331248 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 331248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:05:25 -0000 Author: jhb Date: Tue Mar 20 17:05:23 2018 New Revision: 331248 URL: https://svnweb.freebsd.org/changeset/base/331248 Log: Set the proper vnet in IPsec callback functions. When using hardware crypto engines, the callback functions used to handle an IPsec packet after it has been encrypted or decrypted can be invoked asynchronously from a worker thread that is not associated with a vnet. Extend 'struct xform_data' to include a vnet pointer and save the current vnet in this new member when queueing crypto requests in IPsec. In the IPsec callback routines, use the new member to set the current vnet while processing the modified packet. This fixes a panic when using hardware offload such as ccr(4) with IPsec after VIMAGE was enabled in GENERIC. Reported by: Sony Arpita Das and Harsh Jain @ Chelsio Reviewed by: bz MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14763 Modified: head/sys/netipsec/xform.h head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/xform.h ============================================================================== --- head/sys/netipsec/xform.h Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform.h Tue Mar 20 17:05:23 2018 (r331248) @@ -76,6 +76,7 @@ struct xform_data { int protoff; /* current protocol offset */ int skip; /* data offset */ uint8_t nxt; /* next protocol, e.g. IPV4 */ + struct vnet *vnet; }; #define XF_IP4 1 /* unused */ Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform_ah.c Tue Mar 20 17:05:23 2018 (r331248) @@ -667,6 +667,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski xd->protoff = protoff; xd->skip = skip; xd->cryptoid = cryptoid; + xd->vnet = curvnet; return (crypto_dispatch(crp)); bad: m_freem(m); @@ -693,6 +694,7 @@ ah_input_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sav = xd->sav; skip = xd->skip; nxt = xd->nxt; @@ -710,6 +712,7 @@ ah_input_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } AHSTAT_INC(ahs_noxform); @@ -805,8 +808,10 @@ ah_input_cb(struct cryptop *crp) panic("%s: Unexpected address family: %d saidx=%p", __func__, saidx->dst.sa.sa_family, saidx); } + CURVNET_RESTORE(); return error; bad: + CURVNET_RESTORE(); if (sav) key_freesav(&sav); if (m != NULL) @@ -1040,6 +1045,7 @@ ah_output(struct mbuf *m, struct secpolicy *sp, struct xd->skip = skip; xd->idx = idx; xd->cryptoid = cryptoid; + xd->vnet = curvnet; return crypto_dispatch(crp); bad: @@ -1067,6 +1073,7 @@ ah_output_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sp = xd->sp; sav = xd->sav; skip = xd->skip; @@ -1081,6 +1088,7 @@ ah_output_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } AHSTAT_INC(ahs_noxform); @@ -1122,8 +1130,10 @@ ah_output_cb(struct cryptop *crp) /* NB: m is reclaimed by ipsec_process_done. */ error = ipsec_process_done(m, sp, sav, idx); + CURVNET_RESTORE(); return (error); bad: + CURVNET_RESTORE(); free(xd, M_XDATA); crypto_freereq(crp); key_freesav(&sav); Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform_esp.c Tue Mar 20 17:05:23 2018 (r331248) @@ -397,6 +397,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, int sk xd->protoff = protoff; xd->skip = skip; xd->cryptoid = cryptoid; + xd->vnet = curvnet; /* Decryption descriptor */ IPSEC_ASSERT(crde != NULL, ("null esp crypto descriptor")); @@ -455,6 +456,7 @@ esp_input_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sav = xd->sav; skip = xd->skip; protoff = xd->protoff; @@ -469,6 +471,7 @@ esp_input_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } ESPSTAT_INC(esps_noxform); @@ -603,8 +606,10 @@ esp_input_cb(struct cryptop *crp) panic("%s: Unexpected address family: %d saidx=%p", __func__, saidx->dst.sa.sa_family, saidx); } + CURVNET_RESTORE(); return error; bad: + CURVNET_RESTORE(); if (sav != NULL) key_freesav(&sav); if (m != NULL) @@ -837,6 +842,7 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struc xd->sav = sav; xd->idx = idx; xd->cryptoid = cryptoid; + xd->vnet = curvnet; /* Crypto operation descriptor. */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */ @@ -882,6 +888,7 @@ esp_output_cb(struct cryptop *crp) int error; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); m = (struct mbuf *) crp->crp_buf; sp = xd->sp; sav = xd->sav; @@ -895,6 +902,7 @@ esp_output_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } ESPSTAT_INC(esps_noxform); @@ -940,8 +948,10 @@ esp_output_cb(struct cryptop *crp) /* NB: m is reclaimed by ipsec_process_done. */ error = ipsec_process_done(m, sp, sav, idx); + CURVNET_RESTORE(); return (error); bad: + CURVNET_RESTORE(); free(xd, M_XDATA); crypto_freereq(crp); key_freesav(&sav); Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform_ipcomp.c Tue Mar 20 17:05:23 2018 (r331248) @@ -255,6 +255,7 @@ ipcomp_input(struct mbuf *m, struct secasvar *sav, int xd->sav = sav; xd->protoff = protoff; xd->skip = skip; + xd->vnet = curvnet; SECASVAR_LOCK(sav); crp->crp_sid = xd->cryptoid = sav->tdb_cryptoid; @@ -286,6 +287,7 @@ ipcomp_input_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sav = xd->sav; skip = xd->skip; protoff = xd->protoff; @@ -302,6 +304,7 @@ ipcomp_input_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } IPCOMPSTAT_INC(ipcomps_noxform); @@ -366,8 +369,10 @@ ipcomp_input_cb(struct cryptop *crp) panic("%s: Unexpected address family: %d saidx=%p", __func__, saidx->dst.sa.sa_family, saidx); } + CURVNET_RESTORE(); return error; bad: + CURVNET_RESTORE(); if (sav != NULL) key_freesav(&sav); if (m != NULL) @@ -493,6 +498,7 @@ ipcomp_output(struct mbuf *m, struct secpolicy *sp, st xd->idx = idx; xd->skip = skip; xd->protoff = protoff; + xd->vnet = curvnet; /* Crypto operation descriptor */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length */ @@ -531,6 +537,7 @@ ipcomp_output_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); idx = xd->idx; sp = xd->sp; sav = xd->sav; @@ -545,6 +552,7 @@ ipcomp_output_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } IPCOMPSTAT_INC(ipcomps_noxform); @@ -640,10 +648,12 @@ ipcomp_output_cb(struct cryptop *crp) /* NB: m is reclaimed by ipsec_process_done. */ error = ipsec_process_done(m, sp, sav, idx); + CURVNET_RESTORE(); return (error); bad: if (m) m_freem(m); + CURVNET_RESTORE(); free(xd, M_XDATA); crypto_freereq(crp); key_freesav(&sav); From owner-svn-src-all@freebsd.org Tue Mar 20 17:27:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5263CF5F03C; Tue, 20 Mar 2018 17:27:01 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE30B7DCC2; Tue, 20 Mar 2018 17:27:00 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E40FC1FBD4; Tue, 20 Mar 2018 17:27:00 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHR0Nf045504; Tue, 20 Mar 2018 17:27:00 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHR0rQ045501; Tue, 20 Mar 2018 17:27:00 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803201727.w2KHR0rQ045501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 20 Mar 2018 17:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331249 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 331249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:27:01 -0000 Author: sbruno Date: Tue Mar 20 17:27:00 2018 New Revision: 331249 URL: https://svnweb.freebsd.org/changeset/base/331249 Log: MFC r330675 Update tcp_lro with tested bugfixes from Netflix and LLNW: rrs - Lets make the LRO code look for true dup-acks and window update acks fly on through and combine. rrs - Make the LRO engine a bit more aware of ack-only seq space. Lets not have it incorrectly wipe out newer acks for older acks when we have out-of-order acks (common in wifi environments). jeggleston - LRO eating window updates Based on all of the above I think we are RFC compliant doing it this way: https://tools.ietf.org/html/rfc1122 section 4.2.2.16 "Note that TCP has a heuristic to select the latest window update despite possible datagram reordering; as a result, it may ignore a window update with a smaller window than previously offered if neither the sequence number nor the acknowledgment number is increased." Submitted by: Kevin Bowling Sponsored by: NetFlix and Limelight Networks Modified: stable/11/sys/netinet/tcp_lro.c stable/11/sys/netinet/tcp_seq.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_lro.c ============================================================================== --- stable/11/sys/netinet/tcp_lro.c Tue Mar 20 17:05:23 2018 (r331248) +++ stable/11/sys/netinet/tcp_lro.c Tue Mar 20 17:27:00 2018 (r331249) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -734,7 +735,9 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32 /* Try to append the new segment. */ if (__predict_false(seq != le->next_seq || - (tcp_data_len == 0 && le->ack_seq == th->th_ack))) { + (tcp_data_len == 0 && + le->ack_seq == th->th_ack && + le->window == th->th_win))) { /* Out of order packet or duplicate ACK. */ tcp_lro_active_remove(le); tcp_lro_flush(lc, le); @@ -751,12 +754,20 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32 le->tsval = tsval; le->tsecr = *(ts_ptr + 2); } - - le->next_seq += tcp_data_len; - le->ack_seq = th->th_ack; - le->window = th->th_win; - le->append_cnt++; - + if (tcp_data_len || SEQ_GT(ntohl(th->th_ack), ntohl(le->ack_seq))) { + le->next_seq += tcp_data_len; + le->ack_seq = th->th_ack; + le->window = th->th_win; + le->append_cnt++; + } else if (th->th_ack == le->ack_seq) { + le->window = WIN_MAX(le->window, th->th_win); + le->append_cnt++; + } else { + /* no data and old ack */ + le->append_cnt++; + m_freem(m); + return (0); + } #ifdef TCP_LRO_UPDATE_CSUM le->ulp_csum += tcp_lro_rx_csum_fixup(le, l3hdr, th, tcp_data_len, ~csum); Modified: stable/11/sys/netinet/tcp_seq.h ============================================================================== --- stable/11/sys/netinet/tcp_seq.h Tue Mar 20 17:05:23 2018 (r331248) +++ stable/11/sys/netinet/tcp_seq.h Tue Mar 20 17:27:00 2018 (r331249) @@ -47,6 +47,14 @@ #define SEQ_MIN(a, b) ((SEQ_LT(a, b)) ? (a) : (b)) #define SEQ_MAX(a, b) ((SEQ_GT(a, b)) ? (a) : (b)) +#define WIN_LT(a,b) ((short)(ntohs(a)-ntohs(b)) < 0) +#define WIN_LEQ(a,b) ((short)(ntohs(a)-ntohs(b)) <= 0) +#define WIN_GT(a,b) ((short)(ntohs(a)-ntohs(b)) > 0) +#define WIN_GEQ(a,b) ((short)(ntohs(a)-ntohs(b)) >= 0) + +#define WIN_MIN(a, b) ((WIN_LT(a, b)) ? (a) : (b)) +#define WIN_MAX(a, b) ((WIN_GT(a, b)) ? (a) : (b)) + /* for modulo comparisons of timestamps */ #define TSTMP_LT(a,b) ((int)((a)-(b)) < 0) #define TSTMP_GT(a,b) ((int)((a)-(b)) > 0) From owner-svn-src-all@freebsd.org Tue Mar 20 17:39:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70B39F5FF2E; Tue, 20 Mar 2018 17:39:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B4E87E516; Tue, 20 Mar 2018 17:39:51 +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 14DB21FDA4; Tue, 20 Mar 2018 17:39:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHdo8p050735; Tue, 20 Mar 2018 17:39:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHdoYC050734; Tue, 20 Mar 2018 17:39:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803201739.w2KHdoYC050734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 17:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331250 - stable/11/stand/ficl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/ficl X-SVN-Commit-Revision: 331250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:39:51 -0000 Author: kevans Date: Tue Mar 20 17:39:50 2018 New Revision: 331250 URL: https://svnweb.freebsd.org/changeset/base/331250 Log: MFC r330612: stand/ficl: Fix testmain testmain is a userland application intended to be built with standard headers and whatnot, which we broke. Fix it by having the testmain build clobber cflags, reducing it to just the set of defines/includes it needs to build. Modified: stable/11/stand/ficl/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/ficl/Makefile ============================================================================== --- stable/11/stand/ficl/Makefile Tue Mar 20 17:27:00 2018 (r331249) +++ stable/11/stand/ficl/Makefile Tue Mar 20 17:39:50 2018 (r331250) @@ -14,7 +14,8 @@ CLEANFILES+= softcore.c testmain testmain.o .include .ifmake testmain -CFLAGS+= -DTESTMAIN -D_TESTMAIN +CFLAGS= -DTESTMAIN -D_TESTMAIN +CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC} SRCS+= testmain.c PROG= testmain .include From owner-svn-src-all@freebsd.org Tue Mar 20 17:41:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 508DEF601CD; Tue, 20 Mar 2018 17:41:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5B447E880; Tue, 20 Mar 2018 17:41:54 +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 C68141FEF3; Tue, 20 Mar 2018 17:41:54 +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 w2KHfssd053182; Tue, 20 Mar 2018 17:41:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHfs2N053180; Tue, 20 Mar 2018 17:41:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803201741.w2KHfs2N053180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 17:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331251 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 331251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:41:55 -0000 Author: kevans Date: Tue Mar 20 17:41:54 2018 New Revision: 331251 URL: https://svnweb.freebsd.org/changeset/base/331251 Log: MFC r330023, r330028: Add MAXWAIT for configuring pxeboot timeout r330023: libsa: Add MAXWAIT to net for establishing max total timeout Current timeout behavior is to progress in timeout values from MINTMO to MAXTMO in MINTMO steps before finally timing out. This results in a fairly long time before operations finally timeout, which may not be ideal for some use-cases. Add MAXWAIT that may be configured along with MINTMO/MAXTMO. If we attempt to start our send/recv cycle over again but MAXWAIT > 0 and MAXWAIT seconds have already passed, then go ahead and timeout. This is intended for those that just want to say "timeout after 180 seconds" rather than calculate and tweak MINTMO/MAXTMO to get their desired timeout. The default is 0, or "progress from MINTMO to MAXTMO with no exception." This has been modified since review to allow for it to be defined via CFLAGS and doing appropriate error checking. Future work may add some Makefile foo to respect LOADER_NET_MAXWAIT if it's specified in the environment and pass it in as MAXWAIT accordingly. r330028: libsa: Partially revert r330023 The removal of tmo >= MAXTMO check should not have been done; this is specifically what handles timeout if MAXWAIT == 0. Modified: stable/11/stand/libsa/net.c stable/11/stand/libsa/net.h Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/net.c ============================================================================== --- stable/11/stand/libsa/net.c Tue Mar 20 17:39:50 2018 (r331250) +++ stable/11/stand/libsa/net.c Tue Mar 20 17:41:54 2018 (r331251) @@ -77,6 +77,7 @@ sendrecv(struct iodesc *d, { ssize_t cc; time_t t, tmo, tlast; + time_t tref; long tleft; #ifdef NET_DEBUG @@ -87,8 +88,13 @@ sendrecv(struct iodesc *d, tmo = MINTMO; tlast = 0; tleft = 0; + tref = getsecs(); t = getsecs(); for (;;) { + if (MAXWAIT > 0 && (getsecs() - tref) >= MAXWAIT) { + errno = ETIMEDOUT; + return -1; + } if (tleft <= 0) { if (tmo >= MAXTMO) { errno = ETIMEDOUT; Modified: stable/11/stand/libsa/net.h ============================================================================== --- stable/11/stand/libsa/net.h Tue Mar 20 17:39:50 2018 (r331250) +++ stable/11/stand/libsa/net.h Tue Mar 20 17:41:54 2018 (r331251) @@ -61,6 +61,20 @@ enum net_proto { #define MAXTMO 120 /* seconds */ #define MINTMO 2 /* seconds */ +/* + * Maximum wait time for sending and receiving before we give up and timeout. + * If set to 0, operations will eventually timeout completely, but send/recv + * timeouts must progress exponentially from MINTMO to MAXTMO before final + * timeout is hit. + */ +#ifndef MAXWAIT +#define MAXWAIT 0 /* seconds */ +#endif + +#if MAXWAIT < 0 +#error MAXWAIT must not be a negative number +#endif + #define FNAME_SIZE 128 #define IFNAME_SIZE 16 #define RECV_SIZE 1536 /* XXX delete this */ From owner-svn-src-all@freebsd.org Tue Mar 20 17:43:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F331F604BD; Tue, 20 Mar 2018 17:43:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A9ED7EBC7; Tue, 20 Mar 2018 17:43:51 +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 0FB5A1FF20; Tue, 20 Mar 2018 17:43:51 +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 w2KHhoP3055662; Tue, 20 Mar 2018 17:43:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHhoF9055658; Tue, 20 Mar 2018 17:43:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803201743.w2KHhoF9055658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 17:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331252 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 331252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:43:51 -0000 Author: kib Date: Tue Mar 20 17:43:50 2018 New Revision: 331252 URL: https://svnweb.freebsd.org/changeset/base/331252 Log: Provide KPI for handling of rw/ro kernel text. This is a pure syntax patch to create an interface to enable and later restore write access to the kernel text and other read-only mapped regions. It is in line with e.g. vm_fault_disable_pagefaults() by allowing the nesting. Discussed with: Peter Lei Reviewed by: jtl Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14768 Modified: head/sys/amd64/amd64/db_interface.c head/sys/amd64/amd64/gdb_machdep.c head/sys/amd64/amd64/machdep.c head/sys/amd64/include/md_var.h Modified: head/sys/amd64/amd64/db_interface.c ============================================================================== --- head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:43:50 2018 (r331252) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -75,19 +76,19 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da jmp_buf jb; void *prev_jb; char *dst; - u_long cr0save; + bool old_wp; int ret; - cr0save = rcr0(); + old_wp = false; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { - load_cr0(cr0save & ~CR0_WP); + old_wp = disable_wp(); dst = (char *)addr; while (size-- > 0) *dst++ = *data++; } - load_cr0(cr0save); + restore_wp(old_wp); (void)kdb_jmpbuf(prev_jb); return (ret); } Modified: head/sys/amd64/amd64/gdb_machdep.c ============================================================================== --- head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:43:50 2018 (r331252) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -127,17 +128,14 @@ gdb_cpu_signal(int type, int code) void * gdb_begin_write(void) { - u_long cr0save; - cr0save = rcr0(); - load_cr0(cr0save & ~CR0_WP); - return ((void *)cr0save); + return (disable_wp() ? &gdb_begin_write : NULL); } void gdb_end_write(void *arg) { - load_cr0((u_long)arg); + restore_wp(arg != NULL); } Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/amd64/machdep.c Tue Mar 20 17:43:50 2018 (r331252) @@ -2597,6 +2597,31 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags) : "cc", "memory"); } +/* + * Enable and restore kernel text write permissions. + * Callers must ensure that disable_wp()/restore_wp() are executed + * without rescheduling on the same core. + */ +bool +disable_wp(void) +{ + u_int cr0; + + cr0 = rcr0(); + if ((cr0 & CR0_WP) == 0) + return (false); + load_cr0(cr0 & ~CR0_WP); + return (true); +} + +void +restore_wp(bool old_wp) +{ + + if (old_wp) + load_cr0(rcr0() | CR0_WP); +} + #ifdef KDB /* Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/include/md_var.h Tue Mar 20 17:43:50 2018 (r331252) @@ -53,6 +53,8 @@ void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_lower_shared_page(struct sysentvec *); void amd64_syscall(struct thread *td, int traced); +bool disable_wp(void); +void restore_wp(bool old_wp); void doreti_iret(void) __asm(__STRING(doreti_iret)); void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); void ld_ds(void) __asm(__STRING(ld_ds)); From owner-svn-src-all@freebsd.org Tue Mar 20 17:47:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77C74F6088A; Tue, 20 Mar 2018 17:47:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 266D57EE1E; Tue, 20 Mar 2018 17:47:30 +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 1D3ED1FF2A; Tue, 20 Mar 2018 17:47:30 +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 w2KHlTWh055853; Tue, 20 Mar 2018 17:47:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHlTQl055852; Tue, 20 Mar 2018 17:47:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803201747.w2KHlTQl055852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 17:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331253 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 331253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:47:30 -0000 Author: kib Date: Tue Mar 20 17:47:29 2018 New Revision: 331253 URL: https://svnweb.freebsd.org/changeset/base/331253 Log: Disable write protection around patching of XSAVE instruction in the context switch code. Some BIOSes give control to the OS with CR0.WP already set, making the kernel text read-only before cpu_startup(). Reported by: Peter Lei Reviewed by: jtl Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14768 Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Tue Mar 20 17:43:50 2018 (r331252) +++ head/sys/amd64/amd64/fpu.c Tue Mar 20 17:47:29 2018 (r331253) @@ -205,6 +205,7 @@ fpuinit_bsp1(void) { u_int cp[4]; uint64_t xsave_mask_user; + bool old_wp; if ((cpu_feature2 & CPUID2_XSAVE) != 0) { use_xsave = 1; @@ -233,8 +234,14 @@ fpuinit_bsp1(void) * Patch the XSAVE instruction in the cpu_switch code * to XSAVEOPT. We assume that XSAVE encoding used * REX byte, and set the bit 4 of the r/m byte. + * + * It seems that some BIOSes give control to the OS + * with CR0.WP already set, making the kernel text + * read-only before cpu_startup(). */ + old_wp = disable_wp(); ctx_switch_xsave[3] |= 0x10; + restore_wp(old_wp); } } From owner-svn-src-all@freebsd.org Tue Mar 20 17:59:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2CA3F61537; Tue, 20 Mar 2018 17:59:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53BDF7F5DB; Tue, 20 Mar 2018 17:59:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AD41200A4; Tue, 20 Mar 2018 17:59:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHx0aw061095; Tue, 20 Mar 2018 17:59:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHwpMu061006; Tue, 20 Mar 2018 17:58:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803201758.w2KHwpMu061006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 17:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331254 - in head/sys: amd64/acpica amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 amd64/sgx arm/arm arm64/arm64 cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl... X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/acpica amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 amd64/sgx arm/arm arm64/arm64 cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev... X-SVN-Commit-Revision: 331254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:59:01 -0000 Author: emaste Date: Tue Mar 20 17:58:51 2018 New Revision: 331254 URL: https://svnweb.freebsd.org/changeset/base/331254 Log: Rename assym.s to assym.inc assym is only to be included by other .s files, and should never actually be assembled by itself. Reviewed by: imp, bdrewery (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14180 Modified: head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/amd64/apic_vector.S head/sys/amd64/amd64/atpic_vector.S head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/locore.S head/sys/amd64/amd64/mpboot.S head/sys/amd64/amd64/sigtramp.S head/sys/amd64/amd64/support.S head/sys/amd64/amd64/xen-locore.S head/sys/amd64/ia32/ia32_exception.S head/sys/amd64/linux/linux_support.s head/sys/amd64/linux32/linux32_support.s head/sys/amd64/sgx/sgx_support.S head/sys/arm/arm/bcopy_page.S head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/copystr.S head/sys/arm/arm/cpu_asm-v6.S head/sys/arm/arm/exception.S head/sys/arm/arm/fusu.S head/sys/arm/arm/hypervisor-stub.S head/sys/arm/arm/in_cksum_arm.S head/sys/arm/arm/locore-v4.S head/sys/arm/arm/locore-v6.S head/sys/arm/arm/support.S head/sys/arm/arm/swtch-v4.S head/sys/arm/arm/swtch-v6.S head/sys/arm/arm/swtch.S head/sys/arm64/arm64/bzero.S head/sys/arm64/arm64/copyinout.S head/sys/arm64/arm64/exception.S head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/support.S head/sys/arm64/arm64/swtch.S head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S head/sys/cddl/dev/dtrace/arm/dtrace_asm.S head/sys/cddl/dev/dtrace/i386/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/kern.post.mk head/sys/conf/kmod.mk head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S head/sys/i386/acpica/acpi_wakecode.S head/sys/i386/i386/apic_vector.s head/sys/i386/i386/atpic_vector.s head/sys/i386/i386/bioscall.s head/sys/i386/i386/exception.s head/sys/i386/i386/locore.s head/sys/i386/i386/mpboot.s head/sys/i386/i386/sigtramp.s head/sys/i386/i386/support.s head/sys/i386/i386/swtch.s head/sys/i386/i386/vm86bios.s head/sys/i386/linux/linux_locore.s head/sys/i386/linux/linux_support.s head/sys/mips/cavium/octeon_cop2.S head/sys/mips/ingenic/jz4780_mpboot.S head/sys/mips/mips/exception.S head/sys/mips/mips/fp.S head/sys/mips/mips/locore.S head/sys/mips/mips/mpboot.S head/sys/mips/mips/octeon_cop2_swtch.S head/sys/mips/mips/support.S head/sys/mips/mips/swtch.S head/sys/mips/nlm/mpreset.S head/sys/modules/dtrace/dtrace/Makefile head/sys/modules/hyperv/vmbus/Makefile head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile head/sys/modules/sgx/Makefile head/sys/powerpc/aim/locore32.S head/sys/powerpc/aim/locore64.S head/sys/powerpc/booke/locore.S head/sys/powerpc/powerpc/cpu_subr64.S head/sys/powerpc/powerpc/sigcode32.S head/sys/powerpc/powerpc/sigcode64.S head/sys/powerpc/powerpc/swtch32.S head/sys/powerpc/powerpc/swtch64.S head/sys/riscv/riscv/copyinout.S head/sys/riscv/riscv/exception.S head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/support.S head/sys/riscv/riscv/swtch.S head/sys/sparc64/sparc64/exception.S head/sys/sparc64/sparc64/interrupt.S head/sys/sparc64/sparc64/locore.S head/sys/sparc64/sparc64/mp_exception.S head/sys/sparc64/sparc64/mp_locore.S head/sys/sparc64/sparc64/support.S head/sys/sparc64/sparc64/swtch.S Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/acpica/acpi_wakecode.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Resume entry point for real mode. Modified: head/sys/amd64/amd64/apic_vector.S ============================================================================== --- head/sys/amd64/amd64/apic_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/apic_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -44,7 +44,7 @@ #include "opt_smp.h" -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/amd64/amd64/atpic_vector.S ============================================================================== --- head/sys/amd64/amd64/atpic_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/atpic_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ * master and slave interrupt controllers. */ -#include "assym.s" +#include "assym.inc" #include /* Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/cpu_switch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" /*****************************************************************************/ Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ #include "opt_compat.h" #include "opt_hwpmc_hooks.h" -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/amd64/amd64/locore.S ============================================================================== --- head/sys/amd64/amd64/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Compiled KERNBASE location Modified: head/sys/amd64/amd64/mpboot.S ============================================================================== --- head/sys/amd64/amd64/mpboot.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/mpboot.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include /* miscellaneous asm macros */ #include -#include "assym.s" +#include "assym.inc" .data /* So we can modify it */ Modified: head/sys/amd64/amd64/sigtramp.S ============================================================================== --- head/sys/amd64/amd64/sigtramp.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/sigtramp.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ #include -#include "assym.s" +#include "assym.inc" .text /********************************************************************** Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text Modified: head/sys/amd64/amd64/xen-locore.S ============================================================================== --- head/sys/amd64/amd64/xen-locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/xen-locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -40,7 +40,7 @@ #define __ASSEMBLY__ #include -#include "assym.s" +#include "assym.inc" .section __xen_guest ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "FreeBSD") Modified: head/sys/amd64/ia32/ia32_exception.S ============================================================================== --- head/sys/amd64/ia32/ia32_exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/ia32/ia32_exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -28,7 +28,7 @@ #include -#include "assym.s" +#include "assym.inc" .text /* Modified: head/sys/amd64/linux/linux_support.s ============================================================================== --- head/sys/amd64/linux/linux_support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/linux/linux_support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include "linux_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ -#include "assym.s" +#include "assym.inc" futex_fault: movq $0,PCB_ONFAULT(%r8) Modified: head/sys/amd64/linux32/linux32_support.s ============================================================================== --- head/sys/amd64/linux32/linux32_support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/linux32/linux32_support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include "linux32_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ -#include "assym.s" +#include "assym.inc" futex_fault: movq $0,PCB_ONFAULT(%r8) Modified: head/sys/amd64/sgx/sgx_support.S ============================================================================== --- head/sys/amd64/sgx/sgx_support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/sgx/sgx_support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text Modified: head/sys/arm/arm/bcopy_page.S ============================================================================== --- head/sys/arm/arm/bcopy_page.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/bcopy_page.S Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" #ifndef _ARM_ARCH_5E Modified: head/sys/arm/arm/bcopyinout.S ============================================================================== --- head/sys/arm/arm/bcopyinout.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/bcopyinout.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm/arm/copystr.S ============================================================================== --- head/sys/arm/arm/copystr.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/copystr.S Tue Mar 20 17:58:51 2018 (r331254) @@ -38,7 +38,7 @@ * Created : 16/05/95 */ -#include "assym.s" +#include "assym.inc" #include #include __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpu_asm-v6.S ============================================================================== --- head/sys/arm/arm/cpu_asm-v6.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/cpu_asm-v6.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm/arm/exception.S ============================================================================== --- head/sys/arm/arm/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -46,7 +46,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/fusu.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" __FBSDID("$FreeBSD$"); .syntax unified Modified: head/sys/arm/arm/hypervisor-stub.S ============================================================================== --- head/sys/arm/arm/hypervisor-stub.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/hypervisor-stub.S Tue Mar 20 17:58:51 2018 (r331254) @@ -24,7 +24,7 @@ * SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include #include #include Modified: head/sys/arm/arm/in_cksum_arm.S ============================================================================== --- head/sys/arm/arm/in_cksum_arm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/in_cksum_arm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -43,7 +43,7 @@ #include "opt_inet.h" #include -#include "assym.s" +#include "assym.inc" __FBSDID("$FreeBSD$"); .syntax unified Modified: head/sys/arm/arm/locore-v4.S ============================================================================== --- head/sys/arm/arm/locore-v4.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/locore-v4.S Tue Mar 20 17:58:51 2018 (r331254) @@ -33,7 +33,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include #include #include Modified: head/sys/arm/arm/locore-v6.S ============================================================================== --- head/sys/arm/arm/locore-v6.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/locore-v6.S Tue Mar 20 17:58:51 2018 (r331254) @@ -28,7 +28,7 @@ * SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include #include #include @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); -/* We map 64MB of kernel unless overridden in assym.s by the kernel option. */ +/* We map 64MB of kernel unless overridden in assym.inc by the kernel option. */ #ifndef LOCORE_MAP_MB #define LOCORE_MAP_MB 64 #endif Modified: head/sys/arm/arm/support.S ============================================================================== --- head/sys/arm/arm/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -89,7 +89,7 @@ #include __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" .syntax unified Modified: head/sys/arm/arm/swtch-v4.S ============================================================================== --- head/sys/arm/arm/swtch-v4.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/swtch-v4.S Tue Mar 20 17:58:51 2018 (r331254) @@ -78,7 +78,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/arm/arm/swtch-v6.S ============================================================================== --- head/sys/arm/arm/swtch-v6.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/swtch-v6.S Tue Mar 20 17:58:51 2018 (r331254) @@ -78,7 +78,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/arm/arm/swtch.S ============================================================================== --- head/sys/arm/arm/swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -78,7 +78,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm64/arm64/bzero.S ============================================================================== --- head/sys/arm64/arm64/bzero.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/bzero.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" /* * void bzero(void *p, size_t size) Modified: head/sys/arm64/arm64/copyinout.S ============================================================================== --- head/sys/arm64/arm64/copyinout.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/copyinout.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include -#include "assym.s" +#include "assym.inc" /* * Fault handler for the copy{in,out} functions below. Modified: head/sys/arm64/arm64/exception.S ============================================================================== --- head/sys/arm64/arm64/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" .text Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include "opt_kstack_pages.h" #include #include Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "assym.s" +#include "assym.inc" /* * One of the fu* or su* functions failed, return -1. Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include "opt_kstack_pages.h" #include "opt_sched.h" Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* void dtrace_membar_producer(void) Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define INTR_POP \ MEXITCOUNT; \ Modified: head/sys/cddl/dev/dtrace/arm/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/arm/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/arm/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* void dtrace_membar_producer(void) Modified: head/sys/cddl/dev/dtrace/i386/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/i386/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -32,7 +32,7 @@ #include #include -#include "assym.s" +#include "assym.inc" ENTRY(dtrace_invop_start) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -28,7 +28,7 @@ * Use is subject to license terms. */ -#include "assym.s" +#include "assym.inc" #define _ASM Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -37,7 +37,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* void dtrace_membar_producer(void) Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/files.amd64 Tue Mar 20 17:58:51 2018 (r331254) @@ -105,7 +105,7 @@ hptrr_lib.o optional hptrr \ # amd64/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ - dependency "$S/amd64/acpica/acpi_wakecode.S assym.s" \ + dependency "$S/amd64/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ no-obj no-implicit-rule before-depend \ clean "acpi_wakecode.o" Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/files.i386 Tue Mar 20 17:58:51 2018 (r331254) @@ -443,7 +443,7 @@ dev/isci/scil/scif_sas_task_request_states.c optiona dev/isci/scil/scif_sas_timer.c optional isci i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ - dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ + dependency "$S/i386/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ no-obj no-implicit-rule before-depend \ clean "acpi_wakecode.o" Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/kern.post.mk Tue Mar 20 17:58:51 2018 (r331254) @@ -155,7 +155,7 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o .endif ${SYSTEM_LD_TAIL} -OBJS_DEPEND_GUESS+= assym.s vnode_if.h ${BEFORE_DEPEND:M*.h} \ +OBJS_DEPEND_GUESS+= assym.inc vnode_if.h ${BEFORE_DEPEND:M*.h} \ ${MFILES:T:S/.m$/.h/} .for mfile in ${MFILES} @@ -184,7 +184,7 @@ hack.pico: Makefile ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.pico rm -f hack.c -assym.s: $S/kern/genassym.sh genassym.o +assym.inc: $S/kern/genassym.sh genassym.o NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genassym.sh genassym.o > ${.TARGET} genassym.o: $S/$M/$M/genassym.c @@ -212,7 +212,7 @@ _SKIP_DEPEND= 1 .endif kernel-depend: .depend -SRCS= assym.s vnode_if.h ${BEFORE_DEPEND} ${CFILES} \ +SRCS= assym.inc vnode_if.h ${BEFORE_DEPEND} ${CFILES} \ ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \ ${MFILES:T:S/.m$/.h/} DEPENDOBJS+= ${SYSTEM_OBJS} genassym.o Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/kmod.mk Tue Mar 20 17:58:51 2018 (r331254) @@ -454,14 +454,14 @@ acpi_quirks.h: ${SYSDIR}/tools/acpi_quirks2h.awk ${SYS ${AWK} -f ${SYSDIR}/tools/acpi_quirks2h.awk ${SYSDIR}/dev/acpica/acpi_quirks .endif -.if !empty(SRCS:Massym.s) || !empty(DPSRCS:Massym.s) -CLEANFILES+= assym.s genassym.o +.if !empty(SRCS:Massym.inc) || !empty(DPSRCS:Massym.inc) +CLEANFILES+= assym.inc genassym.o DEPENDOBJS+= genassym.o -assym.s: genassym.o +assym.inc: genassym.o .if defined(KERNBUILDDIR) genassym.o: opt_global.h .endif -assym.s: ${SYSDIR}/kern/genassym.sh +assym.inc: ${SYSDIR}/kern/genassym.sh sh ${SYSDIR}/kern/genassym.sh genassym.o > ${.TARGET} genassym.o: ${SYSDIR}/${MACHINE}/${MACHINE}/genassym.c genassym.o: ${SRCS:Mopt_*.h} Modified: head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S ============================================================================== --- head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S ============================================================================== --- head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * This is the Hyper-V vmbus channel direct callback interrupt. Modified: head/sys/i386/acpica/acpi_wakecode.S ============================================================================== --- head/sys/i386/acpica/acpi_wakecode.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/acpica/acpi_wakecode.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Resume entry point. The BIOS enters here in real mode after POST with Modified: head/sys/i386/i386/apic_vector.s ============================================================================== --- head/sys/i386/i386/apic_vector.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/apic_vector.s Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text SUPERALIGN_TEXT Modified: head/sys/i386/i386/atpic_vector.s ============================================================================== --- head/sys/i386/i386/atpic_vector.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/atpic_vector.s Tue Mar 20 17:58:51 2018 (r331254) @@ -38,7 +38,7 @@ #include -#include "assym.s" +#include "assym.inc" /* * Macros for interrupt entry, call to handler, and exit. Modified: head/sys/i386/i386/bioscall.s ============================================================================== --- head/sys/i386/i386/bioscall.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/bioscall.s Tue Mar 20 17:58:51 2018 (r331254) @@ -32,7 +32,7 @@ #include -#include "assym.s" +#include "assym.inc" .data ALIGN_DATA Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/exception.s Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ #include #include -#include "assym.s" +#include "assym.inc #define SEL_RPL_MASK 0x0003 #define GSEL_KPL 0x0020 /* GSEL(GCODE_SEL, SEL_KPL) */ Modified: head/sys/i386/i386/locore.s ============================================================================== --- head/sys/i386/i386/locore.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/locore.s Tue Mar 20 17:58:51 2018 (r331254) @@ -52,7 +52,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * XXX Modified: head/sys/i386/i386/mpboot.s ============================================================================== --- head/sys/i386/i386/mpboot.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/mpboot.s Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define R(x) ((x)-KERNBASE) Modified: head/sys/i386/i386/sigtramp.s ============================================================================== --- head/sys/i386/i386/sigtramp.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/sigtramp.s Tue Mar 20 17:58:51 2018 (r331254) @@ -45,7 +45,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Signal trampoline, copied to top of user stack Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define IDXSHIFT 10 Modified: head/sys/i386/i386/swtch.s ============================================================================== --- head/sys/i386/i386/swtch.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/swtch.s Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ #include -#include "assym.s" +#include "assym.inc" #if defined(SMP) && defined(SCHED_ULE) #define SETOP xchgl Modified: head/sys/i386/i386/vm86bios.s ============================================================================== --- head/sys/i386/i386/vm86bios.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/vm86bios.s Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include /* miscellaneous asm macros */ #include -#include "assym.s" +#include "assym.inc" #define SCR_NEWPTD PCB_ESI /* readability macros */ #define SCR_VMFRAME PCB_EBP /* see vm86.c for explanation */ Modified: head/sys/i386/linux/linux_locore.s ============================================================================== --- head/sys/i386/linux/linux_locore.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/linux/linux_locore.s Tue Mar 20 17:58:51 2018 (r331254) @@ -5,7 +5,7 @@ #include /* system call numbers */ -#include "assym.s" +#include "assym.inc" /* * To avoid excess stack frame the signal trampoline code emulates Modified: head/sys/i386/linux/linux_support.s ============================================================================== --- head/sys/i386/linux/linux_support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/linux/linux_support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include "linux_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ -#include "assym.s" +#include "assym.inc" futex_fault_decx: movl PCPU(CURPCB),%ecx Modified: head/sys/mips/cavium/octeon_cop2.S ============================================================================== --- head/sys/mips/cavium/octeon_cop2.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/cavium/octeon_cop2.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder Modified: head/sys/mips/ingenic/jz4780_mpboot.S ============================================================================== --- head/sys/mips/ingenic/jz4780_mpboot.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/ingenic/jz4780_mpboot.S Tue Mar 20 17:58:51 2018 (r331254) @@ -27,7 +27,7 @@ */ #include -#include "assym.s" +#include "assym.inc" .text .set noat Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -63,7 +63,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder # Noreorder is default style! Modified: head/sys/mips/mips/fp.S ============================================================================== --- head/sys/mips/mips/fp.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/fp.S Tue Mar 20 17:58:51 2018 (r331254) @@ -43,7 +43,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define SEXP_INF 0xff #define DEXP_INF 0x7ff Modified: head/sys/mips/mips/locore.S ============================================================================== --- head/sys/mips/mips/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -70,7 +70,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .data #ifdef YAMON Modified: head/sys/mips/mips/mpboot.S ============================================================================== --- head/sys/mips/mips/mpboot.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/mpboot.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text .set noat Modified: head/sys/mips/mips/octeon_cop2_swtch.S ============================================================================== --- head/sys/mips/mips/octeon_cop2_swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/octeon_cop2_swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder Modified: head/sys/mips/mips/support.S ============================================================================== --- head/sys/mips/mips/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -94,7 +94,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder # Noreorder is default style! Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -64,7 +64,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder # Noreorder is default style! Modified: head/sys/mips/nlm/mpreset.S ============================================================================== --- head/sys/mips/nlm/mpreset.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/nlm/mpreset.S Tue Mar 20 17:58:51 2018 (r331254) @@ -38,7 +38,7 @@ #define SYS_REG_KSEG1(node, reg) (0xa0000000 + XLP_DEFAULT_IO_BASE + \ XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + (reg) * 4) -#include "assym.s" +#include "assym.inc" .text .set noat Modified: head/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- head/sys/modules/dtrace/dtrace/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/dtrace/dtrace/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -27,9 +27,9 @@ CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/inte SRCS+= bus_if.h device_if.h vnode_if.h # Needed for dtrace_asm.S -DPSRCS+= assym.s +DPSRCS+= assym.inc -# These are needed for assym.s +# These are needed for assym.inc SRCS+= opt_compat.h opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h #This is needed for dtrace.c @@ -53,7 +53,7 @@ EXPORT_SYMS= dtrace_register \ dtrace_unregister \ dtrace_probe_lookup -dtrace_asm.o: assym.s +dtrace_asm.o: assym.inc .include Modified: head/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- head/sys/modules/hyperv/vmbus/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/hyperv/vmbus/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -17,13 +17,13 @@ SRCS= hyperv.c \ vmbus_xact.c SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h pci_if.h pcib_if.h vmbus_if.h -# XXX: for assym.s +# XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h opt_compat.h .if ${MACHINE_CPUARCH} == "i386" SRCS+= opt_apic.h .endif -DPSRCS+= assym.s +DPSRCS= assym.inc vmbus_vector.o: ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/linux/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -19,9 +19,9 @@ SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c li opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \ device_if.h bus_if.h \ linux${SFX}_support.s -DPSRCS= assym.s linux${SFX}_genassym.c +DPSRCS= assym.inc linux${SFX}_genassym.c -# XXX: for assym.s +# XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_compat.h opt_hwpmc_hooks.h .if ${MACHINE_CPUARCH} == "i386" SRCS+= opt_apic.h @@ -48,7 +48,7 @@ CLEANFILES= linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} -linux${SFX}_locore.o: linux${SFX}_assym.h assym.s +linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc ${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s \ -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc -nostdlib \ -fno-omit-frame-pointer -fPIC \ @@ -56,7 +56,7 @@ linux${SFX}_locore.o: linux${SFX}_assym.h assym.s -Wl,-soname=${VDSO}.so.1,--eh-frame-hdr,-warn-common \ ${.IMPSRC} -o ${.TARGET} -linux${SFX}_support.o: linux${SFX}_assym.h assym.s +linux${SFX}_support.o: linux${SFX}_assym.h assym.inc ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ ${.IMPSRC} -o ${.TARGET} Modified: head/sys/modules/linux64/Makefile ============================================================================== --- head/sys/modules/linux64/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/linux64/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -13,9 +13,9 @@ SRCS= linux_fork.c linux_dummy.c linux_file.c linux_ev opt_inet6.h opt_compat.h opt_posix.h opt_usb.h \ vnode_if.h device_if.h bus_if.h \ linux_support.s -DPSRCS= assym.s linux_genassym.c +DPSRCS= assym.inc linux_genassym.c -# XXX: for assym.s +# XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h .if ${MACHINE_CPUARCH} == "i386" SRCS+= opt_apic.h @@ -40,7 +40,7 @@ ${VDSO}.so: linux_locore.o -S -g --binary-architecture i386:x86-64 linux_locore.o ${.TARGET} strip -N _binary_linux_locore_o_size ${.TARGET} -linux_support.o: assym.s linux_assym.h +linux_support.o: assym.inc linux_assym.h ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ ${.IMPSRC} -o ${.TARGET} Modified: head/sys/modules/sgx/Makefile ============================================================================== --- head/sys/modules/sgx/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/sgx/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -5,9 +5,9 @@ KMOD= sgx SRCS= sgx.c sgxvar.h sgx_support.S SRCS+= opt_compat.h opt_hwpmc_hooks.h opt_kstack_pages.h -DPSRCS= assym.s +DPSRCS= assym.inc -sgx_support.o: assym.s +sgx_support.o: assym.inc ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ ${.IMPSRC} -o ${.TARGET} Modified: head/sys/powerpc/aim/locore32.S ============================================================================== --- head/sys/powerpc/aim/locore32.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/aim/locore32.S Tue Mar 20 17:58:51 2018 (r331254) @@ -25,7 +25,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/aim/locore64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -27,7 +27,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/booke/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include "opt_hwpmc_hooks.h" Modified: head/sys/powerpc/powerpc/cpu_subr64.S ============================================================================== --- head/sys/powerpc/powerpc/cpu_subr64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/cpu_subr64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -27,7 +27,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include Modified: head/sys/powerpc/powerpc/sigcode32.S ============================================================================== --- head/sys/powerpc/powerpc/sigcode32.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/sigcode32.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * The following code gets copied to the top of the user stack on process Modified: head/sys/powerpc/powerpc/sigcode64.S ============================================================================== --- head/sys/powerpc/powerpc/sigcode64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/sigcode64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * The following code gets copied to the top of the user stack on process Modified: head/sys/powerpc/powerpc/swtch32.S ============================================================================== --- head/sys/powerpc/powerpc/swtch32.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/swtch32.S Tue Mar 20 17:58:51 2018 (r331254) @@ -56,7 +56,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/powerpc/powerpc/swtch64.S ============================================================================== --- head/sys/powerpc/powerpc/swtch64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/swtch64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -56,7 +56,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/riscv/riscv/copyinout.S ============================================================================== --- head/sys/riscv/riscv/copyinout.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/riscv/riscv/copyinout.S Tue Mar 20 17:58:51 2018 (r331254) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Mar 20 18:02:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03E2EF61AA3; Tue, 20 Mar 2018 18:02:21 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7A467F930; Tue, 20 Mar 2018 18:02:21 +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 A2A512011F; Tue, 20 Mar 2018 18:02:21 +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 w2KI2LOT064962; Tue, 20 Mar 2018 18:02:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KI2L5o064961; Tue, 20 Mar 2018 18:02:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803201802.w2KI2L5o064961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 18:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331255 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 18:02:22 -0000 Author: emaste Date: Tue Mar 20 18:02:21 2018 New Revision: 331255 URL: https://svnweb.freebsd.org/changeset/base/331255 Log: Remove stale generated assym.s files after r331254 So that -DNO_CLEAN builds work. This should be reverted after a sufficient transition period (perhaps 3 or 6 months). Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Mar 20 17:58:51 2018 (r331254) +++ head/Makefile.inc1 Tue Mar 20 18:02:21 2018 (r331255) @@ -1394,6 +1394,14 @@ INSTALLKERNEL= ${_kernel} .endif .endfor +_cleankernobj_fast_depend_hack: .PHONY +# 20170202 remove stale generated assym.s after renaming to .inc in r331254 +.if exists(${OBJTOP}/sys/${KERNCONF}/assym.s) + @echo Removing stale generated assym files + @rm -f ${OBJTOP}/sys/${KERNCONF}/assym.* \ + ${OBJTOP}/sys/${KERNCONF}/.depend.assym.* +.endif + ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY # @@ -1429,6 +1437,8 @@ buildkernel: .MAKE .PHONY @echo ">>> stage 2.1: cleaning up the object tree" @echo "--------------------------------------------------------------" ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} +.else + ${_+_}cd ${.CURDIR}; ${WMAKE} _cleankernobj_fast_depend_hack .endif .if !defined(NO_KERNELOBJ) @echo From owner-svn-src-all@freebsd.org Tue Mar 20 19:28:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7614BF67A1D; Tue, 20 Mar 2018 19:28:53 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16B98833B7; Tue, 20 Mar 2018 19:28:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0464520EF1; Tue, 20 Mar 2018 19:28:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KJSqTM006655; Tue, 20 Mar 2018 19:28:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KJSqe3006654; Tue, 20 Mar 2018 19:28:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803201928.w2KJSqe3006654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 19:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331256 - head/sys/amd64/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/amd64/linux X-SVN-Commit-Revision: 331256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 19:28:53 -0000 Author: emaste Date: Tue Mar 20 19:28:52 2018 New Revision: 331256 URL: https://svnweb.freebsd.org/changeset/base/331256 Log: Make linuxulator fn declaration match definition I accidentally swapped 'linux_fixup_elf' to 'linux_elf_fixup' in amd64's declaration (only), while bringing this change over from git and encountering a conflict. Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue Mar 20 18:02:21 2018 (r331255) +++ head/sys/amd64/linux/linux_sysvec.c Tue Mar 20 19:28:52 2018 (r331256) @@ -119,7 +119,7 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static register_t * linux_copyout_strings(struct image_params *imgp); -static int linux_elf_fixup(register_t **stack_base, +static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); From owner-svn-src-all@freebsd.org Tue Mar 20 20:05:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85277F69EB2; Tue, 20 Mar 2018 20:05: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32A0384760; Tue, 20 Mar 2018 20:05: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 2A13A214F0; Tue, 20 Mar 2018 20:05: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 w2KK5C9P026173; Tue, 20 Mar 2018 20:05:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KK5CFl026172; Tue, 20 Mar 2018 20:05:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803202005.w2KK5CFl026172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 20:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331257 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:05:12 -0000 Author: kevans Date: Tue Mar 20 20:05:11 2018 New Revision: 331257 URL: https://svnweb.freebsd.org/changeset/base/331257 Log: lualoader: Reset attributes and color scheme with color.highlight() Previously, we sent a CSI 0m sequence to reset attributes, which also reset the color scheme if the terminal defaults didn't match what we're expecting. Go all-in and reset the color scheme, too, just in case. Reported by: emaste Modified: head/stand/lua/color.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Tue Mar 20 19:28:52 2018 (r331256) +++ head/stand/lua/color.lua Tue Mar 20 20:05:11 2018 (r331257) @@ -96,7 +96,9 @@ function color.highlight(str) if color.disabled then return str end - return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "0m" + -- We need to reset attributes as well as color scheme here, just in + -- case the terminal defaults don't match what we're expecting. + return core.KEYSTR_CSI .. "1m" .. str .. color.default() end return color From owner-svn-src-all@freebsd.org Tue Mar 20 20:10:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 485B2F6A50F; Tue, 20 Mar 2018 20:10:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id B431584C47; Tue, 20 Mar 2018 20:10:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 092233C7A04; Wed, 21 Mar 2018 06:53:33 +1100 (AEDT) Date: Wed, 21 Mar 2018 06:53:32 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux In-Reply-To: Message-ID: <20180321064039.L4104@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> <20180320183744.S950@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=1uFwktCMVjhwZNqsXxYA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:10:55 -0000 On Tue, 20 Mar 2018, Ed Maste wrote: > On 20 March 2018 at 04:19, Bruce Evans wrote: >> >> It is preferable to have a well-chosen (short...) prefix. The linux >> emulator mostly uses l_ for internal names. That is a bit too short >> for external names. > > l_ is too short. The only reasonable alternative is probably lnx_ but > saving two characters seems does not seem worth it. lx_ is reasonable. /sys currently has 1321 lines matching lx_ and 0 lines matching '[^A-Za-z_]lx_', but 865 lines matching lnx_ (mostly for qlnxe(4)). Bruce From owner-svn-src-all@freebsd.org Tue Mar 20 20:15:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEC9CF6AC8F; Tue, 20 Mar 2018 20:15:55 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.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 4D49B852C4; Tue, 20 Mar 2018 20:15:55 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [74.217.198.10] (port=62242 helo=[10.1.4.66]) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1eyLTY-000Nnx-3L; Tue, 20 Mar 2018 17:55:08 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r331257 - head/stand/lua From: Devin Teske In-Reply-To: <201803202005.w2KK5CFl026172@repo.freebsd.org> Date: Tue, 20 Mar 2018 13:15:46 -0700 Cc: Devin Teske , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201803202005.w2KK5CFl026172@repo.freebsd.org> To: Kyle Evans X-Mailer: Apple Mail (2.3273) Sender: devin@shxd.cx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:15:55 -0000 > On Mar 20, 2018, at 1:05 PM, Kyle Evans wrote: >=20 > Author: kevans > Date: Tue Mar 20 20:05:11 2018 > New Revision: 331257 > URL: https://svnweb.freebsd.org/changeset/base/331257 >=20 > Log: > lualoader: Reset attributes and color scheme with color.highlight() >=20 > Previously, we sent a CSI 0m sequence to reset attributes, which also = reset > the color scheme if the terminal defaults didn't match what we're = expecting. > Go all-in and reset the color scheme, too, just in case. >=20 > Reported by: emaste >=20 > Modified: > head/stand/lua/color.lua >=20 > Modified: head/stand/lua/color.lua > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/lua/color.lua Tue Mar 20 19:28:52 2018 = (r331256) > +++ head/stand/lua/color.lua Tue Mar 20 20:05:11 2018 = (r331257) > @@ -96,7 +96,9 @@ function color.highlight(str) > if color.disabled then > return str > end > - return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "0m" > + -- We need to reset attributes as well as color scheme here, = just in > + -- case the terminal defaults don't match what we're expecting. > + return core.KEYSTR_CSI .. "1m" .. str .. color.default() > end >=20 > return color >=20 You should CSI 22m to terminate CSI 1m The corresponding terminators for common effects: CSI 1m ... CSI 22m CSI 2m ... CSI 22m CSI 4m ... CSI 24m CSI 5m ... CSI 25m CSI 7m ... CSI 27m CSI 8m ... CSI 28m CSI (30-37)m ... CSI 39m CSI (40-47)m ... CSI 49m --=20 Devin= From owner-svn-src-all@freebsd.org Tue Mar 20 20:20:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF7DFF6B38A; Tue, 20 Mar 2018 20:20:50 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DE6885846; Tue, 20 Mar 2018 20:20:50 +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 98BE221688; Tue, 20 Mar 2018 20:20:50 +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 w2KKKo46033744; Tue, 20 Mar 2018 20:20:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KKKo7Y033740; Tue, 20 Mar 2018 20:20:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803202020.w2KKKo7Y033740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 20:20:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331258 - in head/sys: amd64/amd64 amd64/include x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include x86/include x86/x86 X-SVN-Commit-Revision: 331258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:20:51 -0000 Author: kib Date: Tue Mar 20 20:20:49 2018 New Revision: 331258 URL: https://svnweb.freebsd.org/changeset/base/331258 Log: Move the CR0.WP manipulation KPI to x86. This should allow to avoid some #ifdefs in the common x86/ code. Requested by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/include/md_var.h head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/amd64/amd64/machdep.c Tue Mar 20 20:20:49 2018 (r331258) @@ -2597,31 +2597,6 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags) : "cc", "memory"); } -/* - * Enable and restore kernel text write permissions. - * Callers must ensure that disable_wp()/restore_wp() are executed - * without rescheduling on the same core. - */ -bool -disable_wp(void) -{ - u_int cr0; - - cr0 = rcr0(); - if ((cr0 & CR0_WP) == 0) - return (false); - load_cr0(cr0 & ~CR0_WP); - return (true); -} - -void -restore_wp(bool old_wp) -{ - - if (old_wp) - load_cr0(rcr0() | CR0_WP); -} - #ifdef KDB /* Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/amd64/include/md_var.h Tue Mar 20 20:20:49 2018 (r331258) @@ -53,8 +53,6 @@ void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_lower_shared_page(struct sysentvec *); void amd64_syscall(struct thread *td, int traced); -bool disable_wp(void); -void restore_wp(bool old_wp); void doreti_iret(void) __asm(__STRING(doreti_iret)); void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); void ld_ds(void) __asm(__STRING(ld_ds)); Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/x86/include/x86_var.h Tue Mar 20 20:20:49 2018 (r331258) @@ -119,6 +119,8 @@ void busdma_swi(void); bool cpu_mwait_usable(void); void cpu_probe_amdc1e(void); void cpu_setregs(void); +bool disable_wp(void); +void restore_wp(bool old_wp); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); void finishidentcpu(void); Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/x86/x86/cpu_machdep.c Tue Mar 20 20:20:49 2018 (r331258) @@ -621,3 +621,29 @@ hw_ibrs_disable_handler(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I", "Disable Indirect Branch Restricted Speculation"); + +/* + * Enable and restore kernel text write permissions. + * Callers must ensure that disable_wp()/restore_wp() are executed + * without rescheduling on the same core. + */ +bool +disable_wp(void) +{ + u_int cr0; + + cr0 = rcr0(); + if ((cr0 & CR0_WP) == 0) + return (false); + load_cr0(cr0 & ~CR0_WP); + return (true); +} + +void +restore_wp(bool old_wp) +{ + + if (old_wp) + load_cr0(rcr0() | CR0_WP); +} + From owner-svn-src-all@freebsd.org Tue Mar 20 20:26:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86F88F6BA4A; Tue, 20 Mar 2018 20:26:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C1A585E6B; Tue, 20 Mar 2018 20:26:25 +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 1C65021808; Tue, 20 Mar 2018 20:26:25 +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 w2KKQOGZ036473; Tue, 20 Mar 2018 20:26:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KKQOP2036471; Tue, 20 Mar 2018 20:26:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803202026.w2KKQOP2036471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 20:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331259 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:26:25 -0000 Author: kevans Date: Tue Mar 20 20:26:24 2018 New Revision: 331259 URL: https://svnweb.freebsd.org/changeset/base/331259 Log: lualoader: Use less atomic options for resetting colors/attributes Noted by dteske: CSI 1m ... CSI 22m CSI 2m ... CSI 22m CSI 4m ... CSI 24m CSI 5m ... CSI 25m CSI 7m ... CSI 27m CSI 8m ... CSI 28m CSI (30-37)m ... CSI 39m CSI (40-47)m ... CSI 49m - Provide resetf/resetb to match escapef/escapeb - Use CSI 22m to undo a bold This is a more reasonable approach than what was previously taken. Reported by: dteske Modified: head/stand/lua/color.lua head/stand/lua/menu.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Tue Mar 20 20:20:49 2018 (r331258) +++ head/stand/lua/color.lua Tue Mar 20 20:26:24 2018 (r331259) @@ -65,6 +65,13 @@ function color.escapef(color_value) return core.KEYSTR_CSI .. "3" .. color_value .. "m" end +function color.resetf() + if color.disabled then + return '' + end + return core.KEYSTR_CSI .. "39m" +end + function color.escapeb(color_value) if color.disabled then return color_value @@ -72,6 +79,13 @@ function color.escapeb(color_value) return core.KEYSTR_CSI .. "4" .. color_value .. "m" end +function color.resetb() + if color.disabled then + return '' + end + return core.KEYSTR_CSI .. "49m" +end + function color.escape(fg_color, bg_color, attribute) if color.disabled then return "" @@ -98,7 +112,7 @@ function color.highlight(str) end -- We need to reset attributes as well as color scheme here, just in -- case the terminal defaults don't match what we're expecting. - return core.KEYSTR_CSI .. "1m" .. str .. color.default() + return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end return color Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Mar 20 20:20:49 2018 (r331258) +++ head/stand/lua/menu.lua Tue Mar 20 20:26:24 2018 (r331259) @@ -120,7 +120,7 @@ menu.boot_environments = { name_color = color.escapef(color.BLUE) end bootenv_name = bootenv_name .. name_color .. - choice .. color.default() + choice .. color.resetf() return color.highlight("A").."ctive: " .. bootenv_name .. " (" .. idx .. " of " .. #all_choices .. ")" @@ -306,7 +306,7 @@ menu.welcome = { name_color = color.escapef(color.BLUE) end kernel_name = kernel_name .. name_color .. - choice .. color.default() + choice .. color.resetf() return color.highlight("K") .. "ernel: " .. kernel_name .. " (" .. idx .. " of " .. #all_choices .. ")" From owner-svn-src-all@freebsd.org Tue Mar 20 20:28:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26072F6BD1B; Tue, 20 Mar 2018 20:28:49 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E134860DC; Tue, 20 Mar 2018 20:28:48 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f50.google.com with SMTP id z143-v6so4603591lff.3; Tue, 20 Mar 2018 13:28:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JYWby4RW8scqS1cJmu6Ofvy1RtBeXHP8kaI6yFcUpMI=; b=r8u6WekeHdaT6PxBSg4NhFjdcotdDJ1E8jvMp6ZjWEkSGldmbW5EOpf57fqfe8cwV8 SDwyqiiCCk2yCJqG6+mf+tdA819HDzFaQM7aUMlb1X+E9UvGv82i7xjQtHxeQSktYR4x C289gXVQEF4Bd4FoXrPCPfDujU4nC8v4KuWlIuZGK/kIdejjXcR0jEhbZUztQTJ4Ab0a i784nQk45iGyH/jegNa3xka/KTdl0OJKR1NfvBb8Z80bOC0LkoTiet0igTWktDaOzGOH 59bBFYzGn166nyHz+iyqmwmbfvPhM2R1IC/sysfCabhkvayuBpj2EZ9hn/UcS2iSlucR /MtQ== X-Gm-Message-State: AElRT7GY8/ta513brIFq5ByZJtCIVC/YWMggGUJpcyKZuvu0Q3GrRhiV IIFP2HQauhQjHUDW1eO0UZukIapw X-Google-Smtp-Source: AG47ELuebvO/Ss+4x/NL5/3wcg92fuG74+IpjdWrLlN6Dwa0WG7YqNTJSoJgjaChrk1LG6EzYI42ow== X-Received: by 10.46.137.203 with SMTP id c11mr12210769ljk.61.1521577721134; Tue, 20 Mar 2018 13:28:41 -0700 (PDT) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by smtp.gmail.com with ESMTPSA id b67-v6sm632146lfh.26.2018.03.20.13.28.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 13:28:41 -0700 (PDT) Received: by mail-lf0-f50.google.com with SMTP id e5-v6so4586426lfb.7; Tue, 20 Mar 2018 13:28:41 -0700 (PDT) X-Received: by 2002:a19:c4c8:: with SMTP id u191-v6mr12599716lff.109.1521577720852; Tue, 20 Mar 2018 13:28:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Tue, 20 Mar 2018 13:28:19 -0700 (PDT) In-Reply-To: References: <201803202005.w2KK5CFl026172@repo.freebsd.org> From: Kyle Evans Date: Tue, 20 Mar 2018 15:28:19 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331257 - head/stand/lua To: Devin Teske Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:28:49 -0000 On Tue, Mar 20, 2018 at 3:15 PM, Devin Teske wrote: > >> On Mar 20, 2018, at 1:05 PM, Kyle Evans wrote: >> >> Author: kevans >> Date: Tue Mar 20 20:05:11 2018 >> New Revision: 331257 >> URL: https://svnweb.freebsd.org/changeset/base/331257 >> >> Log: >> lualoader: Reset attributes and color scheme with color.highlight() >> >> Previously, we sent a CSI 0m sequence to reset attributes, which also reset >> the color scheme if the terminal defaults didn't match what we're expecting. >> Go all-in and reset the color scheme, too, just in case. >> >> Reported by: emaste >> >> Modified: >> head/stand/lua/color.lua >> >> Modified: head/stand/lua/color.lua >> ============================================================================== >> --- head/stand/lua/color.lua Tue Mar 20 19:28:52 2018 (r331256) >> +++ head/stand/lua/color.lua Tue Mar 20 20:05:11 2018 (r331257) >> @@ -96,7 +96,9 @@ function color.highlight(str) >> if color.disabled then >> return str >> end >> - return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "0m" >> + -- We need to reset attributes as well as color scheme here, just in >> + -- case the terminal defaults don't match what we're expecting. >> + return core.KEYSTR_CSI .. "1m" .. str .. color.default() >> end >> >> return color >> > > You should CSI 22m to terminate CSI 1m > > The corresponding terminators for common effects: > > CSI 1m ... CSI 22m > CSI 2m ... CSI 22m > CSI 4m ... CSI 24m > CSI 5m ... CSI 25m > CSI 7m ... CSI 27m > CSI 8m ... CSI 28m > CSI (30-37)m ... CSI 39m > CSI (40-47)m ... CSI 49m Thanks! Fixed, with this map written in blood, in r331259. =) We had a couple of other instances where we went for the 'reset everything' approach rather than the more polite terminators. From owner-svn-src-all@freebsd.org Tue Mar 20 20:45:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 749BFF424B3; Tue, 20 Mar 2018 20:45: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27A3086C4B; Tue, 20 Mar 2018 20:45: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 22AB821B08; Tue, 20 Mar 2018 20:45: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 w2KKjmrX046140; Tue, 20 Mar 2018 20:45:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KKjm0l046139; Tue, 20 Mar 2018 20:45:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803202045.w2KKjm0l046139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 20:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331260 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 331260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:45:48 -0000 Author: markj Date: Tue Mar 20 20:45:47 2018 New Revision: 331260 URL: https://svnweb.freebsd.org/changeset/base/331260 Log: Remove a lingering inaccuracy from mlock.2. User wirings of the same address range don't stack. Noted by: Dan Nelson MFC after: 3 days Modified: head/lib/libc/sys/mlock.2 Modified: head/lib/libc/sys/mlock.2 ============================================================================== --- head/lib/libc/sys/mlock.2 Tue Mar 20 20:26:24 2018 (r331259) +++ head/lib/libc/sys/mlock.2 Tue Mar 20 20:45:47 2018 (r331260) @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd Jan 22, 2018 +.Dd March 20, 2018 .Dt MLOCK 2 .Os .Sh NAME @@ -78,9 +78,7 @@ are removed. Multiple processes may have the same physical pages locked via their own virtual address mappings. A single process may likewise have pages multiply-locked via different virtual -mappings of the same pages or via nested -.Fn mlock -calls on the same address range. +mappings of the same physical pages. Unlocking is performed explicitly by .Fn munlock or implicitly by a call to From owner-svn-src-all@freebsd.org Tue Mar 20 21:00:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 569EFF4683F; Tue, 20 Mar 2018 21:00:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02A818758B; Tue, 20 Mar 2018 21:00:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1CD521C9B; Tue, 20 Mar 2018 21:00:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KL0jFm052415; Tue, 20 Mar 2018 21:00:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KL0jot052414; Tue, 20 Mar 2018 21:00:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803202100.w2KL0jot052414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Mar 2018 21:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331261 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:00:46 -0000 Author: jhb Date: Tue Mar 20 21:00:45 2018 New Revision: 331261 URL: https://svnweb.freebsd.org/changeset/base/331261 Log: Use instead of in userland. is a kernel-only header. The standard header for userland is . Using the standard header in userland avoids weird build errors when building with external compilers that include their own stdarg.h header. Reviewed by: arichardson, brooks, imp Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14776 Modified: head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Tue Mar 20 20:45:47 2018 (r331260) +++ head/sys/cam/scsi/scsi_all.h Tue Mar 20 21:00:45 2018 (r331261) @@ -25,7 +25,11 @@ #define _SCSI_SCSI_ALL_H 1 #include +#ifdef _KERNEL #include +#else +#include +#endif #ifdef _KERNEL /* From owner-svn-src-all@freebsd.org Tue Mar 20 21:02:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8D43F46CC4; Tue, 20 Mar 2018 21:02:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6960287A13; Tue, 20 Mar 2018 21:02:43 +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 4AB5321E1D; Tue, 20 Mar 2018 21:02:43 +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 w2KL2h3V056086; Tue, 20 Mar 2018 21:02:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KL2hcq056085; Tue, 20 Mar 2018 21:02:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803202102.w2KL2hcq056085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 20 Mar 2018 21:02:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331262 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 331262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:02:43 -0000 Author: ian Date: Tue Mar 20 21:02:42 2018 New Revision: 331262 URL: https://svnweb.freebsd.org/changeset/base/331262 Log: MFC r330745: Make root mount timeout logic work for filesystems other than ufs. The vfs.mountroot.timeout tunable and .timeout directive in a mount.conf(5) file allow specifying a wait timeout for the device(s) hosting the root filesystem to become usable. The current mechanism for waiting for devices and detecting their availability can't be used for zfs-hosted filesystems. See the comment #20 in the PR for some expanded detail on these points. This change adds retry logic to the actual root filesystem mount. That is, insted of relying on device availability using device name lookups, it uses the kernel_mount() call itself to detect whether the filesystem can be mounted, and loops until it succeeds or the configured timeout is exceeded. These changes are based on the patch attached to the PR, but it's rewritten enough that all mistakes belong to me. PR: 208882 Modified: stable/11/sys/kern/vfs_mountroot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_mountroot.c ============================================================================== --- stable/11/sys/kern/vfs_mountroot.c Tue Mar 20 21:00:45 2018 (r331261) +++ stable/11/sys/kern/vfs_mountroot.c Tue Mar 20 21:02:42 2018 (r331262) @@ -712,7 +712,7 @@ parse_mount(char **conf) char *errmsg; struct mntarg *ma; char *dev, *fs, *opts, *tok; - int error; + int delay, error, timeout; error = parse_token(conf, &tok); if (error) @@ -753,15 +753,31 @@ parse_mount(char **conf) if (error != 0) goto out; - ma = NULL; - ma = mount_arg(ma, "fstype", fs, -1); - ma = mount_arg(ma, "fspath", "/", -1); - ma = mount_arg(ma, "from", dev, -1); - ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); - ma = mount_arg(ma, "ro", NULL, 0); - ma = parse_mountroot_options(ma, opts); - error = kernel_mount(ma, MNT_ROOTFS); + delay = hz / 10; + timeout = root_mount_timeout * hz; + for (;;) { + ma = NULL; + ma = mount_arg(ma, "fstype", fs, -1); + ma = mount_arg(ma, "fspath", "/", -1); + ma = mount_arg(ma, "from", dev, -1); + ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); + ma = mount_arg(ma, "ro", NULL, 0); + ma = parse_mountroot_options(ma, opts); + + error = kernel_mount(ma, MNT_ROOTFS); + if (error == 0 || timeout <= 0) + break; + + if (root_mount_timeout * hz == timeout || + (bootverbose && timeout % hz == 0)) { + printf("Mounting from %s:%s failed with error %d; " + "retrying for %d more second%s\n", fs, dev, error, + timeout / hz, (timeout / hz > 1) ? "s" : ""); + } + pause("rmretry", delay); + timeout -= delay; + } out: if (error) { printf("Mounting from %s:%s failed with error %d", From owner-svn-src-all@freebsd.org Tue Mar 20 21:04:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E51AF4A001; Tue, 20 Mar 2018 21:04:48 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 41F6687C38; Tue, 20 Mar 2018 21:04:48 +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 3868921E1F; Tue, 20 Mar 2018 21:04:48 +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 w2KL4mAe056209; Tue, 20 Mar 2018 21:04:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KL4mkm056208; Tue, 20 Mar 2018 21:04:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803202104.w2KL4mkm056208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 21:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331263 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 331263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:04:48 -0000 Author: emaste Date: Tue Mar 20 21:04:47 2018 New Revision: 331263 URL: https://svnweb.freebsd.org/changeset/base/331263 Log: Restore close quote lost in r331254 Modified: head/sys/i386/i386/exception.s Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Tue Mar 20 21:02:42 2018 (r331262) +++ head/sys/i386/i386/exception.s Tue Mar 20 21:04:47 2018 (r331263) @@ -42,7 +42,7 @@ #include #include -#include "assym.inc +#include "assym.inc" #define SEL_RPL_MASK 0x0003 #define GSEL_KPL 0x0020 /* GSEL(GCODE_SEL, SEL_KPL) */ From owner-svn-src-all@freebsd.org Tue Mar 20 21:16:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D3A6F4AEBB; Tue, 20 Mar 2018 21:16:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B00CA684E4; Tue, 20 Mar 2018 21:16:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A63B421F9A; Tue, 20 Mar 2018 21:16:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KLGQqC061168; Tue, 20 Mar 2018 21:16:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLGQsF061167; Tue, 20 Mar 2018 21:16:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803202116.w2KLGQsF061167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 21:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331264 - head/sys/cddl/dev/fbt/x86 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/dev/fbt/x86 X-SVN-Commit-Revision: 331264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:16:27 -0000 Author: markj Date: Tue Mar 20 21:16:26 2018 New Revision: 331264 URL: https://svnweb.freebsd.org/changeset/base/331264 Log: Make use of the KPI added in r331252. MFC after: 2 weeks Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:04:47 2018 (r331263) +++ head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:16:26 2018 (r331264) @@ -35,6 +35,7 @@ #include #include +#include #include "fbt.h" @@ -145,15 +146,11 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uin void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { - u_long cr0save; - register_t intr; + bool old_wp; - intr = intr_disable(); - cr0save = rcr0(); - load_cr0(cr0save & ~CR0_WP); + old_wp = disable_wp(); *fbt->fbtp_patchpoint = val; - load_cr0(cr0save); - intr_restore(intr); + restore_wp(old_wp); } int From owner-svn-src-all@freebsd.org Tue Mar 20 21:17:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABBB4F4B0DE; Tue, 20 Mar 2018 21:17:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DF866869D; Tue, 20 Mar 2018 21:17:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58E6121F9B; Tue, 20 Mar 2018 21:17:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KLHmb6061265; Tue, 20 Mar 2018 21:17:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLHmSQ061264; Tue, 20 Mar 2018 21:17:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202117.w2KLHmSQ061264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331265 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 331265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:17:48 -0000 Author: imp Date: Tue Mar 20 21:17:48 2018 New Revision: 331265 URL: https://svnweb.freebsd.org/changeset/base/331265 Log: Remove obsolete lint support. Modified: head/sys/sys/_stdarg.h Modified: head/sys/sys/_stdarg.h ============================================================================== --- head/sys/sys/_stdarg.h Tue Mar 20 21:16:26 2018 (r331264) +++ head/sys/sys/_stdarg.h Tue Mar 20 21:17:48 2018 (r331265) @@ -52,18 +52,5 @@ #define va_end(ap) __builtin_va_end(ap) #endif -#if defined(lint) && !defined(va_start) - /* - * Provide a fake implementation for lint's benefit - * This very much assumes that __va_list ends up being a pointer - */ - #define va_start(ap, last) ((void)((ap) = (char *) (&(last)+1))) - #if __ISO_C_VISIBLE >= 1999 - #define va_copy(dst, src) ((dst) = (src)) - #endif - #define va_arg(ap, type) (*((type*)(((ap) += sizeof(type)) - sizeof(type)))) - #define va_end(ap) ((void)0) -#endif - #endif /* ! _SYS__STDARG_H_ */ From owner-svn-src-all@freebsd.org Tue Mar 20 21:18:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 626B3F4B277; Tue, 20 Mar 2018 21:18:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13C476882A; Tue, 20 Mar 2018 21:18:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EAE221F9C; Tue, 20 Mar 2018 21:18:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KLIeAX061340; Tue, 20 Mar 2018 21:18:40 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLIe93061339; Tue, 20 Mar 2018 21:18:40 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202118.w2KLIe93061339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331266 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 331266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:18:41 -0000 Author: imp Date: Tue Mar 20 21:18:40 2018 New Revision: 331266 URL: https://svnweb.freebsd.org/changeset/base/331266 Log: Drop support for lint for cdefs.h. Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Tue Mar 20 21:17:48 2018 (r331265) +++ head/sys/sys/cdefs.h Tue Mar 20 21:18:40 2018 (r331266) @@ -591,7 +591,7 @@ * __FBSDID("$FreeBSD$"); */ #ifndef __FBSDID -#if !defined(lint) && !defined(STRIP_FBSDID) +#if !defined(STRIP_FBSDID) #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else #define __FBSDID(s) struct __hack From owner-svn-src-all@freebsd.org Tue Mar 20 21:31:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 236F1F4C15C; Tue, 20 Mar 2018 21:31:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5E2869013; Tue, 20 Mar 2018 21:31:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0D862223F; Tue, 20 Mar 2018 21:31:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KLVIQW071169; Tue, 20 Mar 2018 21:31:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLVIag071168; Tue, 20 Mar 2018 21:31:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202131.w2KLVIag071168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331267 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 331267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:31:19 -0000 Author: imp Date: Tue Mar 20 21:31:18 2018 New Revision: 331267 URL: https://svnweb.freebsd.org/changeset/base/331267 Log: Update to include information about using SPDX-License-Identifier lines. Modified: head/share/man/man9/style.9 Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Tue Mar 20 21:18:40 2018 (r331266) +++ head/share/man/man9/style.9 Tue Mar 20 21:31:18 2018 (r331267) @@ -65,6 +65,8 @@ The copyright header should be a multi-line comment, w line of the comment having a dash after the star like so: .Bd -literal /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1984-2025 John Q. Public * All rights reserved. * @@ -82,6 +84,7 @@ license or copyright notice, change the dash to a star comments. Comments starting in columns other than the first are never considered license statements. +Use the appropriate SPDX-License-Identifier line before the copyright. .Pp After any copyright header, there is a blank line, and the .Li $\&FreeBSD$ From owner-svn-src-all@freebsd.org Tue Mar 20 21:36:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A68FF4C9EF; Tue, 20 Mar 2018 21:36:36 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1B386950D; Tue, 20 Mar 2018 21:36:35 +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 CCBFF2228F; Tue, 20 Mar 2018 21:36:35 +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 w2KLaZCi071415; Tue, 20 Mar 2018 21:36:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLaZNW071413; Tue, 20 Mar 2018 21:36:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803202136.w2KLaZNW071413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 21:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331268 - head/sys/cddl/dev/fbt/x86 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/dev/fbt/x86 X-SVN-Commit-Revision: 331268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:36:36 -0000 Author: markj Date: Tue Mar 20 21:36:35 2018 New Revision: 331268 URL: https://svnweb.freebsd.org/changeset/base/331268 Log: Revert part of r331264: disable interrupts before disabling WP. We might otherwise be preempted, leaving WP disabled while another thread runs on the CPU. Reported by: kib X-MFC with: r331264 Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:31:18 2018 (r331267) +++ head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:36:35 2018 (r331268) @@ -146,11 +146,14 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uin void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { + register_t intr; bool old_wp; + intr = intr_disable(); old_wp = disable_wp(); *fbt->fbtp_patchpoint = val; restore_wp(old_wp); + intr_restore(intr); } int From owner-svn-src-all@freebsd.org Tue Mar 20 21:37:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAF76F4CBA4; Tue, 20 Mar 2018 21:37:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E3D76969C; Tue, 20 Mar 2018 21:37:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7929322290; Tue, 20 Mar 2018 21:37:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KLbXuT071490; Tue, 20 Mar 2018 21:37:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLbXrp071489; Tue, 20 Mar 2018 21:37:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202137.w2KLbXrp071489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331269 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 331269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:37:34 -0000 Author: imp Date: Tue Mar 20 21:37:33 2018 New Revision: 331269 URL: https://svnweb.freebsd.org/changeset/base/331269 Log: Remove reference to lint. We no longer support it, so exceptions for it are no longer relevant. Modified: head/share/man/man9/style.9 Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) @@ -107,11 +107,7 @@ Only add .Dq Li "From: " in front of foreign VCS IDs if the file is renamed. .Bd -literal -#if 0 -#ifndef lint -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; -#endif /* not lint */ -#endif +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ #include __FBSDID("$FreeBSD$"); @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) lo greater than 20 lines, or where a series of nested .Ic #ifdef 's may be confusing to the reader. -Exceptions may be made for cases where code is conditionally not compiled for -the purposes of -.Xr lint 1 , -even though the uncompiled region may be small. The comment should be separated from the .Ic #endif or From owner-svn-src-all@freebsd.org Tue Mar 20 22:00:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE327F4E66F; Tue, 20 Mar 2018 22:00:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EE086A348; Tue, 20 Mar 2018 22:00:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59D07225B4; Tue, 20 Mar 2018 22:00:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KM0wq9083586; Tue, 20 Mar 2018 22:00:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM0wUR083585; Tue, 20 Mar 2018 22:00:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803202200.w2KM0wUR083585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 20 Mar 2018 22:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331270 - head/usr.sbin/syslogd X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/usr.sbin/syslogd X-SVN-Commit-Revision: 331270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:00:59 -0000 Author: glebius Date: Tue Mar 20 22:00:58 2018 New Revision: 331270 URL: https://svnweb.freebsd.org/changeset/base/331270 Log: Fix whitespace issues in r330034. No functional changes. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Tue Mar 20 21:37:33 2018 (r331269) +++ head/usr.sbin/syslogd/syslogd.c Tue Mar 20 22:00:58 2018 (r331270) @@ -383,13 +383,13 @@ close_filed(struct filed *f) switch (f->f_type) { case F_FORW: - if (f->f_un.f_forw.f_addr) { - freeaddrinfo(f->f_un.f_forw.f_addr); - f->f_un.f_forw.f_addr = NULL; - } - /*FALLTHROUGH*/ + if (f->f_un.f_forw.f_addr) { + freeaddrinfo(f->f_un.f_forw.f_addr); + f->f_un.f_forw.f_addr = NULL; + } + /* FALLTHROUGH */ - case F_FILE: + case F_FILE: case F_TTY: case F_CONSOLE: f->f_type = F_UNUSED; @@ -1865,7 +1865,7 @@ readconfigfile(FILE *cf, int allow_includes) f = cfline(cline, prog, host); if (f != NULL) addfile(f); - free(f); + free(f); } } @@ -1963,11 +1963,11 @@ init(int signo) f = cfline("*.ERR\t/dev/console", "*", "*"); if (f != NULL) addfile(f); - free(f); + free(f); f = cfline("*.PANIC\t*", "*", "*"); if (f != NULL) addfile(f); - free(f); + free(f); Initialized = 1; return; From owner-svn-src-all@freebsd.org Tue Mar 20 22:01:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 652F9F4E6D2; Tue, 20 Mar 2018 22:01:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 142286A49F; Tue, 20 Mar 2018 22:01:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F2FB226C1; Tue, 20 Mar 2018 22:01:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KM1Io9085332; Tue, 20 Mar 2018 22:01:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM1Isd085328; Tue, 20 Mar 2018 22:01:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202201.w2KM1Isd085328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 22:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331271 - in head/sys/dev: cardbus pccard pccbb X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/dev: cardbus pccard pccbb X-SVN-Commit-Revision: 331271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:01:19 -0000 Author: imp Date: Tue Mar 20 22:01:18 2018 New Revision: 331271 URL: https://svnweb.freebsd.org/changeset/base/331271 Log: Push down Giant one layer. In the days of yore, back when Penitums were the new kids on the block and F00F hacks were all the rage, one needed to take out Giant to do anything moderately complicated with the VM, mappings and such. So the pccard / cardbus code held Giant for the entire insertion or removal process. Today, the VM is MP safe. The lock is only needed for dealing with newbus things. Move locking and unlocking Giant to be only around adding and probing devices in pccard and cardbus. Modified: head/sys/dev/cardbus/cardbus.c head/sys/dev/pccard/pccard.c head/sys/dev/pccbb/pccbb.c Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Tue Mar 20 22:00:58 2018 (r331270) +++ head/sys/dev/cardbus/cardbus.c Tue Mar 20 22:01:18 2018 (r331271) @@ -197,6 +197,7 @@ cardbus_attach_card(device_t cbdev) domain = pcib_get_domain(cbdev); bus = pcib_get_bus(cbdev); slot = 0; + mtx_lock(&Giant); /* For each function, set it up and try to attach a driver to it */ for (func = 0; func <= cardbusfunchigh; func++) { struct cardbus_devinfo *dinfo; @@ -230,6 +231,7 @@ cardbus_attach_card(device_t cbdev) else pci_cfg_save(dinfo->pci.cfg.dev, &dinfo->pci, 1); } + mtx_unlock(&Giant); if (cardattached > 0) return (0); /* POWER_DISABLE_SOCKET(brdev, cbdev); */ Modified: head/sys/dev/pccard/pccard.c ============================================================================== --- head/sys/dev/pccard/pccard.c Tue Mar 20 22:00:58 2018 (r331270) +++ head/sys/dev/pccard/pccard.c Tue Mar 20 22:01:18 2018 (r331271) @@ -236,6 +236,7 @@ pccard_attach_card(device_t dev) DEVPRINTF((dev, "Card has %d functions. pccard_mfc is %d\n", i + 1, pccard_mfc(sc))); + mtx_lock(&Giant); STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) { if (STAILQ_EMPTY(&pf->cfe_head)) continue; @@ -248,6 +249,7 @@ pccard_attach_card(device_t dev) pf->dev = child; pccard_probe_and_attach_child(dev, child, pf); } + mtx_unlock(&Giant); return (0); } Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Tue Mar 20 22:00:58 2018 (r331270) +++ head/sys/dev/pccbb/pccbb.c Tue Mar 20 22:01:18 2018 (r331271) @@ -470,14 +470,6 @@ cbb_event_thread(void *arg) sc->flags |= CBB_KTHREAD_RUNNING; while ((sc->flags & CBB_KTHREAD_DONE) == 0) { mtx_unlock(&sc->mtx); - /* - * We take out Giant here because we need it deep, - * down in the bowels of the vm system for mapping the - * memory we need to read the CIS. In addition, since - * we are adding/deleting devices from the dev tree, - * and that code isn't MP safe, we have to hold Giant. - */ - mtx_lock(&Giant); status = cbb_get(sc, CBB_SOCKET_STATE); DPRINTF(("Status is 0x%x\n", status)); if (!CBB_CARD_PRESENT(status)) { @@ -503,7 +495,6 @@ cbb_event_thread(void *arg) not_a_card = 0; /* We know card type */ cbb_insert(sc); } - mtx_unlock(&Giant); /* * First time through we need to tell mountroot that we're From owner-svn-src-all@freebsd.org Tue Mar 20 22:05:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF70EF4ED06; Tue, 20 Mar 2018 22:05:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 606CE6AA59; Tue, 20 Mar 2018 22:05:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B2092270F; Tue, 20 Mar 2018 22:05:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KM5LDi086519; Tue, 20 Mar 2018 22:05:21 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM5LoE086518; Tue, 20 Mar 2018 22:05:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803202205.w2KM5LoE086518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 20 Mar 2018 22:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331272 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:05:21 -0000 Author: glebius Date: Tue Mar 20 22:05:21 2018 New Revision: 331272 URL: https://svnweb.freebsd.org/changeset/base/331272 Log: At this point iwmesg isn't initialized yet, so print pointer to lock rather than panic before panicing. Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Tue Mar 20 22:01:18 2018 (r331271) +++ head/sys/kern/kern_lock.c Tue Mar 20 22:05:21 2018 (r331272) @@ -722,8 +722,8 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc class = LOCK_CLASS(ilk); class->lc_unlock(ilk); } - panic("%s: recursing on non recursive lockmgr %s @ %s:%d\n", - __func__, iwmesg, file, line); + panic("%s: recursing on non recursive lockmgr %p " + "@ %s:%d\n", __func__, lk, file, line); } lk->lk_recurse++; LOCK_LOG2(lk, "%s: %p recursing", __func__, lk); From owner-svn-src-all@freebsd.org Tue Mar 20 22:07:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11615F4EF96; Tue, 20 Mar 2018 22:07:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3DC96AC41; Tue, 20 Mar 2018 22:07:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA81B22710; Tue, 20 Mar 2018 22:07:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KM7jxY086655; Tue, 20 Mar 2018 22:07:45 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM7jwt086654; Tue, 20 Mar 2018 22:07:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202207.w2KM7jwt086654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 22:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331273 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:07:46 -0000 Author: imp Date: Tue Mar 20 22:07:45 2018 New Revision: 331273 URL: https://svnweb.freebsd.org/changeset/base/331273 Log: Release the "TUR" reference when clearing the TUR work flag. We mostly do this right, except when there's no BP and we do a TUR by request. In that case, we clear the flag, but don't release the reference, leaking the reference on rare occasion. PR: 226510 Sponsored by: Netflix Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Tue Mar 20 22:05:21 2018 (r331272) +++ head/sys/cam/scsi/scsi_da.c Tue Mar 20 22:07:45 2018 (r331273) @@ -3114,6 +3114,7 @@ more: if (bp == NULL) { if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); + da_periph_release_locked(periph, DA_REF_TUR); scsi_test_unit_ready(&start_ccb->csio, /*retries*/ da_retry_count, dadone, @@ -3137,11 +3138,6 @@ more: biofinish(bp, NULL, 0); goto more; } - } - - if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { - cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - da_periph_release_locked(periph, DA_REF_TUR); } if ((bp->bio_flags & BIO_ORDERED) != 0 || From owner-svn-src-all@freebsd.org Tue Mar 20 22:41:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 485FFF51E20; Tue, 20 Mar 2018 22:41:27 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEA0B6D779; Tue, 20 Mar 2018 22:41:26 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E99B322CE9; Tue, 20 Mar 2018 22:41:26 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KMfQEZ008636; Tue, 20 Mar 2018 22:41:26 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KMfQ4X008634; Tue, 20 Mar 2018 22:41:26 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201803202241.w2KMfQ4X008634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Tue, 20 Mar 2018 22:41:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331274 - in head/share/man: man4 man9 X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: in head/share/man: man4 man9 X-SVN-Commit-Revision: 331274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:41:27 -0000 Author: sevan (doc committer) Date: Tue Mar 20 22:41:26 2018 New Revision: 331274 URL: https://svnweb.freebsd.org/changeset/base/331274 Log: Extend the description of ALTQ to call it a system which is a framework in altq(4) to match altq(9). This makes preserving the history section as the author of ALTQ easier in the history section, rather than calling it a framework in the description & a system in the history. Add a history section to altq(4) and extend the history section in altq(9) Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D14774 Modified: head/share/man/man4/altq.4 head/share/man/man9/altq.9 Modified: head/share/man/man4/altq.4 ============================================================================== --- head/share/man/man4/altq.4 Tue Mar 20 22:07:45 2018 (r331273) +++ head/share/man/man4/altq.4 Tue Mar 20 22:41:26 2018 (r331274) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 28, 2017 +.Dd March 20, 2018 .Dt ALTQ 4 .Os .Sh NAME @@ -45,7 +45,8 @@ .Sh DESCRIPTION The .Nm -framework provides several disciplines for queuing outgoing network packets. +system is a framework which provides several disciplines for queuing outgoing +network packets. This is done by modifications to the interface packet queues. See .Xr altq 9 @@ -59,7 +60,7 @@ utility, so please refer to the .Xr pfctl 8 and the .Xr pf.conf 5 -manpages for a complete description of the +man pages for a complete description of the .Nm capabilities and how to use it. .Ss Kernel Options @@ -195,3 +196,11 @@ pseudo drivers also do support .Xr ipfw 8 , .Xr pfctl 8 , .Xr altq 9 +.Sh HISTORY +The +.Nm +system first appeared in March 1997 and found home in the KAME project +(http://www.kame.net). +It was imported to +.Fx +in 5.3 . Modified: head/share/man/man9/altq.9 ============================================================================== --- head/share/man/man9/altq.9 Tue Mar 20 22:07:45 2018 (r331273) +++ head/share/man/man9/altq.9 Tue Mar 20 22:41:26 2018 (r331274) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 25, 2004 +.Dd March 20, 2018 .Dt ALTQ 9 .Os .\" @@ -595,4 +595,8 @@ is called immediately after .Sh HISTORY The .Nm -system first appeared in March 1997. +system first appeared in March 1997 and found home in the KAME project +(http://www.kame.net). +It was imported to +.Fx +in 5.3 . From owner-svn-src-all@freebsd.org Tue Mar 20 22:57:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2303CF532D2; Tue, 20 Mar 2018 22:57:07 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B12156E64B; Tue, 20 Mar 2018 22:57:06 +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 A7D4522ED2; Tue, 20 Mar 2018 22:57:06 +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 w2KMv6k0014770; Tue, 20 Mar 2018 22:57:06 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KMv6Md014768; Tue, 20 Mar 2018 22:57:06 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201803202257.w2KMv6Md014768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 20 Mar 2018 22:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331275 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 331275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:57:07 -0000 Author: melifaro Date: Tue Mar 20 22:57:06 2018 New Revision: 331275 URL: https://svnweb.freebsd.org/changeset/base/331275 Log: Use count(9) api for the bpf(4) statistics. Currently each bfp descriptor uses u64 variables to maintain its counters. On interfaces with high packet rate this leads to unnecessary contention and inaccurate reporting. PR: kern/205320 Reported by: elofu17 at hotmail.com MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14726 Modified: head/sys/net/bpf.c head/sys/net/bpfdesc.h Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Tue Mar 20 22:41:26 2018 (r331274) +++ head/sys/net/bpf.c Tue Mar 20 22:57:06 2018 (r331275) @@ -280,7 +280,7 @@ bpf_append_bytes(struct bpf_d *d, caddr_t buf, u_int o return (bpf_buffer_append_bytes(d, buf, offset, src, len)); case BPF_BUFMODE_ZBUF: - d->bd_zcopy++; + counter_u64_add(d->bd_zcopy, 1); return (bpf_zerocopy_append_bytes(d, buf, offset, src, len)); default: @@ -300,7 +300,7 @@ bpf_append_mbuf(struct bpf_d *d, caddr_t buf, u_int of return (bpf_buffer_append_mbuf(d, buf, offset, src, len)); case BPF_BUFMODE_ZBUF: - d->bd_zcopy++; + counter_u64_add(d->bd_zcopy, 1); return (bpf_zerocopy_append_mbuf(d, buf, offset, src, len)); default: @@ -886,6 +886,15 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct t return (error); } + /* Setup counters */ + d->bd_rcount = counter_u64_alloc(M_WAITOK); + d->bd_dcount = counter_u64_alloc(M_WAITOK); + d->bd_fcount = counter_u64_alloc(M_WAITOK); + d->bd_wcount = counter_u64_alloc(M_WAITOK); + d->bd_wfcount = counter_u64_alloc(M_WAITOK); + d->bd_wdcount = counter_u64_alloc(M_WAITOK); + d->bd_zcopy = counter_u64_alloc(M_WAITOK); + /* * For historical reasons, perform a one-time initialization call to * the buffer routines, even though we're not yet committed to a @@ -1111,22 +1120,22 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag return (error); BPF_PID_REFRESH_CUR(d); - d->bd_wcount++; + counter_u64_add(d->bd_wcount, 1); /* XXX: locking required */ if (d->bd_bif == NULL) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (ENXIO); } ifp = d->bd_bif->bif_ifp; if ((ifp->if_flags & IFF_UP) == 0) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (ENETDOWN); } if (uio->uio_resid == 0) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (0); } @@ -1137,10 +1146,10 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp, &m, &dst, &hlen, d); if (error) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (error); } - d->bd_wfcount++; + counter_u64_add(d->bd_wfcount, 1); if (d->bd_hdrcmplt) dst.sa_family = pseudo_AF_HDRCMPLT; @@ -1176,7 +1185,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag error = (*ifp->if_output)(ifp, m, &dst, &ro); if (error) - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); if (mc != NULL) { if (error == 0) @@ -1215,13 +1224,13 @@ reset_d(struct bpf_d *d) } if (bpf_canwritebuf(d)) d->bd_slen = 0; - d->bd_rcount = 0; - d->bd_dcount = 0; - d->bd_fcount = 0; - d->bd_wcount = 0; - d->bd_wfcount = 0; - d->bd_wdcount = 0; - d->bd_zcopy = 0; + counter_u64_zero(d->bd_rcount); + counter_u64_zero(d->bd_dcount); + counter_u64_zero(d->bd_fcount); + counter_u64_zero(d->bd_wcount); + counter_u64_zero(d->bd_wfcount); + counter_u64_zero(d->bd_wdcount); + counter_u64_zero(d->bd_zcopy); } /* @@ -1592,8 +1601,8 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, i struct bpf_stat *bs = (struct bpf_stat *)addr; /* XXXCSJP overflow */ - bs->bs_recv = d->bd_rcount; - bs->bs_drop = d->bd_dcount; + bs->bs_recv = (u_int)counter_u64_fetch(d->bd_rcount); + bs->bs_drop = (u_int)counter_u64_fetch(d->bd_dcount); break; } @@ -2146,8 +2155,7 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen) * write lock, too */ - /* XXX: Do not protect counter for the sake of performance. */ - ++d->bd_rcount; + counter_u64_add(d->bd_rcount, 1); /* * NB: We dont call BPF_CHECK_DIRECTION() here since there is no * way for the caller to indiciate to us whether this packet @@ -2167,7 +2175,7 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen) */ BPFD_LOCK(d); - d->bd_fcount++; + counter_u64_add(d->bd_fcount, 1); if (gottime < bpf_ts_quality(d->bd_tstamp)) gottime = bpf_gettime(&bt, d->bd_tstamp, NULL); #ifdef MAC @@ -2214,7 +2222,7 @@ bpf_mtap(struct bpf_if *bp, struct mbuf *m) LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; - ++d->bd_rcount; + counter_u64_add(d->bd_rcount, 1); #ifdef BPF_JITTER bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; /* XXX We cannot handle multiple mbufs. */ @@ -2226,7 +2234,7 @@ bpf_mtap(struct bpf_if *bp, struct mbuf *m) if (slen != 0) { BPFD_LOCK(d); - d->bd_fcount++; + counter_u64_add(d->bd_fcount, 1); if (gottime < bpf_ts_quality(d->bd_tstamp)) gottime = bpf_gettime(&bt, d->bd_tstamp, m); #ifdef MAC @@ -2277,12 +2285,12 @@ bpf_mtap2(struct bpf_if *bp, void *data, u_int dlen, s LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; - ++d->bd_rcount; + counter_u64_add(d->bd_rcount, 1); slen = bpf_filter(d->bd_rfilter, (u_char *)&mb, pktlen, 0); if (slen != 0) { BPFD_LOCK(d); - d->bd_fcount++; + counter_u64_add(d->bd_fcount, 1); if (gottime < bpf_ts_quality(d->bd_tstamp)) gottime = bpf_gettime(&bt, d->bd_tstamp, m); #ifdef MAC @@ -2435,7 +2443,7 @@ catchpacket(struct bpf_d *d, u_char *pkt, u_int pktlen * buffer model. */ bpf_buffull(d); - ++d->bd_dcount; + counter_u64_add(d->bd_dcount, 1); return; } KASSERT(!d->bd_hbuf_in_use, ("hold buffer is in use")); @@ -2535,6 +2543,15 @@ bpf_freed(struct bpf_d *d) if (d->bd_wfilter != NULL) free((caddr_t)d->bd_wfilter, M_BPF); mtx_destroy(&d->bd_lock); + + counter_u64_free(d->bd_rcount); + counter_u64_free(d->bd_dcount); + counter_u64_free(d->bd_fcount); + counter_u64_free(d->bd_wcount); + counter_u64_free(d->bd_wfcount); + counter_u64_free(d->bd_wdcount); + counter_u64_free(d->bd_zcopy); + } /* @@ -2835,12 +2852,12 @@ bpf_zero_counters(void) BPFIF_RLOCK(bp); LIST_FOREACH(bd, &bp->bif_dlist, bd_next) { BPFD_LOCK(bd); - bd->bd_rcount = 0; - bd->bd_dcount = 0; - bd->bd_fcount = 0; - bd->bd_wcount = 0; - bd->bd_wfcount = 0; - bd->bd_zcopy = 0; + counter_u64_zero(bd->bd_rcount); + counter_u64_zero(bd->bd_dcount); + counter_u64_zero(bd->bd_fcount); + counter_u64_zero(bd->bd_wcount); + counter_u64_zero(bd->bd_wfcount); + counter_u64_zero(bd->bd_zcopy); BPFD_UNLOCK(bd); } BPFIF_RUNLOCK(bp); @@ -2865,9 +2882,9 @@ bpfstats_fill_xbpf(struct xbpf_d *d, struct bpf_d *bd) d->bd_direction = bd->bd_direction; d->bd_feedback = bd->bd_feedback; d->bd_async = bd->bd_async; - d->bd_rcount = bd->bd_rcount; - d->bd_dcount = bd->bd_dcount; - d->bd_fcount = bd->bd_fcount; + d->bd_rcount = counter_u64_fetch(bd->bd_rcount); + d->bd_dcount = counter_u64_fetch(bd->bd_dcount); + d->bd_fcount = counter_u64_fetch(bd->bd_fcount); d->bd_sig = bd->bd_sig; d->bd_slen = bd->bd_slen; d->bd_hlen = bd->bd_hlen; @@ -2876,10 +2893,10 @@ bpfstats_fill_xbpf(struct xbpf_d *d, struct bpf_d *bd) strlcpy(d->bd_ifname, bd->bd_bif->bif_ifp->if_xname, IFNAMSIZ); d->bd_locked = bd->bd_locked; - d->bd_wcount = bd->bd_wcount; - d->bd_wdcount = bd->bd_wdcount; - d->bd_wfcount = bd->bd_wfcount; - d->bd_zcopy = bd->bd_zcopy; + d->bd_wcount = counter_u64_fetch(bd->bd_wcount); + d->bd_wdcount = counter_u64_fetch(bd->bd_wdcount); + d->bd_wfcount = counter_u64_fetch(bd->bd_wfcount); + d->bd_zcopy = counter_u64_fetch(bd->bd_zcopy); d->bd_bufmode = bd->bd_bufmode; } Modified: head/sys/net/bpfdesc.h ============================================================================== --- head/sys/net/bpfdesc.h Tue Mar 20 22:41:26 2018 (r331274) +++ head/sys/net/bpfdesc.h Tue Mar 20 22:57:06 2018 (r331275) @@ -45,6 +45,7 @@ #include #include #include +#include #include /* @@ -76,8 +77,8 @@ struct bpf_d { struct bpf_insn *bd_rfilter; /* read filter code */ struct bpf_insn *bd_wfilter; /* write filter code */ void *bd_bfilter; /* binary filter code */ - u_int64_t bd_rcount; /* number of packets received */ - u_int64_t bd_dcount; /* number of packets dropped */ + counter_u64_t bd_rcount; /* number of packets received */ + counter_u64_t bd_dcount; /* number of packets dropped */ u_char bd_promisc; /* true if listening promiscuously */ u_char bd_state; /* idle, waiting, or timed out */ @@ -94,14 +95,14 @@ struct bpf_d { struct mtx bd_lock; /* per-descriptor lock */ struct callout bd_callout; /* for BPF timeouts with select */ struct label *bd_label; /* MAC label for descriptor */ - u_int64_t bd_fcount; /* number of packets which matched filter */ + counter_u64_t bd_fcount; /* number of packets which matched filter */ pid_t bd_pid; /* PID which created descriptor */ int bd_locked; /* true if descriptor is locked */ u_int bd_bufmode; /* Current buffer mode. */ - u_int64_t bd_wcount; /* number of packets written */ - u_int64_t bd_wfcount; /* number of packets that matched write filter */ - u_int64_t bd_wdcount; /* number of packets dropped during a write */ - u_int64_t bd_zcopy; /* number of zero copy operations */ + counter_u64_t bd_wcount; /* number of packets written */ + counter_u64_t bd_wfcount; /* number of packets that matched write filter */ + counter_u64_t bd_wdcount; /* number of packets dropped during a write */ + counter_u64_t bd_zcopy; /* number of zero copy operations */ u_char bd_compat32; /* 32-bit stream on LP64 system */ }; From owner-svn-src-all@freebsd.org Tue Mar 20 22:57:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F200DF53325; Tue, 20 Mar 2018 22:57:14 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4136E734; Tue, 20 Mar 2018 22:57:14 +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 97B4722ED4; Tue, 20 Mar 2018 22:57:14 +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 w2KMvEWo014834; Tue, 20 Mar 2018 22:57:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KMvEG7014833; Tue, 20 Mar 2018 22:57:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803202257.w2KMvEG7014833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 20 Mar 2018 22:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331276 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 331276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:57:15 -0000 Author: ian Date: Tue Mar 20 22:57:14 2018 New Revision: 331276 URL: https://svnweb.freebsd.org/changeset/base/331276 Log: MFC r330745: Make root mount timeout logic work for filesystems other than ufs. The vfs.mountroot.timeout tunable and .timeout directive in a mount.conf(5) file allow specifying a wait timeout for the device(s) hosting the root filesystem to become usable. The current mechanism for waiting for devices and detecting their availability can't be used for zfs-hosted filesystems. See the comment #20 in the PR for some expanded detail on these points. This change adds retry logic to the actual root filesystem mount. That is, insted of relying on device availability using device name lookups, it uses the kernel_mount() call itself to detect whether the filesystem can be mounted, and loops until it succeeds or the configured timeout is exceeded. These changes are based on the patch attached to the PR, but it's rewritten enough that all mistakes belong to me. PR: 208882 Modified: stable/10/sys/kern/vfs_mountroot.c Modified: stable/10/sys/kern/vfs_mountroot.c ============================================================================== --- stable/10/sys/kern/vfs_mountroot.c Tue Mar 20 22:57:06 2018 (r331275) +++ stable/10/sys/kern/vfs_mountroot.c Tue Mar 20 22:57:14 2018 (r331276) @@ -741,15 +741,31 @@ parse_mount(char **conf) } } - ma = NULL; - ma = mount_arg(ma, "fstype", fs, -1); - ma = mount_arg(ma, "fspath", "/", -1); - ma = mount_arg(ma, "from", dev, -1); - ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); - ma = mount_arg(ma, "ro", NULL, 0); - ma = parse_mountroot_options(ma, opts); - error = kernel_mount(ma, MNT_ROOTFS); + delay = hz / 10; + timeout = root_mount_timeout * hz; + for (;;) { + ma = NULL; + ma = mount_arg(ma, "fstype", fs, -1); + ma = mount_arg(ma, "fspath", "/", -1); + ma = mount_arg(ma, "from", dev, -1); + ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); + ma = mount_arg(ma, "ro", NULL, 0); + ma = parse_mountroot_options(ma, opts); + + error = kernel_mount(ma, MNT_ROOTFS); + if (error == 0 || timeout <= 0) + break; + + if (root_mount_timeout * hz == timeout || + (bootverbose && timeout % hz == 0)) { + printf("Mounting from %s:%s failed with error %d; " + "retrying for %d more second%s\n", fs, dev, error, + timeout / hz, (timeout / hz > 1) ? "s" : ""); + } + pause("rmretry", delay); + timeout -= delay; + } out: if (error) { printf("Mounting from %s:%s failed with error %d", From owner-svn-src-all@freebsd.org Tue Mar 20 23:04:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77B17F53B8A; Tue, 20 Mar 2018 23:04:16 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.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 1FA036EE12; Tue, 20 Mar 2018 23:04:16 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [74.217.198.10] (port=62988 helo=[10.1.4.66]) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1eyO6Y-000POk-Nl; Tue, 20 Mar 2018 20:43:34 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r331259 - head/stand/lua From: Devin Teske In-Reply-To: <201803202026.w2KKQOP2036471@repo.freebsd.org> Date: Tue, 20 Mar 2018 16:04:13 -0700 Cc: Devin Teske , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <401EA542-5E2B-4342-B098-7C8D78FAD721@freebsd.org> References: <201803202026.w2KKQOP2036471@repo.freebsd.org> To: Kyle Evans X-Mailer: Apple Mail (2.3273) Sender: devin@shxd.cx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 23:04:16 -0000 > On Mar 20, 2018, at 1:26 PM, Kyle Evans wrote: >=20 > Author: kevans > Date: Tue Mar 20 20:26:24 2018 > New Revision: 331259 > URL: https://svnweb.freebsd.org/changeset/base/331259 >=20 > Log: > lualoader: Use less atomic options for resetting colors/attributes >=20 > Noted by dteske: >=20 > CSI 1m ... CSI 22m > CSI 2m ... CSI 22m > CSI 4m ... CSI 24m > CSI 5m ... CSI 25m > CSI 7m ... CSI 27m > CSI 8m ... CSI 28m > CSI (30-37)m ... CSI 39m > CSI (40-47)m ... CSI 49m >=20 > - Provide resetf/resetb to match escapef/escapeb > - Use CSI 22m to undo a bold >=20 > This is a more reasonable approach than what was previously taken. >=20 > Reported by: dteske >=20 > Modified: > head/stand/lua/color.lua > head/stand/lua/menu.lua >=20 > Modified: head/stand/lua/color.lua > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/lua/color.lua Tue Mar 20 20:20:49 2018 = (r331258) > +++ head/stand/lua/color.lua Tue Mar 20 20:26:24 2018 = (r331259) > @@ -65,6 +65,13 @@ function color.escapef(color_value) > return core.KEYSTR_CSI .. "3" .. color_value .. "m" > end >=20 > +function color.resetf() > + if color.disabled then > + return '' > + end > + return core.KEYSTR_CSI .. "39m" > +end > + > function color.escapeb(color_value) > if color.disabled then > return color_value > @@ -72,6 +79,13 @@ function color.escapeb(color_value) > return core.KEYSTR_CSI .. "4" .. color_value .. "m" > end >=20 > +function color.resetb() > + if color.disabled then > + return '' > + end > + return core.KEYSTR_CSI .. "49m" > +end > + > function color.escape(fg_color, bg_color, attribute) > if color.disabled then > return "" > @@ -98,7 +112,7 @@ function color.highlight(str) > end > -- We need to reset attributes as well as color scheme here, = just in > -- case the terminal defaults don't match what we're expecting. > - return core.KEYSTR_CSI .. "1m" .. str .. color.default() > + return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. = "22m" > end >=20 > return color >=20 > Modified: head/stand/lua/menu.lua > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/lua/menu.lua Tue Mar 20 20:20:49 2018 = (r331258) > +++ head/stand/lua/menu.lua Tue Mar 20 20:26:24 2018 = (r331259) > @@ -120,7 +120,7 @@ menu.boot_environments =3D { > name_color =3D = color.escapef(color.BLUE) > end > bootenv_name =3D bootenv_name .. = name_color .. > - choice .. color.default() > + choice .. color.resetf() > return color.highlight("A").."ctive: " = .. > bootenv_name .. " (" .. idx .. " of = " .. > #all_choices .. ")" > @@ -306,7 +306,7 @@ menu.welcome =3D { > name_color =3D = color.escapef(color.BLUE) > end > kernel_name =3D kernel_name .. = name_color .. > - choice .. color.default() > + choice .. color.resetf() > return color.highlight("K") .. "ernel: " = .. > kernel_name .. " (" .. idx .. " of " = .. > #all_choices .. ")" >=20 Minor nit ... While resetf is unlikely to be mistaken for anything other than "reset = foreground", ... "resetb" could easily be mistaken for "reset bold". I would like to suggest, in tradition, that resetf/resetb be renamed to = resetfg/resetbg You know... should you want to add a "resetb" later that actually resets = bold (e.g., if you have to use CSI 22m in more than one place). --=20 Devin= From owner-svn-src-all@freebsd.org Tue Mar 20 23:08:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEDC0F53F63; Tue, 20 Mar 2018 23:08:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 957CA6F04A; Tue, 20 Mar 2018 23:08:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C1332306C; Tue, 20 Mar 2018 23:08:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KN84Ac019829; Tue, 20 Mar 2018 23:08:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KN84MN019828; Tue, 20 Mar 2018 23:08:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803202308.w2KN84MN019828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 23:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331277 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 23:08:05 -0000 Author: emaste Date: Tue Mar 20 23:08:04 2018 New Revision: 331277 URL: https://svnweb.freebsd.org/changeset/base/331277 Log: Correct comment date in r331255 Reported by: jhb Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Mar 20 22:57:14 2018 (r331276) +++ head/Makefile.inc1 Tue Mar 20 23:08:04 2018 (r331277) @@ -1395,7 +1395,7 @@ INSTALLKERNEL= ${_kernel} .endfor _cleankernobj_fast_depend_hack: .PHONY -# 20170202 remove stale generated assym.s after renaming to .inc in r331254 +# 20180320 remove stale generated assym.s after renaming to .inc in r331254 .if exists(${OBJTOP}/sys/${KERNCONF}/assym.s) @echo Removing stale generated assym files @rm -f ${OBJTOP}/sys/${KERNCONF}/assym.* \ From owner-svn-src-all@freebsd.org Tue Mar 20 23:08:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47D25F54015; Tue, 20 Mar 2018 23:08:43 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEEA16F198; Tue, 20 Mar 2018 23:08:42 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9AEA2306D; Tue, 20 Mar 2018 23:08:42 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KN8g1Y019891; Tue, 20 Mar 2018 23:08:42 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KN8gYe019890; Tue, 20 Mar 2018 23:08:42 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201803202308.w2KN8gYe019890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Tue, 20 Mar 2018 23:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331278 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 23:08:43 -0000 Author: jamie Date: Tue Mar 20 23:08:42 2018 New Revision: 331278 URL: https://svnweb.freebsd.org/changeset/base/331278 Log: Represent boolean jail options as an array of structures containing the flag and both the regular and "no" names, instead of two different string arrays whose indices need to match the flag's bit position. This makes them similar to the say "jailsys" options are represented. Loop through either kind of option array with a structure pointer rather then an integer index. Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Tue Mar 20 23:08:04 2018 (r331277) +++ head/sys/kern/kern_jail.c Tue Mar 20 23:08:42 2018 (r331278) @@ -115,6 +115,17 @@ struct prison prison0 = { }; MTX_SYSINIT(prison0, &prison0.pr_mtx, "jail mutex", MTX_DEF); +struct bool_flags { + const char *name; + const char *noname; + unsigned flag; +}; +struct jailsys_flags { + const char *name; + unsigned disable; + unsigned new; +}; + /* allprison, allprison_racct and lastprid are protected by allprison_lock. */ struct sx allprison_lock; SX_SYSINIT(allprison_lock, &allprison_lock, "allprison"); @@ -145,86 +156,55 @@ static void prison_racct_detach(struct prison *pr); * as we cannot figure out the size of a sparse array, or an array without a * terminating entry. */ -static char *pr_flag_names[] = { - [0] = "persist", +static struct bool_flags pr_flag_bool[] = { + {"persist", "nopersist", PR_PERSIST}, #ifdef INET - [7] = "ip4.saddrsel", + {"ip4.saddrsel", "ip4.nosaddrsel", PR_IP4_SADDRSEL}, #endif #ifdef INET6 - [8] = "ip6.saddrsel", + {"ip6.saddrsel", "ip6.nosaddrsel", PR_IP6_SADDRSEL}, #endif }; -const size_t pr_flag_names_size = sizeof(pr_flag_names); +const size_t pr_flag_bool_size = sizeof(pr_flag_bool); -static char *pr_flag_nonames[] = { - [0] = "nopersist", -#ifdef INET - [7] = "ip4.nosaddrsel", -#endif -#ifdef INET6 - [8] = "ip6.nosaddrsel", -#endif -}; -const size_t pr_flag_nonames_size = sizeof(pr_flag_nonames); - -struct jailsys_flags { - const char *name; - unsigned disable; - unsigned new; -} pr_flag_jailsys[] = { - { "host", 0, PR_HOST }, +static struct jailsys_flags pr_flag_jailsys[] = { + {"host", 0, PR_HOST}, #ifdef VIMAGE - { "vnet", 0, PR_VNET }, + {"vnet", 0, PR_VNET}, #endif #ifdef INET - { "ip4", PR_IP4_USER, PR_IP4_USER }, + {"ip4", PR_IP4_USER, PR_IP4_USER}, #endif #ifdef INET6 - { "ip6", PR_IP6_USER, PR_IP6_USER }, + {"ip6", PR_IP6_USER, PR_IP6_USER}, #endif }; const size_t pr_flag_jailsys_size = sizeof(pr_flag_jailsys); -static char *pr_allow_names[] = { - "allow.set_hostname", - "allow.sysvipc", - "allow.raw_sockets", - "allow.chflags", - "allow.mount", - "allow.quotas", - "allow.socket_af", - "allow.mount.devfs", - "allow.mount.nullfs", - "allow.mount.zfs", - "allow.mount.procfs", - "allow.mount.tmpfs", - "allow.mount.fdescfs", - "allow.mount.linprocfs", - "allow.mount.linsysfs", - "allow.reserved_ports", +static struct bool_flags pr_flag_allow[] = { + {"allow.set_hostname", "allow.noset_hostname", PR_ALLOW_SET_HOSTNAME}, + {"allow.sysvipc", "allow.nosysvipc", PR_ALLOW_SYSVIPC}, + {"allow.raw_sockets", "allow.noraw_sockets", PR_ALLOW_RAW_SOCKETS}, + {"allow.chflags", "allow.nochflags", PR_ALLOW_CHFLAGS}, + {"allow.mount", "allow.nomount", PR_ALLOW_MOUNT}, + {"allow.quotas", "allow.noquotas", PR_ALLOW_QUOTAS}, + {"allow.socket_af", "allow.nosocket_af", PR_ALLOW_SOCKET_AF}, + {"allow.mount.devfs", "allow.mount.nodevfs", PR_ALLOW_MOUNT_DEVFS}, + {"allow.mount.nullfs", "allow.mount.nonullfs", PR_ALLOW_MOUNT_NULLFS}, + {"allow.mount.zfs", "allow.mount.nozfs", PR_ALLOW_MOUNT_ZFS}, + {"allow.mount.procfs", "allow.mount.noprocfs", PR_ALLOW_MOUNT_PROCFS}, + {"allow.mount.tmpfs", "allow.mount.notmpfs", PR_ALLOW_MOUNT_TMPFS}, + {"allow.mount.fdescfs", "allow.mount.nofdescfs", + PR_ALLOW_MOUNT_FDESCFS}, + {"allow.mount.linprocfs", "allow.mount.nolinprocfs", + PR_ALLOW_MOUNT_LINPROCFS}, + {"allow.mount.linsysfs", "allow.mount.nolinsysfs", + PR_ALLOW_MOUNT_LINSYSFS}, + {"allow.reserved_ports", "allow.noreserved_ports", + PR_ALLOW_RESERVED_PORTS}, }; -const size_t pr_allow_names_size = sizeof(pr_allow_names); +const size_t pr_flag_allow_size = sizeof(pr_flag_allow); -static char *pr_allow_nonames[] = { - "allow.noset_hostname", - "allow.nosysvipc", - "allow.noraw_sockets", - "allow.nochflags", - "allow.nomount", - "allow.noquotas", - "allow.nosocket_af", - "allow.mount.nodevfs", - "allow.mount.nonullfs", - "allow.mount.nozfs", - "allow.mount.noprocfs", - "allow.mount.notmpfs", - "allow.mount.nofdescfs", - "allow.mount.nolinprocfs", - "allow.mount.nolinsysfs", - "allow.noreserved_ports", -}; -const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames); - #define JAIL_DEFAULT_ALLOW (PR_ALLOW_SET_HOSTNAME | PR_ALLOW_RESERVED_PORTS) #define JAIL_DEFAULT_ENFORCE_STATFS 2 #define JAIL_DEFAULT_DEVFS_RSNUM 0 @@ -305,7 +285,7 @@ sys_jail(struct thread *td, struct jail_args *uap) int kern_jail(struct thread *td, struct jail *j) { - struct iovec optiov[2 * (4 + nitems(pr_allow_names) + struct iovec optiov[2 * (4 + nitems(pr_flag_allow) #ifdef INET + 1 #endif @@ -315,6 +295,7 @@ kern_jail(struct thread *td, struct jail *j) )]; struct uio opt; char *u_path, *u_hostname, *u_name; + struct bool_flags *bf; #ifdef INET uint32_t ip4s; struct in_addr *u_ip4; @@ -323,7 +304,7 @@ kern_jail(struct thread *td, struct jail *j) struct in6_addr *u_ip6; #endif size_t tmplen; - int error, enforce_statfs, fi; + int error, enforce_statfs; bzero(&optiov, sizeof(optiov)); opt.uio_iov = optiov; @@ -336,10 +317,12 @@ kern_jail(struct thread *td, struct jail *j) /* Set permissions for top-level jails from sysctls. */ if (!jailed(td->td_ucred)) { - for (fi = 0; fi < nitems(pr_allow_names); fi++) { - optiov[opt.uio_iovcnt].iov_base = - (jail_default_allow & (1 << fi)) - ? pr_allow_names[fi] : pr_allow_nonames[fi]; + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) { + optiov[opt.uio_iovcnt].iov_base = __DECONST(char *, + (jail_default_allow & bf->flag) + ? bf->name : bf->noname); optiov[opt.uio_iovcnt].iov_len = strlen(optiov[opt.uio_iovcnt].iov_base) + 1; opt.uio_iovcnt += 2; @@ -498,6 +481,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, i struct vnode *root; char *domain, *errmsg, *host, *name, *namelc, *p, *path, *uuid; char *g_path, *osrelstr; + struct bool_flags *bf; + struct jailsys_flags *jsf; #if defined(INET) || defined(INET6) struct prison *tppr; void *op; @@ -507,7 +492,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, i int born, created, cuflags, descend, enforce; int error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; - int fi, jid, jsys, len, level; + int jid, jsys, len, level; int childmax, osreldt, rsnum, slevel; int fullpath_disabled; #if defined(INET) || defined(INET6) @@ -605,30 +590,31 @@ kern_jail_set(struct thread *td, struct uio *optuio, i gotrsnum = 1; pr_flags = ch_flags = 0; - for (fi = 0; fi < nitems(pr_flag_names); fi++) { - if (pr_flag_names[fi] == NULL) - continue; - vfs_flagopt(opts, pr_flag_names[fi], &pr_flags, 1 << fi); - vfs_flagopt(opts, pr_flag_nonames[fi], &ch_flags, 1 << fi); + for (bf = pr_flag_bool; + bf < pr_flag_bool + nitems(pr_flag_bool); + bf++) { + vfs_flagopt(opts, bf->name, &pr_flags, bf->flag); + vfs_flagopt(opts, bf->noname, &ch_flags, bf->flag); } ch_flags |= pr_flags; - for (fi = 0; fi < nitems(pr_flag_jailsys); fi++) { - error = vfs_copyopt(opts, pr_flag_jailsys[fi].name, &jsys, - sizeof(jsys)); + for (jsf = pr_flag_jailsys; + jsf < pr_flag_jailsys + nitems(pr_flag_jailsys); + jsf++) { + error = vfs_copyopt(opts, jsf->name, &jsys, sizeof(jsys)); if (error == ENOENT) continue; if (error != 0) goto done_free; switch (jsys) { case JAIL_SYS_DISABLE: - if (!pr_flag_jailsys[fi].disable) { + if (!jsf->disable) { error = EINVAL; goto done_free; } - pr_flags |= pr_flag_jailsys[fi].disable; + pr_flags |= jsf->disable; break; case JAIL_SYS_NEW: - pr_flags |= pr_flag_jailsys[fi].new; + pr_flags |= jsf->new; break; case JAIL_SYS_INHERIT: break; @@ -636,8 +622,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, i error = EINVAL; goto done_free; } - ch_flags |= - pr_flag_jailsys[fi].new | pr_flag_jailsys[fi].disable; + ch_flags |= jsf->new | jsf->disable; } if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE && !(pr_flags & PR_PERSIST)) { @@ -668,9 +653,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, i #endif pr_allow = ch_allow = 0; - for (fi = 0; fi < nitems(pr_allow_names); fi++) { - vfs_flagopt(opts, pr_allow_names[fi], &pr_allow, 1 << fi); - vfs_flagopt(opts, pr_allow_nonames[fi], &ch_allow, 1 << fi); + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) { + vfs_flagopt(opts, bf->name, &pr_allow, bf->flag); + vfs_flagopt(opts, bf->noname, &ch_allow, bf->flag); } ch_allow |= pr_allow; @@ -1940,11 +1927,14 @@ sys_jail_get(struct thread *td, struct jail_get_args * int kern_jail_get(struct thread *td, struct uio *optuio, int flags) { + struct bool_flags *bf; + struct jailsys_flags *jsf; struct prison *pr, *mypr; struct vfsopt *opt; struct vfsoptlist *opts; char *errmsg, *name; - int error, errmsg_len, errmsg_pos, fi, i, jid, len, locked, pos; + int error, errmsg_len, errmsg_pos, i, jid, len, locked, pos; + unsigned f; if (flags & ~JAIL_GET_MASK) return (EINVAL); @@ -2101,39 +2091,38 @@ kern_jail_get(struct thread *td, struct uio *optuio, i sizeof(pr->pr_devfs_rsnum)); if (error != 0 && error != ENOENT) goto done_deref; - for (fi = 0; fi < nitems(pr_flag_names); fi++) { - if (pr_flag_names[fi] == NULL) - continue; - i = (pr->pr_flags & (1 << fi)) ? 1 : 0; - error = vfs_setopt(opts, pr_flag_names[fi], &i, sizeof(i)); + for (bf = pr_flag_bool; + bf < pr_flag_bool + nitems(pr_flag_bool); + bf++) { + i = (pr->pr_flags & bf->flag) ? 1 : 0; + error = vfs_setopt(opts, bf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; i = !i; - error = vfs_setopt(opts, pr_flag_nonames[fi], &i, sizeof(i)); + error = vfs_setopt(opts, bf->noname, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; } - for (fi = 0; fi < nitems(pr_flag_jailsys); fi++) { - i = pr->pr_flags & - (pr_flag_jailsys[fi].disable | pr_flag_jailsys[fi].new); - i = pr_flag_jailsys[fi].disable && - (i == pr_flag_jailsys[fi].disable) ? JAIL_SYS_DISABLE - : (i == pr_flag_jailsys[fi].new) ? JAIL_SYS_NEW + for (jsf = pr_flag_jailsys; + jsf < pr_flag_jailsys + nitems(pr_flag_jailsys); + jsf++) { + f = pr->pr_flags & (jsf->disable | jsf->new); + i = (f != 0 && f == jsf->disable) ? JAIL_SYS_DISABLE + : (f == jsf->new) ? JAIL_SYS_NEW : JAIL_SYS_INHERIT; - error = - vfs_setopt(opts, pr_flag_jailsys[fi].name, &i, sizeof(i)); + error = vfs_setopt(opts, jsf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; } - for (fi = 0; fi < nitems(pr_allow_names); fi++) { - if (pr_allow_names[fi] == NULL) - continue; - i = (pr->pr_allow & (1 << fi)) ? 1 : 0; - error = vfs_setopt(opts, pr_allow_names[fi], &i, sizeof(i)); + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) { + i = (pr->pr_allow & bf->flag) ? 1 : 0; + error = vfs_setopt(opts, bf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; i = !i; - error = vfs_setopt(opts, pr_allow_nonames[fi], &i, sizeof(i)); + error = vfs_setopt(opts, bf->noname, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; } @@ -4007,11 +3996,12 @@ prison_racct_detach(struct prison *pr) static void db_show_prison(struct prison *pr) { - int fi; + struct bool_flags *bf; + struct jailsys_flags *jsf; #if defined(INET) || defined(INET6) int ii; #endif - unsigned jsf; + unsigned f; #ifdef INET char ip4buf[INET_ADDRSTRLEN]; #endif @@ -4039,22 +4029,24 @@ db_show_prison(struct prison *pr) db_printf(" child = %p\n", LIST_FIRST(&pr->pr_children)); db_printf(" sibling = %p\n", LIST_NEXT(pr, pr_sibling)); db_printf(" flags = 0x%x", pr->pr_flags); - for (fi = 0; fi < nitems(pr_flag_names); fi++) - if (pr_flag_names[fi] != NULL && (pr->pr_flags & (1 << fi))) - db_printf(" %s", pr_flag_names[fi]); - for (fi = 0; fi < nitems(pr_flag_jailsys); fi++) { - jsf = pr->pr_flags & - (pr_flag_jailsys[fi].disable | pr_flag_jailsys[fi].new); - db_printf(" %-16s= %s\n", pr_flag_jailsys[fi].name, - pr_flag_jailsys[fi].disable && - (jsf == pr_flag_jailsys[fi].disable) ? "disable" - : (jsf == pr_flag_jailsys[fi].new) ? "new" + for (bf = pr_flag_bool; bf < pr_flag_bool + nitems(pr_flag_bool); bf++) + if (pr->pr_flags & bf->flag) + db_printf(" %s", bf->name); + for (jsf = pr_flag_jailsys; + jsf < pr_flag_jailsys + nitems(pr_flag_jailsys); + jsf++) { + f = pr->pr_flags & (jsf->disable | jsf->new); + db_printf(" %-16s= %s\n", jsf->name, + (f != 0 && f == jsf->disable) ? "disable" + : (f == jsf->new) ? "new" : "inherit"); } db_printf(" allow = 0x%x", pr->pr_allow); - for (fi = 0; fi < nitems(pr_allow_names); fi++) - if (pr_allow_names[fi] != NULL && (pr->pr_allow & (1 << fi))) - db_printf(" %s", pr_allow_names[fi]); + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) + if (pr->pr_allow & bf->flag) + db_printf(" %s", bf->name); db_printf("\n"); db_printf(" enforce_statfs = %d\n", pr->pr_enforce_statfs); db_printf(" host.hostname = %s\n", pr->pr_hostname); From owner-svn-src-all@freebsd.org Wed Mar 21 00:29:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57EA3F59AA9 for ; Wed, 21 Mar 2018 00:29:57 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yw0-x241.google.com (mail-yw0-x241.google.com [IPv6:2607:f8b0:4002:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BCFED71E41 for ; Wed, 21 Mar 2018 00:29:56 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yw0-x241.google.com with SMTP id y64so1160873ywa.3 for ; Tue, 20 Mar 2018 17:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=naWPISMBntOCF1Gz9MHvS/z7ckjgwHEYm2ih96sWrbU=; b=k+HcYVWHjUG84CXKFifTMq9/uMoYBHaM/NOi05VPJAzhy+s7v4eT2zqate6PoaabbE oy+8lrvFYQeZmmg+0C5fmxc3S3SJVh2u20n14IQrhqaNHpspO2EuvroDTxG4ZZ1tNMP6 U9xuk12CR0hgRk2AOU1LstQh/IW++C4ih0XOtdewkngFKvYA1RfkjvnanoIYucmCbY2+ 5J7wTmdhwxh8e9gYdLuv/8SrStiFG9HWyW26ee0h9lmvKaqQtD4658H+tzJ3hXpo/yhc L2CPwuxRu390o+WRqIe/p+hNyCxn4DPu1cSKVSN9j5+qJJyBcl+ESZPEciPX8CDvDO9I 4GVQ== 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=naWPISMBntOCF1Gz9MHvS/z7ckjgwHEYm2ih96sWrbU=; b=FUlbLGDfdvNaZ+kSubRMNWBibT/54h3BbdPCcjARfeGcrUj/xZ4NRhA20S+yw3O/EE SECVPnDB+rY7zTebus9Nt9ePk4Bb3b9EfaemV78sYJAguGO9q7Fx/XlvX9aePqUCX5TI sBXm4tCnumnTnNQzy79T+vZfzo8qeskbbS/2DMvwBx7rVXX/7q6tydoJxoM9FALn1aWY euIu0N0CmuQ2rOMnnJxOeSa799Ia8ZH2ADz7KLBTdqmPm6UJ53s/iAB/fwi6tjSFe7TQ Ub/nQqn03VnuUA8i4sOROusrLvxNo37QgrmhBjivqWkg0QvX8TSbf7A1NMLuZ/nJ5r1h sdhA== X-Gm-Message-State: AElRT7GN+yDrhMUD6NDw76SAV/3HwMaTfIQsD4gf7OWIMLlsjkpGkGer RG65ayw8/5aphqCcooHJo0zzoy13N7dFYn/qTG1Fmg== X-Google-Smtp-Source: AG47ELvU8+6+ipOqV50KxQzHJ1wqzQGwCSl8aY7YDyYlsyFaK97q34wHgcqrS/TAeFwLWtu6BX+i5VU7zumvJQ8FYuE= X-Received: by 10.13.204.146 with SMTP id o140mr10950229ywd.265.1521592195937; Tue, 20 Mar 2018 17:29:55 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:61c5:0:0:0:0:0 with HTTP; Tue, 20 Mar 2018 17:29:55 -0700 (PDT) In-Reply-To: <201803201743.w2KHhoF9055658@repo.freebsd.org> References: <201803201743.w2KHhoF9055658@repo.freebsd.org> From: Oliver Pinter Date: Wed, 21 Mar 2018 01:29:55 +0100 Message-ID: Subject: Re: svn commit: r331252 - in head/sys/amd64: amd64 include To: Konstantin Belousov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 00:29:57 -0000 On Tuesday, March 20, 2018, Konstantin Belousov wrote: > Author: kib > Date: Tue Mar 20 17:43:50 2018 > New Revision: 331252 > URL: https://svnweb.freebsd.org/changeset/base/331252 > > Log: > Provide KPI for handling of rw/ro kernel text. > > This is a pure syntax patch to create an interface to enable and later > restore write access to the kernel text and other read-only mapped > regions. It is in line with e.g. vm_fault_disable_pagefaults() by > allowing the nesting. > > Discussed with: Peter Lei > Reviewed by: jtl > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D14768 > > Modified: > head/sys/amd64/amd64/db_interface.c > head/sys/amd64/amd64/gdb_machdep.c > head/sys/amd64/amd64/machdep.c > head/sys/amd64/include/md_var.h > > Modified: head/sys/amd64/amd64/db_interface.c > ============================================================ > ================== > --- head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:43:50 2018 > (r331252) > @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); > #include > > #include > +#include > #include > > #include > @@ -75,19 +76,19 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da > jmp_buf jb; > void *prev_jb; > char *dst; > - u_long cr0save; > + bool old_wp; > int ret; > > - cr0save = rcr0(); > + old_wp = false; This line should be old_wp = (rcr0() & CR0_WP) ? true : false; to preserve the old behavior in ret != 0 case. > prev_jb = kdb_jmpbuf(jb); > ret = setjmp(jb); > if (ret == 0) { > - load_cr0(cr0save & ~CR0_WP); > + old_wp = disable_wp(); > dst = (char *)addr; > while (size-- > 0) > *dst++ = *data++; > } > - load_cr0(cr0save); > + restore_wp(old_wp); > (void)kdb_jmpbuf(prev_jb); > return (ret); > } > > Modified: head/sys/amd64/amd64/gdb_machdep.c > ============================================================ > ================== > --- head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:43:50 2018 > (r331252) > @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -127,17 +128,14 @@ gdb_cpu_signal(int type, int code) > void * > gdb_begin_write(void) > { > - u_long cr0save; > > - cr0save = rcr0(); > - load_cr0(cr0save & ~CR0_WP); > - return ((void *)cr0save); > + return (disable_wp() ? &gdb_begin_write : NULL); > } > > void > gdb_end_write(void *arg) > { > > - load_cr0((u_long)arg); > + restore_wp(arg != NULL); > } > > > Modified: head/sys/amd64/amd64/machdep.c > ============================================================ > ================== > --- head/sys/amd64/amd64/machdep.c Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/amd64/machdep.c Tue Mar 20 17:43:50 2018 > (r331252) > @@ -2597,6 +2597,31 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags) > : "cc", "memory"); > } > > +/* > + * Enable and restore kernel text write permissions. > + * Callers must ensure that disable_wp()/restore_wp() are executed > + * without rescheduling on the same core. > + */ > +bool > +disable_wp(void) > +{ > + u_int cr0; > + > + cr0 = rcr0(); > + if ((cr0 & CR0_WP) == 0) > + return (false); > + load_cr0(cr0 & ~CR0_WP); > + return (true); > +} > + > +void > +restore_wp(bool old_wp) > +{ > + > + if (old_wp) > + load_cr0(rcr0() | CR0_WP); > +} > + > #ifdef KDB > > /* > > Modified: head/sys/amd64/include/md_var.h > ============================================================ > ================== > --- head/sys/amd64/include/md_var.h Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/include/md_var.h Tue Mar 20 17:43:50 2018 > (r331252) > @@ -53,6 +53,8 @@ void amd64_conf_fast_syscall(void); > void amd64_db_resume_dbreg(void); > void amd64_lower_shared_page(struct sysentvec *); > void amd64_syscall(struct thread *td, int traced); > +bool disable_wp(void); > +void restore_wp(bool old_wp); > void doreti_iret(void) __asm(__STRING(doreti_iret)); > void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); > void ld_ds(void) __asm(__STRING(ld_ds)); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Wed Mar 21 00:57:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4A34F5BC27; Wed, 21 Mar 2018 00:57:25 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14613731D7; Wed, 21 Mar 2018 00:57:24 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2L0vMDk019009; Tue, 20 Mar 2018 17:57:22 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2L0vM2m019008; Tue, 20 Mar 2018 17:57:22 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803210057.w2L0vM2m019008@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331269 - head/share/man/man9 In-Reply-To: <201803202137.w2KLbXrp071489@repo.freebsd.org> To: Warner Losh Date: Tue, 20 Mar 2018 17:57:22 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 00:57:25 -0000 > Author: imp > Date: Tue Mar 20 21:37:33 2018 > New Revision: 331269 > URL: https://svnweb.freebsd.org/changeset/base/331269 > > Log: > Remove reference to lint. We no longer support it, so exceptions for > it are no longer relevant. I still believe this is putting the cart before the horse: /usr/src # find . -print0 | xargs -0 grep "ifndef lint" | wc 1228 2459 48568 > Modified: > head/share/man/man9/style.9 > > Modified: head/share/man/man9/style.9 > ============================================================================== > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) > @@ -107,11 +107,7 @@ Only add > .Dq Li "From: " > in front of foreign VCS IDs if the file is renamed. > .Bd -literal > -#if 0 > -#ifndef lint > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > -#endif /* not lint */ > -#endif > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ > > #include > __FBSDID("$FreeBSD$"); > @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) lo > greater than 20 lines, or where a series of nested > .Ic #ifdef 's > may be confusing to the reader. > -Exceptions may be made for cases where code is conditionally not compiled for > -the purposes of > -.Xr lint 1 , > -even though the uncompiled region may be small. > The comment should be separated from the > .Ic #endif > or > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Mar 21 01:15:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 957D6F5D070; Wed, 21 Mar 2018 01:15:47 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 410D973CC7; Wed, 21 Mar 2018 01:15:47 +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 369BD243E7; Wed, 21 Mar 2018 01:15:47 +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 w2L1FloX084716; Wed, 21 Mar 2018 01:15:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L1Fjt9084698; Wed, 21 Mar 2018 01:15:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210115.w2L1Fjt9084698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 01:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss X-SVN-Commit-Revision: 331279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:15:48 -0000 Author: cem Date: Wed Mar 21 01:15:45 2018 New Revision: 331279 URL: https://svnweb.freebsd.org/changeset/base/331279 Log: Implement getrandom(2) and getentropy(3) The general idea here is to provide userspace programs with well-defined sources of entropy, in a fashion that doesn't require opening a new file descriptor (ulimits) or accessing paths (/dev/urandom may be restricted by chroot or capsicum). getrandom(2) is the more general API, and comes from the Linux world. Since our urandom and random devices are identical, the GRND_RANDOM flag is ignored. getentropy(3) is added as a compatibility shim for the OpenBSD API. truss(1) support is included. Tests for both system calls are provided. Coverage is believed to be at least as comprehensive as LTP getrandom(2) test coverage. Additionally, instructions for running the LTP tests directly against FreeBSD are provided in the "Test Plan" section of the Differential revision linked below. (They pass, of course.) PR: 194204 Reported by: David CARLIER Discussed with: cperciva, delphij, jhb, markj Relnotes: maybe Differential Revision: https://reviews.freebsd.org/D14500 Added: head/lib/libc/gen/getentropy.3 (contents, props changed) head/lib/libc/gen/getentropy.c (contents, props changed) head/lib/libc/sys/getrandom.2 (contents, props changed) head/lib/libc/tests/gen/getentropy_test.c (contents, props changed) head/sys/kern/sys_getrandom.c (contents, props changed) head/tests/sys/kern/sys_getrandom.c (contents, props changed) Modified: head/include/unistd.h head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/tests/gen/Makefile head/sys/compat/freebsd32/syscalls.master head/sys/conf/files head/sys/kern/syscalls.master head/sys/sys/random.h head/tests/sys/kern/Makefile head/usr.bin/truss/syscalls.c Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Tue Mar 20 23:08:42 2018 (r331278) +++ head/include/unistd.h Wed Mar 21 01:15:45 2018 (r331279) @@ -506,6 +506,7 @@ int execvP(const char *, const char *, char * const * int feature_present(const char *); char *fflagstostr(u_long); int getdomainname(char *, int); +int getentropy(void *, size_t); int getgrouplist(const char *, gid_t, gid_t *, int *); int getloginclass(char *, size_t); mode_t getmode(const void *, mode_t); Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/gen/Makefile.inc Wed Mar 21 01:15:45 2018 (r331279) @@ -57,6 +57,7 @@ SRCS+= __getosreldate.c \ getcap.c \ getcwd.c \ getdomainname.c \ + getentropy.c \ getgrent.c \ getgrouplist.c \ gethostname.c \ @@ -220,6 +221,7 @@ MAN+= alarm.3 \ getcwd.3 \ getdiskbyname.3 \ getdomainname.3 \ + getentropy.3 \ getfsent.3 \ getgrent.3 \ getgrouplist.3 \ Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/gen/Symbol.map Wed Mar 21 01:15:45 2018 (r331279) @@ -408,6 +408,7 @@ FBSD_1.5 { fts_set; fts_set_clientptr; ftw; + getentropy; getmntinfo; glob; globfree; Added: head/lib/libc/gen/getentropy.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/getentropy.3 Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,86 @@ +.\" $OpenBSD: getentropy.2,v 1.8 2015/01/31 00:20:12 schwarze Exp $ +.\" +.\" Copyright (c) 2018 Conrad Meyer +.\" Copyright (c) 2014 Theo de Raadt +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 24, 2018 +.Dt GETENTROPY 3 +.Os +.Sh NAME +.Nm getentropy +.Nd get entropy +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In unistd.h +.Ft int +.Fn getentropy "void *buf" "size_t buflen" +.Sh DESCRIPTION +.Fn getentropy +fills a buffer with high-quality random data. +.Pp +The maximum +.Fa buflen +permitted is 256 bytes. +.Pp +If it does not produce an error, +.Fn getentropy +always provides the requested number of bytes of random data. +.Pp +Similar to reading from +.Pa /dev/urandom +just after boot, +.Fn getentropy +may block until the system has collected enough entropy to seed the CSPRNG. +.Sh IMPLEMENTATION NOTES +The +.Fn getentropy +function is implemented using +.Xr getrandom 2 . +.Sh RETURN VALUES +.Rv -std +.Sh ERRORS +.Fn getentropy +will succeed unless: +.Bl -tag -width Er +.It Bq Er EFAULT +The +.Fa buf +parameter points to an +invalid address. +.It Bq Er EIO +Too many bytes requested, or some other fatal error occurred. +.El +.Sh SEE ALSO +.Xr arc4random 3 , +.Xr getrandom 2 , +.Xr random 4 +.Sh STANDARDS +.Fn getentropy +is non-standard. +It is present on +.Ox +and Linux. +.Sh HISTORY +The +.Fn getentropy +function appeared in +.Ox 5.6 . +The +.Fx +libc compatibility shim first appeared in +.Fx 12.0 . Added: head/lib/libc/gen/getentropy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/getentropy.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,70 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 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 "libc_private.h" + +int +getentropy(void *buf, size_t buflen) +{ + ssize_t rd; + + if (buflen > 256) { + errno = EIO; + return (-1); + } + + while (buflen > 0) { + rd = getrandom(buf, buflen, 0); + if (rd == -1) { + if (errno == EINTR) + continue; + else if (errno == ENOSYS) + abort(); + else + return (-1); + } + + /* This cannot happen. */ + if (rd == 0) + abort(); + + buf = (char *)buf + rd; + buflen -= rd; + } + + return (0); +} Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/sys/Makefile.inc Wed Mar 21 01:15:45 2018 (r331279) @@ -197,6 +197,7 @@ MAN+= abort2.2 \ getpgrp.2 \ getpid.2 \ getpriority.2 \ + getrandom.2 \ getrlimit.2 \ getrusage.2 \ getsid.2 \ Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/sys/Symbol.map Wed Mar 21 01:15:45 2018 (r331279) @@ -392,6 +392,7 @@ FBSD_1.5 { getdents; getdirentries; getfsstat; + getrandom; kevent; lstat; mknod; @@ -627,6 +628,8 @@ FBSDprivate_1.0 { __sys_getppid; _getpriority; __sys_getpriority; + _getrandom; + __sys_getrandom; _getresgid; __sys_getresgid; _getresuid; Added: head/lib/libc/sys/getrandom.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/getrandom.2 Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,121 @@ +.\" Copyright (c) 2018 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 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. +.\" +.\" $FreeBSD$ +.\" +.Dd February 24, 2018 +.Dt GETRANDOM 2 +.Os +.Sh NAME +.Nm getrandom +.Nd get random data +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/random.h +.Ft ssize_t +.Fn getrandom "void *buf" "size_t buflen" "unsigned int flags" +.Sh DESCRIPTION +.Fn getrandom +fills +.Fa buf +with up to +.Fa buflen +bytes of random data. +.Pp +The +.Fa flags +argument may include zero or more of the following: +.Bl -tag -width _GRND_NONBLOCK_ +.It Ql GRND_NONBLOCK +Return +.Er EAGAIN +instead of blocking, if the +.Xr random 4 +device has not yet been seeded. +By default, +.Fn getrandom +will block until the device is seeded. +.It Ql GRND_RANDOM +This flag does nothing on +.Fx . +.Pa /dev/random +and +.Pa /dev/urandom +are identical. +.El +.Pp +If the +.Xr random 4 +device has been seeded, reads of up to 256 bytes will always return as many +bytes as requested and will not be interrupted by signals. +.Pp +.Sh RETURN VALUES +Upon successful completion, the number of bytes which were actually read is +returned. +For requests larger than 256 bytes, this can be fewer bytes than were +requested. +Otherwise, -1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn getrandom +operation returns the following errors: +.Bl -tag -width Er +.It Bq Er EAGAIN +The +.Ql GRND_NONBLOCK +flag was set and the +.Xr random 4 +device was not yet seeded. +.It Bq Er EFAULT +The +.Fa buf +parameter points to an invalid address. +.It Bq Er EINTR +The sleep was interrupted by a signal. +.It Bq Er EINVAL +An invalid +.Fa flags +was specified. +.It Bq Er EINVAL +The requested +.Fa buflen +was larger than +.Dv IOSIZE_MAX . +.El +.Sh SEE ALSO +.Xr arc4random 3 , +.Xr getentropy 3 , +.Xr random 4 +.Sh STANDARDS +.Fn getentropy +is non-standard. +It is present in Linux. +.Sh HISTORY +The +.Fn getrandom +system call first appeared in +.Fx 12.0 . Modified: head/lib/libc/tests/gen/Makefile ============================================================================== --- head/lib/libc/tests/gen/Makefile Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/tests/gen/Makefile Wed Mar 21 01:15:45 2018 (r331279) @@ -10,6 +10,7 @@ ATF_TESTS_C+= fmtmsg_test ATF_TESTS_C+= fnmatch2_test ATF_TESTS_C+= fpclassify2_test ATF_TESTS_C+= ftw_test +ATF_TESTS_C+= getentropy_test ATF_TESTS_C+= getmntinfo_test ATF_TESTS_C+= glob2_test ATF_TESTS_C+= makecontext_test @@ -61,6 +62,8 @@ NETBSD_ATF_TESTS_C+= vis_test .include "../Makefile.netbsd-tests" +CFLAGS.getentropy_test+= -I${SRCTOP}/include +LIBADD.getentropy_test+= c LIBADD.humanize_number_test+= util LIBADD.fpclassify_test+=m Added: head/lib/libc/tests/gen/getentropy_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/gen/getentropy_test.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,84 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 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 + +ATF_TC_WITHOUT_HEAD(getentropy_count); +ATF_TC_BODY(getentropy_count, tc) +{ + char buf[2]; + int ret; + + /* getentropy(2) does not modify buf past the requested length */ + buf[1] = 0x7C; + ret = getentropy(buf, 1); + ATF_REQUIRE_EQ(ret, 0); + ATF_REQUIRE_EQ(buf[1], 0x7C); +} + +ATF_TC_WITHOUT_HEAD(getentropy_fault); +ATF_TC_BODY(getentropy_fault, tc) +{ + int ret; + + ret = getentropy(NULL, 1); + ATF_REQUIRE_EQ(ret, -1); + ATF_REQUIRE_EQ(errno, EFAULT); +} + +ATF_TC_WITHOUT_HEAD(getentropy_sizes); +ATF_TC_BODY(getentropy_sizes, tc) +{ + char buf[512]; + + ATF_REQUIRE_EQ(getentropy(buf, sizeof(buf)), -1); + ATF_REQUIRE_EQ(errno, EIO); + ATF_REQUIRE_EQ(getentropy(buf, 257), -1); + ATF_REQUIRE_EQ(errno, EIO); + + /* Smaller sizes always succeed: */ + ATF_REQUIRE_EQ(getentropy(buf, 256), 0); + ATF_REQUIRE_EQ(getentropy(buf, 128), 0); + ATF_REQUIRE_EQ(getentropy(buf, 0), 0); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, getentropy_count); + ATF_TP_ADD_TC(tp, getentropy_fault); + ATF_TP_ADD_TC(tp, getentropy_sizes); + return (atf_no_error()); +} Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/compat/freebsd32/syscalls.master Wed Mar 21 01:15:45 2018 (r331279) @@ -1116,5 +1116,7 @@ cpuwhich_t which, uint32_t id1, uint32_t id2, \ size_t domainsetsize, domainset_t *mask, \ int policy); } +563 AUE_NULL NOPROTO { int getrandom(void *buf, size_t buflen, \ + unsigned int flags); } ; vim: syntax=off Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/conf/files Wed Mar 21 01:15:45 2018 (r331279) @@ -3895,6 +3895,7 @@ kern/subr_vmem.c standard kern/subr_witness.c optional witness kern/sys_capability.c standard kern/sys_generic.c standard +kern/sys_getrandom.c standard kern/sys_pipe.c standard kern/sys_procdesc.c standard kern/sys_process.c standard Added: head/sys/kern/sys_getrandom.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/sys_getrandom.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,97 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 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 "opt_compat.h" + +#include +#include +#include +#include +#include +#include +#include + +#define GRND_VALIDFLAGS (GRND_NONBLOCK | GRND_RANDOM) + +/* + * random_read_uio(9) returns EWOULDBLOCK if a nonblocking request would block, + * but the Linux API name is EAGAIN. On FreeBSD, they have the same numeric + * value for now. + */ +CTASSERT(EWOULDBLOCK == EAGAIN); + +static int +kern_getrandom(struct thread *td, void *user_buf, size_t buflen, + unsigned int flags) +{ + struct uio auio; + struct iovec aiov; + int error; + + if ((flags & ~GRND_VALIDFLAGS) != 0) + return (EINVAL); + if (buflen > IOSIZE_MAX) + return (EINVAL); + + if (buflen == 0) { + td->td_retval[0] = 0; + return (0); + } + + aiov.iov_base = user_buf; + aiov.iov_len = buflen; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_offset = 0; + auio.uio_resid = buflen; + auio.uio_segflg = UIO_USERSPACE; + auio.uio_rw = UIO_READ; + auio.uio_td = td; + + error = read_random_uio(&auio, (flags & GRND_NONBLOCK) != 0); + if (error == 0) + td->td_retval[0] = buflen - auio.uio_resid; + return (error); +} + +#ifndef _SYS_SYSPROTO_H_ +struct getrandom_args { + void *buf; + size_t buflen; + unsigned int flags; +}; +#endif + +int +sys_getrandom(struct thread *td, struct getrandom_args *uap) +{ + return (kern_getrandom(td, uap->buf, uap->buflen, uap->flags)); +} Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/kern/syscalls.master Wed Mar 21 01:15:45 2018 (r331279) @@ -1021,6 +1021,8 @@ cpuwhich_t which, id_t id, \ size_t domainsetsize, domainset_t *mask, \ int policy); } +563 AUE_NULL STD { int getrandom(void *buf, size_t buflen, \ + unsigned int flags); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/sys/random.h Wed Mar 21 01:15:45 2018 (r331279) @@ -31,10 +31,10 @@ #ifndef _SYS_RANDOM_H_ #define _SYS_RANDOM_H_ -#ifdef _KERNEL - #include +#ifdef _KERNEL + #if !defined(KLD_MODULE) #if defined(RANDOM_LOADABLE) && defined(RANDOM_YARROW) #error "Cannot define both RANDOM_LOADABLE and RANDOM_YARROW" @@ -126,5 +126,9 @@ void random_harvest_deregister_source(enum random_entr #endif /* defined(RANDOM_ENABLE_UMA) */ #endif /* _KERNEL */ + +#define GRND_NONBLOCK 0x1 +#define GRND_RANDOM 0x2 +ssize_t getrandom(void *buf, size_t buflen, unsigned int flags); #endif /* _SYS_RANDOM_H_ */ Modified: head/tests/sys/kern/Makefile ============================================================================== --- head/tests/sys/kern/Makefile Tue Mar 20 23:08:42 2018 (r331278) +++ head/tests/sys/kern/Makefile Wed Mar 21 01:15:45 2018 (r331279) @@ -11,6 +11,7 @@ ATF_TESTS_C+= ptrace_test TEST_METADATA.ptrace_test+= timeout="15" ATF_TESTS_C+= reaper PLAIN_TESTS_C+= subr_unit_test +ATF_TESTS_C+= sys_getrandom ATF_TESTS_C+= unix_seqpacket_test ATF_TESTS_C+= unix_passfd_test TEST_METADATA.unix_seqpacket_test+= timeout="15" @@ -21,6 +22,10 @@ ATF_TESTS_SH+= coredump_phnum_test BINDIR= ${TESTSDIR} PROGS+= coredump_phnum_helper +CFLAGS.sys_getrandom+= -I${SRCTOP}/sys/contrib/zstd/lib +LIBADD.sys_getrandom+= zstd +LIBADD.sys_getrandom+= c +LIBADD.sys_getrandom+= pthread LIBADD.ptrace_test+= pthread LIBADD.unix_seqpacket_test+= pthread Added: head/tests/sys/kern/sys_getrandom.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kern/sys_getrandom.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,130 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 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 + +const static unsigned valid_flags[] = { 0, GRND_NONBLOCK, GRND_RANDOM, + GRND_NONBLOCK | GRND_RANDOM }; + +ATF_TC_WITHOUT_HEAD(getrandom_randomness); +ATF_TC_BODY(getrandom_randomness, tc) +{ + char randomb[4096], compressed[5000]; + ssize_t ret; + size_t i, j, c; + unsigned mode; + + for (i = 0; i < nitems(valid_flags); i++) { + mode = valid_flags[i]; + + /* Get new random data, filling randomb. */ + + memset(randomb, 0, sizeof(randomb)); + + for (j = 0; j < sizeof(randomb);) { + ret = getrandom(&randomb[j], sizeof(randomb) - j, mode); + if (ret < 0 && (mode & GRND_NONBLOCK) != 0 && + errno == EAGAIN) + continue; + + ATF_REQUIRE_MSG(ret >= 0, "other error: %d", errno); + ATF_REQUIRE_MSG(ret > 0, "bogus zero return"); + + j += (size_t)ret; + } + + /* Perform compressibility test */ + c = ZSTD_compress(compressed, sizeof(compressed), randomb, + sizeof(randomb), ZSTD_maxCLevel()); + ATF_REQUIRE_MSG(!ZSTD_isError(c), "zstd compress: %s", + ZSTD_getErrorName(c)); + + /* + * If the output is very compressible, it's probably not random + */ + ATF_REQUIRE_MSG(c > (sizeof(randomb) * 4 / 5), + "purportedly random data was compressible: %zu/%zu or %f%%", + c, sizeof(randomb), (double)c / (double)sizeof(randomb)); + } +} + +ATF_TC_WITHOUT_HEAD(getrandom_fault); +ATF_TC_BODY(getrandom_fault, tc) +{ + ssize_t ret; + + ret = getrandom(NULL, 1, 0); + ATF_REQUIRE_EQ(ret, -1); + ATF_REQUIRE_EQ(errno, EFAULT); +} + +ATF_TC_WITHOUT_HEAD(getrandom_count); +ATF_TC_BODY(getrandom_count, tc) +{ + char buf[4096], reference[4096]; + ssize_t ret; + + /* getrandom(2) does not modify buf past the requested length */ + _Static_assert(sizeof(reference) == sizeof(buf), "must match"); + memset(reference, 0x7C, sizeof(reference)); + + memset(buf, 0x7C, sizeof(buf)); + ret = getrandom(buf, 1, 0); + ATF_REQUIRE_EQ(ret, 1); + ATF_REQUIRE_EQ(memcmp(&buf[1], reference, sizeof(reference) - 1), 0); + + memset(buf, 0x7C, sizeof(buf)); + ATF_REQUIRE_EQ(getrandom(buf, 15, 0), 15); + ATF_REQUIRE_EQ(memcmp(&buf[15], reference, sizeof(reference) - 15), 0); + + memset(buf, 0x7C, sizeof(buf)); + ATF_REQUIRE_EQ(getrandom(buf, 255, 0), 255); + ATF_REQUIRE_EQ(memcmp(&buf[255], reference, sizeof(reference) - 255), 0); + + memset(buf, 0x7C, sizeof(buf)); + ATF_REQUIRE_EQ(getrandom(buf, 4095, 0), 4095); + ATF_REQUIRE_EQ(memcmp(&buf[4095], reference, sizeof(reference) - 4095), 0); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, getrandom_count); + ATF_TP_ADD_TC(tp, getrandom_fault); + ATF_TP_ADD_TC(tp, getrandom_randomness); + return (atf_no_error()); +} Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Tue Mar 20 23:08:42 2018 (r331278) +++ head/usr.bin/truss/syscalls.c Wed Mar 21 01:15:45 2018 (r331279) @@ -259,6 +259,8 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 } } }, { .name = "getpriority", .ret_type = 1, .nargs = 2, .args = { { Priowhich, 0 }, { Int, 1 } } }, + { .name = "getrandom", .ret_type = 1, .nargs = 3, + .args = { { BinString | OUT, 0 }, { Sizet, 1 }, { UInt, 2 } } }, { .name = "getrlimit", .ret_type = 1, .nargs = 2, .args = { { Resource, 0 }, { Rlimit | OUT, 1 } } }, { .name = "getrusage", .ret_type = 1, .nargs = 2, From owner-svn-src-all@freebsd.org Wed Mar 21 01:17:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 225CFF5D1C3; Wed, 21 Mar 2018 01:17:03 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7B9573E96; Wed, 21 Mar 2018 01:17: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 C29E724406; Wed, 21 Mar 2018 01:17: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 w2L1H2ws084824; Wed, 21 Mar 2018 01:17:02 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L1H1C7084812; Wed, 21 Mar 2018 01:17:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210117.w2L1H1C7084812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 01:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331280 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 331280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:17:03 -0000 Author: cem Date: Wed Mar 21 01:17:01 2018 New Revision: 331280 URL: https://svnweb.freebsd.org/changeset/base/331280 Log: Regenerate sysent files after r331279. Modified: head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Wed Mar 21 01:17:01 2018 (r331280) @@ -468,4 +468,5 @@ #define FREEBSD32_SYS_freebsd32_kevent 560 #define FREEBSD32_SYS_freebsd32_cpuset_getdomain 561 #define FREEBSD32_SYS_freebsd32_cpuset_setdomain 562 -#define FREEBSD32_SYS_MAXSYSCALL 563 +#define FREEBSD32_SYS_getrandom 563 +#define FREEBSD32_SYS_MAXSYSCALL 564 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Mar 21 01:17:01 2018 (r331280) @@ -595,4 +595,5 @@ const char *freebsd32_syscallnames[] = { "freebsd32_kevent", /* 560 = freebsd32_kevent */ "freebsd32_cpuset_getdomain", /* 561 = freebsd32_cpuset_getdomain */ "freebsd32_cpuset_setdomain", /* 562 = freebsd32_cpuset_setdomain */ + "getrandom", /* 563 = getrandom */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Wed Mar 21 01:17:01 2018 (r331280) @@ -644,4 +644,5 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_kevent_args), (sy_call_t *)freebsd32_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = freebsd32_kevent */ { AS(freebsd32_cpuset_getdomain_args), (sy_call_t *)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = freebsd32_cpuset_getdomain */ { AS(freebsd32_cpuset_setdomain_args), (sy_call_t *)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = freebsd32_cpuset_setdomain */ + { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 563 = getrandom */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Mar 21 01:17:01 2018 (r331280) @@ -3274,6 +3274,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 7; break; } + /* getrandom */ + case 563: { + struct getrandom_args *p = params; + uarg[0] = (intptr_t) p->buf; /* void * */ + uarg[1] = p->buflen; /* size_t */ + uarg[2] = p->flags; /* unsigned int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8800,6 +8809,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* getrandom */ + case 563: + switch(ndx) { + case 0: + p = "userland void *"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "unsigned int"; + break; + default: + break; + }; + break; default: break; }; @@ -10648,6 +10673,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* freebsd32_cpuset_setdomain */ case 562: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* getrandom */ + case 563: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/kern/init_sysent.c Wed Mar 21 01:17:01 2018 (r331280) @@ -614,4 +614,5 @@ struct sysent sysent[] = { { AS(kevent_args), (sy_call_t *)sys_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = kevent */ { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = cpuset_getdomain */ { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = cpuset_setdomain */ + { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 563 = getrandom */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/kern/syscalls.c Wed Mar 21 01:17:01 2018 (r331280) @@ -569,4 +569,5 @@ const char *syscallnames[] = { "kevent", /* 560 = kevent */ "cpuset_getdomain", /* 561 = cpuset_getdomain */ "cpuset_setdomain", /* 562 = cpuset_setdomain */ + "getrandom", /* 563 = getrandom */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/kern/systrace_args.c Wed Mar 21 01:17:01 2018 (r331280) @@ -3282,6 +3282,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 6; break; } + /* getrandom */ + case 563: { + struct getrandom_args *p = params; + uarg[0] = (intptr_t) p->buf; /* void * */ + uarg[1] = p->buflen; /* size_t */ + uarg[2] = p->flags; /* unsigned int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8752,6 +8761,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* getrandom */ + case 563: + switch(ndx) { + case 0: + p = "userland void *"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "unsigned int"; + break; + default: + break; + }; + break; default: break; }; @@ -10635,6 +10660,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* cpuset_setdomain */ case 562: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* getrandom */ + case 563: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/sys/syscall.h Wed Mar 21 01:17:01 2018 (r331280) @@ -478,4 +478,5 @@ #define SYS_kevent 560 #define SYS_cpuset_getdomain 561 #define SYS_cpuset_setdomain 562 -#define SYS_MAXSYSCALL 563 +#define SYS_getrandom 563 +#define SYS_MAXSYSCALL 564 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/sys/syscall.mk Wed Mar 21 01:17:01 2018 (r331280) @@ -405,4 +405,5 @@ MIASM = \ mknodat.o \ kevent.o \ cpuset_getdomain.o \ - cpuset_setdomain.o + cpuset_setdomain.o \ + getrandom.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/sys/sysproto.h Wed Mar 21 01:17:01 2018 (r331280) @@ -1768,6 +1768,11 @@ struct cpuset_setdomain_args { char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)]; }; +struct getrandom_args { + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char buflen_l_[PADL_(size_t)]; size_t buflen; char buflen_r_[PADR_(size_t)]; + char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2148,6 +2153,7 @@ int sys_mknodat(struct thread *, struct mknodat_args * int sys_kevent(struct thread *, struct kevent_args *); int sys_cpuset_getdomain(struct thread *, struct cpuset_getdomain_args *); int sys_cpuset_setdomain(struct thread *, struct cpuset_setdomain_args *); +int sys_getrandom(struct thread *, struct getrandom_args *); #ifdef COMPAT_43 @@ -3040,6 +3046,7 @@ int freebsd11_mknodat(struct thread *, struct freebsd1 #define SYS_AUE_kevent AUE_KEVENT #define SYS_AUE_cpuset_getdomain AUE_NULL #define SYS_AUE_cpuset_setdomain AUE_NULL +#define SYS_AUE_getrandom AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-all@freebsd.org Wed Mar 21 01:40:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A067EF5EB6E for ; Wed, 21 Mar 2018 01:40:55 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 2E80D74F3A for ; Wed, 21 Mar 2018 01:40:55 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: bf2f9271-2ca8-11e8-b951-f99fef315fd9 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 outbound2.ore.mailhop.org (Halon) with ESMTPSA id bf2f9271-2ca8-11e8-b951-f99fef315fd9; Wed, 21 Mar 2018 01:39:51 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w2L1epIj041495; Tue, 20 Mar 2018 19:40:51 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1521596451.54965.39.camel@freebsd.org> Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss From: Ian Lepore To: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 20 Mar 2018 19:40:51 -0600 In-Reply-To: <201803210115.w2L1Fjt9084698@repo.freebsd.org> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:40:55 -0000 On Wed, 2018-03-21 at 01:15 +0000, Conrad Meyer wrote: > Author: cem > Date: Wed Mar 21 01:15:45 2018 > New Revision: 331279 > URL: https://svnweb.freebsd.org/changeset/base/331279 > > Log: >   Implement getrandom(2) and getentropy(3) >    >   The general idea here is to provide userspace programs with well- > defined >   sources of entropy, in a fashion that doesn't require opening a new > file >   descriptor (ulimits) or accessing paths (/dev/urandom may be > restricted >   by chroot or capsicum). >    >   getrandom(2) is the more general API, and comes from the Linux > world. >   Since our urandom and random devices are identical, the GRND_RANDOM > flag >   is ignored. >    >   getentropy(3) is added as a compatibility shim for the OpenBSD API. >    >   truss(1) support is included. >    >   Tests for both system calls are provided.  Coverage is believed to > be at >   least as comprehensive as LTP getrandom(2) test > coverage.  Additionally, >   instructions for running the LTP tests directly against FreeBSD are > provided >   in the "Test Plan" section of the Differential revision linked > below.  (They >   pass, of course.) >    >   PR: 194204 >   Reported by: David CARLIER hardenedbsd.org> >   Discussed with: cperciva, delphij, jhb, markj >   Relnotes: maybe >   Differential Revision: https://reviews.freebsd.org/D14500 > A good followup to this might be to switch libc's arc4random seeding to getrandom(), instead of using a sysctl in a loop. -- Ian From owner-svn-src-all@freebsd.org Wed Mar 21 01:47:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C0A6F5F201 for ; Wed, 21 Mar 2018 01:47:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2815B752CC for ; Wed, 21 Mar 2018 01:47:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x229.google.com with SMTP id e195-v6so4895312ita.5 for ; Tue, 20 Mar 2018 18:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=idDyOhCQ7P43LV3Jz2315nb5fh2fNRMNSAN0D7sg8Vw=; b=h0q6iYawrO4VNxPgw/t57IoHpp+/2//GncFR87kocYf83JIedd+F/eyaMdgA6RXUea 7T4PnS0HyWIvi7MIYTkTUTpqp1MF1oTzX7vYbMlVisusIQK91qjG9Nl2luxfz7Ey3bR4 OSzJtI9bs1t1Uvs/ElcITfc//UYQ3GVAMoEh3Kbu5kM+SyWn+i5XK1UFaK/LQgSJLd4H jVcv0T9A8RevaKMqSZHRiaGm24BvWb02fNy0XXbPe2c0PuqvUatR1Ac3WFBhE0YV+DnF ct3kUWAwvJF/7lGv7/zXPHUupu41o4N7SvWCt9GxAmJwIB5xHZvWIQ33LXZ1u8rXvbuZ DbuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=idDyOhCQ7P43LV3Jz2315nb5fh2fNRMNSAN0D7sg8Vw=; b=Ov+SE2QLHT+4Lm850sUql4y2Gnu0AnVzKJghsZXDJlvQRrENJ5ePL7lufrkydQJNBI qbVqrXQJj+FtfpuUXoFQtzmglyLIDBkDyXLHHDqRXpQAiE/A3axEq0uRcxEzzrsocpWE WgGj/UU8uzPIh+94GOGL5KeqZehUY8mevM4lx/vPsFBFqhSByThv+NxcTip5HYXP1BVC nfpG2JZX+kFxucTOoL3+Xm2YAcigoG+frCCdiWccFNRe2LHkUfqSuz5VffSA23xNZe7I N8dMauhpGoDv8FNcm+3BJFEEZCTxH13xUlIy5QSmrv1B+KIjlkV0mtMHwwOg+54FKgHT D60Q== X-Gm-Message-State: AElRT7GGN+7V2+z/RZ9pO4Ln3jy4+gsRTfdZL0TPqR2hed3uNECcsejT 2gNo3OKH18zBhyC+Y2E8AJJKIhEl/Ialps31uWQLjw== X-Google-Smtp-Source: AG47ELtiK3GzNETt/93zcRGgBP6NO+ta7fFABIm096L/ChwOJ+hd9S4KG9HuXLJFJ4+0fclE7S8VSLX+z9PKovqR7cU= X-Received: by 2002:a24:fa83:: with SMTP id v125-v6mr2233138ith.36.1521596837284; Tue, 20 Mar 2018 18:47:17 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Tue, 20 Mar 2018 18:47:15 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:b173:8715:8433:2600] Received: by 10.79.203.196 with HTTP; Tue, 20 Mar 2018 18:47:15 -0700 (PDT) In-Reply-To: <201803210057.w2L0vM2m019008@pdx.rh.CN85.dnsmgr.net> References: <201803202137.w2KLbXrp071489@repo.freebsd.org> <201803210057.w2L0vM2m019008@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Tue, 20 Mar 2018 19:47:15 -0600 X-Google-Sender-Auth: PDtuU3Z4C26CcGRaVH6Cu9usJx0 Message-ID: Subject: Re: svn commit: r331269 - head/share/man/man9 To: "Rodney W. Grimes" Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:47:18 -0000 On Mar 20, 2018 6:57 PM, "Rodney W. Grimes" wrote: > Author: imp > Date: Tue Mar 20 21:37:33 2018 > New Revision: 331269 > URL: https://svnweb.freebsd.org/changeset/base/331269 > > Log: > Remove reference to lint. We no longer support it, so exceptions for > it are no longer relevant. I still believe this is putting the cart before the horse: /usr/src # find . -print0 | xargs -0 grep "ifndef lint" | wc 1228 2459 48568 Perhaps yes, perhaps no. They are slowly being eliminated and no new lint code. It's time. Warner > Modified: > head/share/man/man9/style.9 > > Modified: head/share/man/man9/style.9 > ============================================================ ================== > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) > @@ -107,11 +107,7 @@ Only add > .Dq Li "From: " > in front of foreign VCS IDs if the file is renamed. > .Bd -literal > -#if 0 > -#ifndef lint > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > -#endif /* not lint */ > -#endif > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ > > #include > __FBSDID("$FreeBSD$"); > @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) lo > greater than 20 lines, or where a series of nested > .Ic #ifdef 's > may be confusing to the reader. > -Exceptions may be made for cases where code is conditionally not compiled for > -the purposes of > -.Xr lint 1 , > -even though the uncompiled region may be small. > The comment should be separated from the > .Ic #endif > or > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Mar 21 01:51:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34FC9F5F816; Wed, 21 Mar 2018 01:51:46 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9872A755D4; Wed, 21 Mar 2018 01:51:44 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2L1peHt019278; Tue, 20 Mar 2018 18:51:40 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2L1pelA019277; Tue, 20 Mar 2018 18:51:40 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803210151.w2L1pelA019277@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331269 - head/share/man/man9 In-Reply-To: To: Warner Losh Date: Tue, 20 Mar 2018 18:51:40 -0700 (PDT) CC: "Rodney W. Grimes" , Warner Losh , src-committers , 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-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:51:46 -0000 > > On Mar 20, 2018 6:57 PM, "Rodney W. Grimes" > > wrote: > > > > > Author: imp > > > Date: Tue Mar 20 21:37:33 2018 > > > New Revision: 331269 > > > URL: https://svnweb.freebsd.org/changeset/base/331269 > > > > > > Log: > > > Remove reference to lint. We no longer support it, so exceptions for > > > it are no longer relevant. > > > > I still believe this is putting the cart before the horse: > > /usr/src # find . -print0 | xargs -0 grep "ifndef lint" | wc > > 1228 2459 48568 > > > > Perhaps yes, perhaps no. They are slowly being eliminated and no new lint > code. It's time. You will find that there is much of this in contrib, so it will not be so easy to eliminate. And again, your email client is not quoting properly, I have re-quoted it. > Warner > > > Modified: > > head/share/man/man9/style.9 > > > > Modified: head/share/man/man9/style.9 > > ============================================================ > ================== > > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 > (r331268) > > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 > (r331269) > > @@ -107,11 +107,7 @@ Only add > > .Dq Li "From: " > > in front of foreign VCS IDs if the file is renamed. > > .Bd -literal > > -#if 0 > > -#ifndef lint > > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > > -#endif /* not lint */ > > -#endif > > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ > > > > #include > > __FBSDID("$FreeBSD$"); > > @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) > lo > > greater than 20 lines, or where a series of nested > > .Ic #ifdef 's > > may be confusing to the reader. > > -Exceptions may be made for cases where code is conditionally not > compiled for > > -the purposes of > > -.Xr lint 1 , > > -even though the uncompiled region may be small. > > The comment should be separated from the > > .Ic #endif > > or > > > > > > -- > Rod Grimes > rgrimes@freebsd.org -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Mar 21 03:07:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A29FAF64229; Wed, 21 Mar 2018 03:07:17 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 57DB977F82; Wed, 21 Mar 2018 03:07:17 +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 4C4EF254FE; Wed, 21 Mar 2018 03:07:17 +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 w2L37HmW041097; Wed, 21 Mar 2018 03:07:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L37Gnp041093; Wed, 21 Mar 2018 03:07:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803210307.w2L37Gnp041093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 03:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331281 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 03:07:17 -0000 Author: kevans Date: Wed Mar 21 03:07:16 2018 New Revision: 331281 URL: https://svnweb.freebsd.org/changeset/base/331281 Log: lualoader: Add primitive hook module, use it to untangle bogus reference See: comments in the hook module about intended usage, as well as the introduced use for config.reloaded. Use the newly introduced hook module to define a "config.reloaded" hook. This is currently used to register core's clearKernelCache as a reload hook to avoid a circular dependency and fix this functionality- it didn't actually work out, and it isn't immediately obvious how it slipped into src. Other hook types will be introduced into the core lualoader as useful hook points are identified. Added: head/stand/lua/hook.lua (contents, props changed) Modified: head/stand/lua/Makefile head/stand/lua/config.lua head/stand/lua/core.lua Modified: head/stand/lua/Makefile ============================================================================== --- head/stand/lua/Makefile Wed Mar 21 01:17:01 2018 (r331280) +++ head/stand/lua/Makefile Wed Mar 21 03:07:16 2018 (r331281) @@ -8,6 +8,7 @@ FILES= cli.lua \ config.lua \ core.lua \ drawer.lua \ + hook.lua \ loader.lua \ menu.lua \ password.lua \ Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Mar 21 01:17:01 2018 (r331280) +++ head/stand/lua/config.lua Wed Mar 21 03:07:16 2018 (r331281) @@ -29,6 +29,8 @@ -- $FreeBSD$ -- +local hook = require("hook") + local config = {} local modules = {} local carousel_choices = {} @@ -503,7 +505,7 @@ function config.reload(file) modules = {} config.restoreEnv() config.load(file) - core.configReloaded() + hook.runAll("config.reloaded") end function config.loadelf() @@ -523,4 +525,5 @@ function config.loadelf() end end +hook.registerType("config.reloaded") return config Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Mar 21 01:17:01 2018 (r331280) +++ head/stand/lua/core.lua Wed Mar 21 03:07:16 2018 (r331281) @@ -30,6 +30,7 @@ -- local config = require("config") +local hook = require("hook") local core = {} @@ -138,7 +139,7 @@ function core.setSafeMode(safe_mode) core.sm = safe_mode end -function core.configReloaded() +function core.clearCachedKernels() -- Clear the kernel cache on config changes, autodetect might have -- changed or if we've switched boot environments then we could have -- a new kernel set. @@ -364,4 +365,6 @@ end if core.isSystem386() and core.getACPIPresent(false) then core.setACPI(true) end + +hook.register("config.reloaded", core.clearCachedKernels) return core Added: head/stand/lua/hook.lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/lua/hook.lua Wed Mar 21 03:07:16 2018 (r331281) @@ -0,0 +1,84 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- 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$ +-- + +local hook = {} + +local registered_hooks = {} + +-- Module exports +-- Register a hook type; these are the names that hooks may be registered for. +-- It is expected that modules will register all of their hook types upon +-- initial load. Other modules may then, at any time, register a hook for these +-- types. +-- +-- Naming convention: hook types should be sensible named, preferably prefixed +-- with the name of the module that registered them. They would also ideally +-- describe an action that may or may not match a function name. +-- e.g. config.reloaded which takes place after config has been reloaded, +-- possibly from a different source. +function hook.registerType(hooktype) + registered_hooks[hooktype] = {} +end + +function hook.register(hooktype, hookfunc) + local selected_hooks = registered_hooks[hooktype] + if selected_hooks == nil then + print("Tried registering a hook for an unknown hook type: " .. + hooktype) + return + end + selected_hooks[#selected_hooks + 1] = hookfunc + registered_hooks[hooktype] = selected_hooks +end + +-- Takes a hooktype and runs all functions associated with that specific hook +-- type in the order that they were registered in. This ordering should likely +-- not be relied upon. +function hook.runAll(hooktype) + local selected_hooks = registered_hooks[hooktype] + if selected_hooks == nil then + -- This message, and the print() above, should only be seen by + -- developers. Hook type registration should have happened at + -- module load, so if this hasn't happened then we have messed + -- up the order in which we've loaded modules and we need to + -- catch that as soon as possible. + print("Tried to run hooks for an unknown hook type: " .. + hooktype) + return 0 + end + if #selected_hooks > 0 then + for _, func in ipairs(selected_hooks) do + func() + end + end + return #selected_hooks +end + +return hook From owner-svn-src-all@freebsd.org Wed Mar 21 03:16:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E29FF64BDA; Wed, 21 Mar 2018 03:16:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF5BF7858F; Wed, 21 Mar 2018 03:16:14 +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 A9FB925684; Wed, 21 Mar 2018 03:16:14 +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 w2L3GENe045919; Wed, 21 Mar 2018 03:16:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L3GEYF045918; Wed, 21 Mar 2018 03:16:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803210316.w2L3GEYF045918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 03:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331282 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 03:16:15 -0000 Author: kevans Date: Wed Mar 21 03:16:14 2018 New Revision: 331282 URL: https://svnweb.freebsd.org/changeset/base/331282 Log: core.lua(8): Update to reflect recently added function clearCachedKernels Modified: head/stand/lua/core.lua.8 Modified: head/stand/lua/core.lua.8 ============================================================================== --- head/stand/lua/core.lua.8 Wed Mar 21 03:07:16 2018 (r331281) +++ head/stand/lua/core.lua.8 Wed Mar 21 03:16:14 2018 (r331282) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2018 +.Dd March 21, 2018 .Dt CORE.LUA 8 .Os .Sh NAME @@ -138,6 +138,16 @@ and If .Fa safeMode is omitted, toggle the current safe mode setting. +.It Fn core.clearCachedKernels +Clears out the cache of kernels to be displayed on the boot menu. +This function is registered as a +.Ev config.reloaded +hook. +It is used to invalidate the kernel list whenever it may have changed, either +due to a boot environment change or a potential change in either +.Ic kernel +or +.Ic kernels . .It Fn core.kernelList Returns a table of kernels to display on the boot menu. This will combine From owner-svn-src-all@freebsd.org Wed Mar 21 03:43:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5FB1F669A6; Wed, 21 Mar 2018 03:43:40 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EF987959B; Wed, 21 Mar 2018 03:43:40 +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 89EDF25B1D; Wed, 21 Mar 2018 03:43:40 +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 w2L3heRn060590; Wed, 21 Mar 2018 03:43:40 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L3heB7060589; Wed, 21 Mar 2018 03:43:40 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210343.w2L3heB7060589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 03:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331283 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 03:43:41 -0000 Author: cem Date: Wed Mar 21 03:43:40 2018 New Revision: 331283 URL: https://svnweb.freebsd.org/changeset/base/331283 Log: Add missed sys/limits.h include Apparently header pollution on x86 hid its absense. Sorry, other arch users. Fix the missed header introduced in r331279. Reported by: tinderbox Modified: head/sys/kern/sys_getrandom.c Modified: head/sys/kern/sys_getrandom.c ============================================================================== --- head/sys/kern/sys_getrandom.c Wed Mar 21 03:16:14 2018 (r331282) +++ head/sys/kern/sys_getrandom.c Wed Mar 21 03:43:40 2018 (r331283) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include From owner-svn-src-all@freebsd.org Wed Mar 21 04:44:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4931CF6A6B9; Wed, 21 Mar 2018 04:44:20 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E11257B5D4; Wed, 21 Mar 2018 04:44: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 CDE452641D; Wed, 21 Mar 2018 04:44: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 w2L4iJwd090558; Wed, 21 Mar 2018 04:44:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L4iJaJ090557; Wed, 21 Mar 2018 04:44:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210444.w2L4iJaJ090557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 04:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331284 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 331284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 04:44:20 -0000 Author: cem Date: Wed Mar 21 04:44:19 2018 New Revision: 331284 URL: https://svnweb.freebsd.org/changeset/base/331284 Log: Appease GCC 4.2 It mistakenly believes the 'static' keyword must come first. Fix PPC, Sparc64, and maybe MIPS world. Fallout from r331279. Reported by: tinderbox (results come slowly) Modified: head/tests/sys/kern/sys_getrandom.c Modified: head/tests/sys/kern/sys_getrandom.c ============================================================================== --- head/tests/sys/kern/sys_getrandom.c Wed Mar 21 03:43:40 2018 (r331283) +++ head/tests/sys/kern/sys_getrandom.c Wed Mar 21 04:44:19 2018 (r331284) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include -const static unsigned valid_flags[] = { 0, GRND_NONBLOCK, GRND_RANDOM, +static const unsigned valid_flags[] = { 0, GRND_NONBLOCK, GRND_RANDOM, GRND_NONBLOCK | GRND_RANDOM }; ATF_TC_WITHOUT_HEAD(getrandom_randomness); From owner-svn-src-all@freebsd.org Wed Mar 21 05:40:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 418A4F4A568; Wed, 21 Mar 2018 05:40:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 93E0B7CF83; Wed, 21 Mar 2018 05:40:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 115F04284A7; Wed, 21 Mar 2018 16:40:38 +1100 (AEDT) Date: Wed, 21 Mar 2018 16:40:38 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331269 - head/share/man/man9 In-Reply-To: <201803202137.w2KLbXrp071489@repo.freebsd.org> Message-ID: <20180321160918.T1241@besplex.bde.org> References: <201803202137.w2KLbXrp071489@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=0GwoL8mGeRctihYA72gA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 05:40:47 -0000 On Tue, 20 Mar 2018, Warner Losh wrote: > Log: > Remove reference to lint. We no longer support it, so exceptions for > it are no longer relevant. > ... > Modified: head/share/man/man9/style.9 > ============================================================================== > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) > @@ -107,11 +107,7 @@ Only add > .Dq Li "From: " > in front of foreign VCS IDs if the file is renamed. > .Bd -literal > -#if 0 > -#ifndef lint > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > -#endif /* not lint */ > -#endif > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ This breaks the example for non-lint things in it. The description still gives the rule for adding '#if 0 ... #endif'. The example is technically partly correct, though not what is intended. The original file named 'style' doesn't have "static char sccsid[] ...". It had the sccsid in a comment, and still has it there, in the same position in the file. The char array was added to give an example of using '#if 0 ... #endif'. This change adds another copy of the comment, edited this time. This gives an example of adding "From: ". The rule says to add "From: " only if the file name changed (it should say to add it iff the file path changed and/or the current VCS doesn't have the file's history back to the version with the sccsid). This is not quite right, since the comment is duplicated, once without the editing suggested by the rule, and once with it but with the larger editing of moving the example. There is a similar self-reference problem for the FreeBSD id. $FreeBSD$ occurs twice, once in a comment and once just after the above. Duplicating it is a style bug, but there is no rule saying this so the meta-rule that style(9) gives rules by example says the opposite. Bruce From owner-svn-src-all@freebsd.org Wed Mar 21 09:07:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F1B7F56161; Wed, 21 Mar 2018 09:07:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B070084753; Wed, 21 Mar 2018 09:07:01 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAC4C28B31; Wed, 21 Mar 2018 09:07:01 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L971Vb021772; Wed, 21 Mar 2018 09:07:01 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L971P4021771; Wed, 21 Mar 2018 09:07:01 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803210907.w2L971P4021771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Wed, 21 Mar 2018 09:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331285 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 331285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 09:07:02 -0000 Author: eadler Date: Wed Mar 21 09:07:01 2018 New Revision: 331285 URL: https://svnweb.freebsd.org/changeset/base/331285 Log: [bsd-family-tree] Announce NetBSD 7.1.2 MFC After: 3 days Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Wed Mar 21 04:44:19 2018 (r331284) +++ head/share/misc/bsd-family-tree Wed Mar 21 09:07:01 2018 (r331285) @@ -365,6 +365,8 @@ FreeBSD 5.2 | | | | | | | | | | | | | | NetBSD 7.1.1 | DragonFly 5.0.2 | | | | | | | + | | | | NetBSD 7.1.2 | | + | | | | | | | | | | | v | | | v | | | | | | | | | @@ -736,6 +738,7 @@ DragonFly 5.0.0 2017-10-16 [DFB] DragonFly 5.0.1 2017-11-06 [DFB] DragonFly 5.0.2 2017-12-04 [DFB] NetBSD 7.1.1 2017-12-22 [NBD] +NetBSD 7.1.2 2018-03-15 [NBD] Bibliography ------------------------ From owner-svn-src-all@freebsd.org Wed Mar 21 09:55:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81808F58C27; Wed, 21 Mar 2018 09:55:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33878867D6; Wed, 21 Mar 2018 09:55:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E956292E2; Wed, 21 Mar 2018 09:55:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L9tKMl046566; Wed, 21 Mar 2018 09:55:20 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9tKel046565; Wed, 21 Mar 2018 09:55:20 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210955.w2L9tKel046565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331286 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 331286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 09:55:20 -0000 Author: kp Date: Wed Mar 21 09:55:19 2018 New Revision: 331286 URL: https://svnweb.freebsd.org/changeset/base/331286 Log: MFC r330108: pf: Apply $pf_flags when verifying the pf.conf file When checking the validity of the pf.conf file also include the user supplied pf_flags. These flags might overrule macros or specify anchors, which we will apply when actually applying the pf.conf file, so we must also take them into account when verifying the validity. Submitted by: Andreas Longwitz Modified: stable/11/etc/rc.d/pf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/pf ============================================================================== --- stable/11/etc/rc.d/pf Wed Mar 21 09:07:01 2018 (r331285) +++ stable/11/etc/rc.d/pf Wed Mar 21 09:55:19 2018 (r331286) @@ -47,13 +47,13 @@ pf_stop() pf_check() { echo "Checking pf rules." - $pf_program -n -f "$pf_rules" + $pf_program -n -f "$pf_rules" $pf_flags } pf_reload() { echo "Reloading pf rules." - $pf_program -n -f "$pf_rules" || return 1 + $pf_program -n -f "$pf_rules" $pf_flags || return 1 # Flush everything but existing state entries that way when # rules are read in, it doesn't break established connections. $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 From owner-svn-src-all@freebsd.org Wed Mar 21 09:55:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D473F58CD5; Wed, 21 Mar 2018 09:55:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21C76868F6; Wed, 21 Mar 2018 09:55:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A73A292E3; Wed, 21 Mar 2018 09:55:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L9tnZf046631; Wed, 21 Mar 2018 09:55:49 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9tnLO046630; Wed, 21 Mar 2018 09:55:49 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210955.w2L9tnLO046630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:55:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331287 - stable/10/etc/rc.d X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/etc/rc.d X-SVN-Commit-Revision: 331287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 09:55:50 -0000 Author: kp Date: Wed Mar 21 09:55:49 2018 New Revision: 331287 URL: https://svnweb.freebsd.org/changeset/base/331287 Log: MFC r330108: pf: Apply $pf_flags when verifying the pf.conf file When checking the validity of the pf.conf file also include the user supplied pf_flags. These flags might overrule macros or specify anchors, which we will apply when actually applying the pf.conf file, so we must also take them into account when verifying the validity. Submitted by: Andreas Longwitz Modified: stable/10/etc/rc.d/pf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/pf ============================================================================== --- stable/10/etc/rc.d/pf Wed Mar 21 09:55:19 2018 (r331286) +++ stable/10/etc/rc.d/pf Wed Mar 21 09:55:49 2018 (r331287) @@ -46,13 +46,13 @@ pf_stop() pf_check() { echo "Checking pf rules." - $pf_program -n -f "$pf_rules" + $pf_program -n -f "$pf_rules" $pf_flags } pf_reload() { echo "Reloading pf rules." - $pf_program -n -f "$pf_rules" || return 1 + $pf_program -n -f "$pf_rules" $pf_flags || return 1 # Flush everything but existing state entries that way when # rules are read in, it doesn't break established connections. $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 From owner-svn-src-all@freebsd.org Wed Mar 21 09:57:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 978BBF58DE7; Wed, 21 Mar 2018 09:57:06 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C09786A64; Wed, 21 Mar 2018 09:57:06 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46F65292E4; Wed, 21 Mar 2018 09:57:06 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L9v6EU046734; Wed, 21 Mar 2018 09:57:06 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9v6jA046733; Wed, 21 Mar 2018 09:57:06 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210957.w2L9v6jA046733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331288 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 331288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 09:57:06 -0000 Author: kp Date: Wed Mar 21 09:57:05 2018 New Revision: 331288 URL: https://svnweb.freebsd.org/changeset/base/331288 Log: MFC 330105: pf: Do not flush on reload pfctl only takes the last '-F' argument into account, so this never did what was intended. Moreover, there is no reason to flush rules before reloading, because pf keeps track of the rule which created a given state. That means that existing connections will keep being processed according to the rule which originally created them. Simply reloading the (new) rules suffices. The new rules will apply to new connections. PR: 127814 Submitted by: Andreas Longwitz Modified: stable/11/etc/rc.d/pf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/pf ============================================================================== --- stable/11/etc/rc.d/pf Wed Mar 21 09:55:49 2018 (r331287) +++ stable/11/etc/rc.d/pf Wed Mar 21 09:57:05 2018 (r331288) @@ -54,9 +54,6 @@ pf_reload() { echo "Reloading pf rules." $pf_program -n -f "$pf_rules" $pf_flags || return 1 - # Flush everything but existing state entries that way when - # rules are read in, it doesn't break established connections. - $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags } From owner-svn-src-all@freebsd.org Wed Mar 21 09:57:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83D3BF58E76; Wed, 21 Mar 2018 09:57:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 34C1D86B86; Wed, 21 Mar 2018 09:57:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FCA4292E6; Wed, 21 Mar 2018 09:57:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L9vUMc046808; Wed, 21 Mar 2018 09:57:30 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9vUin046807; Wed, 21 Mar 2018 09:57:30 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210957.w2L9vUin046807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331289 - stable/10/etc/rc.d X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/etc/rc.d X-SVN-Commit-Revision: 331289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 09:57:30 -0000 Author: kp Date: Wed Mar 21 09:57:29 2018 New Revision: 331289 URL: https://svnweb.freebsd.org/changeset/base/331289 Log: MFC 330105: pf: Do not flush on reload pfctl only takes the last '-F' argument into account, so this never did what was intended. Moreover, there is no reason to flush rules before reloading, because pf keeps track of the rule which created a given state. That means that existing connections will keep being processed according to the rule which originally created them. Simply reloading the (new) rules suffices. The new rules will apply to new connections. PR: 127814 Submitted by: Andreas Longwitz Modified: stable/10/etc/rc.d/pf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/pf ============================================================================== --- stable/10/etc/rc.d/pf Wed Mar 21 09:57:05 2018 (r331288) +++ stable/10/etc/rc.d/pf Wed Mar 21 09:57:29 2018 (r331289) @@ -53,9 +53,6 @@ pf_reload() { echo "Reloading pf rules." $pf_program -n -f "$pf_rules" $pf_flags || return 1 - # Flush everything but existing state entries that way when - # rules are read in, it doesn't break established connections. - $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags } From owner-svn-src-all@freebsd.org Wed Mar 21 10:26:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9A27F5B2A9; Wed, 21 Mar 2018 10:26:39 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 87CFA87F47; Wed, 21 Mar 2018 10:26:39 +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 7EA992975B; Wed, 21 Mar 2018 10:26:39 +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 w2LAQd21061715; Wed, 21 Mar 2018 10:26:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LAQdLJ061713; Wed, 21 Mar 2018 10:26:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803211026.w2LAQdLJ061713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Mar 2018 10:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331290 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 331290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 10:26:40 -0000 Author: kib Date: Wed Mar 21 10:26:39 2018 New Revision: 331290 URL: https://svnweb.freebsd.org/changeset/base/331290 Log: Move sysinit and sysuninit linker sets in the data (writeable) section. Both sets are sorted in place, and with the introduction of read-only permissions on the amd64 kernel text, the sorting override depended on CR0.WP turned off. Make it correct by moving the sets into writeable part of the KVA, also fixing boot on machines where hand-off from BIOS to OS occurs with CR0.WP set. Based on submission by: Peter Lei MFC after: 1 week Modified: head/sys/sys/kernel.h head/sys/sys/linker_set.h Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Wed Mar 21 09:57:29 2018 (r331289) +++ head/sys/sys/kernel.h Wed Mar 21 10:26:39 2018 (r331290) @@ -259,7 +259,7 @@ sysinit_tslog_shim(const void * data) sysinit_tslog_shim, \ &uniquifier ## _sys_init_tslog \ }; \ - DATA_SET(sysinit_set,uniquifier ## _sys_init) + DATA_WSET(sysinit_set,uniquifier ## _sys_init) #else #define C_SYSINIT(uniquifier, subsystem, order, func, ident) \ static struct sysinit uniquifier ## _sys_init = { \ @@ -268,7 +268,7 @@ sysinit_tslog_shim(const void * data) func, \ (ident) \ }; \ - DATA_SET(sysinit_set,uniquifier ## _sys_init) + DATA_WSET(sysinit_set,uniquifier ## _sys_init) #endif #define SYSINIT(uniquifier, subsystem, order, func, ident) \ @@ -285,7 +285,7 @@ sysinit_tslog_shim(const void * data) func, \ (ident) \ }; \ - DATA_SET(sysuninit_set,uniquifier ## _sys_uninit) + DATA_WSET(sysuninit_set,uniquifier ## _sys_uninit) #define SYSUNINIT(uniquifier, subsystem, order, func, ident) \ C_SYSUNINIT(uniquifier, subsystem, order, \ Modified: head/sys/sys/linker_set.h ============================================================================== --- head/sys/sys/linker_set.h Wed Mar 21 09:57:29 2018 (r331289) +++ head/sys/sys/linker_set.h Wed Mar 21 10:26:39 2018 (r331290) @@ -56,12 +56,13 @@ * Private macros, not to be used outside this header file. */ #ifdef __GNUCLIKE___SECTION -#define __MAKE_SET(set, sym) \ +#define __MAKE_SET_QV(set, sym, qv) \ __GLOBL(__CONCAT(__start_set_,set)); \ __GLOBL(__CONCAT(__stop_set_,set)); \ - static void const * __MAKE_SET_CONST \ + static void const * qv \ __set_##set##_sym_##sym __section("set_" #set) \ __used = &(sym) +#define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) #else /* !__GNUCLIKE___SECTION */ #error this file needs to be ported to your compiler #endif /* __GNUCLIKE___SECTION */ @@ -71,6 +72,7 @@ */ #define TEXT_SET(set, sym) __MAKE_SET(set, sym) #define DATA_SET(set, sym) __MAKE_SET(set, sym) +#define DATA_WSET(set, sym) __MAKE_SET_QV(set, sym, ) #define BSS_SET(set, sym) __MAKE_SET(set, sym) #define ABS_SET(set, sym) __MAKE_SET(set, sym) #define SET_ENTRY(set, sym) __MAKE_SET(set, sym) From owner-svn-src-all@freebsd.org Wed Mar 21 10:33:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1FD0F5BACE; Wed, 21 Mar 2018 10:33:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 EE7C16856E; Wed, 21 Mar 2018 10:33:35 +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 w2LAXP8p085828 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 12:33:28 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LAXP8p085828 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LAXPbH085827; Wed, 21 Mar 2018 12:33:25 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 12:33:25 +0200 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss Message-ID: <20180321103325.GJ76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201803210115.w2L1Fjt9084698@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 10:33:36 -0000 On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote: > +int > +getentropy(void *buf, size_t buflen) > +{ > + ssize_t rd; > + > + if (buflen > 256) { > + errno = EIO; > + return (-1); > + } > + > + while (buflen > 0) { > + rd = getrandom(buf, buflen, 0); > + if (rd == -1) { > + if (errno == EINTR) > + continue; > + else if (errno == ENOSYS) > + abort(); Libraries must not abort the application. Esp. libc. > + else > + return (-1); > + } > + > + /* This cannot happen. */ > + if (rd == 0) > + abort(); > + > + buf = (char *)buf + rd; > + buflen -= rd; > + } > + > + return (0); > +} > @@ -627,6 +628,8 @@ FBSDprivate_1.0 { > __sys_getppid; > _getpriority; > __sys_getpriority; > + _getrandom; > + __sys_getrandom; > _getresgid; > __sys_getresgid; > _getresuid; Is there any use planned for _getrandom and for __sys_ ? If not, we do not add private symbols for newer syscalls in recent times. From owner-svn-src-all@freebsd.org Wed Mar 21 12:56:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCEB2F65BD3; Wed, 21 Mar 2018 12:56:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 672A36DE71; Wed, 21 Mar 2018 12:56:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 574BC2AF8A; Wed, 21 Mar 2018 12:56:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LCu08O036124; Wed, 21 Mar 2018 12:56:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LCu0x5036123; Wed, 21 Mar 2018 12:56:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211256.w2LCu0x5036123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 12:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331291 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 12:56:00 -0000 Author: imp Date: Wed Mar 21 12:55:59 2018 New Revision: 331291 URL: https://svnweb.freebsd.org/changeset/base/331291 Log: Revert r331273: "Release the "TUR" reference when clearing the TUR work flag. We mostly" It exposes other issues, so revert to the pervious state of known issues. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Mar 21 10:26:39 2018 (r331290) +++ head/sys/cam/scsi/scsi_da.c Wed Mar 21 12:55:59 2018 (r331291) @@ -3114,7 +3114,6 @@ more: if (bp == NULL) { if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - da_periph_release_locked(periph, DA_REF_TUR); scsi_test_unit_ready(&start_ccb->csio, /*retries*/ da_retry_count, dadone, @@ -3138,6 +3137,11 @@ more: biofinish(bp, NULL, 0); goto more; } + } + + if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { + cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); + da_periph_release_locked(periph, DA_REF_TUR); } if ((bp->bio_flags & BIO_ORDERED) != 0 || From owner-svn-src-all@freebsd.org Wed Mar 21 14:34:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBE248A4 for ; Wed, 21 Mar 2018 14:34:49 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic305-34.consmr.mail.gq1.yahoo.com (sonic305-34.consmr.mail.gq1.yahoo.com [98.137.64.97]) (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 6959772373 for ; Wed, 21 Mar 2018 14:34:49 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1521642888; bh=MEc+TpRAnxj6q+MJD+5NNr+8DGh4JST9MIWmu5D5ZH0=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=EZ/eqKKBMU6UvWrD+pz0+LuqcQD48XIBQaGMP5ItoYS+paAj7jY7quZLtarV77ph6aurr0aWqolUNoSNlJhYwKJ5PUPDvdQoB2kUpRK7HSVJRcz5+6tsUeIrHpSj39OBQJvWuTPa+0QW86ngxOiTS2lPhsdoSfKl+C79sGTKcF4/LpHU8/GkXvneeNRcJe7yLoMgx1ikkPBciA54H2b5M9ptMaZf5Ag/p3bz36sR6Jtt4wiKuwMO7DNXSo0e9nuoLM1m3DTJLuyWArhqCqEXOP/jzOXJWcC5msrVN5BD67fMxJLfaIz+iFLceHrq5fMJoqTmSJ9vKPslPZxmDVXvvQ== X-YMail-OSG: Kj7p6gwVM1kkHyHqRajc95A7ClWYEQO29Wxr.WBVM5gvxdT43CbG6E8TzkFfhBg XDn9lZ1aA.uYI8jUvk4RunenaeyYRoyBCC95YK8QjAetR1rheOBQmYxn_NRgRb6JqjAsBWubJBIo J9RnItIxowGf19HmQlxYYSUlcO1LJ8GFokzeCGFIF3JFwfy2EXS4YdkuGxFONB9lguxtHW5JKXHs 5nynZrRXcvutQ6exI1z8klSCcPa2LsWkCQJd43S2U.o.jOuzd7jTEtiMqcErtMoJNaJPUYg5fTKn DLMZiuhEZT7BZZHkUaE7LyclEJ0voQPsZmxZ3KEipoJ3CitaWWe5cX0f8y_Fr8nvPhKe8aHjWJDG ONw_hb8MnZadXK4ZEC4E368tD7StX405nI3f2PQK7aZR.MIVuAo3Gj2ZtAaxsHIinhTk4wdgoYKQ CFaO_FO4id85ZW51cmBe05eDdMVbG6vXuSsvn.SjX6lLzZGcUKnqKcB._zFnoHOZpRSQl.Qrb_Hp U_422N8MnPg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.gq1.yahoo.com with HTTP; Wed, 21 Mar 2018 14:34:48 +0000 Received: from 181.52.72.201 (EHLO [192.168.0.4]) ([181.52.72.201]) by smtp405.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID f4b106b0b1d5412ccabdd5406b065f37; Wed, 21 Mar 2018 14:14:30 +0000 (UTC) Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Ian Lepore , Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <1521596451.54965.39.camel@freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <10290d09-dc33-dae5-aeb8-2e8affb69f29@FreeBSD.org> Date: Wed, 21 Mar 2018 09:14:29 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1521596451.54965.39.camel@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:34:50 -0000 On 20/03/2018 20:40, Ian Lepore wrote: > On Wed, 2018-03-21 at 01:15 +0000, Conrad Meyer wrote: >> Author: cem >> Date: Wed Mar 21 01:15:45 2018 >> New Revision: 331279 >> URL: https://svnweb.freebsd.org/changeset/base/331279 >> >> Log: >>   Implement getrandom(2) and getentropy(3) >> >>   The general idea here is to provide userspace programs with well- >> defined >>   sources of entropy, in a fashion that doesn't require opening a new >> file >>   descriptor (ulimits) or accessing paths (/dev/urandom may be >> restricted >>   by chroot or capsicum). >> >>   getrandom(2) is the more general API, and comes from the Linux >> world. >>   Since our urandom and random devices are identical, the GRND_RANDOM >> flag >>   is ignored. >> >>   getentropy(3) is added as a compatibility shim for the OpenBSD API. >> >>   truss(1) support is included. >> >>   Tests for both system calls are provided.  Coverage is believed to >> be at >>   least as comprehensive as LTP getrandom(2) test >> coverage.  Additionally, >>   instructions for running the LTP tests directly against FreeBSD are >> provided >>   in the "Test Plan" section of the Differential revision linked >> below.  (They >>   pass, of course.) >> >>   PR: 194204 >>   Reported by: David CARLIER > hardenedbsd.org> >>   Discussed with: cperciva, delphij, jhb, markj >>   Relnotes: maybe >>   Differential Revision: https://reviews.freebsd.org/D14500 >> > A good followup to this might be to switch libc's arc4random seeding to > getrandom(), instead of using a sysctl in a loop. That appears to be the main use of getentropy() in OpenBSD. We should now obviate linux_getrandom() as well. Cheers, Pedro. From owner-svn-src-all@freebsd.org Wed Mar 21 14:36:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C98AB43; Wed, 21 Mar 2018 14:36:17 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA55F72413; Wed, 21 Mar 2018 14:36:16 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E12162BF14; Wed, 21 Mar 2018 14:36:16 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEaGaQ086797; Wed, 21 Mar 2018 14:36:16 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEaGwf086796; Wed, 21 Mar 2018 14:36:16 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803211436.w2LEaGwf086796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 21 Mar 2018 14:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331292 - head/release/arm64 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/arm64 X-SVN-Commit-Revision: 331292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:36:17 -0000 Author: gjb Date: Wed Mar 21 14:36:16 2018 New Revision: 331292 URL: https://svnweb.freebsd.org/changeset/base/331292 Log: Following ports commit r465175, avoid fetch(1) to obtain overlays and DTB files for the RPI3. Submitted by: manu Sponsored by: The FreeBSD Foundation Modified: head/release/arm64/RPI3.conf Modified: head/release/arm64/RPI3.conf ============================================================================== --- head/release/arm64/RPI3.conf Wed Mar 21 12:55:59 2018 (r331291) +++ head/release/arm64/RPI3.conf Wed Mar 21 14:36:16 2018 (r331292) @@ -3,18 +3,19 @@ # $FreeBSD$ # -DTB_REPO="https://github.com/raspberrypi/firmware/blob/master/boot" +DTB_DIR="/usr/local/share/rpi-firmware" DTB="bcm2710-rpi-3-b.dtb" EMBEDDED_TARGET_ARCH="aarch64" EMBEDDED_TARGET="arm64" EMBEDDEDBUILD=1 -EMBEDDEDPORTS="sysutils/u-boot-rpi3 security/ca_root_nss" +EMBEDDEDPORTS="sysutils/u-boot-rpi3 sysutils/rpi-firmware" FAT_SIZE="50m -b 1m" FAT_TYPE="16" IMAGE_SIZE="2560M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 +OL_DIR="${DTB_DIR}/overlays" OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo" PART_SCHEME="MBR" export BOARDNAME="RPI3" @@ -33,11 +34,11 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \ ${FATMOUNT}/${_UF} done - chroot ${CHROOTDIR} fetch -o "${FATMOUNT}/${DTB}" "${DTB_REPO}/${DTB}?raw=true" + chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${DTB} ${FATMOUNT}/${DTB} chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays for _OL in ${OVERLAYS}; do - chroot ${CHROOTDIR} fetch -o "${FATMOUNT}/overlays/${_OL}"\ - "${DTB_REPO}/overlays/${_OL}?raw=true" + chroot ${CHROOTDIR} cp -p ${OL_DIR}/${_OL} \ + ${FATMOUNT}/overlays/${_OL} done BOOTFILES="$(chroot ${CHROOTDIR} \ From owner-svn-src-all@freebsd.org Wed Mar 21 14:37:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7A9FC44; Wed, 21 Mar 2018 14:37:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8966572580; Wed, 21 Mar 2018 14:37:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8462E2BF15; Wed, 21 Mar 2018 14:37:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEb5Wm086872; Wed, 21 Mar 2018 14:37:05 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEb5m9086867; Wed, 21 Mar 2018 14:37:05 GMT (envelope-from br@FreeBSD.org) Message-Id: <201803211437.w2LEb5m9086867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 21 Mar 2018 14:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331293 - in head: etc/mtree lib lib/libipt share/mk X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: etc/mtree lib lib/libipt share/mk X-SVN-Commit-Revision: 331293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:37:06 -0000 Author: br Date: Wed Mar 21 14:37:04 2018 New Revision: 331293 URL: https://svnweb.freebsd.org/changeset/base/331293 Log: Add new shared library -- libipt. libipt is the Intel Processor Trace (Intel PT) packets decoder. - Include libipt to amd64 build. - Install libipt headers to /usr/include/libipt/ Sponsored by: DARPA, AFRL Added: head/lib/libipt/ head/lib/libipt/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/lib/Makefile head/share/mk/bsd.libnames.mk head/share/mk/src.libnames.mk Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Wed Mar 21 14:36:16 2018 (r331292) +++ head/etc/mtree/BSD.include.dist Wed Mar 21 14:37:04 2018 (r331293) @@ -257,6 +257,8 @@ .. lib80211 .. + libipt + .. libmilter .. libxo Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Wed Mar 21 14:36:16 2018 (r331292) +++ head/lib/Makefile Wed Mar 21 14:37:04 2018 (r331293) @@ -176,6 +176,7 @@ _libvgl= libvgl .endif .if ${MACHINE_CPUARCH} == "amd64" +SUBDIR.${MK_PMC}+= libipt SUBDIR.${MK_BHYVE}+= libvmmapi .endif Added: head/lib/libipt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libipt/Makefile Wed Mar 21 14:37:04 2018 (r331293) @@ -0,0 +1,77 @@ +# $FreeBSD$ + +PACKAGE=lib${LIB} +SHLIBDIR?= /lib + +.include + +PTSRC= ${SRCTOP}/contrib/processor-trace + +.PATH: ${PTSRC}/libipt/src \ + ${PTSRC}/libipt/src/posix \ + ${PTSRC}/libipt/internal/include \ + ${PTSRC}/libipt/include \ + ${PTSRC}/include + +LIB= ipt +SHLIB_MAJOR=0 + +SRCS= \ + init.c \ + pt_asid.c \ + pt_block_cache.c \ + pt_block_decoder.c \ + pt_config.c \ + pt_cpu.c \ + pt_cpuid.c \ + pt_decoder_function.c \ + pt_encoder.c \ + pt_error.c \ + pt_event_queue.c \ + pt_ild.c \ + pt_image_section_cache.c \ + pt_image.c \ + pt_insn_decoder.c \ + pt_insn.c \ + pt_last_ip.c \ + pt_packet_decoder.c \ + pt_packet.c \ + pt_query_decoder.c \ + pt_retstack.c \ + pt_section_file.c \ + pt_section_posix.c \ + pt_section.c \ + pt_sync.c \ + pt_time.c \ + pt_tnt_cache.c \ + pt_version.c + +CFLAGS+= \ + -I${PTSRC}/libipt/internal/include/posix \ + -I${PTSRC}/libipt/internal/include \ + -I${PTSRC}/libipt/include \ + -I${PTSRC}/include \ + -I${.CURDIR} + +CFLAGS+= \ + -DPT_VERSION_BUILD=0 \ + -DPT_VERSION_EXT=\"\" \ + -DPT_VERSION_MAJOR=1 \ + -DPT_VERSION_MINOR=6 + +INCS= \ + intel-pt.h \ + pt_cpu.h \ + pt_last_ip.h \ + pt_time.h \ + pt_compiler.h + +INCSDIR=${INCLUDEDIR}/libipt + +LIBADD= + +WARNS?= 1 + +HAS_TESTS= + +.include Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Wed Mar 21 14:36:16 2018 (r331292) +++ head/share/mk/bsd.libnames.mk Wed Mar 21 14:37:04 2018 (r331293) @@ -88,6 +88,7 @@ LIBIBUMAD?= ${LIBDESTDIR}${LIBDIR_BASE}/libibumad.a LIBIBVERBS?= ${LIBDESTDIR}${LIBDIR_BASE}/libibverbs.a LIBIFCONFIG?= ${LIBDESTDIR}${LIBDIR_BASE}/libifconfig.a LIBIPSEC?= ${LIBDESTDIR}${LIBDIR_BASE}/libipsec.a +LIBIPT?= ${LIBDESTDIR}${LIBDIR_BASE}/libipt.a LIBJAIL?= ${LIBDESTDIR}${LIBDIR_BASE}/libjail.a LIBKADM5CLNT?= ${LIBDESTDIR}${LIBDIR_BASE}/libkadm5clnt.a LIBKADM5SRV?= ${LIBDESTDIR}${LIBDIR_BASE}/libkadm5srv.a Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Wed Mar 21 14:36:16 2018 (r331292) +++ head/share/mk/src.libnames.mk Wed Mar 21 14:37:04 2018 (r331293) @@ -111,6 +111,7 @@ _LIBRARIES= \ heimsqlite \ hx509 \ ipsec \ + ipt \ jail \ kadm5clnt \ kadm5srv \ From owner-svn-src-all@freebsd.org Wed Mar 21 14:46:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69F00F46899; Wed, 21 Mar 2018 14:46:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19E7D72C4A; Wed, 21 Mar 2018 14:46:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CBC72C0A3; Wed, 21 Mar 2018 14:46:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEksga091774; Wed, 21 Mar 2018 14:46:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEkst9091771; Wed, 21 Mar 2018 14:46:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211446.w2LEkst9091771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331294 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:46:55 -0000 Author: imp Date: Wed Mar 21 14:46:54 2018 New Revision: 331294 URL: https://svnweb.freebsd.org/changeset/base/331294 Log: Remove Giant from init creation and vfs_mountroot. Sponsored by: Netflix Discussed with: kib@, mckusick@ Differential Review: https://reviews.freebsd.org/D14712 Modified: head/sys/kern/init_main.c head/sys/kern/kern_shutdown.c head/sys/kern/vfs_mountroot.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Mar 21 14:37:04 2018 (r331293) +++ head/sys/kern/init_main.c Wed Mar 21 14:46:54 2018 (r331294) @@ -703,10 +703,6 @@ start_init(void *dummy) struct thread *td; struct proc *p; - mtx_lock(&Giant); - - GIANT_REQUIRED; - TSENTER(); /* Here so we don't overlap with mi_startup. */ td = curthread; @@ -801,7 +797,6 @@ start_init(void *dummy) * to user mode as init! */ if ((error = sys_execve(td, &args)) == EJUSTRETURN) { - mtx_unlock(&Giant); TSEXIT(); return; } Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Wed Mar 21 14:37:04 2018 (r331293) +++ head/sys/kern/kern_shutdown.c Wed Mar 21 14:46:54 2018 (r331294) @@ -268,13 +268,10 @@ sys_reboot(struct thread *td, struct reboot_args *uap) if (error == 0) error = priv_check(td, PRIV_REBOOT); if (error == 0) { - if (uap->opt & RB_REROOT) { + if (uap->opt & RB_REROOT) error = kern_reroot(); - } else { - mtx_lock(&Giant); + else kern_reboot(uap->opt); - mtx_unlock(&Giant); - } } return (error); } Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Wed Mar 21 14:37:04 2018 (r331293) +++ head/sys/kern/vfs_mountroot.c Wed Mar 21 14:46:54 2018 (r331294) @@ -579,9 +579,7 @@ parse_dir_md(char **conf) if (root_mount_mddev != -1) { mdio->md_unit = root_mount_mddev; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); - PICKUP_GIANT(); /* Ignore errors. We don't care. */ root_mount_mddev = -1; } @@ -590,9 +588,7 @@ parse_dir_md(char **conf) mdio->md_options = MD_AUTOUNIT | MD_READONLY; mdio->md_mediasize = sb.st_size; mdio->md_unit = 0; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio); - PICKUP_GIANT(); if (error) goto out; @@ -601,9 +597,7 @@ parse_dir_md(char **conf) mdio->md_file = NULL; mdio->md_options = 0; mdio->md_mediasize = 0; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); - PICKUP_GIANT(); /* Ignore errors. We don't care. */ error = ERANGE; goto out; @@ -960,9 +954,7 @@ vfs_mountroot_wait(void) curfail = 0; while (1) { - DROP_GIANT(); g_waitidle(); - PICKUP_GIANT(); mtx_lock(&root_holds_mtx); if (LIST_EMPTY(&root_holds)) { mtx_unlock(&root_holds_mtx); @@ -1004,9 +996,7 @@ vfs_mountroot_wait_if_neccessary(const char *fs, const * Note that we must wait for GEOM to finish reconfiguring itself, * eg for geom_part(4) to finish tasting. */ - DROP_GIANT(); g_waitidle(); - PICKUP_GIANT(); if (parse_mount_dev_present(dev)) return (0); @@ -1038,6 +1028,8 @@ vfs_mountroot(void) time_t timebase; int error; + mtx_assert(&Giant, MA_NOTOWNED); + TSENTER(); td = curthread; From owner-svn-src-all@freebsd.org Wed Mar 21 14:47:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18BBDF468D7; Wed, 21 Mar 2018 14:47:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC27C72CF6; Wed, 21 Mar 2018 14:47:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD0322C0A4; Wed, 21 Mar 2018 14:46:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEkxDL091828; Wed, 21 Mar 2018 14:46:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEkxSb091827; Wed, 21 Mar 2018 14:46:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211446.w2LEkxSb091827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331295 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:02 -0000 Author: imp Date: Wed Mar 21 14:46:59 2018 New Revision: 331295 URL: https://svnweb.freebsd.org/changeset/base/331295 Log: bufshutdown is no longer called with Giant held, so there's no need to drop or pickup Giant anymore. Remove that code and adjust comments. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Mar 21 14:46:54 2018 (r331294) +++ head/sys/kern/vfs_bio.c Wed Mar 21 14:46:59 2018 (r331295) @@ -1376,25 +1376,20 @@ bufshutdown(int show_busybufs) #ifdef PREEMPTION /* - * Drop Giant and spin for a while to allow - * interrupt threads to run. + * Spin for a while to allow interrupt threads to run. */ - DROP_GIANT(); DELAY(50000 * iter); - PICKUP_GIANT(); #else /* - * Drop Giant and context switch several times to - * allow interrupt threads to run. + * Context switch several times to allow interrupt + * threads to run. */ - DROP_GIANT(); for (subiter = 0; subiter < 50 * iter; subiter++) { thread_lock(curthread); mi_switch(SW_VOL, NULL); thread_unlock(curthread); DELAY(1000); } - PICKUP_GIANT(); #endif } printf("\n"); From owner-svn-src-all@freebsd.org Wed Mar 21 14:47:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60BA7F468F1; Wed, 21 Mar 2018 14:47:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 126DA72D32; Wed, 21 Mar 2018 14:47:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BDC62C0A5; Wed, 21 Mar 2018 14:47:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEl3VN091883; Wed, 21 Mar 2018 14:47:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEl3vg091882; Wed, 21 Mar 2018 14:47:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LEl3vg091882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331296 - head/sys/sparc64/sbus X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sparc64/sbus X-SVN-Commit-Revision: 331296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:04 -0000 Author: imp Date: Wed Mar 21 14:47:03 2018 New Revision: 331296 URL: https://svnweb.freebsd.org/changeset/base/331296 Log: These interrupts call shutdown_nice() which should be called Giant unlocked. Rather than dropping it in the interrupt handler, mark these handlers as MPSAFE. Modified: head/sys/sparc64/sbus/sbus.c Modified: head/sys/sparc64/sbus/sbus.c ============================================================================== --- head/sys/sparc64/sbus/sbus.c Wed Mar 21 14:46:59 2018 (r331295) +++ head/sys/sparc64/sbus/sbus.c Wed Mar 21 14:47:03 2018 (r331296) @@ -411,7 +411,7 @@ sbus_attach(device_t dev) INTIGN(vec = rman_get_start(sc->sc_ot_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE, + bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0) panic("%s: failed to set up temperature interrupt", __func__); i = 3; @@ -421,7 +421,7 @@ sbus_attach(device_t dev) INTIGN(vec = rman_get_start(sc->sc_pf_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE, + bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, NULL, sbus_pwrfail, sc, &sc->sc_pf_ihand) != 0) panic("%s: failed to set up power fail interrupt", __func__); From owner-svn-src-all@freebsd.org Wed Mar 21 14:47:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 902A3F4692C; Wed, 21 Mar 2018 14:47:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3AEE172E16; Wed, 21 Mar 2018 14:47:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B9502C0A6; Wed, 21 Mar 2018 14:47:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEl8I8091937; Wed, 21 Mar 2018 14:47:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEl8l4091936; Wed, 21 Mar 2018 14:47:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LEl8l4091936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331297 - head/sys/arm/at91 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/arm/at91 X-SVN-Commit-Revision: 331297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:10 -0000 Author: imp Date: Wed Mar 21 14:47:08 2018 New Revision: 331297 URL: https://svnweb.freebsd.org/changeset/base/331297 Log: This is MPSAFE on this platform, so don't take Giant out while running the callback. Modified: head/sys/arm/at91/at91_rst.c Modified: head/sys/arm/at91/at91_rst.c ============================================================================== --- head/sys/arm/at91/at91_rst.c Wed Mar 21 14:47:03 2018 (r331296) +++ head/sys/arm/at91/at91_rst.c Wed Mar 21 14:47:08 2018 (r331297) @@ -124,7 +124,7 @@ at91_rst_attach(device_t dev) at91_rst_sc = sc = device_get_softc(dev); sc->sc_dev = dev; - callout_init(&sc->tick_ch, 0); + callout_init(&sc->tick_ch, 1); rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, From owner-svn-src-all@freebsd.org Wed Mar 21 14:47:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F8A8F46980; Wed, 21 Mar 2018 14:47:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 067A372E90; Wed, 21 Mar 2018 14:47:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42E9C2C0A7; Wed, 21 Mar 2018 14:47:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LElDIB091989; Wed, 21 Mar 2018 14:47:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LElDcK091988; Wed, 21 Mar 2018 14:47:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LElDcK091988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331298 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 331298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:17 -0000 Author: imp Date: Wed Mar 21 14:47:12 2018 New Revision: 331298 URL: https://svnweb.freebsd.org/changeset/base/331298 Log: Unlock giant when calling shutdown_nice() Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:08 2018 (r331297) +++ head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:12 2018 (r331298) @@ -3858,22 +3858,28 @@ next_code: case RBT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(0); + } #endif break; case HALT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(RB_HALT); + } #endif break; case PDWN: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(RB_HALT|RB_POWEROFF); + } #endif break; From owner-svn-src-all@freebsd.org Wed Mar 21 14:47:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 780A5F46988; Wed, 21 Mar 2018 14:47:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0858C72F3A; Wed, 21 Mar 2018 14:47:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3FCA2C0A8; Wed, 21 Mar 2018 14:47:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LElHdl092042; Wed, 21 Mar 2018 14:47:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LElHqY092041; Wed, 21 Mar 2018 14:47:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LElHqY092041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331299 - head/sys/sparc64/pci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sparc64/pci X-SVN-Commit-Revision: 331299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:18 -0000 Author: imp Date: Wed Mar 21 14:47:17 2018 New Revision: 331299 URL: https://svnweb.freebsd.org/changeset/base/331299 Log: Mark psycho interrupts as MPSAFE. It's safe to do so now that we don't need Giant to call shutdown_nice(). Modified: head/sys/sparc64/pci/psycho.c Modified: head/sys/sparc64/pci/psycho.c ============================================================================== --- head/sys/sparc64/pci/psycho.c Wed Mar 21 14:47:12 2018 (r331298) +++ head/sys/sparc64/pci/psycho.c Wed Mar 21 14:47:17 2018 (r331299) @@ -664,7 +664,7 @@ psycho_set_intr(struct psycho_softc *sc, u_int index, INTVEC(PSYCHO_READ8(sc, intrmap)) != vec || intr_vectors[vec].iv_ic != &psycho_ic || bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], - INTR_TYPE_MISC | INTR_BRIDGE, filt, intr, sc, + INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, filt, intr, sc, &sc->sc_ihand[index]) != 0) panic("%s: failed to set up interrupt %d", __func__, index); } From owner-svn-src-all@freebsd.org Wed Mar 21 15:03:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9BB6F4AEF4; Wed, 21 Mar 2018 15:03:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 660A073EAE; Wed, 21 Mar 2018 15:03:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f45.google.com with SMTP id b136-v6so7270242iti.3; Wed, 21 Mar 2018 08:03:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=sf5gqIOw/cFJO/zO8WIY/nChpEWzJiSlQ1PWwP0HQRc=; b=Vg8hQ/1FrrvGwW+TWvF3WAFC6nOqKX6aALr0PiRDIeVAX/fdBzRI04cm0njp49OYjH +cMY7L0Xib0//XHux+efXE7R67S4abF1MAdnNaRs5vX2ohEgPMxwQT+bB0exGXxGr5o9 /vlM+Oe9md0p1HmekDzegbeTfrB5d3RPeOMlAffjMXZSXvEGfoVYLCXV8EzS39lHR80z 1LnVrYx70A34kOiCsFR+zywc836Wicaa1YRRaZRN2LPUUEWoe6uAzzARd7QOwpjjQOwN 7aZ1aysxmZinavkt5rpo5x1BN8oHU4gQ4RCVUXltbdzBP0l0+Z4tU40KvJvOabg1iNP2 soVw== X-Gm-Message-State: AElRT7EP1hxxpfqIuKxeS5t3RDLLue0/sxaCa1ie6BYN7cdGuS698wHW ivNpbNMQODg3d3CDYImrtLq1zsG1 X-Google-Smtp-Source: AG47ELu/bW2NDPol7vyRPGoOWQSszTU9E9sn60C0/JZ8bOOkFEguUW2VFbtYMSAuYwEC5BGs5ylbew== X-Received: by 2002:a24:2c8:: with SMTP id 191-v6mr4566968itu.108.1521644597462; Wed, 21 Mar 2018 08:03:17 -0700 (PDT) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com. [209.85.214.41]) by smtp.gmail.com with ESMTPSA id b34-v6sm2389989itd.12.2018.03.21.08.03.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:03:17 -0700 (PDT) Received: by mail-it0-f41.google.com with SMTP id p67-v6so2221905itc.2; Wed, 21 Mar 2018 08:03:16 -0700 (PDT) X-Received: by 2002:a24:e14e:: with SMTP id n75-v6mr3473776ith.58.1521644596835; Wed, 21 Mar 2018 08:03:16 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Wed, 21 Mar 2018 08:03:16 -0700 (PDT) In-Reply-To: <20180321103325.GJ76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> From: Conrad Meyer Date: Wed, 21 Mar 2018 08:03:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:03:25 -0000 On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov wrote: > On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote: >> +int >> +getentropy(void *buf, size_t buflen) >> +{ >> + ssize_t rd; >> + >> + if (buflen > 256) { >> + errno = EIO; >> + return (-1); >> + } >> + >> + while (buflen > 0) { >> + rd = getrandom(buf, buflen, 0); >> + if (rd == -1) { >> + if (errno == EINTR) >> + continue; >> + else if (errno == ENOSYS) >> + abort(); > Libraries must not abort the application. > Esp. libc. What do you propose instead? while (1); ? I don't see that as obviously better. >> ... >> @@ -627,6 +628,8 @@ FBSDprivate_1.0 { >> __sys_getppid; >> _getpriority; >> __sys_getpriority; >> + _getrandom; >> + __sys_getrandom; >> _getresgid; >> __sys_getresgid; >> _getresuid; > > Is there any use planned for _getrandom and for __sys_ ? If not, > we do not add private symbols for newer syscalls in recent times. Nope, just following the pattern. They can be removed if they are not needed. Best, Conrad From owner-svn-src-all@freebsd.org Wed Mar 21 15:05:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 975FAF4B237; Wed, 21 Mar 2018 15:05:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBE2740B3; Wed, 21 Mar 2018 15:05:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4318B2C39C; Wed, 21 Mar 2018 15:05:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LF59n5002251; Wed, 21 Mar 2018 15:05:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF59ba002250; Wed, 21 Mar 2018 15:05:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211505.w2LF59ba002250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331300 - stable/11/sys/ddb X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/ddb X-SVN-Commit-Revision: 331300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:05:09 -0000 Author: avg Date: Wed Mar 21 15:05:08 2018 New Revision: 331300 URL: https://svnweb.freebsd.org/changeset/base/331300 Log: MFC r330374: db_script_exec: use a saved script name when reporting commands executed Modified: stable/11/sys/ddb/db_script.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ddb/db_script.c ============================================================================== --- stable/11/sys/ddb/db_script.c Wed Mar 21 14:47:17 2018 (r331299) +++ stable/11/sys/ddb/db_script.c Wed Mar 21 15:05:08 2018 (r331300) @@ -294,7 +294,7 @@ db_script_exec(const char *scriptname, int warnifnotfo buffer = drd->drd_buffer; strcpy(buffer, dsp->ds_script); while ((command = strsep(&buffer, ";")) != NULL) { - db_printf("db:%d:%s> %s\n", db_recursion, scriptname, + db_printf("db:%d:%s> %s\n", db_recursion, dsp->ds_scriptname, command); db_command_trim(&command); prev_jb = kdb_jmpbuf(jb); From owner-svn-src-all@freebsd.org Wed Mar 21 15:05:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 432E8F4B3CC; Wed, 21 Mar 2018 15:05:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED36974202; Wed, 21 Mar 2018 15:05:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E79AC2C39D; Wed, 21 Mar 2018 15:05:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LF5jrx002339; Wed, 21 Mar 2018 15:05:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF5jx4002338; Wed, 21 Mar 2018 15:05:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211505.w2LF5jx4002338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:05:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331301 - stable/10/sys/ddb X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/ddb X-SVN-Commit-Revision: 331301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:05:46 -0000 Author: avg Date: Wed Mar 21 15:05:45 2018 New Revision: 331301 URL: https://svnweb.freebsd.org/changeset/base/331301 Log: MFC r330374: db_script_exec: use a saved script name when reporting commands executed Modified: stable/10/sys/ddb/db_script.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ddb/db_script.c ============================================================================== --- stable/10/sys/ddb/db_script.c Wed Mar 21 15:05:08 2018 (r331300) +++ stable/10/sys/ddb/db_script.c Wed Mar 21 15:05:45 2018 (r331301) @@ -294,7 +294,7 @@ db_script_exec(const char *scriptname, int warnifnotfo buffer = drd->drd_buffer; strcpy(buffer, dsp->ds_script); while ((command = strsep(&buffer, ";")) != NULL) { - db_printf("db:%d:%s> %s\n", db_recursion, scriptname, + db_printf("db:%d:%s> %s\n", db_recursion, dsp->ds_scriptname, command); db_command_trim(&command); prev_jb = kdb_jmpbuf(jb); From owner-svn-src-all@freebsd.org Wed Mar 21 15:07:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3950CF4B6A1; Wed, 21 Mar 2018 15:07:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAE58743D0; Wed, 21 Mar 2018 15:07:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5C8B2C3A0; Wed, 21 Mar 2018 15:07:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LF7Qfv002459; Wed, 21 Mar 2018 15:07:26 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF7QeO002458; Wed, 21 Mar 2018 15:07:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211507.w2LF7QeO002458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331302 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:07:27 -0000 Author: avg Date: Wed Mar 21 15:07:26 2018 New Revision: 331302 URL: https://svnweb.freebsd.org/changeset/base/331302 Log: MFC r330592: MFV r330591: 8984 fix for 6764 breaks ACL inheritance PR: 216886 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Mar 21 15:05:45 2018 (r331301) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Mar 21 15:07:26 2018 (r331302) @@ -1476,7 +1476,7 @@ zfs_ace_can_use(vtype_t vtype, uint16_t acep_flags) */ static zfs_acl_t * zfs_acl_inherit(zfsvfs_t *zfsvfs, vtype_t vtype, zfs_acl_t *paclp, - uint64_t mode) + uint64_t mode, boolean_t *need_chmod) { void *pacep = NULL; void *acep; @@ -1490,7 +1490,10 @@ zfs_acl_inherit(zfsvfs_t *zfsvfs, vtype_t vtype, zfs_a size_t data1sz, data2sz; uint_t aclinherit; boolean_t isdir = (vtype == VDIR); + boolean_t isreg = (vtype == VREG); + *need_chmod = B_TRUE; + aclp = zfs_acl_alloc(paclp->z_version); aclinherit = zfsvfs->z_acl_inherit; if (aclinherit == ZFS_ACL_DISCARD || vtype == VLNK) @@ -1513,6 +1516,17 @@ zfs_acl_inherit(zfsvfs_t *zfsvfs, vtype_t vtype, zfs_a continue; /* + * If owner@, group@, or everyone@ inheritable + * then zfs_acl_chmod() isn't needed. + */ + if ((aclinherit == ZFS_ACL_PASSTHROUGH || + aclinherit == ZFS_ACL_PASSTHROUGH_X) && + ((iflags & (ACE_OWNER|ACE_EVERYONE)) || + ((iflags & OWNING_GROUP) == OWNING_GROUP)) && + (isreg || (isdir && (iflags & ACE_DIRECTORY_INHERIT_ACE)))) + *need_chmod = B_FALSE; + + /* * Strip inherited execute permission from file if * not in mode */ @@ -1599,6 +1613,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va zfsvfs_t *zfsvfs = dzp->z_zfsvfs; zfs_acl_t *paclp; gid_t gid; + boolean_t need_chmod = B_TRUE; boolean_t trim = B_FALSE; boolean_t inherited = B_FALSE; @@ -1694,7 +1709,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va !(dzp->z_pflags & ZFS_XATTR)) { VERIFY(0 == zfs_acl_node_read(dzp, &paclp, B_FALSE)); acl_ids->z_aclp = zfs_acl_inherit(zfsvfs, - vap->va_type, paclp, acl_ids->z_mode); + vap->va_type, paclp, acl_ids->z_mode, &need_chmod); inherited = B_TRUE; } else { acl_ids->z_aclp = @@ -1703,15 +1718,18 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va } mutex_exit(&dzp->z_acl_lock); - if (vap->va_type == VDIR) - acl_ids->z_aclp->z_hints |= ZFS_ACL_AUTO_INHERIT; + if (need_chmod) { + if (vap->va_type == VDIR) + acl_ids->z_aclp->z_hints |= + ZFS_ACL_AUTO_INHERIT; - if (zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK && - zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH && - zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH_X) - trim = B_TRUE; - zfs_acl_chmod(vap->va_type, acl_ids->z_mode, B_FALSE, trim, - acl_ids->z_aclp); + if (zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK && + zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH && + zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH_X) + trim = B_TRUE; + zfs_acl_chmod(vap->va_type, acl_ids->z_mode, B_FALSE, + trim, acl_ids->z_aclp); + } } if (inherited || vsecp) { From owner-svn-src-all@freebsd.org Wed Mar 21 15:09:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FA58F4B90E; Wed, 21 Mar 2018 15:09:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E19574598; Wed, 21 Mar 2018 15:09:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44B212C3A2; Wed, 21 Mar 2018 15:09:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LF9g4T002628; Wed, 21 Mar 2018 15:09:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF9g6a002627; Wed, 21 Mar 2018 15:09:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211509.w2LF9g6a002627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331303 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 331303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:09:42 -0000 Author: avg Date: Wed Mar 21 15:09:41 2018 New Revision: 331303 URL: https://svnweb.freebsd.org/changeset/base/331303 Log: MFC r330793: fix r297857, do not modify CPU extension bits under virtual machines PR: 213155 Modified: stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Wed Mar 21 15:07:26 2018 (r331302) +++ stable/11/sys/x86/x86/identcpu.c Wed Mar 21 15:09:41 2018 (r331303) @@ -1394,7 +1394,8 @@ fix_cpuid(void) * See BIOS and Kernel Developer’s Guide (BKDG) for AMD Family 15h * Models 60h-6Fh Processors, Publication # 50742. */ - if (cpu_vendor_id == CPU_VENDOR_AMD && CPUID_TO_FAMILY(cpu_id) == 0x15) { + if (vm_guest == VM_GUEST_NO && cpu_vendor_id == CPU_VENDOR_AMD && + CPUID_TO_FAMILY(cpu_id) == 0x15) { msr = rdmsr(MSR_EXTFEATURES); if ((msr & ((uint64_t)1 << 54)) == 0) { msr |= (uint64_t)1 << 54; From owner-svn-src-all@freebsd.org Wed Mar 21 15:09:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2065AF4B992; Wed, 21 Mar 2018 15:09:50 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E08A74665; Wed, 21 Mar 2018 15:09: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 EF9B52C3A4; Wed, 21 Mar 2018 15:09:48 +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 w2LF9mlZ002704; Wed, 21 Mar 2018 15:09:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF9m8I002701; Wed, 21 Mar 2018 15:09:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211509.w2LF9m8I002701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 15:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331304 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:09:50 -0000 Author: kevans Date: Wed Mar 21 15:09:47 2018 New Revision: 331304 URL: https://svnweb.freebsd.org/changeset/base/331304 Log: lualoader: Clear up some possible naming confusion In the original lualoader project, 'escapef' and 'escapeb' were chosen for 'escape fg' and 'escape bg'. We've carried on this naming convention, and as our use of attributes grow the likeliness of 'escapeb'/'resetb' being confused upon glance for 'escape bold'/'reset bold' increases. Fix this by renaming these four functions to {escape,reset}{fg,bg} rather than {escape,reset}{f,b} for clarity. Reported by: dteske Modified: head/stand/lua/color.lua head/stand/lua/menu.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Wed Mar 21 15:09:41 2018 (r331303) +++ head/stand/lua/color.lua Wed Mar 21 15:09:47 2018 (r331304) @@ -58,28 +58,28 @@ end color.disabled = not color.isEnabled() -function color.escapef(color_value) +function color.escapefg(color_value) if color.disabled then return color_value end return core.KEYSTR_CSI .. "3" .. color_value .. "m" end -function color.resetf() +function color.resetfg() if color.disabled then return '' end return core.KEYSTR_CSI .. "39m" end -function color.escapeb(color_value) +function color.escapebg(color_value) if color.disabled then return color_value end return core.KEYSTR_CSI .. "4" .. color_value .. "m" end -function color.resetb() +function color.resetbg() if color.disabled then return '' end Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Mar 21 15:09:41 2018 (r331303) +++ head/stand/lua/menu.lua Wed Mar 21 15:09:47 2018 (r331304) @@ -46,11 +46,11 @@ local return_menu_entry = { local function OnOff(str, value) if value then - return str .. color.escapef(color.GREEN) .. "On" .. - color.escapef(color.WHITE) + return str .. color.escapefg(color.GREEN) .. "On" .. + color.escapefg(color.WHITE) else - return str .. color.escapef(color.RED) .. "off" .. - color.escapef(color.WHITE) + return str .. color.escapefg(color.RED) .. "off" .. + color.escapefg(color.WHITE) end end @@ -115,12 +115,12 @@ menu.boot_environments = { local bootenv_name = "" local name_color if is_default then - name_color = color.escapef(color.GREEN) + name_color = color.escapefg(color.GREEN) else - name_color = color.escapef(color.BLUE) + name_color = color.escapefg(color.BLUE) end bootenv_name = bootenv_name .. name_color .. - choice .. color.resetf() + choice .. color.resetfg() return color.highlight("A").."ctive: " .. bootenv_name .. " (" .. idx .. " of " .. #all_choices .. ")" @@ -300,13 +300,13 @@ menu.welcome = { local kernel_name = "" local name_color if is_default then - name_color = color.escapef(color.GREEN) + name_color = color.escapefg(color.GREEN) kernel_name = "default/" else - name_color = color.escapef(color.BLUE) + name_color = color.escapefg(color.BLUE) end kernel_name = kernel_name .. name_color .. - choice .. color.resetf() + choice .. color.resetfg() return color.highlight("K") .. "ernel: " .. kernel_name .. " (" .. idx .. " of " .. #all_choices .. ")" Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Wed Mar 21 15:09:41 2018 (r331303) +++ head/stand/lua/screen.lua Wed Mar 21 15:09:47 2018 (r331304) @@ -56,14 +56,14 @@ function screen.setforeground(color_value) if color.disabled then return color_value end - printc(color.escapef(color_value)) + printc(color.escapefg(color_value)) end function screen.setbackground(color_value) if color.disabled then return color_value end - printc(color.escapeb(color_value)) + printc(color.escapebg(color_value)) end function screen.defcolor() From owner-svn-src-all@freebsd.org Wed Mar 21 15:12:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FEAF4BF5D; Wed, 21 Mar 2018 15:12:35 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A477F74B7A; Wed, 21 Mar 2018 15:12:34 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id z143-v6so8402389lff.3; Wed, 21 Mar 2018 08:12:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TVc41fw9FwamqmjlYZ8ICQCLB2Mo6hg4lKRhJgpxTgg=; b=TQ98IvoN35nVpOKqm3n3dVgBT5BdDMRfwKDAcae/oizObbaqTnUcOqJFkkhrlrSNEZ fwIP/KlzDF+p7QK+noQEW1hlSYAq8lccawBGuoZ/3gvQkLI8svuaN0gJ+pmBOs8ZjIe8 58eExXQNtRCg2vRV/7XbNE2+2re0KXLmM+OKYfdvzjCMz70OtL3QW7pddqH/sD010xE0 5ezWv8+Cqd8F5J/egpHkA9SSprGrwKOhzCFJgyyjd+GXbdJ6MDkG8H2eRXkvlNOA/Z+0 Wd+EWWLFAKOLQ5jMrgpS0wKPMd5ZQTGF9jtnKDmBIAcpZlUYoxSnmwVimayxP6Xv9+TR 8dQQ== X-Gm-Message-State: AElRT7G6tI596/U4IfFwn1FqmCe5pFjxugJubTo981NloPD2fg7ozgFb 84xq+yYdlosONTTHWf09iKgkzaOC X-Google-Smtp-Source: AG47ELvQe5Rolo+4vJPKf1yetzLnrgZQoFC+o1OKrRNTfxnS2rPFAeh/07AgyDsR6SMAo7dfydlNHw== X-Received: by 2002:a19:4acc:: with SMTP id x195-v6mr14756270lfa.46.1521645146488; Wed, 21 Mar 2018 08:12:26 -0700 (PDT) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com. [209.85.215.53]) by smtp.gmail.com with ESMTPSA id j25sm338249lji.94.2018.03.21.08.12.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:12:26 -0700 (PDT) Received: by mail-lf0-f53.google.com with SMTP id a22-v6so8388533lfg.9; Wed, 21 Mar 2018 08:12:26 -0700 (PDT) X-Received: by 10.46.87.72 with SMTP id r8mr14273870ljd.93.1521645146155; Wed, 21 Mar 2018 08:12:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Wed, 21 Mar 2018 08:12:05 -0700 (PDT) In-Reply-To: <401EA542-5E2B-4342-B098-7C8D78FAD721@freebsd.org> References: <201803202026.w2KKQOP2036471@repo.freebsd.org> <401EA542-5E2B-4342-B098-7C8D78FAD721@freebsd.org> From: Kyle Evans Date: Wed, 21 Mar 2018 10:12:05 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331259 - head/stand/lua To: Devin Teske Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:12:35 -0000 On Tue, Mar 20, 2018 at 6:04 PM, Devin Teske wrote: > > Minor nit ... > > While resetf is unlikely to be mistaken for anything other than "reset foreground", ... > > "resetb" could easily be mistaken for "reset bold". > > I would like to suggest, in tradition, that resetf/resetb be renamed to resetfg/resetbg > > You know... should you want to add a "resetb" later that actually resets bold (e.g., if you have to use CSI 22m in more than one place). > -- > Devin This set of functions has been renamed in r331304. The choice of 'f' and 'b' always kind of bothered me, but not enough to actually fix it until someone else complained about it. =) From owner-svn-src-all@freebsd.org Wed Mar 21 15:13:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65B0EF4C0FB; Wed, 21 Mar 2018 15:13:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1930874D68; Wed, 21 Mar 2018 15:13:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13F062C541; Wed, 21 Mar 2018 15:13:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFDlfa007495; Wed, 21 Mar 2018 15:13:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFDlPs007494; Wed, 21 Mar 2018 15:13:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211513.w2LFDlPs007494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331305 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/x86/x86 X-SVN-Commit-Revision: 331305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:13:48 -0000 Author: avg Date: Wed Mar 21 15:13:47 2018 New Revision: 331305 URL: https://svnweb.freebsd.org/changeset/base/331305 Log: MFC r330793: fix r297857, do not modify CPU extension bits under virtual machines PR: 213155 Modified: stable/10/sys/x86/x86/identcpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/identcpu.c ============================================================================== --- stable/10/sys/x86/x86/identcpu.c Wed Mar 21 15:09:47 2018 (r331304) +++ stable/10/sys/x86/x86/identcpu.c Wed Mar 21 15:13:47 2018 (r331305) @@ -1335,7 +1335,8 @@ fix_cpuid(void) * See BIOS and Kernel Developer’s Guide (BKDG) for AMD Family 15h * Models 60h-6Fh Processors, Publication # 50742. */ - if (cpu_vendor_id == CPU_VENDOR_AMD && CPUID_TO_FAMILY(cpu_id) == 0x15) { + if (vm_guest == VM_GUEST_NO && cpu_vendor_id == CPU_VENDOR_AMD && + CPUID_TO_FAMILY(cpu_id) == 0x15) { msr = rdmsr(MSR_EXTFEATURES); if ((msr & ((uint64_t)1 << 54)) == 0) { msr |= (uint64_t)1 << 54; From owner-svn-src-all@freebsd.org Wed Mar 21 15:17:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 910E5F4C6C3; Wed, 21 Mar 2018 15:17:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4447875108; Wed, 21 Mar 2018 15:17:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24FB92C55A; Wed, 21 Mar 2018 15:17:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFHs4A007716; Wed, 21 Mar 2018 15:17:54 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFHsHf007714; Wed, 21 Mar 2018 15:17:54 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803211517.w2LFHsHf007714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 21 Mar 2018 15:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331306 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 331306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:17:55 -0000 Author: andrew Date: Wed Mar 21 15:17:54 2018 New Revision: 331306 URL: https://svnweb.freebsd.org/changeset/base/331306 Log: Use a table to find the endpoint configuration On the Allwinner SoCs we need to set a custom endpoint configuration. To allow for this use a table to store the configuration so the attachment can override it. Reviewed by: hselasky Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14783 Modified: head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/musb_otg.h Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:13:47 2018 (r331305) +++ head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:17:54 2018 (r331306) @@ -149,6 +149,27 @@ static const struct usb_hw_ep_profile musbotg_ep_profi } }; +static const struct musb_otg_ep_cfg musbotg_ep_default[] = { + { + .ep_end = 1, + .ep_fifosz_shift = 12, + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_4096 | MUSB2_MASK_FIFODB, + }, + { + .ep_end = 7, + .ep_fifosz_shift = 9, + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, + }, + { + .ep_end = 15, + .ep_fifosz_shift = 7, + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_128, + }, + { + .ep_end = -1, + }, +}; + static int musbotg_channel_alloc(struct musbotg_softc *sc, struct musbotg_td *td, uint8_t is_tx) { @@ -3059,7 +3080,9 @@ musbotg_clear_stall(struct usb_device *udev, struct us usb_error_t musbotg_init(struct musbotg_softc *sc) { + const struct musb_otg_ep_cfg *cfg; struct usb_hw_ep_profile *pf; + int i; uint16_t offset; uint8_t nrx; uint8_t ntx; @@ -3075,6 +3098,10 @@ musbotg_init(struct musbotg_softc *sc) sc->sc_bus.usbrev = USB_REV_2_0; sc->sc_bus.methods = &musbotg_bus_methods; + /* Set a default endpoint configuration */ + if (sc->sc_ep_cfg == NULL) + sc->sc_ep_cfg = musbotg_ep_default; + USB_BUS_LOCK(&sc->sc_bus); /* turn on clocks */ @@ -3193,20 +3220,15 @@ musbotg_init(struct musbotg_softc *sc) if (dynfifo) { if (frx && (temp <= nrx)) { - if (temp == 1) { - frx = 12; /* 4K */ - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, - MUSB2_VAL_FIFOSZ_4096 | - MUSB2_MASK_FIFODB); - } else if (temp < 8) { - frx = 10; /* 1K */ - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, - MUSB2_VAL_FIFOSZ_512 | - MUSB2_MASK_FIFODB); - } else { - frx = 7; /* 128 bytes */ - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, - MUSB2_VAL_FIFOSZ_128); + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { + cfg = &sc->sc_ep_cfg[i]; + if (temp <= cfg->ep_end) { + frx = cfg->ep_fifosz_shift; + MUSB2_WRITE_1(sc, + MUSB2_REG_RXFIFOSZ, + cfg->ep_fifosz_reg); + break; + } } MUSB2_WRITE_2(sc, MUSB2_REG_RXFIFOADD, @@ -3215,20 +3237,15 @@ musbotg_init(struct musbotg_softc *sc) offset += (1 << frx); } if (ftx && (temp <= ntx)) { - if (temp == 1) { - ftx = 12; /* 4K */ - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ_4096 | - MUSB2_MASK_FIFODB); - } else if (temp < 8) { - ftx = 10; /* 1K */ - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ_512 | - MUSB2_MASK_FIFODB); - } else { - ftx = 7; /* 128 bytes */ - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ_128); + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { + cfg = &sc->sc_ep_cfg[i]; + if (temp <= cfg->ep_end) { + ftx = cfg->ep_fifosz_shift; + MUSB2_WRITE_1(sc, + MUSB2_REG_TXFIFOSZ, + cfg->ep_fifosz_reg); + break; + } } MUSB2_WRITE_2(sc, MUSB2_REG_TXFIFOADD, Modified: head/sys/dev/usb/controller/musb_otg.h ============================================================================== --- head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:13:47 2018 (r331305) +++ head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:17:54 2018 (r331306) @@ -387,6 +387,12 @@ struct musbotg_flags { uint8_t d_pulled_up:1; }; +struct musb_otg_ep_cfg { + int ep_end; + int ep_fifosz_shift; + uint8_t ep_fifosz_reg; +}; + struct musbotg_softc { struct usb_bus sc_bus; union musbotg_hub_temp sc_hub_temp; @@ -423,6 +429,7 @@ struct musbotg_softc { uint8_t sc_id; uint8_t sc_mode; void *sc_platform_data; + const struct musb_otg_ep_cfg *sc_ep_cfg; }; /* prototypes */ From owner-svn-src-all@freebsd.org Wed Mar 21 15:23:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54040F4D11D; Wed, 21 Mar 2018 15:23:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 81AD9757E8; Wed, 21 Mar 2018 15:23:46 +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 w2LFNZf7051025 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 17:23:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LFNZf7051025 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LFNZd9051024; Wed, 21 Mar 2018 17:23:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 17:23:35 +0200 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss Message-ID: <20180321152335.GL76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:23:47 -0000 On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > wrote: > > On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote: > >> +int > >> +getentropy(void *buf, size_t buflen) > >> +{ > >> + ssize_t rd; > >> + > >> + if (buflen > 256) { > >> + errno = EIO; > >> + return (-1); > >> + } > >> + > >> + while (buflen > 0) { > >> + rd = getrandom(buf, buflen, 0); > >> + if (rd == -1) { > >> + if (errno == EINTR) > >> + continue; > >> + else if (errno == ENOSYS) > >> + abort(); > > Libraries must not abort the application. > > Esp. libc. > > What do you propose instead? while (1); ? I don't see that as > obviously better. Return the error to caller, as all, well most, correct library functions do. From owner-svn-src-all@freebsd.org Wed Mar 21 15:24:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDD9DF4D2E2; Wed, 21 Mar 2018 15:24:46 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464A9759FC; Wed, 21 Mar 2018 15:24:46 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f47.google.com with SMTP id z143-v6so8466217lff.3; Wed, 21 Mar 2018 08:24:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ciJEVQPkr6Hpt1isNVMD2qVCaO8d4lkuR+9OjgaAZkU=; b=D68eeQBGR91RKq/yvNq3BHciw48Lo3XquyhE0BDMPqetvl9ds5CU9awAJWTelFQIYs zXrNJGgFuU5+mkrGU8hMuk3SaQJctsQA4HEYjyDfMlews+GRFES/zUkc/mfgO/mmo58O ScQaSujUhgwuE5zWTer1KqrzQC0YlqXQ4Qxa/qXyNXoTcOHouRJQzgZbX9gaqEWZrM9z vGfYzUCuJIuak7sGSMYlCA8FR7TS0g/UV3kD7L0GvGAx5d7tRe5qiBtugVTBQ1sdQYsx We9WJOPIU7ImwXZN4Z2MeWezRD0l9+7aErcPe0qQlP5WBptSIzXTLAB8NwxhL/v4Nw7u u15Q== X-Gm-Message-State: AElRT7H1DkjOCkUIia0n8Aqlyf6EV6tY8eTkdlAkPdFKMlkzVEwov2tv sIOTAfbP1HpuO3Lp9R49wXx8bpmC X-Google-Smtp-Source: AG47ELsMETvoBcSbaxa3by1lU2ldudeKr0qxuX7006Cxtuof0mhdpfZlwBJgqzJgSWeJe69kDOiT0Q== X-Received: by 2002:a19:590c:: with SMTP id n12-v6mr14759131lfb.10.1521645878495; Wed, 21 Mar 2018 08:24:38 -0700 (PDT) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com. [209.85.215.47]) by smtp.gmail.com with ESMTPSA id p1sm932659lje.56.2018.03.21.08.24.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:24:38 -0700 (PDT) Received: by mail-lf0-f47.google.com with SMTP id e5-v6so8464727lfb.7; Wed, 21 Mar 2018 08:24:38 -0700 (PDT) X-Received: by 10.46.155.204 with SMTP id w12mr13690980ljj.76.1521645878198; Wed, 21 Mar 2018 08:24:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Wed, 21 Mar 2018 08:24:17 -0700 (PDT) In-Reply-To: <201803211517.w2LFHsHf007714@repo.freebsd.org> References: <201803211517.w2LFHsHf007714@repo.freebsd.org> From: Kyle Evans Date: Wed, 21 Mar 2018 10:24:17 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Andrew Turner , Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:24:47 -0000 On Wed, Mar 21, 2018 at 10:17 AM, Andrew Turner wrote: > Author: andrew > Date: Wed Mar 21 15:17:54 2018 > New Revision: 331306 > URL: https://svnweb.freebsd.org/changeset/base/331306 > > Log: > Use a table to find the endpoint configuration > > On the Allwinner SoCs we need to set a custom endpoint configuration. To > allow for this use a table to store the configuration so the attachment > can override it. > > Reviewed by: hselasky > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D14783 > > Modified: > head/sys/dev/usb/controller/musb_otg.c > head/sys/dev/usb/controller/musb_otg.h > > Modified: head/sys/dev/usb/controller/musb_otg.c > ============================================================================== > --- head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:13:47 2018 (r331305) > +++ head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:17:54 2018 (r331306) > @@ -149,6 +149,27 @@ static const struct usb_hw_ep_profile musbotg_ep_profi > } > }; > > +static const struct musb_otg_ep_cfg musbotg_ep_default[] = { > + { > + .ep_end = 1, > + .ep_fifosz_shift = 12, > + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_4096 | MUSB2_MASK_FIFODB, > + }, > + { > + .ep_end = 7, > + .ep_fifosz_shift = 9, > + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, > + }, I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for this case drop to 9? frx = 10 in the temp < 8 case in the removals of the following hunks. Mostly curious because the others seemed to stay the same. > [..snip..] > @@ -3193,20 +3220,15 @@ musbotg_init(struct musbotg_softc *sc) > > if (dynfifo) { > if (frx && (temp <= nrx)) { > - if (temp == 1) { > - frx = 12; /* 4K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_4096 | > - MUSB2_MASK_FIFODB); > - } else if (temp < 8) { > - frx = 10; /* 1K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_512 | > - MUSB2_MASK_FIFODB); > - } else { > - frx = 7; /* 128 bytes */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_128); > + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { > + cfg = &sc->sc_ep_cfg[i]; > + if (temp <= cfg->ep_end) { > + frx = cfg->ep_fifosz_shift; > + MUSB2_WRITE_1(sc, > + MUSB2_REG_RXFIFOSZ, > + cfg->ep_fifosz_reg); > + break; > + } > } > > MUSB2_WRITE_2(sc, MUSB2_REG_RXFIFOADD, > @@ -3215,20 +3237,15 @@ musbotg_init(struct musbotg_softc *sc) > offset += (1 << frx); > } > if (ftx && (temp <= ntx)) { > - if (temp == 1) { > - ftx = 12; /* 4K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_4096 | > - MUSB2_MASK_FIFODB); > - } else if (temp < 8) { > - ftx = 10; /* 1K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_512 | > - MUSB2_MASK_FIFODB); > - } else { > - ftx = 7; /* 128 bytes */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_128); > + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { > + cfg = &sc->sc_ep_cfg[i]; > + if (temp <= cfg->ep_end) { > + ftx = cfg->ep_fifosz_shift; > + MUSB2_WRITE_1(sc, > + MUSB2_REG_TXFIFOSZ, > + cfg->ep_fifosz_reg); > + break; > + } > } > > MUSB2_WRITE_2(sc, MUSB2_REG_TXFIFOADD, > > Modified: head/sys/dev/usb/controller/musb_otg.h > ============================================================================== > --- head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:13:47 2018 (r331305) > +++ head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:17:54 2018 (r331306) > @@ -387,6 +387,12 @@ struct musbotg_flags { > uint8_t d_pulled_up:1; > }; > > +struct musb_otg_ep_cfg { > + int ep_end; > + int ep_fifosz_shift; > + uint8_t ep_fifosz_reg; > +}; > + > struct musbotg_softc { > struct usb_bus sc_bus; > union musbotg_hub_temp sc_hub_temp; > @@ -423,6 +429,7 @@ struct musbotg_softc { > uint8_t sc_id; > uint8_t sc_mode; > void *sc_platform_data; > + const struct musb_otg_ep_cfg *sc_ep_cfg; > }; > > /* prototypes */ > From owner-svn-src-all@freebsd.org Wed Mar 21 15:37:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8E4DF4E289; Wed, 21 Mar 2018 15:37:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com [209.85.223.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74E3A76444; Wed, 21 Mar 2018 15:37:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f182.google.com with SMTP id d5so7157950iob.9; Wed, 21 Mar 2018 08:37:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=Falil5Fyc0DxNhqTH4s+RmZXJ/mxtZ6SH5aY1Vj23Vk=; b=BmeoGgvcFovYc1PU//0Ne467ZfTHdk3HNHuvmzv+upPD99fCLQkWcS7tTTSNhc4cwb lh6frUkbvAgH32h9Y32EEqBpbAKRtWsBPVSWOUhKN60rDeqKIXVNIzA1K1pYU2Y+N/5M aeFkocXvs1jkBgxgNIWdfM5xo8mtVrdjTqmJosOyM6ACZGOtMLZhK1A2YOtSbGy/pA1i 5y0Pxld9fGvlHdqbGVwY+rwGHqk0ZRMkQqYAn2+UbZRxvwUqaNgHEEHYvWwxYPYnIFir fnZBs/qY+w9dQo3xnkU4XTfrqBzQ9b60+4qSTO2K37eAQbvKUSsv6E53OGVJbyh6+H8V XbBA== X-Gm-Message-State: AElRT7FifQmKMA6f8XKHtN07eFdvunkORJRh5vOp83f5SruPLXlFDXyR FkeG7xVo1/E+h7B4JfprwisCtCMa X-Google-Smtp-Source: AG47ELucg8jz2Ma1aVAvWeQJq04FujqInQvAjynXj01KaPkMBKJhNK0FoC5uZ2xEovoRz9fnBVhhbQ== X-Received: by 10.107.47.198 with SMTP id v67mr11793528iov.281.1521646634718; Wed, 21 Mar 2018 08:37:14 -0700 (PDT) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com. [209.85.214.41]) by smtp.gmail.com with ESMTPSA id a129-v6sm3220106itd.34.2018.03.21.08.37.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:37:14 -0700 (PDT) Received: by mail-it0-f41.google.com with SMTP id p67-v6so2363037itc.2; Wed, 21 Mar 2018 08:37:14 -0700 (PDT) X-Received: by 2002:a24:c101:: with SMTP id e1-v6mr4744079itg.46.1521646634148; Wed, 21 Mar 2018 08:37:14 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Wed, 21 Mar 2018 08:37:13 -0700 (PDT) In-Reply-To: <20180321152335.GL76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> From: Conrad Meyer Date: Wed, 21 Mar 2018 08:37:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Xin LI Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:37:22 -0000 On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov wrote: > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov >> > Libraries must not abort the application. >> > Esp. libc. >> >> What do you propose instead? while (1); ? I don't see that as >> obviously better. > > Return the error to caller, as all, well most, correct library functions > do. The abort() in case of ENOSYS was proposed by delphij@. It is intended for users that getentropy() not fail. Another possible fallback is to use the kern.arandom sysctl. Would this be amenable to you? Thanks, Conrad From owner-svn-src-all@freebsd.org Wed Mar 21 15:37:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 680EFF4E357; Wed, 21 Mar 2018 15:37:57 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 F2FF3765ED; Wed, 21 Mar 2018 15:37:56 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9AC5C26061A; Wed, 21 Mar 2018 16:37:55 +0100 (CET) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Kyle Evans , Andrew Turner Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803211517.w2LFHsHf007714@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Wed, 21 Mar 2018 16:37:49 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 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-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:37:57 -0000 On 03/21/18 16:24, Kyle Evans wrote: >> + { >> + .ep_end = 7, >> + .ep_fifosz_shift = 9, >> + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, >> + }, > I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for > this case drop to 9? frx = 10 in the temp < 8 case in the removals of > the following hunks. Mostly curious because the others seemed to stay > the same. > Hi Andrew, It might be an idea to keep the fifosz_shift at 10, else high-speed BULK traffic won't be double buffered, and this might affect performance. --HPS From owner-svn-src-all@freebsd.org Wed Mar 21 15:42:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4381EF4EAAC for ; Wed, 21 Mar 2018 15:42:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C40C476CC3 for ; Wed, 21 Mar 2018 15:42:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22c.google.com with SMTP id r18so7181164ioa.1 for ; Wed, 21 Mar 2018 08:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=3MGT8ORScPruzAB3x/7OuTxH78rpZNwc7Q8SjOD65E8=; b=ARx+664c8dBNMYFb5+25CrRz0N4zEjTvKJHA6VCEx/fjuyXp5LVcETJ4VzkaXNRu8q 8xelmbcjAG6K6rnQy4OLElia4iUXXG7h7ZQrQvRKXUP2ctBgbsnHPD7NeBhCzGmoDVSI 2zUEW6Bj7WzEvtw2y+61FPv3xP91ItcM1KAno3FZK2X4S+9cqHzpcT36Jf5j8jwAv5sE 5vngD5kCFtfF2xruCpVFcJZ27uklL/fMt3VpgUF9pMVdjA+VJbq/MZZ3AaJgqgZWsHPR ssri2ASYiHy2xAmuI79krH90ItAWaNx0smPovtdx7+4ZzO5uKiOknYnGRHSCh1PVmHQC Ne+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=3MGT8ORScPruzAB3x/7OuTxH78rpZNwc7Q8SjOD65E8=; b=OAXGmDqZFYX6cac/bDtp4frj1zGKb3k06vhLjxLmwEKuiG0v131oZw99YV321F0ddg AsjagpZVS0trys1odTrow/z8F0mahs4U+VniOBIbOQ1KIu+7tTUwNcJ5URXeYCQTTAM3 ZIAb7t+gTvIQMK4fCOHmQT49ETK/ufaT67QhtN5850iNGNnkcyOvL7Yq2WJBgbivLxlP KkX1A89LSBqm5PO2vTk51+UbUioHm9V/U+znCbmwRBn33VP3KvkUUXOps7aDQr7NtKm+ PabRu3RvqrFJa6X5QWbmuRjDJyRfbuDIQ0Y/PfaQet0aI0AqhNn4xfn+V2zvpOKS3kSe KOoA== X-Gm-Message-State: AElRT7EKA+FdYmvgoWyKycsmLGqXlasHUYbKfo+9HuG0uSkENeOBSEpu TQbEA3zdeCSu5HlnpQ5MKgGWpnCW/LIR0s/YCptAAg== X-Google-Smtp-Source: AG47ELvglvGJA6p3wLJCGU+rihZu+CglY58Ts/tKxUHAc5zNIToYAgMydURhS953KgEtHvS/WBpPmSd0ELp533V1EVU= X-Received: by 10.107.12.230 with SMTP id 99mr20841542iom.117.1521646947972; Wed, 21 Mar 2018 08:42:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 08:42:26 -0700 (PDT) X-Originating-IP: [50.227.106.226] In-Reply-To: References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> From: Warner Losh Date: Wed, 21 Mar 2018 09:42:26 -0600 X-Google-Sender-Auth: FxfTQR2H_fgxt1I1lKuiVTZdDGQ Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: "Conrad E. Meyer" Cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Xin LI Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:42:29 -0000 On Wed, Mar 21, 2018 at 9:37 AM, Conrad Meyer wrote: > On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov > wrote: > > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > >> > Libraries must not abort the application. > >> > Esp. libc. > >> > >> What do you propose instead? while (1); ? I don't see that as > >> obviously better. > > > > Return the error to caller, as all, well most, correct library functions > > do. > > The abort() in case of ENOSYS was proposed by delphij@. It is > intended for users that getentropy() not fail. Another possible > fallback is to use the kern.arandom sysctl. Would this be amenable to > you? > You should get a SIGSYS unless you've setup signal handlers for ENOSYS anyway, right? Warner From owner-svn-src-all@freebsd.org Wed Mar 21 15:42:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 469B0F4EAB2; Wed, 21 Mar 2018 15:42:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E83EE76CCB; Wed, 21 Mar 2018 15:42:29 +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 E33062C9F3; Wed, 21 Mar 2018 15:42:29 +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 w2LFgT4h022715; Wed, 21 Mar 2018 15:42:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFgTZM022714; Wed, 21 Mar 2018 15:42:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211542.w2LFgTZM022714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 15:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331307 - stable/11/stand/uboot/common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/uboot/common X-SVN-Commit-Revision: 331307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:42:30 -0000 Author: kevans Date: Wed Mar 21 15:42:29 2018 New Revision: 331307 URL: https://svnweb.freebsd.org/changeset/base/331307 Log: MFC r330891: ubldr: Bump heap size from 512K to 1M lualoader in itself only uses another ~200K, but there seems to be no reason not to bump it a little higher to give us some more wiggle room. With this, I can boot using a menu-enabled lualoader, no problem and reasonably fast. Some heap usage datapoints from the review: forthloader, no menus, kernel loaded: heap base at 0x1203d5b0, top at 0x1208e000, used 330320 lualoader, no menus, kernel loaded: heap base at 0x42050028, top at 0x420ab000, used 372696 lualoader, menus, kernel loaded: heap base at 0x42050028, top at 0x420d5000, used 544728 Since then, the no menu case for lualoader should have decreased slightly as I've made some changes to make sure that it no longer loads any of th emenu bits with beastie disabled. While here, split heap size out into a HEAP_SIZE macro. Modified: stable/11/stand/uboot/common/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/uboot/common/main.c ============================================================================== --- stable/11/stand/uboot/common/main.c Wed Mar 21 15:17:54 2018 (r331306) +++ stable/11/stand/uboot/common/main.c Wed Mar 21 15:42:29 2018 (r331307) @@ -41,6 +41,10 @@ __FBSDID("$FreeBSD$"); #define nitems(x) (sizeof((x)) / sizeof((x)[0])) #endif +#ifndef HEAP_SIZE +#define HEAP_SIZE (1 * 1024 * 1024) +#endif + struct uboot_devdesc currdev; struct arch_switch archsw; /* MI/MD interface boundary */ int devs_no; @@ -421,7 +425,7 @@ main(int argc, char **argv) * of our bss and the bottom of the u-boot stack to avoid overlap. */ uboot_heap_start = round_page((uintptr_t)end); - uboot_heap_end = uboot_heap_start + 512 * 1024; + uboot_heap_end = uboot_heap_start + HEAP_SIZE; setheap((void *)uboot_heap_start, (void *)uboot_heap_end); /* From owner-svn-src-all@freebsd.org Wed Mar 21 15:43:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE9FFF4EC7F; Wed, 21 Mar 2018 15:43:57 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DD1B76F99; Wed, 21 Mar 2018 15:43:57 +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 78CE62C9F8; Wed, 21 Mar 2018 15:43:57 +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 w2LFhv50022814; Wed, 21 Mar 2018 15:43:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFhvUL022812; Wed, 21 Mar 2018 15:43:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211543.w2LFhvUL022812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 15:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331308 - in stable/11: . release/packages X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . release/packages X-SVN-Commit-Revision: 331308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:43:58 -0000 Author: kevans Date: Wed Mar 21 15:43:57 2018 New Revision: 331308 URL: https://svnweb.freebsd.org/changeset/base/331308 Log: MFC r330929: pkgbase: Fix post-install script for kernel packages kernel.ucl uses a hardcoded boot/kernel for kldxref, which is the incorrect directory when we're installing extra kernels that aren't the "default" kernel (placed at boot/kernel). Fix this by instead using a new %KERNELDIR% that we now replace in Makefile.inc1 with "kernel" for the default kernel and "kernel.${_kernel}" for these extra kernels so that, e.g. /boot/kernel.SHIVA, will get properly kldxref'd upon update and avoid outdated linker.hints. Modified: stable/11/Makefile.inc1 stable/11/release/packages/kernel.ucl Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Wed Mar 21 15:42:29 2018 (r331307) +++ stable/11/Makefile.inc1 Wed Mar 21 15:43:57 2018 (r331308) @@ -1495,6 +1495,7 @@ _debug=-debug pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel/" \ -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ @@ -1527,6 +1528,7 @@ _debug=-debug pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel.${_kernel}/" \ -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ Modified: stable/11/release/packages/kernel.ucl ============================================================================== --- stable/11/release/packages/kernel.ucl Wed Mar 21 15:42:29 2018 (r331307) +++ stable/11/release/packages/kernel.ucl Wed Mar 21 15:43:57 2018 (r331308) @@ -17,6 +17,6 @@ desc = < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A8EFF4F953; Wed, 21 Mar 2018 15:54:47 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2217277737; Wed, 21 Mar 2018 15:54:47 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 122982CB85; Wed, 21 Mar 2018 15:54:47 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFsk30027709; Wed, 21 Mar 2018 15:54:46 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFskv7027707; Wed, 21 Mar 2018 15:54:46 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803211554.w2LFskv7027707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Wed, 21 Mar 2018 15:54:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331309 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 331309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:54:47 -0000 Author: jtl Date: Wed Mar 21 15:54:46 2018 New Revision: 331309 URL: https://svnweb.freebsd.org/changeset/base/331309 Log: If the INP lock is uncontested, avoid taking a reference and jumping through the lock-switching hoops. A few of the INP lookup operations that lock INPs after the lookup do so using this mechanism (to maintain lock ordering): 1. Lock lookup structure. 2. Find INP. 3. Acquire reference on INP. 4. Drop lock on lookup structure. 5. Acquire INP lock. 6. Drop reference on INP. This change provides a slightly shorter path for cases where the INP lock is uncontested: 1. Lock lookup structure. 2. Find INP. 3. Try to acquire the INP lock. 4. If successful, drop lock on lookup structure. Of course, if the INP lock is contested, the functions will need to revert to the previous way of switching locks safely. This saves a few atomic operations when the INP lock is uncontested. Discussed with: gallatin, rrs, rwatson MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D12911 Modified: head/sys/netinet/in_pcb.c head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Mar 21 15:43:57 2018 (r331308) +++ head/sys/netinet/in_pcb.c Wed Mar 21 15:54:46 2018 (r331309) @@ -1632,6 +1632,7 @@ in_pcblookup_group(struct inpcbinfo *pcbinfo, struct i struct inpcbhead *head; struct inpcb *inp, *tmpinp; u_short fport = fport_arg, lport = lport_arg; + bool locked; /* * First look for an exact match. @@ -1818,18 +1819,32 @@ in_pcblookup_group(struct inpcbinfo *pcbinfo, struct i return (NULL); found: - in_pcbref(inp); - INP_GROUP_UNLOCK(pcbgroup); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = TRY_INP_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = TRY_INP_RLOCK(inp); + else panic("%s: locking bug", __func__); + if (!locked) + in_pcbref(inp); + INP_GROUP_UNLOCK(pcbgroup); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif return (inp); } #endif /* PCBGROUP */ @@ -1968,23 +1983,38 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in struct ifnet *ifp) { struct inpcb *inp; + bool locked; INP_HASH_RLOCK(pcbinfo); inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); if (inp != NULL) { - in_pcbref(inp); - INP_HASH_RUNLOCK(pcbinfo); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = INP_TRY_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = INP_TRY_RLOCK(inp); + else panic("%s: locking bug", __func__); + if (!locked) + in_pcbref(inp); + INP_HASH_RUNLOCK(pcbinfo); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif } else INP_HASH_RUNLOCK(pcbinfo); return (inp); Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Mar 21 15:43:57 2018 (r331308) +++ head/sys/netinet6/in6_pcb.c Wed Mar 21 15:54:46 2018 (r331309) @@ -868,6 +868,7 @@ in6_pcblookup_group(struct inpcbinfo *pcbinfo, struct struct inpcbhead *head; struct inpcb *inp, *tmpinp; u_short fport = fport_arg, lport = lport_arg; + bool locked; /* * First look for an exact match. @@ -1026,18 +1027,32 @@ in6_pcblookup_group(struct inpcbinfo *pcbinfo, struct return (NULL); found: - in_pcbref(inp); - INP_GROUP_UNLOCK(pcbgroup); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = INP_TRY_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = INP_TRY_RLOCK(inp); + else panic("%s: locking buf", __func__); + if (!locked) + in_pcbref(inp); + INP_GROUP_UNLOCK(pcbgroup); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif return (inp); } #endif /* PCBGROUP */ @@ -1163,23 +1178,38 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct i struct ifnet *ifp) { struct inpcb *inp; + bool locked; INP_HASH_RLOCK(pcbinfo); inp = in6_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); if (inp != NULL) { - in_pcbref(inp); - INP_HASH_RUNLOCK(pcbinfo); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = INP_TRY_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = INP_TRY_RLOCK(inp); + else panic("%s: locking bug", __func__); + if (!locked) + in_pcbref(inp); + INP_HASH_RUNLOCK(pcbinfo); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif } else INP_HASH_RUNLOCK(pcbinfo); return (inp); From owner-svn-src-all@freebsd.org Wed Mar 21 15:57:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40E8BF4FCEA; Wed, 21 Mar 2018 15:57:37 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E83DF779FF; Wed, 21 Mar 2018 15:57:36 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE6A52CBAB; Wed, 21 Mar 2018 15:57:36 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFvatw027867; Wed, 21 Mar 2018 15:57:36 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFvaHB027864; Wed, 21 Mar 2018 15:57:36 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201803211557.w2LFvaHB027864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Wed, 21 Mar 2018 15:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331310 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 331310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:57:37 -0000 Author: shurd Date: Wed Mar 21 15:57:36 2018 New Revision: 331310 URL: https://svnweb.freebsd.org/changeset/base/331310 Log: Update copyright per Matthew Macy "Under my tutelage Nicole did 85% of the work. At the time it seemed simplest for a number of reasons to put my copyright on it. I now consider that to have been a mistake." Submitted by: Matthew Macy Reviewed by: shurd Approved by: shurd Differential Revision: https://reviews.freebsd.org/D14766 Modified: head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/em_txrx.c ============================================================================== --- head/sys/dev/e1000/em_txrx.c Wed Mar 21 15:54:46 2018 (r331309) +++ head/sys/dev/e1000/em_txrx.c Wed Mar 21 15:57:36 2018 (r331310) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2016-2017 Matthew Macy + * Copyright (c) 2016 Nicole Graziano + * Copyright (c) 2017 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Mar 21 15:54:46 2018 (r331309) +++ head/sys/dev/e1000/if_em.c Wed Mar 21 15:57:36 2018 (r331310) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matthew Macy + * Copyright (c) 2016 Nicole Graziano * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Wed Mar 21 15:54:46 2018 (r331309) +++ head/sys/dev/e1000/if_em.h Wed Mar 21 15:57:36 2018 (r331310) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matthew Macy + * Copyright (c) 2016 Nicole Graziano * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Wed Mar 21 16:05:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E56FF50647; Wed, 21 Mar 2018 16:05:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 90B09780E0; Wed, 21 Mar 2018 16:05:03 +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 w2LG4pOd060067 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 18:04:54 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LG4pOd060067 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LG4ppA060066; Wed, 21 Mar 2018 18:04:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 18:04:51 +0200 From: Konstantin Belousov To: Warner Losh Cc: "Conrad E. Meyer" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Xin LI Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss Message-ID: <20180321160451.GM76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:05:04 -0000 On Wed, Mar 21, 2018 at 09:42:26AM -0600, Warner Losh wrote: > On Wed, Mar 21, 2018 at 9:37 AM, Conrad Meyer wrote: > > > On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov > > wrote: > > > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > > >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > > >> > Libraries must not abort the application. > > >> > Esp. libc. > > >> > > >> What do you propose instead? while (1); ? I don't see that as > > >> obviously better. > > > > > > Return the error to caller, as all, well most, correct library functions > > > do. > > > > The abort() in case of ENOSYS was proposed by delphij@. It is > > intended for users that getentropy() not fail. Another possible > > fallback is to use the kern.arandom sysctl. Would this be amenable to > > you? > > > > You should get a SIGSYS unless you've setup signal handlers for ENOSYS > anyway, right? The signal handler is under control of the application which uses libc. The library can be only passive there. So passing ENOSYS silently to the caller, or trying to use kern.arandom on ENOSYS are both fine. Abort() is not, IMO. From owner-svn-src-all@freebsd.org Wed Mar 21 16:12:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85630F50EAE; Wed, 21 Mar 2018 16:12: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 371427858B; Wed, 21 Mar 2018 16:12: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 31A792CEC5; Wed, 21 Mar 2018 16:12: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 w2LGC8A0035761; Wed, 21 Mar 2018 16:12:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LGC8EB035760; Wed, 21 Mar 2018 16:12:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803211612.w2LGC8EB035760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 16:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331311 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 331311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:12:08 -0000 Author: cem Date: Wed Mar 21 16:12:07 2018 New Revision: 331311 URL: https://svnweb.freebsd.org/changeset/base/331311 Log: cryptosoft(4): Zero plain hash contexts, too An OCF-naive user program could use these primitives to implement HMAC, for example. This would make the freed context sensitive data. Probably other bzeros in this file should be explicit_bzeros as well. Future work. Reviewed by: jhb, markj Differential Revision: https://reviews.freebsd.org/D14662 (minor part of a larger work) Modified: head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Wed Mar 21 15:57:36 2018 (r331310) +++ head/sys/opencrypto/cryptosoft.c Wed Mar 21 16:12:07 2018 (r331311) @@ -1053,8 +1053,10 @@ swcr_freesession_locked(device_t dev, u_int64_t tid) case CRYPTO_SHA1: axf = swd->sw_axf; - if (swd->sw_ictx) + if (swd->sw_ictx) { + explicit_bzero(swd->sw_ictx, axf->ctxsize); free(swd->sw_ictx, M_CRYPTO_DATA); + } break; case CRYPTO_DEFLATE_COMP: From owner-svn-src-all@freebsd.org Wed Mar 21 16:18:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A89AFF51531; Wed, 21 Mar 2018 16:18:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5687778ADD; Wed, 21 Mar 2018 16:18:15 +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 514BE2CEE9; Wed, 21 Mar 2018 16:18:15 +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 w2LGIFPD038522; Wed, 21 Mar 2018 16:18:15 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LGIE6h038516; Wed, 21 Mar 2018 16:18:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803211618.w2LGIE6h038516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 16:18:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331312 - in head: sys/conf sys/contrib/libb2 sys/crypto/blake2 sys/modules sys/modules/blake2 sys/modules/crypto sys/opencrypto tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/conf sys/contrib/libb2 sys/crypto/blake2 sys/modules sys/modules/blake2 sys/modules/crypto sys/opencrypto tests/sys/opencrypto X-SVN-Commit-Revision: 331312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:18:16 -0000 Author: cem Date: Wed Mar 21 16:18:14 2018 New Revision: 331312 URL: https://svnweb.freebsd.org/changeset/base/331312 Log: Import Blake2 algorithms (blake2b, blake2s) from libb2 The upstream repository is on github BLAKE2/libb2. Files landed in sys/contrib/libb2 are the unmodified upstream files, except for one difference: secure_zero_memory's contents have been replaced with explicit_bzero() only because the previous implementation broke powerpc link. Preferential use of explicit_bzero() is in progress upstream, so it is anticipated we will be able to drop this diff in the future. sys/crypto/blake2 contains the source files needed to port libb2 to our build system, a wrapped (limited) variant of the algorithm to match the API of our auth_transform softcrypto abstraction, incorporation into the Open Crypto Framework (OCF) cryptosoft(4) driver, as well as an x86 SSE/AVX accelerated OCF driver, blake2(4). Optimized variants of blake2 are compiled for a number of x86 machines (anything from SSE2 to AVX + XOP). On those machines, FPU context will need to be explicitly saved before using blake2(4)-provided algorithms directly. Use via cryptodev / OCF saves FPU state automatically, and use via the auth_transform softcrypto abstraction does not use FPU. The intent of the OCF driver is mostly to enable testing in userspace via /dev/crypto. ATF tests are added with published KAT test vectors to validate correctness. Reviewed by: jhb, markj Obtained from: github BLAKE2/libb2 Differential Revision: https://reviews.freebsd.org/D14662 Added: head/sys/contrib/libb2/ head/sys/contrib/libb2/blake2-config.h (contents, props changed) head/sys/contrib/libb2/blake2-dispatch.c (contents, props changed) head/sys/contrib/libb2/blake2-impl.h (contents, props changed) head/sys/contrib/libb2/blake2.h (contents, props changed) head/sys/contrib/libb2/blake2b-load-sse2.h (contents, props changed) head/sys/contrib/libb2/blake2b-load-sse41.h (contents, props changed) head/sys/contrib/libb2/blake2b-ref.c (contents, props changed) head/sys/contrib/libb2/blake2b-round.h (contents, props changed) head/sys/contrib/libb2/blake2b.c (contents, props changed) head/sys/contrib/libb2/blake2bp.c (contents, props changed) head/sys/contrib/libb2/blake2s-load-sse2.h (contents, props changed) head/sys/contrib/libb2/blake2s-load-sse41.h (contents, props changed) head/sys/contrib/libb2/blake2s-load-xop.h (contents, props changed) head/sys/contrib/libb2/blake2s-ref.c (contents, props changed) head/sys/contrib/libb2/blake2s-round.h (contents, props changed) head/sys/contrib/libb2/blake2s.c (contents, props changed) head/sys/contrib/libb2/blake2sp.c (contents, props changed) head/sys/crypto/blake2/ head/sys/crypto/blake2/blake2-sw.c (contents, props changed) head/sys/crypto/blake2/blake2_cryptodev.c (contents, props changed) head/sys/crypto/blake2/blake2_kfreebsd.h (contents, props changed) head/sys/crypto/blake2/blake2b-avx.c (contents, props changed) head/sys/crypto/blake2/blake2b-sse2.c (contents, props changed) head/sys/crypto/blake2/blake2b-sse41.c (contents, props changed) head/sys/crypto/blake2/blake2b-ssse3.c (contents, props changed) head/sys/crypto/blake2/blake2b-xop.c (contents, props changed) head/sys/crypto/blake2/blake2s-avx.c (contents, props changed) head/sys/crypto/blake2/blake2s-sse2.c (contents, props changed) head/sys/crypto/blake2/blake2s-sse41.c (contents, props changed) head/sys/crypto/blake2/blake2s-ssse3.c (contents, props changed) head/sys/crypto/blake2/blake2s-xop.c (contents, props changed) head/sys/crypto/blake2/config.h (contents, props changed) head/sys/crypto/blake2/stddef.h (contents, props changed) head/sys/crypto/blake2/stdint.h (contents, props changed) head/sys/crypto/blake2/stdio.h (contents, props changed) head/sys/crypto/blake2/stdlib.h (contents, props changed) head/sys/crypto/blake2/string.h (contents, props changed) head/sys/modules/blake2/ head/sys/modules/blake2/Makefile (contents, props changed) head/tests/sys/opencrypto/blake2-kat.h (contents, props changed) head/tests/sys/opencrypto/blake2_test.c (contents, props changed) Modified: head/sys/conf/files head/sys/modules/Makefile head/sys/modules/crypto/Makefile head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/xform_auth.h head/tests/sys/opencrypto/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Mar 21 16:12:07 2018 (r331311) +++ head/sys/conf/files Wed Mar 21 16:18:14 2018 (r331312) @@ -648,6 +648,13 @@ contrib/zstd/lib/compress/zstd_ldm.c standard compile contrib/zstd/lib/compress/zstd_opt.c standard compile-with ${ZSTD_C} contrib/zstd/lib/decompress/zstd_decompress.c standard compile-with ${ZSTD_C} contrib/zstd/lib/decompress/huf_decompress.c standard compile-with ${ZSTD_C} +# Blake 2 +contrib/libb2/blake2b-ref.c optional crypto | ipsec | ipsec_support \ + compile-with "${NORMAL_C} -I$S/crypto/blake2 ${NO_WCAST_QUAL} -DSUFFIX=_ref" +contrib/libb2/blake2s-ref.c optional crypto | ipsec | ipsec_support \ + compile-with "${NORMAL_C} -I$S/crypto/blake2 ${NO_WCAST_QUAL} -DSUFFIX=_ref" +crypto/blake2/blake2-sw.c optional crypto | ipsec | ipsec_support \ + compile-with "${NORMAL_C} -I$S/crypto/blake2 ${NO_WCAST_QUAL}" crypto/blowfish/bf_ecb.c optional ipsec | ipsec_support crypto/blowfish/bf_skey.c optional crypto | ipsec | ipsec_support crypto/camellia/camellia.c optional crypto | ipsec | ipsec_support Added: head/sys/contrib/libb2/blake2-config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2-config.h Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,71 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#pragma once +#ifndef __BLAKE2_CONFIG_H__ +#define __BLAKE2_CONFIG_H__ + +#if defined(__SSE2__) +#define HAVE_SSE2 +#endif + +#if defined(__SSSE3__) +#define HAVE_SSSE3 +#endif + +#if defined(__SSE4_1__) +#define HAVE_SSE4_1 +#endif + +#if defined(__AVX__) +#define HAVE_AVX +#endif + +#if defined(__XOP__) +#define HAVE_XOP +#endif + + +#ifdef HAVE_AVX2 +#ifndef HAVE_AVX +#define HAVE_AVX +#endif +#endif + +#ifdef HAVE_XOP +#ifndef HAVE_AVX +#define HAVE_AVX +#endif +#endif + +#ifdef HAVE_AVX +#ifndef HAVE_SSE4_1 +#define HAVE_SSE4_1 +#endif +#endif + +#ifdef HAVE_SSE41 +#ifndef HAVE_SSSE3 +#define HAVE_SSSE3 +#endif +#endif + +#ifdef HAVE_SSSE3 +#define HAVE_SSE2 +#endif + +#if !defined(HAVE_SSE2) +#error "This code requires at least SSE2." +#endif + +#endif + Added: head/sys/contrib/libb2/blake2-dispatch.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2-dispatch.c Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,577 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#include +#if defined(WIN32) +#include +#endif +#include "blake2.h" + +#if defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64) +#define HAVE_X86 +#endif + +typedef enum +{ + NONE = 0, +#if defined(HAVE_X86) + SSE2 = 1, + SSSE3 = 2, + SSE41 = 3, + AVX = 4, + XOP = 5, + /* AVX2 = 6, */ +#endif +} cpu_feature_t; + +static const char feature_names[][8] = +{ + "none", +#if defined(HAVE_X86) + "sse2", + "ssse3", + "sse41", + "avx", + "xop", + /* "avx2" */ +#endif +}; + +#if defined(HAVE_X86) + +#if defined(__GNUC__) +static inline void cpuid( uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx ) +{ + __asm__ __volatile__( +#if defined(__i386__) /* This is needed for -fPIC to work on i386 */ + "movl %%ebx, %%esi\n\t" +#endif + "cpuid\n\t" +#if defined(__i386__) + "xchgl %%ebx, %%esi\n\t" + : "=a"( *eax ), "=S"( *ebx ), "=c"( *ecx ), "=d"( *edx ) : "a"( *eax ) ); +#else + : "=a"( *eax ), "=b"( *ebx ), "=c"( *ecx ), "=d"( *edx ) : "a"( *eax ) ); +#endif +} + +static inline uint64_t xgetbv(uint32_t xcr) +{ + uint32_t a, d; + __asm__ __volatile__( + "xgetbv" + : "=a"(a),"=d"(d) + : "c"(xcr) + ); + return ((uint64_t)d << 32) | a; +} + +#elif defined(_MSC_VER) +#include +static inline void cpuid( uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx ) +{ + int regs[4]; + __cpuid( regs, *eax ); + *eax = regs[0]; + *ebx = regs[1]; + *ecx = regs[2]; + *edx = regs[3]; +} +#else +#error "Don't know how to call cpuid on this compiler!" +#endif + +#endif /* HAVE_X86 */ + +static inline cpu_feature_t get_cpu_features( void ) +{ +#if defined(HAVE_X86) + static volatile int initialized = 0; + static cpu_feature_t feature = NONE; // Safe default + uint32_t eax, ecx, edx, ebx; + + if( initialized ) + return feature; + + eax = 1; + cpuid( &eax, &ebx, &ecx, &edx ); + + if( 1 & ( edx >> 26 ) ) + feature = SSE2; + + if( 1 & ( ecx >> 9 ) ) + feature = SSSE3; + + if( 1 & ( ecx >> 19 ) ) + feature = SSE41; + +#if defined(WIN32) /* Work around the fact that Windows <7 does NOT support AVX... */ + if( IsProcessorFeaturePresent(17) ) /* Some environments don't know about PF_XSAVE_ENABLED */ +#endif + { + /* check for AVX and OSXSAVE bits */ + if( 1 & ( ecx >> 28 ) & (ecx >> 27) ) { +#if !defined(WIN32) /* Already checked for this in WIN32 */ + if( (xgetbv(0) & 6) == 6 ) /* XCR0 */ +#endif + feature = AVX; + } + + + eax = 0x80000001; + cpuid( &eax, &ebx, &ecx, &edx ); + + if( 1 & ( ecx >> 11 ) ) + feature = XOP; + } + + /* For future architectures */ + /* + eax = 7; ecx = 0; + cpuid(&eax, &ebx, &ecx, &edx); + + if(1&(ebx >> 5)) + feature = AVX2; + */ + /* fprintf( stderr, "Using %s engine\n", feature_names[feature] ); */ + initialized = 1; + return feature; +#else + return NONE; +#endif +} + + + +#if defined(__cplusplus) +extern "C" { +#endif + int blake2b_init_ref( blake2b_state *S, size_t outlen ); + int blake2b_init_key_ref( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_ref( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_ref( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_ref( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_ref( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#if defined(HAVE_X86) + + int blake2b_init_sse2( blake2b_state *S, size_t outlen ); + int blake2b_init_key_sse2( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_sse2( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_sse2( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_sse2( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_sse2( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_ssse3( blake2b_state *S, size_t outlen ); + int blake2b_init_key_ssse3( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_ssse3( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_ssse3( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_ssse3( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_ssse3( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_sse41( blake2b_state *S, size_t outlen ); + int blake2b_init_key_sse41( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_sse41( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_sse41( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_sse41( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_sse41( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_avx( blake2b_state *S, size_t outlen ); + int blake2b_init_key_avx( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_avx( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_avx( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_avx( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_avx( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_xop( blake2b_state *S, size_t outlen ); + int blake2b_init_key_xop( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_xop( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_xop( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_xop( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_xop( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#endif /* HAVE_X86 */ + + int blake2s_init_ref( blake2s_state *S, size_t outlen ); + int blake2s_init_key_ref( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_ref( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_ref( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_ref( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_ref( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#if defined(HAVE_X86) + + int blake2s_init_sse2( blake2s_state *S, size_t outlen ); + int blake2s_init_key_sse2( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_sse2( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_sse2( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_sse2( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_sse2( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_ssse3( blake2s_state *S, size_t outlen ); + int blake2s_init_key_ssse3( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_ssse3( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_ssse3( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_ssse3( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_ssse3( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_sse41( blake2s_state *S, size_t outlen ); + int blake2s_init_key_sse41( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_sse41( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_sse41( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_sse41( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_sse41( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_avx( blake2s_state *S, size_t outlen ); + int blake2s_init_key_avx( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_avx( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_avx( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_avx( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_avx( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_xop( blake2s_state *S, size_t outlen ); + int blake2s_init_key_xop( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_xop( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_xop( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_xop( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_xop( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#endif /* HAVE_X86 */ + +#if defined(__cplusplus) +} +#endif + +typedef int ( *blake2b_init_fn )( blake2b_state *, size_t ); +typedef int ( *blake2b_init_key_fn )( blake2b_state *, size_t, const void *, size_t ); +typedef int ( *blake2b_init_param_fn )( blake2b_state *, const blake2b_param * ); +typedef int ( *blake2b_update_fn )( blake2b_state *, const uint8_t *, size_t ); +typedef int ( *blake2b_final_fn )( blake2b_state *, uint8_t *, size_t ); +typedef int ( *blake2b_fn )( uint8_t *, const void *, const void *, size_t, size_t, size_t ); + +typedef int ( *blake2s_init_fn )( blake2s_state *, size_t ); +typedef int ( *blake2s_init_key_fn )( blake2s_state *, size_t, const void *, size_t ); +typedef int ( *blake2s_init_param_fn )( blake2s_state *, const blake2s_param * ); +typedef int ( *blake2s_update_fn )( blake2s_state *, const uint8_t *, size_t ); +typedef int ( *blake2s_final_fn )( blake2s_state *, uint8_t *, size_t ); +typedef int ( *blake2s_fn )( uint8_t *, const void *, const void *, size_t, size_t, size_t ); + +static const blake2b_init_fn blake2b_init_table[] = +{ + blake2b_init_ref, +#if defined(HAVE_X86) + blake2b_init_sse2, + blake2b_init_ssse3, + blake2b_init_sse41, + blake2b_init_avx, + blake2b_init_xop +#endif +}; + +static const blake2b_init_key_fn blake2b_init_key_table[] = +{ + blake2b_init_key_ref, +#if defined(HAVE_X86) + blake2b_init_key_sse2, + blake2b_init_key_ssse3, + blake2b_init_key_sse41, + blake2b_init_key_avx, + blake2b_init_key_xop +#endif +}; + +static const blake2b_init_param_fn blake2b_init_param_table[] = +{ + blake2b_init_param_ref, +#if defined(HAVE_X86) + blake2b_init_param_sse2, + blake2b_init_param_ssse3, + blake2b_init_param_sse41, + blake2b_init_param_avx, + blake2b_init_param_xop +#endif +}; + +static const blake2b_update_fn blake2b_update_table[] = +{ + blake2b_update_ref, +#if defined(HAVE_X86) + blake2b_update_sse2, + blake2b_update_ssse3, + blake2b_update_sse41, + blake2b_update_avx, + blake2b_update_xop +#endif +}; + +static const blake2b_final_fn blake2b_final_table[] = +{ + blake2b_final_ref, +#if defined(HAVE_X86) + blake2b_final_sse2, + blake2b_final_ssse3, + blake2b_final_sse41, + blake2b_final_avx, + blake2b_final_xop +#endif +}; + +static const blake2b_fn blake2b_table[] = +{ + blake2b_ref, +#if defined(HAVE_X86) + blake2b_sse2, + blake2b_ssse3, + blake2b_sse41, + blake2b_avx, + blake2b_xop +#endif +}; + +static const blake2s_init_fn blake2s_init_table[] = +{ + blake2s_init_ref, +#if defined(HAVE_X86) + blake2s_init_sse2, + blake2s_init_ssse3, + blake2s_init_sse41, + blake2s_init_avx, + blake2s_init_xop +#endif +}; + +static const blake2s_init_key_fn blake2s_init_key_table[] = +{ + blake2s_init_key_ref, +#if defined(HAVE_X86) + blake2s_init_key_sse2, + blake2s_init_key_ssse3, + blake2s_init_key_sse41, + blake2s_init_key_avx, + blake2s_init_key_xop +#endif +}; + +static const blake2s_init_param_fn blake2s_init_param_table[] = +{ + blake2s_init_param_ref, +#if defined(HAVE_X86) + blake2s_init_param_sse2, + blake2s_init_param_ssse3, + blake2s_init_param_sse41, + blake2s_init_param_avx, + blake2s_init_param_xop +#endif +}; + +static const blake2s_update_fn blake2s_update_table[] = +{ + blake2s_update_ref, +#if defined(HAVE_X86) + blake2s_update_sse2, + blake2s_update_ssse3, + blake2s_update_sse41, + blake2s_update_avx, + blake2s_update_xop +#endif +}; + +static const blake2s_final_fn blake2s_final_table[] = +{ + blake2s_final_ref, +#if defined(HAVE_X86) + blake2s_final_sse2, + blake2s_final_ssse3, + blake2s_final_sse41, + blake2s_final_avx, + blake2s_final_xop +#endif +}; + +static const blake2s_fn blake2s_table[] = +{ + blake2s_ref, +#if defined(HAVE_X86) + blake2s_sse2, + blake2s_ssse3, + blake2s_sse41, + blake2s_avx, + blake2s_xop +#endif +}; + +#if defined(__cplusplus) +extern "C" { +#endif + int blake2b_init_dispatch( blake2b_state *S, size_t outlen ); + int blake2b_init_key_dispatch( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_dispatch( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_dispatch( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_dispatch( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_dispatch( blake2s_state *S, size_t outlen ); + int blake2s_init_key_dispatch( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_dispatch( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_dispatch( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_dispatch( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); +#if defined(__cplusplus) +} +#endif + +static blake2b_init_fn blake2b_init_ptr = blake2b_init_dispatch; +static blake2b_init_key_fn blake2b_init_key_ptr = blake2b_init_key_dispatch; +static blake2b_init_param_fn blake2b_init_param_ptr = blake2b_init_param_dispatch; +static blake2b_update_fn blake2b_update_ptr = blake2b_update_dispatch; +static blake2b_final_fn blake2b_final_ptr = blake2b_final_dispatch; +static blake2b_fn blake2b_ptr = blake2b_dispatch; + +static blake2s_init_fn blake2s_init_ptr = blake2s_init_dispatch; +static blake2s_init_key_fn blake2s_init_key_ptr = blake2s_init_key_dispatch; +static blake2s_init_param_fn blake2s_init_param_ptr = blake2s_init_param_dispatch; +static blake2s_update_fn blake2s_update_ptr = blake2s_update_dispatch; +static blake2s_final_fn blake2s_final_ptr = blake2s_final_dispatch; +static blake2s_fn blake2s_ptr = blake2s_dispatch; + +int blake2b_init_dispatch( blake2b_state *S, size_t outlen ) +{ + blake2b_init_ptr = blake2b_init_table[get_cpu_features()]; + return blake2b_init_ptr( S, outlen ); +} + +int blake2b_init_key_dispatch( blake2b_state *S, size_t outlen, const void *key, size_t keylen ) +{ + blake2b_init_key_ptr = blake2b_init_key_table[get_cpu_features()]; + return blake2b_init_key_ptr( S, outlen, key, keylen ); +} + +int blake2b_init_param_dispatch( blake2b_state *S, const blake2b_param *P ) +{ + blake2b_init_param_ptr = blake2b_init_param_table[get_cpu_features()]; + return blake2b_init_param_ptr( S, P ); +} + +int blake2b_update_dispatch( blake2b_state *S, const uint8_t *in, size_t inlen ) +{ + blake2b_update_ptr = blake2b_update_table[get_cpu_features()]; + return blake2b_update_ptr( S, in, inlen ); +} + +int blake2b_final_dispatch( blake2b_state *S, uint8_t *out, size_t outlen ) +{ + blake2b_final_ptr = blake2b_final_table[get_cpu_features()]; + return blake2b_final_ptr( S, out, outlen ); +} + +int blake2b_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + blake2b_ptr = blake2b_table[get_cpu_features()]; + return blake2b_ptr( out, in, key, outlen, inlen, keylen ); +} + +BLAKE2_API int blake2b_init( blake2b_state *S, size_t outlen ) +{ + return blake2b_init_ptr( S, outlen ); +} + +BLAKE2_API int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen ) +{ + return blake2b_init_key_ptr( S, outlen, key, keylen ); +} + +BLAKE2_API int blake2b_init_param( blake2b_state *S, const blake2b_param *P ) +{ + return blake2b_init_param_ptr( S, P ); +} + +BLAKE2_API int blake2b_update( blake2b_state *S, const uint8_t *in, size_t inlen ) +{ + return blake2b_update_ptr( S, in, inlen ); +} + +BLAKE2_API int blake2b_final( blake2b_state *S, uint8_t *out, size_t outlen ) +{ + return blake2b_final_ptr( S, out, outlen ); +} + +BLAKE2_API int blake2b( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + return blake2b_ptr( out, in, key, outlen, inlen, keylen ); +} + +int blake2s_init_dispatch( blake2s_state *S, size_t outlen ) +{ + blake2s_init_ptr = blake2s_init_table[get_cpu_features()]; + return blake2s_init_ptr( S, outlen ); +} + +int blake2s_init_key_dispatch( blake2s_state *S, size_t outlen, const void *key, size_t keylen ) +{ + blake2s_init_key_ptr = blake2s_init_key_table[get_cpu_features()]; + return blake2s_init_key_ptr( S, outlen, key, keylen ); +} + +int blake2s_init_param_dispatch( blake2s_state *S, const blake2s_param *P ) +{ + blake2s_init_param_ptr = blake2s_init_param_table[get_cpu_features()]; + return blake2s_init_param_ptr( S, P ); +} + +int blake2s_update_dispatch( blake2s_state *S, const uint8_t *in, size_t inlen ) +{ + blake2s_update_ptr = blake2s_update_table[get_cpu_features()]; + return blake2s_update_ptr( S, in, inlen ); +} + +int blake2s_final_dispatch( blake2s_state *S, uint8_t *out, size_t outlen ) +{ + blake2s_final_ptr = blake2s_final_table[get_cpu_features()]; + return blake2s_final_ptr( S, out, outlen ); +} + +int blake2s_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + blake2s_ptr = blake2s_table[get_cpu_features()]; + return blake2s_ptr( out, in, key, outlen, inlen, keylen ); +} + +BLAKE2_API int blake2s_init( blake2s_state *S, size_t outlen ) +{ + return blake2s_init_ptr( S, outlen ); +} + +BLAKE2_API int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen ) +{ + return blake2s_init_key_ptr( S, outlen, key, keylen ); +} + +BLAKE2_API int blake2s_init_param( blake2s_state *S, const blake2s_param *P ) +{ + return blake2s_init_param_ptr( S, P ); +} + +BLAKE2_API int blake2s_update( blake2s_state *S, const uint8_t *in, size_t inlen ) +{ + return blake2s_update_ptr( S, in, inlen ); +} + +BLAKE2_API int blake2s_final( blake2s_state *S, uint8_t *out, size_t outlen ) +{ + return blake2s_final_ptr( S, out, outlen ); +} + +BLAKE2_API int blake2s( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + return blake2s_ptr( out, in, key, outlen, inlen, keylen ); +} + Added: head/sys/contrib/libb2/blake2-impl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2-impl.h Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,143 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#pragma once +#ifndef __BLAKE2_IMPL_H__ +#define __BLAKE2_IMPL_H__ + +#include +#include +#include +#include "config.h" + +#define BLAKE2_IMPL_CAT(x,y) x ## y +#define BLAKE2_IMPL_EVAL(x,y) BLAKE2_IMPL_CAT(x,y) +#define BLAKE2_IMPL_NAME(fun) BLAKE2_IMPL_EVAL(fun, SUFFIX) + +static inline uint32_t load32( const void *src ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + return *( uint32_t * )( src ); +#else + const uint8_t *p = ( uint8_t * )src; + uint32_t w = *p++; + w |= ( uint32_t )( *p++ ) << 8; + w |= ( uint32_t )( *p++ ) << 16; + w |= ( uint32_t )( *p++ ) << 24; + return w; +#endif +} + +static inline uint64_t load64( const void *src ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + return *( uint64_t * )( src ); +#else + const uint8_t *p = ( uint8_t * )src; + uint64_t w = *p++; + w |= ( uint64_t )( *p++ ) << 8; + w |= ( uint64_t )( *p++ ) << 16; + w |= ( uint64_t )( *p++ ) << 24; + w |= ( uint64_t )( *p++ ) << 32; + w |= ( uint64_t )( *p++ ) << 40; + w |= ( uint64_t )( *p++ ) << 48; + w |= ( uint64_t )( *p++ ) << 56; + return w; +#endif +} + +static inline void store32( void *dst, uint32_t w ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + *( uint32_t * )( dst ) = w; +#else + uint8_t *p = ( uint8_t * )dst; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; +#endif +} + +static inline void store64( void *dst, uint64_t w ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + *( uint64_t * )( dst ) = w; +#else + uint8_t *p = ( uint8_t * )dst; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; +#endif +} + +static inline uint64_t load48( const void *src ) +{ + const uint8_t *p = ( const uint8_t * )src; + uint64_t w = *p++; + w |= ( uint64_t )( *p++ ) << 8; + w |= ( uint64_t )( *p++ ) << 16; + w |= ( uint64_t )( *p++ ) << 24; + w |= ( uint64_t )( *p++ ) << 32; + w |= ( uint64_t )( *p++ ) << 40; + return w; +} + +static inline void store48( void *dst, uint64_t w ) +{ + uint8_t *p = ( uint8_t * )dst; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; +} + +static inline uint32_t rotl32( const uint32_t w, const unsigned c ) +{ + return ( w << c ) | ( w >> ( 32 - c ) ); +} + +static inline uint64_t rotl64( const uint64_t w, const unsigned c ) +{ + return ( w << c ) | ( w >> ( 64 - c ) ); +} + +static inline uint32_t rotr32( const uint32_t w, const unsigned c ) +{ + return ( w >> c ) | ( w << ( 32 - c ) ); +} + +static inline uint64_t rotr64( const uint64_t w, const unsigned c ) +{ + return ( w >> c ) | ( w << ( 64 - c ) ); +} + +/* prevents compiler optimizing out memset() */ +static inline void secure_zero_memory(void *v, size_t n) +{ +#ifdef __FreeBSD__ + explicit_bzero(v, n); +#else + static void *(*const volatile memset_v)(void *, int, size_t) = &memset; + memset_v(v, 0, n); +#endif +} + +#endif + Added: head/sys/contrib/libb2/blake2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2.h Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,182 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#pragma once +#ifndef __BLAKE2_H__ +#define __BLAKE2_H__ + +#include +#include + +#if defined(_WIN32) || defined(__CYGWIN__) + #define BLAKE2_DLL_IMPORT __declspec(dllimport) + #define BLAKE2_DLL_EXPORT __declspec(dllexport) + #define BLAKE2_DLL_PRIVATE +#elif __GNUC__ >= 4 + #define BLAKE2_DLL_IMPORT __attribute__ ((visibility ("default"))) + #define BLAKE2_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define BLAKE2_DLL_PRIVATE __attribute__ ((visibility ("hidden"))) +#else + #define BLAKE2_DLL_IMPORT + #define BLAKE2_DLL_EXPORT + #define BLAKE2_DLL_PRIVATE +#endif + +#if defined(BLAKE2_DLL) + #if defined(BLAKE2_DLL_EXPORTS) // defined if we are building the DLL + #define BLAKE2_API BLAKE2_DLL_EXPORT + #else + #define BLAKE2_API BLAKE2_DLL_IMPORT + #endif + #define BLAKE2_PRIVATE BLAKE2_DLL_PRIVATE // must only be used by hidden logic +#else + #define BLAKE2_API + #define BLAKE2_PRIVATE +#endif + +#if defined(__cplusplus) +extern "C" { +#elif defined(_MSC_VER) && !defined(inline) +#define inline __inline +#endif + + enum blake2s_constant + { + BLAKE2S_BLOCKBYTES = 64, + BLAKE2S_OUTBYTES = 32, + BLAKE2S_KEYBYTES = 32, + BLAKE2S_SALTBYTES = 8, + BLAKE2S_PERSONALBYTES = 8 + }; + + enum blake2b_constant + { + BLAKE2B_BLOCKBYTES = 128, + BLAKE2B_OUTBYTES = 64, + BLAKE2B_KEYBYTES = 64, + BLAKE2B_SALTBYTES = 16, + BLAKE2B_PERSONALBYTES = 16 + }; + +#pragma pack(push, 1) + typedef struct __blake2s_param + { + uint8_t digest_length; // 1 + uint8_t key_length; // 2 + uint8_t fanout; // 3 + uint8_t depth; // 4 + uint32_t leaf_length; // 8 + uint8_t node_offset[6];// 14 + uint8_t node_depth; // 15 + uint8_t inner_length; // 16 + // uint8_t reserved[0]; + uint8_t salt[BLAKE2S_SALTBYTES]; // 24 + uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32 + } blake2s_param; + + typedef struct __blake2s_state + { + uint32_t h[8]; + uint32_t t[2]; + uint32_t f[2]; + uint8_t buf[2 * BLAKE2S_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + uint8_t last_node; + } blake2s_state; + + typedef struct __blake2b_param + { + uint8_t digest_length; // 1 + uint8_t key_length; // 2 + uint8_t fanout; // 3 + uint8_t depth; // 4 + uint32_t leaf_length; // 8 + uint64_t node_offset; // 16 + uint8_t node_depth; // 17 + uint8_t inner_length; // 18 + uint8_t reserved[14]; // 32 + uint8_t salt[BLAKE2B_SALTBYTES]; // 48 + uint8_t personal[BLAKE2B_PERSONALBYTES]; // 64 + } blake2b_param; + + typedef struct __blake2b_state + { + uint64_t h[8]; + uint64_t t[2]; + uint64_t f[2]; + uint8_t buf[2 * BLAKE2B_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + uint8_t last_node; + } blake2b_state; + + typedef struct __blake2sp_state + { + blake2s_state S[8][1]; + blake2s_state R[1]; + uint8_t buf[8 * BLAKE2S_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + } blake2sp_state; + + typedef struct __blake2bp_state + { + blake2b_state S[4][1]; + blake2b_state R[1]; + uint8_t buf[4 * BLAKE2B_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + } blake2bp_state; +#pragma pack(pop) + + // Streaming API + BLAKE2_API int blake2s_init( blake2s_state *S, size_t outlen ); + BLAKE2_API int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2s_init_param( blake2s_state *S, const blake2s_param *P ); + BLAKE2_API int blake2s_update( blake2s_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2s_final( blake2s_state *S, uint8_t *out, size_t outlen ); + + BLAKE2_API int blake2b_init( blake2b_state *S, size_t outlen ); + BLAKE2_API int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2b_init_param( blake2b_state *S, const blake2b_param *P ); + BLAKE2_API int blake2b_update( blake2b_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2b_final( blake2b_state *S, uint8_t *out, size_t outlen ); + + BLAKE2_API int blake2sp_init( blake2sp_state *S, size_t outlen ); + BLAKE2_API int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2sp_update( blake2sp_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2sp_final( blake2sp_state *S, uint8_t *out, size_t outlen ); + + BLAKE2_API int blake2bp_init( blake2bp_state *S, size_t outlen ); + BLAKE2_API int blake2bp_init_key( blake2bp_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2bp_update( blake2bp_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2bp_final( blake2bp_state *S, uint8_t *out, size_t outlen ); + + // Simple API + BLAKE2_API int blake2s( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + BLAKE2_API int blake2b( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + BLAKE2_API int blake2sp( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + BLAKE2_API int blake2bp( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + static inline int blake2( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) + { + return blake2b( out, in, key, outlen, inlen, keylen ); + } + +#if defined(__cplusplus) +} +#endif + +#endif *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Mar 21 16:46:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC98AF5377D; Wed, 21 Mar 2018 16:46:14 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 7CF987A0C3; Wed, 21 Mar 2018 16:46:14 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2001:630:212:2a8:c475:595a:854e:1122] (unknown [IPv6:2001:630:212:2a8:c475:595a:854e:1122]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 9B0644EB9F; Wed, 21 Mar 2018 16:45:35 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller From: Andrew Turner In-Reply-To: Date: Wed, 21 Mar 2018 16:45:34 +0000 Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> References: <201803211517.w2LFHsHf007714@repo.freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:46:15 -0000 > On 21 Mar 2018, at 15:37, Hans Petter Selasky wrote: >=20 > On 03/21/18 16:24, Kyle Evans wrote: >>> + { >>> + .ep_end =3D 7, >>> + .ep_fifosz_shift =3D 9, >>> + .ep_fifosz_reg =3D MUSB2_VAL_FIFOSZ_512 | = MUSB2_MASK_FIFODB, >>> + }, >> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >> this case drop to 9? frx =3D 10 in the temp < 8 case in the removals = of >> the following hunks. Mostly curious because the others seemed to stay >> the same. >=20 > Hi Andrew, >=20 > It might be an idea to keep the fifosz_shift at 10, else high-speed = BULK traffic won't be double buffered, and this might affect = performance. Should the endpoint 1 size also be fixed? The register has it at 4k, but = it wasn=E2=80=99t an 8k buffer. Andrew From owner-svn-src-all@freebsd.org Wed Mar 21 17:22:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D39D1F56020; Wed, 21 Mar 2018 17:22:42 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8580E7BE1E; Wed, 21 Mar 2018 17:22:42 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8067C2D9BA; Wed, 21 Mar 2018 17:22:42 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LHMgdQ074370; Wed, 21 Mar 2018 17:22:42 GMT (envelope-from csjp@FreeBSD.org) Received: (from csjp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LHMgCZ074369; Wed, 21 Mar 2018 17:22:42 GMT (envelope-from csjp@FreeBSD.org) Message-Id: <201803211722.w2LHMgCZ074369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: csjp set sender to csjp@FreeBSD.org using -f From: "Christian S.J. Peron" Date: Wed, 21 Mar 2018 17:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331313 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: csjp X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 331313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 17:22:43 -0000 Author: csjp Date: Wed Mar 21 17:22:42 2018 New Revision: 331313 URL: https://svnweb.freebsd.org/changeset/base/331313 Log: Document the limitations associated with using the audit syscalls from jailed process. These might get implemented in jails in the future, but for now they are not supported. Discussed on: freebsd-security@ Reviewed by: brueffer@ MFC after: 2 weeks Modified: head/share/man/man4/audit.4 Modified: head/share/man/man4/audit.4 ============================================================================== --- head/share/man/man4/audit.4 Wed Mar 21 16:18:14 2018 (r331312) +++ head/share/man/man4/audit.4 Wed Mar 21 17:22:42 2018 (r331313) @@ -138,3 +138,11 @@ incomplete argument information. Mandatory Access Control (MAC) labels, as provided by the .Xr mac 4 facility, are not audited as part of records involving MAC decisions. +.Pp +Currently the +.Nm +syscalls are not supported for jailed processes. +However, if a process has +.Nm +session state associated with it, audit records will still be produced and a zonename token +containing the jail's ID or name will be present in the audit records. From owner-svn-src-all@freebsd.org Wed Mar 21 17:31:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C23FF56A61; Wed, 21 Mar 2018 17:31:42 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E0187C5E7; Wed, 21 Mar 2018 17:31:41 +0000 (UTC) (envelope-from delphij@gmail.com) Received: by mail-io0-x244.google.com with SMTP id v13so7586883iob.6; Wed, 21 Mar 2018 10:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GLmxFYI560FWvzUg0kb0meObKjL4olL5Zy88+ZMYD8Q=; b=ReQXEGoccz7wfX+W/UyKJNuf7x+uzBMV+EpCsq+kxL+Bh1CFtfBZQGp+hoNu7SBnIM dwpEHQo2Hi9FKxF6D81Ye5EVZX+0j1AHbAhdghDXCWjfkyFtgFn25cRVlEXZdveWu3pF cyUPjUGyX7lcfks0fARPjjkM6143NOS+tJPQNuwByqzMPyllSPtBUSdtGm/X9Dx9Vzu3 Kvi5w4Imb9iti+QQ/Pl4X58DYQDp7VOV9xnt6s5ycd5biK3Lu2CaaStgTIeXWWSkhnk9 Q2VRxPZe8yVYMWfYuefcZm8pNcPineVPoqCfcgIw0p0EB9L8ItskLVn651mU5HwJSGeh F/6w== 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=GLmxFYI560FWvzUg0kb0meObKjL4olL5Zy88+ZMYD8Q=; b=mK85Lly02m4CJTXmw9OBlPzi32VX49ydlSaDcWbcePVfuiL3bitnuVFVcFxO775C5H nrlHUrx4lU8wDIA5B0wPoUzVuLYM8eJDDRmUDtr9p6rKEDnh+PCKQXRDsB5JapPAm8V6 1FvX0cc7xY2QJmkgZgyA7pHa7d6mceUWVKIbF9nnpUpOFh2MhAzrt79Rr0zP5ac/zjgw X10RJI3xVhakPV4dnQkIuYIDl7SCJuHoWMhbDMLXZGP41McLkT3k/n/jcdbVor0Ci+FW WbaEOGT4CkD5wzbP5YHb1F5C1maQZ1uRDuyAhJ4OFeObBDRJn3AR/aJEtOcVhcbXp6MM pxJA== X-Gm-Message-State: AElRT7Fga5mqoyk276iMKp/4esvbBPAmuzVv/hqqdDB9ghZJHu0HCJ6K moPpCYgtQ+3xYjbaW7UHDUiYtcdPcUOMPujmPe/ykKtr X-Google-Smtp-Source: AG47ELvaSQkL65a7wq0sm5htsKOf7yMlibXoE29pdDwkS8eLPHRZuC2Z8RRBOnU4XuHkE7XEPZfo+UCI4pnz2nQDtjA= X-Received: by 10.107.242.7 with SMTP id q7mr21481066ioh.297.1521653500357; Wed, 21 Mar 2018 10:31:40 -0700 (PDT) MIME-Version: 1.0 References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> In-Reply-To: From: Xin LI Date: Wed, 21 Mar 2018 17:31:29 +0000 Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Conrad Meyer Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Xin Li Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 17:31:42 -0000 On Wed, Mar 21, 2018 at 8:37 AM Conrad Meyer wrote: > On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov > wrote: > > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > >> > Libraries must not abort the application. > >> > Esp. libc. > >> > >> What do you propose instead? while (1); ? I don't see that as > >> obviously better. > > > > Return the error to caller, as all, well most, correct library function= s > > do. > > The abort() in case of ENOSYS was proposed by delphij@. It is > intended for users that getentropy() not fail. Another possible > fallback is to use the kern.arandom sysctl. Would this be amenable to > you? > =E2=80=8BMy proposal was: "Note that ENOSYS should be handled by fallback w= ith kern.arandom or an explicit abort() should be done.=E2=80=8B". It seems that a more graceful way of doing this should be something like: if (sysctl({MIB: KERN, ARND}, 2, buf, &buflen_copy, NULL, 0) =3D=3D -1 || buflen_copy !=3D buflen) { /* * The sysctl cannot fail. If it does fail on some FreeBSD * derivative or after some future change, just abort so that * the problem will be found and fixed. abort is not normally * suitable for a library but makes sense here. */ abort(); } Like it was done in srandomdev(). From owner-svn-src-all@freebsd.org Wed Mar 21 17:53:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE774F5860A; Wed, 21 Mar 2018 17:53:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id C61567D739; Wed, 21 Mar 2018 17:53:25 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id B777642C9D5; Thu, 22 Mar 2018 04:53:23 +1100 (AEDT) Date: Thu, 22 Mar 2018 04:53:22 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <201803211447.w2LElDcK091988@repo.freebsd.org> Message-ID: <20180322024846.S4293@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=dk6ZlAi4zWyv9OyJo4MA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 17:53:27 -0000 On Wed, 21 Mar 2018, Warner Losh wrote: > Log: > Unlock giant when calling shutdown_nice() This breaks the driver. Giant is syscons' driver lock, and also the interrupt handler lock for at least the atkbd keyboard driver, so vt sometimes holds the lock for. vt has to sprinkle lots of Giant locking and unlocking where the corresponding locking is automatic for syscons, but this seems to be nonsense in its event handler. vt has to acquire Giant when calling the keyboard driver, but event handling is a call from the keyboard driver, usually from the interrupt handler with a suitable lock held. For atkbd, the suitable lock is Giant -- see atkbd_intr(). (All keyboard drivers that use the kbd(4) for the top level use Giant looking since toe top level specifies D_NEEDGIANT in its cdevsw. I think that is all keyboard drivers.) So where vt_kbdevent() sprinkles Giant, that has no effect since Giant is held by the caller. So vt_kbdevent() calls vt_processkey() with Giant held despite it not acquiring Giant explicitly; vt_processkey() calls vt_machine_kbdevent() and that calls various shutdown functions, all with Giant held. > Modified: head/sys/dev/syscons/syscons.c > ============================================================================== > --- head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:08 2018 (r331297) > +++ head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:12 2018 (r331298) > @@ -3858,22 +3858,28 @@ next_code: > > case RBT: > #ifndef SC_DISABLE_REBOOT > - if (enable_reboot && !(flags & SCGETC_CN)) > + if (enable_reboot && !(flags & SCGETC_CN)) { > + mtx_unlock(&Giant); > shutdown_nice(0); > + } > #endif > break; > > case HALT: > #ifndef SC_DISABLE_REBOOT > - if (enable_reboot && !(flags & SCGETC_CN)) > + if (enable_reboot && !(flags & SCGETC_CN)) { > + mtx_unlock(&Giant); > shutdown_nice(RB_HALT); > + } > #endif > break; > > case PDWN: > #ifndef SC_DISABLE_REBOOT > - if (enable_reboot && !(flags & SCGETC_CN)) > + if (enable_reboot && !(flags & SCGETC_CN)) { > + mtx_unlock(&Giant); > shutdown_nice(RB_HALT|RB_POWEROFF); > + } > #endif > break; The new bugs should cause assertion failures. shutdown_nice() just signals init and returns. Giant is not re-acquired, so assertions should fail when the caller drops the lock. So the shutdown should be a nasty panic. Transiently dropping the lock is probably not fatal depending on what the caller does. On x86 with atkbd, nested interrupts are prevented by masking the in the ATPIC or APIC -- Giant is not really the driver lock, but just a lock for interfacing between related screen and keyboard drivers. Serial console drivers with fast interrupt handlers have much more broken locking for ddb special keys. It is invalid to either drop locks or call the "any" function from a fast interrupt handler, but buggy serial console drivers calls kbd_alt_break(), and that now calls shutdown_nice() and other functions that cannot be called from a fast interrupt handler. ddb keys supply most of the shutdown_nice() functionality for serial consoles, and there are no escape sequence to get this without ddb or maybe another debugger, so these bugs don't affect most users. Handling this correctly requires much the same fix as an unsafe signal handler, and fixes have much the same problems -- not much more than setting a flag is safe, and the flag might never be looked at if the system is in a bad state. However, if a nice shutdown is possible then the sytem must be in a good enough state to poll for flags. For normal signal handlers, there is no problem sending a signal to init or at least with setting a flag and waking up some thread to check the flag. I don't quite understand this commit. It should be valid to send a signal to init() in proc or non-fast ithread context including with Giant held. shutdown_nice() starts with PROC_LOCK(initproc), so it would be a LOR to call it with a spinlock held, and is even more obviously wrong to call it from kbd_alt_break() with interrupts masked and possibly a spinlock held, but Giant is a special sleep lock that causes fewer LORs than most sleep locks. Actual testing shows that doesn't cause a panic, but it also doesn't actually unlock for shutdown_nice(), since the lock is acquired twice and only released once. syscons has much the same extra lock sprinkling for event handling as vt: - intr_event_execute_handlers() acquires Giant and calls atkbdintr() - atkbdintr() calls sckbdevent() - sckbdevent() unnecessarily acquires Giant again - the buggy unlocking drops Giant just once - shutdown_nice() is called with Giant held - the buggy unlocking fails to re-acquire Giant - sckbdevent() releases Giant, leaving it not held - sckbdevent() returns - atkbdintr() returns - intr_event_execute_handlers() releases Giant. This should panic, but it apparently blocks for long enough for init to shut down first. When I trace the last step, I get a panic which might be either from the different timing or just a bug in kdb. Bruce From owner-svn-src-all@freebsd.org Wed Mar 21 18:02:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD39CF59085; Wed, 21 Mar 2018 18:02:56 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 625977DED4; Wed, 21 Mar 2018 18:02:56 +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 5C08B2E008; Wed, 21 Mar 2018 18:02:56 +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 w2LI2uWX094466; Wed, 21 Mar 2018 18:02:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LI2uu3094465; Wed, 21 Mar 2018 18:02:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211802.w2LI2uu3094465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 18:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331314 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:02:56 -0000 Author: kevans Date: Wed Mar 21 18:02:56 2018 New Revision: 331314 URL: https://svnweb.freebsd.org/changeset/base/331314 Log: lualoader: Use printc when we expect ANSI escape sequences Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Wed Mar 21 17:22:42 2018 (r331313) +++ head/stand/lua/drawer.lua Wed Mar 21 18:02:56 2018 (r331314) @@ -313,7 +313,7 @@ function drawer.drawmenu(menudef) entry_num = entry_num + 1 screen.setcursor(x, y + effective_line_num) - print(entry_num .. ". " .. menuEntryName(menudef, e)) + printc(entry_num .. ". " .. menuEntryName(menudef, e)) -- fill the alias table alias_table[tostring(entry_num)] = e @@ -324,7 +324,7 @@ function drawer.drawmenu(menudef) end else screen.setcursor(x, y + effective_line_num) - print(menuEntryName(menudef, e)) + printc(menuEntryName(menudef, e)) end ::continue:: end From owner-svn-src-all@freebsd.org Wed Mar 21 18:09:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D29AF596F5; Wed, 21 Mar 2018 18:09:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFF537E22A; Wed, 21 Mar 2018 18:09:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f45.google.com with SMTP id k135-v6so8019796ite.2; Wed, 21 Mar 2018 11:09:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=649Cx6Ioe4VLdAi4UILCwFSKxOmS0S7mcjiyBWcoYOM=; b=AyQoEuSYMlsdNkR6TwHmN6YrK/NCtdIMdHIwvhvP0pF4KlmMJcwHhxj+q458nQma5O gvzrI7q7i0zW6M0GaY6mhBwI5byiun4TCphUGXHoHvzAedVFtdX+wry0CA+0k+q1O8L7 9RifgCIkIakNMkmzZPi6SkARNN6pd+dfL5gwAeWz13Ci03iaSk48j5wUk9aA5RCpyF24 ilylOpkMAuVwB2G9BlGEtAhYg0bGCYO45UbibojWBTYRm85oS8TiDaR8N4YS4ebvhPnH hco7IcydJuq3W1jFWJi5UqK3/yW04aWS119kr11zo8c7WrUZTYJ8F9EKEgfH6a0HW4fz 6m8Q== X-Gm-Message-State: AElRT7GBTTfWiC4zMw42c3o4tpfQK98e9fxct5Zxv7vINuSgu50VycTW XXP7pomEa6NtxfKeaxyR4SRCtRLV X-Google-Smtp-Source: AIpwx49o8NP+fTQfRrUJKfZSToidChZUFzn590uV7lEj1TszCzz9X8kHP2yRlnH8+IjeyNo+9A+DtQ== X-Received: by 2002:a24:496a:: with SMTP id z103-v6mr3228402ita.133.1521655770012; Wed, 21 Mar 2018 11:09:30 -0700 (PDT) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id m191-v6sm2060464itg.42.2018.03.21.11.09.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 11:09:29 -0700 (PDT) Received: by mail-it0-f48.google.com with SMTP id v194-v6so7868569itb.0; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) X-Received: by 2002:a24:82c1:: with SMTP id t184-v6mr5454758itd.61.1521655769679; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) In-Reply-To: References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> From: Conrad Meyer Date: Wed, 21 Mar 2018 11:09:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Xin LI Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:09:32 -0000 Please see https://reviews.freebsd.org/D14785 . :-) Thanks, Conrad On Wed, Mar 21, 2018 at 10:31 AM, Xin LI wrote: > > > > On Wed, Mar 21, 2018 at 8:37 AM Conrad Meyer wrote: >> >> On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov >> wrote: >> > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: >> >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov >> >> > Libraries must not abort the application. >> >> > Esp. libc. >> >> >> >> What do you propose instead? while (1); ? I don't see that as >> >> obviously better. >> > >> > Return the error to caller, as all, well most, correct library functions >> > do. >> >> The abort() in case of ENOSYS was proposed by delphij@. It is >> intended for users that getentropy() not fail. Another possible >> fallback is to use the kern.arandom sysctl. Would this be amenable to >> you? > > > My proposal was: "Note that ENOSYS should be handled by fallback with > kern.arandom or an explicit abort() should be done.". > > It seems that a more graceful way of doing this should be something like: > > if (sysctl({MIB: KERN, ARND}, 2, buf, &buflen_copy, NULL, 0) == -1 || > buflen_copy != buflen) { > /* > * The sysctl cannot fail. If it does fail on some FreeBSD > * derivative or after some future change, just abort so that > * the problem will be found and fixed. abort is not normally > * suitable for a library but makes sense here. > */ > abort(); > } > > Like it was done in srandomdev(). From owner-svn-src-all@freebsd.org Wed Mar 21 18:31:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6061EF5B080; Wed, 21 Mar 2018 18:31:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 9D3ED7F260; Wed, 21 Mar 2018 18:31:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 0683C42CD90; Thu, 22 Mar 2018 05:31:18 +1100 (AEDT) Date: Thu, 22 Mar 2018 05:31:18 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <20180322024846.S4293@besplex.bde.org> Message-ID: <20180322050628.U5175@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=_9ZPQwydy-ByBSi8r-QA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:31:22 -0000 On Thu, 22 Mar 2018, Bruce Evans wrote: > On Wed, 21 Mar 2018, Warner Losh wrote: > >> Log: >> Unlock giant when calling shutdown_nice() > ... > This breaks the driver. Giant is syscons' driver lock, and also the > interrupt handler lock for at least the atkbd keyboard driver, so vt > sometimes holds the lock for. [That should have been "... lock too".] > ... > Actual testing shows that doesn't cause a panic, but it also doesn't > actually unlock for shutdown_nice(), since the lock is acquired twice > and only released once. syscons has much the same extra lock sprinkling > for event handling as vt: > > - intr_event_execute_handlers() acquires Giant and calls atkbdintr() > - atkbdintr() calls sckbdevent() > - sckbdevent() unnecessarily acquires Giant again > - the buggy unlocking drops Giant just once > - shutdown_nice() is called with Giant held > - the buggy unlocking fails to re-acquire Giant > - sckbdevent() releases Giant, leaving it not held > - sckbdevent() returns > - atkbdintr() returns > - intr_event_execute_handlers() releases Giant. This should panic, but > it apparently blocks for long enough for init to shut down first. > > When I trace the last step, I get a panic which might be either from the > different timing or just a bug in kdb. Testing with a kernel with other bugs fixed shows that the invariants violation really is detected, causing a panic instead of a nice shutdown for Ctrl-Alt-Del, but recursive panics pile up and printf() in -current is too broken to print anything. A better kernel prints: XX ppppppppppppppppppppppppppkernel trap 12 with interrupts disabled XX panic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic XX panic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic XX panic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic XX panic: kernel trap doesn't have ucrepanic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic where some messages are lost and some are duplicated (there are 8 CPUs). I got control by putting a breakpoint after stop_cpus_hard() in vpanic(). (A breakpoint at panic() crashes, probably for multiple CPUs hitting it, though this is supposed to be fixed in the test version.) The backtrace is then: XX Breakpoint at vpanic+0x4a: popl %ecx XX db> t XX Tracing pid 11 tid 100042 td 0xd6a61360 XX vpanic(c0916c91,d6685ab4,d6685ab4,c098f050,c098f040,...) at vpanic+0x4a/frame 0xd6685a8c XX kassert_panic(c0916c91,c093b956,c0930a24,c09066cf,557) at kassert_panic+0x49/frame 0xd6685aa8 XX witness_unlock(c098f040,8,c09066c6,557) at witness_unlock+0xe7/frame 0xd6685af0 XX __mtx_unlock_flags(c098f050,0,c09066c6,557) at __mtx_unlock_flags+0x65/frame 0xd6685b14 XX intr_event_execute_handlers(c8f466b0) at intr_event_execute_handlers+0xed/frame 0xd6685b40 XX ithread_execute_handlers(c8f466b0,0,80202,d6a61360,c8f466b0,...) at ithread_execute_handlers+0x21/frame 0xd6685b54 XX ithread_loop(d6cda250,d6685ba8,0,d6cda250,c06a2c56,...) at ithread_loop+0x5f/frame 0xd6685b74 XX fork_exit(c06a2c56,d6cda250,d6685ba8) at fork_exit+0x83/frame 0xd6685b94 XX fork_trampoline() at fork_trampoline+0x8 The stack trace is messed up are mis-decoded despite attempts to avoid this (use i386, don't use clang, and turn off auto-inlining...). panic() is not shown, and args passed in registers are not shown. There are just enough args to find the panic message. It is as expected: XX db> x/s 0xd6685ab4 XX 0xd6685ab4: V\271\223\300$\012\223\300\317f\220\300W\005 XX db> x/s 0xc0916c91 XX __func__.16466+0x1c41: lock (%s) %s not locked @ %s:%d Bruce From owner-svn-src-all@freebsd.org Wed Mar 21 19:33:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FCFEF60003; Wed, 21 Mar 2018 19:33:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1ACCC83502; Wed, 21 Mar 2018 19:33:01 +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 143792EE65; Wed, 21 Mar 2018 19:33:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LJX0vJ042565; Wed, 21 Mar 2018 19:33:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LJX05p042562; Wed, 21 Mar 2018 19:33:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803211933.w2LJX05p042562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Mar 2018 19:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331319 - in stable/11: lib/libpmc sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: lib/libpmc sys/dev/hwpmc X-SVN-Commit-Revision: 331319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 19:33:01 -0000 Author: kib Date: Wed Mar 21 19:33:00 2018 New Revision: 331319 URL: https://svnweb.freebsd.org/changeset/base/331319 Log: MFC r328087 (by fabient): Fix pmcstat exit from kernel introduced by r325275. PR: 223689 Modified: stable/11/lib/libpmc/pmclog.c stable/11/sys/dev/hwpmc/hwpmc_logging.c stable/11/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libpmc/pmclog.c ============================================================================== --- stable/11/lib/libpmc/pmclog.c Wed Mar 21 18:57:31 2018 (r331318) +++ stable/11/lib/libpmc/pmclog.c Wed Mar 21 19:33:00 2018 (r331319) @@ -335,6 +335,8 @@ pmclog_get_event(void *cookie, char **data, ssize_t *l ev->pl_u.pl_cc.pl_pc[npc] = (uintfptr_t) 0; break; case PMCLOG_TYPE_CLOSELOG: + ev->pl_state = PMCLOG_EOF; + return (-1); case PMCLOG_TYPE_DROPNOTIFY: /* nothing to do */ break; Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 21 18:57:31 2018 (r331318) +++ stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 21 19:33:00 2018 (r331319) @@ -803,6 +803,8 @@ pmclog_close(struct pmc_owner *po) PMCDBG1(LOG,CLO,1, "po=%p", po); + pmclog_process_closelog(po); + mtx_lock(&pmc_kthread_mtx); /* Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 21 18:57:31 2018 (r331318) +++ stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 21 19:33:00 2018 (r331319) @@ -2928,7 +2928,6 @@ pmc_syscall_handler(struct thread *td, void *syscall_a po : NULL); } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_proc_ignite(pmclog_proc_handle, NULL); - pmclog_process_closelog(po); error = pmclog_close(po); if (error == 0) { LIST_FOREACH(pm, &po->po_pmcs, pm_next) From owner-svn-src-all@freebsd.org Wed Mar 21 20:13:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 006C8F63227; Wed, 21 Mar 2018 20:13:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A75288571E; Wed, 21 Mar 2018 20:13:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A22642F48A; Wed, 21 Mar 2018 20:13:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LKDOCx064106; Wed, 21 Mar 2018 20:13:24 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LKDOVU064104; Wed, 21 Mar 2018 20:13:24 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803212013.w2LKDOVU064104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 21 Mar 2018 20:13:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331320 - stable/10/sys/dev/cxgb X-SVN-Group: stable-10 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/10/sys/dev/cxgb X-SVN-Commit-Revision: 331320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 20:13:25 -0000 Author: np Date: Wed Mar 21 20:13:24 2018 New Revision: 331320 URL: https://svnweb.freebsd.org/changeset/base/331320 Log: MFC r328315: cxgb(4): Validate offset/len in the GET_EEPROM ioctl. Sponsored by: Chelsio Communications. Modified: stable/10/sys/dev/cxgb/cxgb_main.c Modified: stable/10/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/10/sys/dev/cxgb/cxgb_main.c Wed Mar 21 19:33:00 2018 (r331319) +++ stable/10/sys/dev/cxgb/cxgb_main.c Wed Mar 21 20:13:24 2018 (r331320) @@ -2914,8 +2914,14 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long c case CHELSIO_GET_EEPROM: { int i; struct ch_eeprom *e = (struct ch_eeprom *)data; - uint8_t *buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT); + uint8_t *buf; + if (e->offset & 3 || e->offset >= EEPROMSIZE || + e->len > EEPROMSIZE || e->offset + e->len > EEPROMSIZE) { + return (EINVAL); + } + + buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT); if (buf == NULL) { return (ENOMEM); } From owner-svn-src-all@freebsd.org Wed Mar 21 20:28:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4F33F6460C; Wed, 21 Mar 2018 20:28:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 2392F863A1; Wed, 21 Mar 2018 20:28:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2LKRqEf020067 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 22:27:55 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LKRqEf020067 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LKRqBW020066; Wed, 21 Mar 2018 22:27:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 22:27:52 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons Message-ID: <20180321202752.GO76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322024846.S4293@besplex.bde.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 20:28:04 -0000 On Thu, Mar 22, 2018 at 04:53:22AM +1100, Bruce Evans wrote: > Serial console drivers with fast interrupt handlers have much more > broken locking for ddb special keys. It is invalid to either drop locks > or call the "any" function from a fast interrupt handler, but buggy > serial console drivers calls kbd_alt_break(), and that now calls > shutdown_nice() and other functions that cannot be called from a fast > interrupt handler. ddb keys supply most of the shutdown_nice() > functionality for serial consoles, and there are no escape sequence to > get this without ddb or maybe another debugger, so these bugs don't > affect most users. > > Handling this correctly requires much the same fix as an unsafe signal > handler, and fixes have much the same problems -- not much more than > setting a flag is safe, and the flag might never be looked at if the > system is in a bad state. However, if a nice shutdown is possible then > the sytem must be in a good enough state to poll for flags. Are you saying that fast interrupt handlers call shutdown_nice() ? This is the quite serious bug on its own. To fix it, shutdown_nice() should use a fast taskqueue to schedule the task which would lock the process and send the signal. From owner-svn-src-all@freebsd.org Wed Mar 21 20:36:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEDAEF6504A; Wed, 21 Mar 2018 20:36:58 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70E2286A5D; Wed, 21 Mar 2018 20:36:58 +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 6775D2F7AF; Wed, 21 Mar 2018 20:36:58 +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 w2LKawnm074471; Wed, 21 Mar 2018 20:36:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LKavpe074466; Wed, 21 Mar 2018 20:36:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803212036.w2LKavpe074466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 20:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331321 - in head/stand: efi/boot1 efi/loader lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: efi/boot1 efi/loader lua X-SVN-Commit-Revision: 331321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 20:36:59 -0000 Author: kevans Date: Wed Mar 21 20:36:57 2018 New Revision: 331321 URL: https://svnweb.freebsd.org/changeset/base/331321 Log: UEFI: Ditch console mode setting, choose optimal GOP mode later in boot boot1 is too early to be deciding a good resolution. Console modes don't map cleanly/predictably to actual screen resolutions, and GOP does not reflect the actual screen resolution after a console mode change. Rip it out. Add an efi-autoresizecons command to loader to choose an optimal screen resolution based on the current environment. We'll explicitly execute this later, preferably before we draw anything of value but after we load config and pick up any tunables we may need to decide where we're going. This method also allows us to actually pass the correct framebuffer information on to the kernel. UGA autoresizing is not implemented because it doesn't have the kind of mode enumeration that GOP does. If an interested person with relevant hardware could get in contact, we can take a look at implementing UGA autoresize. This effectively "fixes" the breakage caused by r327058, but doesn't actually set the resolution correctly until the interpreter calls efi-autoresizcons. The lualoader version of this has been included for reference; the forth equivalent will follow. Reviewed by: imp (with some hestitation), manu Differential Revision: https://reviews.freebsd.org/D14788 Modified: head/stand/efi/boot1/boot1.c head/stand/efi/loader/framebuffer.c head/stand/lua/core.lua head/stand/lua/loader.lua Modified: head/stand/efi/boot1/boot1.c ============================================================================== --- head/stand/efi/boot1/boot1.c Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/efi/boot1/boot1.c Wed Mar 21 20:36:57 2018 (r331321) @@ -391,7 +391,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) EFI_STATUS status; EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL; SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; - UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles; + UINTN i, hsize, nhandles; CHAR16 *text; UINT16 boot_current; size_t sz; @@ -410,22 +410,11 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) (void)ConsoleControl->SetMode(ConsoleControl, EfiConsoleControlScreenText); /* - * Reset the console and find the best text mode. + * Reset the console enable the cursor. Later we'll choose a better + * console size through GOP/UGA. */ conout = ST->ConOut; conout->Reset(conout, TRUE); - max_dim = best_mode = 0; - for (i = 0; i < conout->Mode->MaxMode; i++) { - status = conout->QueryMode(conout, i, &cols, &rows); - if (EFI_ERROR(status)) - continue; - if (cols * rows > max_dim) { - max_dim = cols * rows; - best_mode = i; - } - } - if (max_dim > 0) - conout->SetMode(conout, best_mode); conout->EnableCursor(conout, TRUE); conout->ClearScreen(conout); Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/efi/loader/framebuffer.c Wed Mar 21 20:36:57 2018 (r331321) @@ -462,6 +462,72 @@ print_efifb(int mode, struct efi_fb *efifb, int verbos } } +static int +gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) +{ + struct efi_fb efifb; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; + EFI_STATUS status; + UINTN infosz; + UINT32 best_mode, currdim, maxdim, mode; + + best_mode = maxdim = 0; + for (mode = 0; mode < gop->Mode->MaxMode; mode++) { + status = gop->QueryMode(gop, mode, &infosz, &info); + if (EFI_ERROR(status)) + continue; + efifb_from_gop(&efifb, gop->Mode, info); + currdim = info->HorizontalResolution * info->VerticalResolution; + /* XXX TODO: Allow tunable or something for max resolution */ + if (currdim > maxdim) { + maxdim = currdim; + best_mode = mode; + } + } + + status = gop->SetMode(gop, best_mode); + if (EFI_ERROR(status)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "gop_autoresize: Unable to set mode to %u (error=%lu)", + mode, EFI_ERROR_CODE(status)); + return (CMD_ERROR); + } + return (CMD_OK); +} + +static int +uga_autoresize(EFI_UGA_DRAW_PROTOCOL *gop) +{ + + return (CMD_OK); +} + +COMMAND_SET(efi_autoresize, "efi-autoresizecons", "EFI Auto-resize Console", command_autoresize); + +static int +command_autoresize(int argc, char *argv[]) +{ + EFI_GRAPHICS_OUTPUT *gop; + EFI_UGA_DRAW_PROTOCOL *uga; + EFI_STATUS status; + u_int mode; + + gop = NULL; + uga = NULL; + status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); + if (EFI_ERROR(status) == 0) + return (gop_autoresize(gop)); + + status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); + if (EFI_ERROR(status) == 0) + return (uga_autoresize(uga)); + + snprintf(command_errbuf, sizeof(command_errbuf), + "%s: Neither Graphics Output Protocol nor Universal Graphics Adapter present", + argv[0]); + return (CMD_ERROR); +} + COMMAND_SET(gop, "gop", "graphics output protocol", command_gop); static int Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/lua/core.lua Wed Mar 21 20:36:57 2018 (r331321) @@ -274,6 +274,12 @@ function core.isSingleUserBoot() return single_user ~= nil and single_user:lower() == "yes" end +function core.isUEFIBoot() + local efiver = loader.getenv("efi-version") + + return efiver ~= nil +end + function core.isZFSBoot() local c = loader.getenv("currdev") Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/lua/loader.lua Wed Mar 21 20:36:57 2018 (r331321) @@ -50,6 +50,9 @@ if result ~= nil then end config.load() +if core.isUEFIBoot() then + loader.perform("efi-autoresizecons") +end -- Our console may have been setup for a different color scheme before we get -- here, so make sure we set the default. if color.isEnabled() then From owner-svn-src-all@freebsd.org Wed Mar 21 20:59:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04E53F6690C; Wed, 21 Mar 2018 20:59:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DCE787A43; Wed, 21 Mar 2018 20:59:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98A502FAAF; Wed, 21 Mar 2018 20:59:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LKxUiH084369; Wed, 21 Mar 2018 20:59:30 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LKxUiO084366; Wed, 21 Mar 2018 20:59:30 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803212059.w2LKxUiO084366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 21 Mar 2018 20:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331322 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 331322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 20:59:31 -0000 Author: glebius Date: Wed Mar 21 20:59:30 2018 New Revision: 331322 URL: https://svnweb.freebsd.org/changeset/base/331322 Log: The net.inet.tcp.nolocaltimewait=1 optimization prevents local TCP connections from entering the TIME_WAIT state. However, it omits sending the ACK for the FIN, which results in RST. This becomes a bigger deal if the sysctl net.inet.tcp.blackhole is 2. In this case RST isn't send, so the other side of the connection (also local) keeps retransmitting FINs. To fix that in tcp_twstart() we will not call tcp_close() immediately. Instead we will allocate a tcptw on stack and proceed to the end of the function all the way to tcp_twrespond(), to generate the correct ACK, then we will drop the last PCB reference. While here, make a few tiny improvements: - use bools for boolean variable - staticize nolocaltimewait - remove pointless acquisiton of socket lock Reported by: jtl Reviewed by: jtl Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D14697 Modified: head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Wed Mar 21 20:36:57 2018 (r331321) +++ head/sys/netinet/tcp_timewait.c Wed Mar 21 20:59:30 2018 (r331322) @@ -172,7 +172,7 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE &maxtcptw, 0, sysctl_maxtcptw, "IU", "Maximum number of compressed TCP TIME_WAIT entries"); -VNET_DEFINE(int, nolocaltimewait) = 0; +static VNET_DEFINE(int, nolocaltimewait) = 0; #define V_nolocaltimewait VNET(nolocaltimewait) SYSCTL_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nolocaltimewait), 0, @@ -225,12 +225,12 @@ tcp_tw_destroy(void) void tcp_twstart(struct tcpcb *tp) { - struct tcptw *tw; + struct tcptw twlocal, *tw; struct inpcb *inp = tp->t_inpcb; - int acknow; struct socket *so; + bool acknow, local; #ifdef INET6 - int isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6; + bool isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6; #endif INP_INFO_RLOCK_ASSERT(&V_tcbinfo); @@ -241,33 +241,29 @@ tcp_twstart(struct tcpcb *tp) "(inp->inp_flags & INP_DROPPED) != 0")); if (V_nolocaltimewait) { - int error = 0; #ifdef INET6 if (isipv6) - error = in6_localaddr(&inp->in6p_faddr); + local = in6_localaddr(&inp->in6p_faddr); #endif #if defined(INET6) && defined(INET) else #endif #ifdef INET - error = in_localip(inp->inp_faddr); + local = in_localip(inp->inp_faddr); #endif - if (error) { - tp = tcp_close(tp); - if (tp != NULL) - INP_WUNLOCK(inp); - return; - } - } + } else + local = false; - /* * For use only by DTrace. We do not reference the state * after this point so modifying it in place is not a problem. */ tcp_state_change(tp, TCPS_TIME_WAIT); - tw = uma_zalloc(V_tcptw_zone, M_NOWAIT); + if (local) + tw = &twlocal; + else + tw = uma_zalloc(V_tcptw_zone, M_NOWAIT); if (tw == NULL) { /* * Reached limit on total number of TIMEWAIT connections @@ -286,11 +282,10 @@ tcp_twstart(struct tcpcb *tp) } } /* - * The tcptw will hold a reference on its inpcb until tcp_twclose - * is called + * For !local case the tcptw will hold a reference on its inpcb + * until tcp_twclose is called. */ tw->tw_inpcb = inp; - in_pcbref(inp); /* Reference from tw */ /* * Recover last window size sent. @@ -337,16 +332,19 @@ tcp_twstart(struct tcpcb *tp) tcp_discardcb(tp); so = inp->inp_socket; soisdisconnected(so); - tw->tw_cred = crhold(so->so_cred); - SOCK_LOCK(so); tw->tw_so_options = so->so_options; - SOCK_UNLOCK(so); + inp->inp_flags |= INP_TIMEWAIT; if (acknow) tcp_twrespond(tw, TH_ACK); - inp->inp_ppcb = tw; - inp->inp_flags |= INP_TIMEWAIT; - TCPSTATES_INC(TCPS_TIME_WAIT); - tcp_tw_2msl_reset(tw, 0); + if (local) + in_pcbdrop(inp); + else { + in_pcbref(inp); /* Reference from tw */ + tw->tw_cred = crhold(so->so_cred); + inp->inp_ppcb = tw; + TCPSTATES_INC(TCPS_TIME_WAIT); + tcp_tw_2msl_reset(tw, 0); + } /* * If the inpcb owns the sole reference to the socket, then we can Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Wed Mar 21 20:36:57 2018 (r331321) +++ head/sys/netinet/tcp_usrreq.c Wed Mar 21 20:59:30 2018 (r331322) @@ -198,15 +198,18 @@ tcp_detach(struct socket *so, struct inpcb *inp) * XXXRW: Would it be cleaner to free the tcptw here? * * Astute question indeed, from twtcp perspective there are - * three cases to consider: + * four cases to consider: * * #1 tcp_detach is called at tcptw creation time by * tcp_twstart, then do not discard the newly created tcptw * and leave inpcb present until timewait ends - * #2 tcp_detach is called at timewait end (or reuse) by + * #2 tcp_detach is called at tcptw creation time by + * tcp_twstart, but connection is local and tw will be + * discarded immediately + * #3 tcp_detach is called at timewait end (or reuse) by * tcp_twclose, then the tcptw has already been discarded * (or reused) and inpcb is freed here - * #3 tcp_detach is called() after timewait ends (or reuse) + * #4 tcp_detach is called() after timewait ends (or reuse) * (e.g. by soclose), then tcptw has already been discarded * (or reused) and inpcb is freed here * From owner-svn-src-all@freebsd.org Wed Mar 21 21:10:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A50BBF67695; Wed, 21 Mar 2018 21:10:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC743683B1; Wed, 21 Mar 2018 21:10:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D745D2FC6F; Wed, 21 Mar 2018 21:10:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LLAnfa089642; Wed, 21 Mar 2018 21:10:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LLAn2A089641; Wed, 21 Mar 2018 21:10:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803212110.w2LLAn2A089641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 21 Mar 2018 21:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331323 - stable/11/gnu/usr.bin/gdb/kgdb X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/gnu/usr.bin/gdb/kgdb X-SVN-Commit-Revision: 331323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 21:10:51 -0000 Author: jhb Date: Wed Mar 21 21:10:49 2018 New Revision: 331323 URL: https://svnweb.freebsd.org/changeset/base/331323 Log: MFC 328158,330708: Update kgdb for PTI. 328158: Recognize mchk_calltrap as a trapframe generator. Should have been included in r328157. 330708: Use the trapframe unwinder for "fast_syscall_common". Modified: stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Directory Properties: stable/11/ (props changed) Modified: stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c ============================================================================== --- stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Wed Mar 21 20:59:30 2018 (r331322) +++ stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Wed Mar 21 21:10:49 2018 (r331323) @@ -189,6 +189,8 @@ kgdb_trgt_trapframe_sniffer(struct frame_info *next_fr if (pname == NULL) return (NULL); if (strcmp(pname, "calltrap") == 0 || + strcmp(pname, "fast_syscall_common") == 0 || + strcmp(pname, "mchk_calltrap") == 0 || strcmp(pname, "nmi_calltrap") == 0 || (pname[0] == 'X' && pname[1] != '_')) return (&kgdb_trgt_trapframe_unwind); From owner-svn-src-all@freebsd.org Wed Mar 21 21:13:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF0C5F67A95; Wed, 21 Mar 2018 21:13:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 769A1687D6; Wed, 21 Mar 2018 21:13:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 712C72FDE5; Wed, 21 Mar 2018 21:13:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LLDQId094357; Wed, 21 Mar 2018 21:13:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LLDQXp094356; Wed, 21 Mar 2018 21:13:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803212113.w2LLDQXp094356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 21 Mar 2018 21:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331324 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 331324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 21:13:27 -0000 Author: jhb Date: Wed Mar 21 21:13:26 2018 New Revision: 331324 URL: https://svnweb.freebsd.org/changeset/base/331324 Log: Ensure thread library is initialized in pthread_testcancel(). Call _thr_check_init() before reading curthread in pthread_testcancel(). If a constructor in a library creates a semaphore via sem_init() and then waits for it via sem_wait(), the program can core dump in _pthread_testcancel() called from sem_wait(). This is because the semaphore implementation lives in libc, so the library's constructors can be run before libthr's constructors. Reported by: arichardson Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14786 Modified: head/lib/libthr/thread/thr_cancel.c Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Wed Mar 21 21:10:49 2018 (r331323) +++ head/lib/libthr/thread/thr_cancel.c Wed Mar 21 21:13:26 2018 (r331324) @@ -132,8 +132,10 @@ _pthread_setcanceltype(int type, int *oldtype) void _pthread_testcancel(void) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; + _thr_check_init(); + curthread = _get_curthread(); testcancel(curthread); } From owner-svn-src-all@freebsd.org Wed Mar 21 21:15:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98598F67E15; Wed, 21 Mar 2018 21:15:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C75B768AA9; Wed, 21 Mar 2018 21:15:43 +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 A4F452FDEA; Wed, 21 Mar 2018 21:15:43 +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 w2LLFh0d094488; Wed, 21 Mar 2018 21:15:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LLFhDl094487; Wed, 21 Mar 2018 21:15:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803212115.w2LLFhDl094487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Mar 2018 21:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331325 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 21:15:45 -0000 Author: markj Date: Wed Mar 21 21:15:43 2018 New Revision: 331325 URL: https://svnweb.freebsd.org/changeset/base/331325 Log: Elide the object lock in the common case in vfs_vmio_unwire(). The object lock was only needed when attempting to free B_DIRECT buffer pages, and for testing for invalid pages (and freeing them if so). Handle the latter by instead moving invalid pages near the head of the inactive queue, where they will be reclaimed quickly. Reviewed by: alc, kib, jeff MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D14778 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Mar 21 21:13:26 2018 (r331324) +++ head/sys/kern/vfs_bio.c Wed Mar 21 21:15:43 2018 (r331325) @@ -2901,7 +2901,8 @@ vfs_vmio_iodone(struct buf *bp) } /* - * Unwire a page held by a buf and place it on the appropriate vm queue. + * Unwire a page held by a buf and either free it or update the page queues to + * reflect its recent use. */ static void vfs_vmio_unwire(struct buf *bp, vm_page_t m) @@ -2910,24 +2911,26 @@ vfs_vmio_unwire(struct buf *bp, vm_page_t m) vm_page_lock(m); if (vm_page_unwire_noq(m)) { - /* - * Determine if the page should be freed before adding - * it to the inactive queue. - */ - if (m->valid == 0) { - freed = !vm_page_busied(m); - if (freed) - vm_page_free(m); - } else if ((bp->b_flags & B_DIRECT) != 0) + if ((bp->b_flags & B_DIRECT) != 0) freed = vm_page_try_to_free(m); else freed = false; if (!freed) { /* - * If the page is unlikely to be reused, let the - * VM know. Otherwise, maintain LRU. + * Use a racy check of the valid bits to determine + * whether we can accelerate reclamation of the page. + * The valid bits will be stable unless the page is + * being mapped or is referenced by multiple buffers, + * and in those cases we expect races to be rare. At + * worst we will either accelerate reclamation of a + * valid page and violate LRU, or unnecessarily defer + * reclamation of an invalid page. + * + * The B_NOREUSE flag marks data that is not expected to + * be reused, so accelerate reclamation in that case + * too. Otherwise, maintain LRU. */ - if ((bp->b_flags & B_NOREUSE) != 0) + if (m->valid == 0 || (bp->b_flags & B_NOREUSE) != 0) vm_page_deactivate_noreuse(m); else if (m->queue == PQ_ACTIVE) vm_page_reference(m); @@ -3014,7 +3017,11 @@ vfs_vmio_truncate(struct buf *bp, int desiredpages) (desiredpages << PAGE_SHIFT), bp->b_npages - desiredpages); } else BUF_CHECK_UNMAPPED(bp); - obj = bp->b_bufobj->bo_object; + + /* + * The object lock is needed only if we will attempt to free pages. + */ + obj = (bp->b_flags & B_DIRECT) != 0 ? bp->b_bufobj->bo_object : NULL; if (obj != NULL) VM_OBJECT_WLOCK(obj); for (i = desiredpages; i < bp->b_npages; i++) { From owner-svn-src-all@freebsd.org Wed Mar 21 21:54:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7D63F6AA45; Wed, 21 Mar 2018 21:54:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 452306A956; Wed, 21 Mar 2018 21:54:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0659526061A; Wed, 21 Mar 2018 22:54:12 +0100 (CET) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Andrew Turner Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803211517.w2LFHsHf007714@repo.freebsd.org> <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> From: Hans Petter Selasky Message-ID: <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> Date: Wed, 21 Mar 2018 22:54:08 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 21:54:15 -0000 On 03/21/18 17:45, Andrew Turner wrote: > > >> On 21 Mar 2018, at 15:37, Hans Petter Selasky wrote: >> >> On 03/21/18 16:24, Kyle Evans wrote: >>>> + { >>>> + .ep_end = 7, >>>> + .ep_fifosz_shift = 9, >>>> + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, >>>> + }, >>> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >>> this case drop to 9? frx = 10 in the temp < 8 case in the removals of >>> the following hunks. Mostly curious because the others seemed to stay >>> the same. >> >> Hi Andrew, >> >> It might be an idea to keep the fifosz_shift at 10, else high-speed BULK traffic won't be double buffered, and this might affect performance. > > Should the endpoint 1 size also be fixed? The register has it at 4k, but it wasn’t an 8k buffer. > No, because High-Speed BULK will only use 512 byte packets, and 4k is reserved for isochronous, which doesn't need double buffering at the moment. --HPS From owner-svn-src-all@freebsd.org Wed Mar 21 22:01:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AF4EF6B402; Wed, 21 Mar 2018 22:01: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2B436B1A9; Wed, 21 Mar 2018 22:01:51 +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 A3C56585; Wed, 21 Mar 2018 22:01:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LM1pWp020206; Wed, 21 Mar 2018 22:01:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LM1pvl020202; Wed, 21 Mar 2018 22:01:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803212201.w2LM1pvl020202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 22:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331326 - in head/stand: forth i386/loader X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: forth i386/loader X-SVN-Commit-Revision: 331326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 22:01:52 -0000 Author: kevans Date: Wed Mar 21 22:01:51 2018 New Revision: 331326 URL: https://svnweb.freebsd.org/changeset/base/331326 Log: Forth version of EFI autoresizing r331321 delegated autoresizing to an efi-autoresizecons command that currently is expected to be done in forth/lua prior to drawing anything useful. Add the Forth version of the lua addition in r331321, hook efi.4th up to be installed. efiboot? was written by dteske@; anything outside of that may be blamed on me. Modified: head/stand/forth/Makefile head/stand/forth/efi.4th head/stand/forth/loader.rc head/stand/i386/loader/loader.rc Modified: head/stand/forth/Makefile ============================================================================== --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th FILES+= check-password.4th FILES+= color.4th FILES+= delay.4th +FILES+= efi.4th FILES+= frames.4th FILES+= loader.4th FILES+= logo-beastie.4th Modified: head/stand/forth/efi.4th ============================================================================== --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) @@ -26,5 +26,16 @@ only forth definitions -\ Place holder for more functions +: efiboot? ( -- flag ) + s" efi-version" getenv -1 <> dup if + swap drop ( c-addr flag -- flag ) + then +; + +: maybe-efi-resizecons + efiboot? if + efi-autoresizecons + then +; + .( EFI boot environment) cr Modified: head/stand/forth/loader.rc ============================================================================== --- head/stand/forth/loader.rc Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/forth/loader.rc Wed Mar 21 22:01:51 2018 (r331326) @@ -6,11 +6,14 @@ \ \ Includes additional commands include /boot/loader.4th +include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables \ NOTE: Change to `initialize' if you enable the below boot menu start + +maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password Modified: head/stand/i386/loader/loader.rc ============================================================================== --- head/stand/i386/loader/loader.rc Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/i386/loader/loader.rc Wed Mar 21 22:01:51 2018 (r331326) @@ -3,10 +3,13 @@ \ \ Includes additional commands include /boot/loader.4th +include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables initialize + +maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password From owner-svn-src-all@freebsd.org Wed Mar 21 23:17:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 781C0F4CD36; Wed, 21 Mar 2018 23:17: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AC0E6E1F8; Wed, 21 Mar 2018 23:17: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 25AF7105A; Wed, 21 Mar 2018 23:17: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 w2LNHR1b055896; Wed, 21 Mar 2018 23:17:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNHRub055895; Wed, 21 Mar 2018 23:17:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212317.w2LNHRub055895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:17:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331327 - head/sys/i386/ibcs2 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/ibcs2 X-SVN-Commit-Revision: 331327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:17:27 -0000 Author: emaste Date: Wed Mar 21 23:17:26 2018 New Revision: 331327 URL: https://svnweb.freebsd.org/changeset/base/331327 Log: Add ) missing from r330297 Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/ibcs2/ibcs2_ipc.c Modified: head/sys/i386/ibcs2/ibcs2_ipc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_ipc.c Wed Mar 21 22:01:51 2018 (r331326) +++ head/sys/i386/ibcs2/ibcs2_ipc.c Wed Mar 21 23:17:26 2018 (r331327) @@ -282,7 +282,7 @@ cvt_semid2isemid(bp, ibp) struct semid_ds *bp; struct ibcs2_semid_ds *ibp; { - memset(ibp, 0, sizeof(*ibp); + memset(ibp, 0, sizeof(*ibp)); cvt_perm2iperm(&bp->sem_perm, &ibp->sem_perm); ibp->sem_nsems = bp->sem_nsems; ibp->sem_otime = bp->sem_otime; From owner-svn-src-all@freebsd.org Wed Mar 21 23:21:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2992F4D26C; Wed, 21 Mar 2018 23:21:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 541AA6E500; Wed, 21 Mar 2018 23:21:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4EFFD1192; Wed, 21 Mar 2018 23:21:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNLW1N059166; Wed, 21 Mar 2018 23:21:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNLWa1059145; Wed, 21 Mar 2018 23:21:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803212321.w2LNLWa1059145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 21 Mar 2018 23:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331328 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:21:33 -0000 Author: glebius Date: Wed Mar 21 23:21:32 2018 New Revision: 331328 URL: https://svnweb.freebsd.org/changeset/base/331328 Log: Fix sysctl types broken in r329612. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Mar 21 23:17:26 2018 (r331327) +++ head/sys/kern/vfs_bio.c Wed Mar 21 23:21:32 2018 (r331328) @@ -261,17 +261,17 @@ SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, "Number of buffers that are dirty (has unwritten changes) at the moment"); static int lodirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, lodirtybuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "L", "How many buffers we want to have free before bufdaemon can sleep"); static int hidirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, hidirtybuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "L", "When the number of dirty buffers is considered severe"); int dirtybufthresh; SYSCTL_PROC(_vfs, OID_AUTO, dirtybufthresh, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "L", "Number of bdwrite to bawrite conversions to clear dirty buffers"); static int numfreebuffers; @@ -279,12 +279,12 @@ SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, "Number of free buffers"); static int lofreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, lofreebuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "L", "Target number of free buffers"); static int hifreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, hifreebuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "L", "Threshold for clean buffer recycling"); static counter_u64_t getnewbufcalls; From owner-svn-src-all@freebsd.org Wed Mar 21 23:26:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E715F4D985; Wed, 21 Mar 2018 23:26:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BABD06EA41; Wed, 21 Mar 2018 23:26:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC97D11D3; Wed, 21 Mar 2018 23:26:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNQgdC060793; Wed, 21 Mar 2018 23:26:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNQg9f060792; Wed, 21 Mar 2018 23:26:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212326.w2LNQg9f060792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331329 - head/sys/i386/ibcs2 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/ibcs2 X-SVN-Commit-Revision: 331329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:26:43 -0000 Author: emaste Date: Wed Mar 21 23:26:42 2018 New Revision: 331329 URL: https://svnweb.freebsd.org/changeset/base/331329 Log: Fix kernel memory disclosure in ibcs2_getdents ibcs2_getdents() copies a dirent structure to userland. The ibcs2 dirent structure contains a 2 byte pad element. This element is never initialized, but copied to userland none-the-less. Note that ibcs2 has not built on HEAD since r302095. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel MFC after: 3 days Security: Kernel memory disclosure (803) Modified: head/sys/i386/ibcs2/ibcs2_misc.c Modified: head/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_misc.c Wed Mar 21 23:21:32 2018 (r331328) +++ head/sys/i386/ibcs2/ibcs2_misc.c Wed Mar 21 23:26:42 2018 (r331329) @@ -330,6 +330,7 @@ ibcs2_getdents(struct thread *td, struct ibcs2_getdent #define BSD_DIRENT(cp) ((struct dirent *)(cp)) #define IBCS2_RECLEN(reclen) (reclen + sizeof(u_short)) + memset(&idb, 0, sizeof(idb)); error = getvnode(td, uap->fd, cap_rights_init(&rights, CAP_READ), &fp); if (error != 0) return (error); From owner-svn-src-all@freebsd.org Wed Mar 21 23:45:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4F15F4EF60; Wed, 21 Mar 2018 23:45:48 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 94C736F580; Wed, 21 Mar 2018 23:45:48 +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 8B7C514F1; Wed, 21 Mar 2018 23:45:48 +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 w2LNjmSc070956; Wed, 21 Mar 2018 23:45:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNjmTf070955; Wed, 21 Mar 2018 23:45:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212345.w2LNjmTf070955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331330 - stable/11/sys/compat/svr4 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/compat/svr4 X-SVN-Commit-Revision: 331330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:45:49 -0000 Author: emaste Date: Wed Mar 21 23:45:48 2018 New Revision: 331330 URL: https://svnweb.freebsd.org/changeset/base/331330 Log: Fix kernel memory disclosure in svr4_sys_getdents64 svr4_sys_getdents64() copies a dirent structure to userland. When calculating the record length for any given dirent entry alignment is performed. However, the aligned bytes are not cleared, this will trigger an info leak. Direct commit to stable/11; this code does not exist in HEAD. This change to be merged from stable/11 to stable/10. Reported by: Ilja Van Sprundel MFC after: 3 days Security: Kernel memory disclosure (797) Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/compat/svr4/svr4_misc.c Modified: stable/11/sys/compat/svr4/svr4_misc.c ============================================================================== --- stable/11/sys/compat/svr4/svr4_misc.c Wed Mar 21 23:26:42 2018 (r331329) +++ stable/11/sys/compat/svr4/svr4_misc.c Wed Mar 21 23:45:48 2018 (r331330) @@ -259,6 +259,7 @@ svr4_sys_getdents64(td, uap) u_long *cookies = NULL, *cookiep; int ncookies; + memset(&svr4_dirent, 0, sizeof(svr4_dirent)); DPRINTF(("svr4_sys_getdents64(%d, *, %d)\n", uap->fd, uap->nbytes)); error = getvnode(td, uap->fd, cap_rights_init(&rights, CAP_READ), &fp); From owner-svn-src-all@freebsd.org Wed Mar 21 23:46:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8057FF4F056; Wed, 21 Mar 2018 23:46:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 345676F6AE; Wed, 21 Mar 2018 23:46:27 +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 2F2D014F2; Wed, 21 Mar 2018 23:46:27 +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 w2LNkRwe071020; Wed, 21 Mar 2018 23:46:27 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNkRhs071019; Wed, 21 Mar 2018 23:46:27 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803212346.w2LNkRhs071019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 23:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331331 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 331331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:46:27 -0000 Author: cem Date: Wed Mar 21 23:46:26 2018 New Revision: 331331 URL: https://svnweb.freebsd.org/changeset/base/331331 Log: Apply r228478 (CTASSERT => _Static_assert()) to stand bootstrap.h Reported by: GCC (it doesn't like the unused array) Sponsored by: Dell EMC Isilon Modified: head/stand/common/bootstrap.h Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Wed Mar 21 23:45:48 2018 (r331330) +++ head/stand/common/bootstrap.h Wed Mar 21 23:46:26 2018 (r331331) @@ -330,10 +330,8 @@ void dev_cleanup(void); time_t time(time_t *tloc); -#ifndef CTASSERT /* Allow lint to override */ -#define CTASSERT(x) _CTASSERT(x, __LINE__) -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] +#ifndef CTASSERT +#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #endif #endif /* !_BOOTSTRAP_H_ */ From owner-svn-src-all@freebsd.org Wed Mar 21 23:50:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10837F4F51D; Wed, 21 Mar 2018 23:50:47 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5ECD6FA05; Wed, 21 Mar 2018 23:50:46 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0EC21503; Wed, 21 Mar 2018 23:50:46 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNok2Z071226; Wed, 21 Mar 2018 23:50:46 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNokLZ071225; Wed, 21 Mar 2018 23:50:46 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201803212350.w2LNokLZ071225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Wed, 21 Mar 2018 23:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331332 - head/lib/libjail X-SVN-Group: head X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: head/lib/libjail X-SVN-Commit-Revision: 331332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:50:47 -0000 Author: jamie Date: Wed Mar 21 23:50:46 2018 New Revision: 331332 URL: https://svnweb.freebsd.org/changeset/base/331332 Log: If a jail parameter isn't found, try loading a related kernel module. Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Wed Mar 21 23:46:26 2018 (r331331) +++ head/lib/libjail/jail.c Wed Mar 21 23:50:46 2018 (r331332) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -59,6 +60,7 @@ __FBSDID("$FreeBSD$"); static int jailparam_import_enum(const char **values, int nvalues, const char *valstr, size_t valsize, int *value); static int jailparam_type(struct jailparam *jp); +static int kldload_param(const char *name); static char *noname(const char *name); static char *nononame(const char *name); @@ -892,6 +894,9 @@ jailparam_type(struct jailparam *jp) "sysctl(0.3.%s): %s", name, strerror(errno)); return (-1); } + if (kldload_param(name) >= 0 && sysctl(mib, 2, mib + 2, &miblen, + desc.s, strlen(desc.s)) >= 0) + goto mib_desc; /* * The parameter probably doesn't exist. But it might be * the "no" counterpart to a boolean. @@ -1028,6 +1033,33 @@ jailparam_type(struct jailparam *jp) jp->jp_valuelen = 0; } return (0); +} + +/* + * Attempt to load a kernel module matching an otherwise nonexistent parameter. + */ +static int +kldload_param(const char *name) +{ + int kl; + + if (strcmp(name, "linux") == 0 || strncmp(name, "linux.", 6) == 0) + kl = kldload("linux"); + else if (strcmp(name, "sysvmsg") == 0 || strcmp(name, "sysvsem") == 0 || + strcmp(name, "sysvshm") == 0) + kl = kldload(name); + else { + errno = ENOENT; + return (-1); + } + if (kl < 0 && errno == EEXIST) { + /* + * In the module is already loaded, then it must not contain + * the parameter. + */ + errno = ENOENT; + } + return kl; } /* From owner-svn-src-all@freebsd.org Wed Mar 21 23:51:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD889F4F5AF; Wed, 21 Mar 2018 23:51:14 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 932766FB7F; Wed, 21 Mar 2018 23:51:14 +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 8E2A51618; Wed, 21 Mar 2018 23:51:14 +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 w2LNpEHd074175; Wed, 21 Mar 2018 23:51:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNpEOP074174; Wed, 21 Mar 2018 23:51:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212351.w2LNpEOP074174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331333 - head/sys/dev/drm X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/drm X-SVN-Commit-Revision: 331333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:51:15 -0000 Author: emaste Date: Wed Mar 21 23:51:14 2018 New Revision: 331333 URL: https://svnweb.freebsd.org/changeset/base/331333 Log: Fix kernel memory disclosure in drm_infobufs drm_infobufs() has a structure on the stack, fills it out and copies it to userland. There are 2 elements in the struct that are not filled out and left uninitialized. This will leak uninitialized kernel stack data to userland. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel MFC after: 1 day Security: Kernel memory disclosure (798) Modified: head/sys/dev/drm/drm_bufs.c Modified: head/sys/dev/drm/drm_bufs.c ============================================================================== --- head/sys/dev/drm/drm_bufs.c Wed Mar 21 23:50:46 2018 (r331332) +++ head/sys/dev/drm/drm_bufs.c Wed Mar 21 23:51:14 2018 (r331333) @@ -935,6 +935,7 @@ int drm_infobufs(struct drm_device *dev, void *data, s if (dma->bufs[i].buf_count) { struct drm_buf_desc from; + memset(&from, 0, sizeof(from)); from.count = dma->bufs[i].buf_count; from.size = dma->bufs[i].buf_size; from.low_mark = dma->bufs[i].freelist.low_mark; From owner-svn-src-all@freebsd.org Wed Mar 21 23:52:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33525F4F8C5; Wed, 21 Mar 2018 23:52:38 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA9C76FEFB; Wed, 21 Mar 2018 23:52:37 +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 D5690166D; Wed, 21 Mar 2018 23:52:37 +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 w2LNqbAs075737; Wed, 21 Mar 2018 23:52:37 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNqbH4075731; Wed, 21 Mar 2018 23:52:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803212352.w2LNqbH4075731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 23:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331334 - in head/lib/libc: gen include sys tests/gen X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/lib/libc: gen include sys tests/gen X-SVN-Commit-Revision: 331334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:52:38 -0000 Author: cem Date: Wed Mar 21 23:52:37 2018 New Revision: 331334 URL: https://svnweb.freebsd.org/changeset/base/331334 Log: getentropy(3): Fallback to kern.arandom sysctl on older kernels On older kernels, when userspace program disables SIGSYS, catch ENOSYS and emulate getrandom(2) syscall with the kern.arandom sysctl (via existing arc4_sysctl wrapper). Special care is taken to faithfully emulate EFAULT on NULL pointers, because sysctl(3) as used by kern.arandom ignores NULL oldp. (This was caught by getentropy(3) ATF tests.) Reported by: kib Reviewed by: kib Discussed with: delphij Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14785 Modified: head/lib/libc/gen/arc4random.c head/lib/libc/gen/getentropy.c head/lib/libc/include/libc_private.h head/lib/libc/sys/Symbol.map head/lib/libc/tests/gen/getentropy_test.c Modified: head/lib/libc/gen/arc4random.c ============================================================================== --- head/lib/libc/gen/arc4random.c Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/gen/arc4random.c Wed Mar 21 23:52:37 2018 (r331334) @@ -111,8 +111,8 @@ arc4_addrandom(u_char *dat, int datlen) rs.j = rs.i; } -static size_t -arc4_sysctl(u_char *buf, size_t size) +size_t +__arc4_sysctl(u_char *buf, size_t size) { int mib[2]; size_t len, done; @@ -143,7 +143,7 @@ arc4_stir(void) arc4_init(); rs_initialized = 1; } - if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE) { + if (__arc4_sysctl(rdat, KEYSIZE) != KEYSIZE) { /* * The sysctl cannot fail. If it does fail on some FreeBSD * derivative or after some future change, just abort so that Modified: head/lib/libc/gen/getentropy.c ============================================================================== --- head/lib/libc/gen/getentropy.c Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/gen/getentropy.c Wed Mar 21 23:52:37 2018 (r331334) @@ -37,6 +37,39 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" +/* + * If a newer libc is accidentally installed on an older kernel, provide high + * quality random data anyway. The sysctl interface is not as fast and does + * not block by itself, but is provided by even very old kernels. + */ +static int +getentropy_fallback(void *buf, size_t buflen) +{ + /* + * oldp (buf) == NULL has a special meaning for sysctl that results in + * no EFAULT. For compatibility with the kernel getrandom(2), detect + * this case and return the appropriate error. + */ + if (buf == NULL && buflen > 0) { + errno = EFAULT; + return (-1); + } + if (__arc4_sysctl(buf, buflen) != buflen) { + if (errno == EFAULT) + return (-1); + /* + * This cannot happen. _arc4_sysctl() spins until the random + * device is seeded and then repeatedly reads until the full + * request is satisfied. The only way for this to return a zero + * byte or short read is if sysctl(2) on the kern.arandom MIB + * fails. In this case, exceping the user-provided-a-bogus- + * buffer EFAULT, give up (like for arc4random(3)'s arc4_stir). + */ + abort(); + } + return (0); +} + int getentropy(void *buf, size_t buflen) { @@ -53,7 +86,7 @@ getentropy(void *buf, size_t buflen) if (errno == EINTR) continue; else if (errno == ENOSYS) - abort(); + return (getentropy_fallback(buf, buflen)); else return (-1); } Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/include/libc_private.h Wed Mar 21 23:52:37 2018 (r331334) @@ -405,6 +405,8 @@ int __sys_futimens(int fd, const struct timespec *tim int __sys_utimensat(int fd, const char *path, const struct timespec *times, int flag) __hidden; +__size_t __arc4_sysctl(unsigned char *, __size_t); + /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/sys/Symbol.map Wed Mar 21 23:52:37 2018 (r331334) @@ -628,8 +628,6 @@ FBSDprivate_1.0 { __sys_getppid; _getpriority; __sys_getpriority; - _getrandom; - __sys_getrandom; _getresgid; __sys_getresgid; _getresuid; Modified: head/lib/libc/tests/gen/getentropy_test.c ============================================================================== --- head/lib/libc/tests/gen/getentropy_test.c Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/tests/gen/getentropy_test.c Wed Mar 21 23:52:37 2018 (r331334) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -76,6 +77,8 @@ ATF_TC_BODY(getentropy_sizes, tc) ATF_TP_ADD_TCS(tp) { + + signal(SIGSYS, SIG_IGN); ATF_TP_ADD_TC(tp, getentropy_count); ATF_TP_ADD_TC(tp, getentropy_fault); From owner-svn-src-all@freebsd.org Thu Mar 22 00:31:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E8B4F529D2 for ; Thu, 22 Mar 2018 00:31:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BC3A71818 for ; Thu, 22 Mar 2018 00:31:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id e195-v6so9141483ita.5 for ; Wed, 21 Mar 2018 17:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=JbSV3/lRfw5JBEsHaH3glG6/IaMh4f3pjo0VrqFDHRU=; b=qIzeEpujJgrpmSgKKG4XcPwJC95AxMC2aLT0ohIzc3V69URN+yX58FmizJNy4u/ZVq aJHFZqKvr6oy/oNp2LbEUudaxB1ztxfg6lDhchy5OOwLILbMi6mWXOXxQmH1JjimJajO XRidC3SvE29IyeHS5WY6GluEO2KNRAMf8bQe5UWBl+Qv8/C3gzEJOtmEodRPN93Pzig1 AzNEyMM3aInVcXBt8Nu9TwO33ZEFN8daDjbWcpwyrznpWQd58DS4Kzy2ZLP5Z3r1MEXd ds/0KNEU6gwmmgj2DfjfOibxu9dvcO2eHFsxm5uq7sgENceWQmKoAVSkLeF3KiXHSK23 gY0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=JbSV3/lRfw5JBEsHaH3glG6/IaMh4f3pjo0VrqFDHRU=; b=mRW19X+EYnoBPCI4iHeKjIxGgWyJZm8NUmC08o7rRYddCFj8y/r+PALXR5J+IMA0gG tnZ3TkxGJaeMfheFHlANHsy5D647AzL2Bx6DjoUBxczyhRwijD68wM8DoqxK4fYESRO5 vEnLr6FWQA8AiolbWm1EbNhMqsc8EajH4WSDr2RHWiQ08Mx2xfHu+LLyVQRTfOi+6pr5 BTlNDhMUT+SIvUTJ79rWiqvGy/VV87z+BgRkx9IqO8LkHOv/h/Rbe/GWV9QaGdRgHGIR aUIR8SAQsL8+iOIc85bYaCqaeXBI3kzRiUUwDCDrlnzbGPXbO+OTSJxKd6VHectRCO+o kM5A== X-Gm-Message-State: AElRT7GwlgjWHO9t418FU+OwS9chcSa4JWkrk9Mc2OdcTdogb/cHo2FH 2IyB+dG1D0/ZW9NV2huel6VpAUzrhY8XwW9h94WXLA== X-Google-Smtp-Source: AG47ELu+ZP4esfZDRRlBqtGvPsDPJmXVjpZALxSuRhxPTyxomdiFycXPAWniwHsE940OCFmTTaE7Cqz8qhyUaiH4LiE= X-Received: by 2002:a24:fa83:: with SMTP id v125-v6mr6779148ith.36.1521678708767; Wed, 21 Mar 2018 17:31:48 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 17:31:48 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180322024846.S4293@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> From: Warner Losh Date: Wed, 21 Mar 2018 18:31:48 -0600 X-Google-Sender-Auth: ISadeU0shefjGu9BpBZmUy76Rpk Message-ID: Subject: Re: svn commit: r331298 - head/sys/dev/syscons To: Bruce Evans Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:31:50 -0000 On Wed, Mar 21, 2018 at 11:53 AM, Bruce Evans wrote: > On Wed, 21 Mar 2018, Warner Losh wrote: > > Log: >> Unlock giant when calling shutdown_nice() >> > > This breaks the driver. Giant is syscons' driver lock, and also the > interrupt handler lock for at least the atkbd keyboard driver, so vt > sometimes holds the lock for. > OK. I got carried away. You're right. The proper fix is to unlock Giant at the top of kern_reboot() instead. This handles the case where we call shutdown_nice() with no init running and have to call kern_reboot directly. Otherwise it's perfectly fine to just call shutdown_nice() with Giant held since we just signal init from there. So I'll revert this change and make that other change instead. > vt has to sprinkle lots of Giant locking and unlocking where the > corresponding locking is automatic for syscons, but this seems to be > nonsense in its event handler. vt has to acquire Giant when calling > the keyboard driver, but event handling is a call from the keyboard > driver, usually from the interrupt handler with a suitable lock held. > For atkbd, the suitable lock is Giant -- see atkbd_intr(). (All keyboard > drivers that use the kbd(4) for the top level use Giant looking since > toe top level specifies D_NEEDGIANT in its cdevsw. I think that is all > keyboard drivers.) So where vt_kbdevent() sprinkles Giant, that has no > effect since Giant is held by the caller. So vt_kbdevent() calls > vt_processkey() with Giant held despite it not acquiring Giant explicitly; > vt_processkey() calls vt_machine_kbdevent() and that calls various > shutdown functions, all with Giant held. True, and covered above. > Modified: head/sys/dev/syscons/syscons.c >> ============================================================ >> ================== >> --- head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:08 2018 >> (r331297) >> +++ head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:12 2018 >> (r331298) >> @@ -3858,22 +3858,28 @@ next_code: >> >> case RBT: >> #ifndef SC_DISABLE_REBOOT >> - if (enable_reboot && !(flags & SCGETC_CN)) >> + if (enable_reboot && !(flags & SCGETC_CN)) { >> + mtx_unlock(&Giant); >> shutdown_nice(0); >> + } >> #endif >> break; >> >> case HALT: >> #ifndef SC_DISABLE_REBOOT >> - if (enable_reboot && !(flags & SCGETC_CN)) >> + if (enable_reboot && !(flags & SCGETC_CN)) { >> + mtx_unlock(&Giant); >> shutdown_nice(RB_HALT); >> + } >> #endif >> break; >> >> case PDWN: >> #ifndef SC_DISABLE_REBOOT >> - if (enable_reboot && !(flags & SCGETC_CN)) >> + if (enable_reboot && !(flags & SCGETC_CN)) { >> + mtx_unlock(&Giant); >> shutdown_nice(RB_HALT|RB_POWEROFF); >> + } >> #endif >> break; >> > > The new bugs should cause assertion failures. shutdown_nice() just > signals init and returns. Giant is not re-acquired, so assertions > should fail when the caller drops the lock. So the shutdown should > be a nasty panic. > I must have been using vt when I tested it, since I didn't see that. > Transiently dropping the lock is probably not fatal depending on what > the caller does. On x86 with atkbd, nested interrupts are prevented > by masking the in the ATPIC or APIC -- Giant is not really the driver > lock, but just a lock for interfacing between related screen and keyboard > drivers. > > Serial console drivers with fast interrupt handlers have much more > broken locking for ddb special keys. It is invalid to either drop locks > or call the "any" function from a fast interrupt handler, but buggy > serial console drivers calls kbd_alt_break(), and that now calls > shutdown_nice() and other functions that cannot be called from a fast > interrupt handler. ddb keys supply most of the shutdown_nice() > functionality for serial consoles, and there are no escape sequence to > get this without ddb or maybe another debugger, so these bugs don't > affect most users. > It's called it before my changes... I'll make a note to look into this. > Handling this correctly requires much the same fix as an unsafe signal > handler, and fixes have much the same problems -- not much more than > setting a flag is safe, and the flag might never be looked at if the > system is in a bad state. However, if a nice shutdown is possible then > the sytem must be in a good enough state to poll for flags. > > For normal signal handlers, there is no problem sending a signal to init > or at least with setting a flag and waking up some thread to check the > flag. > > I don't quite understand this commit. It should be valid to send a > signal to init() in proc or non-fast ithread context including with > Giant held. shutdown_nice() starts with PROC_LOCK(initproc), so it > would be a LOR to call it with a spinlock held, and is even more > obviously wrong to call it from kbd_alt_break() with interrupts masked > and possibly a spinlock held, but Giant is a special sleep lock that > causes fewer LORs than most sleep locks. > Yes, this commit is wrong. > Actual testing shows that doesn't cause a panic, but it also doesn't > actually unlock for shutdown_nice(), since the lock is acquired twice > and only released once. syscons has much the same extra lock sprinkling > for event handling as vt: > > - intr_event_execute_handlers() acquires Giant and calls atkbdintr() > - atkbdintr() calls sckbdevent() > - sckbdevent() unnecessarily acquires Giant again > - the buggy unlocking drops Giant just once > - shutdown_nice() is called with Giant held > - the buggy unlocking fails to re-acquire Giant > - sckbdevent() releases Giant, leaving it not held > - sckbdevent() returns > - atkbdintr() returns > - intr_event_execute_handlers() releases Giant. This should panic, but > it apparently blocks for long enough for init to shut down first. > > When I trace the last step, I get a panic which might be either from the > different timing or just a bug in kdb. Good point. I think the following change is good for everything except calling shutdown_nice() from a fast interrupt handler with noinit running: diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index e5ea9644ad3f..564aecd811be 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -366,6 +366,12 @@ kern_reboot(int howto) { static int once = 0; + /* + * Drop Giant once and for all. + */ + while (mtx_owned(&Giant)) + mtx_unlock(&Giant); + #if defined(SMP) /* * Bind us to the first CPU so that all shutdown code runs there. Some Comments? Warner From owner-svn-src-all@freebsd.org Thu Mar 22 00:36:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53BCCF52FF9 for ; Thu, 22 Mar 2018 00:36:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C76D371BB7 for ; Thu, 22 Mar 2018 00:36:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x234.google.com with SMTP id c1-v6so8047709itj.1 for ; Wed, 21 Mar 2018 17:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=2SY+Vn5yh1yjz1ZbKH8Uc8Bkp3mwMKf0hTJXx7GzGXw=; b=Ml6eLWbqgO7G97jhUr1oMSYd3n2pQR/v8vsmPtjOYYzf2EEpBNemZ3uYoF7jfq2CVD sY+H4kO66yzxU/NGu9r2Cdj1f6/SLKT7fdeKjqFN9stTncM/Ma8TcA4G8G1R460KDxY6 DrvmtD8FI/m1kpbFvqpKoT7A6OzkwZiMuSvWTCmYRSwqZD5DFhS3lE7Wu62rBUfS0a6b T8E824AY+NNAyTi11jZOOgbvhXW2QQfYJa1QUq9twVZIiY9574ajU/gZ78oz2sO4dzGZ CljUTHZUP0RpKQiNnt+ahUzyxMtRNzrskwEHeHxTn5IKNZEdxuEYcLle8EzYTJEEEzDS Lu3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=2SY+Vn5yh1yjz1ZbKH8Uc8Bkp3mwMKf0hTJXx7GzGXw=; b=je09i3gRQJgVzhjrv+FLjjuCA/pKdb+d7WbWKjkN9ftm0jdq02p8F9DPew663pYepe iB7xxvDSkGZz/vYVhHcix7QaO+++4C036xN+XKtwouKt4aB5jdLl7fxaXxntTlX0nTWJ v0zHGiq+yb/r0ASTychC20499gbcA8hCs/pnVVCwpHgOPE9TUOPtSURG19x0Bpq24uhF 5v1RCxEfiVewvgchYIhawiqv2rEgtwkxtA7U2jeUhahXDtO5Ej6D0H0vLBNYwVtBnxKg +v8Cm/ma9xBCYuNq+6KZtJ1//13pn8uLvKKiWWFVJtU1ZyEbLam5RlDMLceQIXp9gz5y nfsg== X-Gm-Message-State: AElRT7G4MHHViykZM0VXaYaKW7gJD32j88J5prKPn94YExWNYaRbFPr4 Fd/y7yMezI9yvZvgN0Q34YJEF5kMyQoDZfflIsVp7Q== X-Google-Smtp-Source: AG47ELurNmIFsNjPCYDsyuhn2jDGAMvO5c4ZMvDhpM4+FlTfcViKDJ9Q5+INKOGU88kbWrsu5B6aQaSMuCxkNWv57VE= X-Received: by 2002:a24:4286:: with SMTP id i128-v6mr6765606itb.73.1521678982095; Wed, 21 Mar 2018 17:36:22 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 17:36:21 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180321202752.GO76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> From: Warner Losh Date: Wed, 21 Mar 2018 18:36:21 -0600 X-Google-Sender-Auth: MBCbBvSxwxZ0VXJ4fIP2YJ5Pgps Message-ID: Subject: Re: svn commit: r331298 - head/sys/dev/syscons To: Konstantin Belousov Cc: Bruce Evans , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:36:23 -0000 On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 04:53:22AM +1100, Bruce Evans wrote: > > Serial console drivers with fast interrupt handlers have much more > > broken locking for ddb special keys. It is invalid to either drop locks > > or call the "any" function from a fast interrupt handler, but buggy > > serial console drivers calls kbd_alt_break(), and that now calls > > shutdown_nice() and other functions that cannot be called from a fast > > interrupt handler. ddb keys supply most of the shutdown_nice() > > functionality for serial consoles, and there are no escape sequence to > > get this without ddb or maybe another debugger, so these bugs don't > > affect most users. > > > > Handling this correctly requires much the same fix as an unsafe signal > > handler, and fixes have much the same problems -- not much more than > > setting a flag is safe, and the flag might never be looked at if the > > system is in a bad state. However, if a nice shutdown is possible then > > the sytem must be in a good enough state to poll for flags. > > Are you saying that fast interrupt handlers call shutdown_nice() ? This > is the quite serious bug on its own. To fix it, shutdown_nice() should > use a fast taskqueue to schedule the task which would lock the process > and send the signal. > Is there some way we know we're in a fast interrupt handler? If so, it should be simple to fix. If not, then there's an API change ahead of us... But bde is right: the system has to be in good enough shape to cope. I wonder if we should put that coping into kdb_reboot() instead. It's only an issue for TILDE ^R, which is a fairly edge case. Warner From owner-svn-src-all@freebsd.org Thu Mar 22 00:45:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7380F53B73; Thu, 22 Mar 2018 00:45:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 755B57220B; Thu, 22 Mar 2018 00:45:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 703091E42; Thu, 22 Mar 2018 00:45:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M0jmn3000977; Thu, 22 Mar 2018 00:45:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0jmqo000976; Thu, 22 Mar 2018 00:45:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803220045.w2M0jmqo000976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 00:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331335 - stable/11/sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/isp X-SVN-Commit-Revision: 331335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:45:49 -0000 Author: mav Date: Thu Mar 22 00:45:48 2018 New Revision: 331335 URL: https://svnweb.freebsd.org/changeset/base/331335 Log: MFC r330963: Increase ABOUT FIRMWARE command timeout to 5s. It seems default timeout of 100ms is not enough for my 2694L card, while it was perfectly fine for others, even for full-height 2694. Modified: stable/11/sys/dev/isp/isp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Wed Mar 21 23:52:37 2018 (r331334) +++ stable/11/sys/dev/isp/isp.c Thu Mar 22 00:45:48 2018 (r331335) @@ -874,6 +874,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults) } } } else if (IS_26XX(isp)) { + isp_prt(isp, ISP_LOGDEBUG1, "loading firmware from flash"); MBSINIT(&mbs, MBOX_LOAD_FLASH_FIRMWARE, MBLOGALL, 5000000); mbs.ibitm = 0x01; mbs.obitm = 0x07; @@ -911,9 +912,12 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults) * we still need to (re)start it. */ MBSINIT(&mbs, MBOX_EXEC_FIRMWARE, MBLOGALL, 5000000); - if (IS_24XX(isp)) { + if (IS_26XX(isp)) { mbs.param[1] = code_org >> 16; mbs.param[2] = code_org; + } else if (IS_24XX(isp)) { + mbs.param[1] = code_org >> 16; + mbs.param[2] = code_org; if (isp->isp_loaded_fw) { mbs.param[3] = 0; } else { @@ -952,7 +956,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults) * Ask the chip for the current firmware version. * This should prove that the new firmware is working. */ - MBSINIT(&mbs, MBOX_ABOUT_FIRMWARE, MBLOGALL, 0); + MBSINIT(&mbs, MBOX_ABOUT_FIRMWARE, MBLOGALL, 5000000); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return; @@ -6737,7 +6741,7 @@ static const char *scsi_mbcmd_names[] = { static const uint32_t mbpfc[] = { ISP_FC_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */ ISP_FC_OPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */ - ISP_FC_OPMAP_HALF(0x07, 0xff, 0x00, 0x03), /* 0x02: MBOX_EXEC_FIRMWARE */ + ISP_FC_OPMAP_HALF(0x07, 0xff, 0x00, 0x1f), /* 0x02: MBOX_EXEC_FIRMWARE */ ISP_FC_OPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */ ISP_FC_OPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */ ISP_FC_OPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ From owner-svn-src-all@freebsd.org Thu Mar 22 00:52:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6D30F54527; Thu, 22 Mar 2018 00:52:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C14E7286D; Thu, 22 Mar 2018 00:52:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D9E11FB9; Thu, 22 Mar 2018 00:52:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M0qr9H006024; Thu, 22 Mar 2018 00:52:53 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0qrMX006023; Thu, 22 Mar 2018 00:52:53 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803220052.w2M0qrMX006023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Mar 2018 00:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331336 - stable/10 X-SVN-Group: stable-10 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/10 X-SVN-Commit-Revision: 331336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:52:53 -0000 Author: np Date: Thu Mar 22 00:52:53 2018 New Revision: 331336 URL: https://svnweb.freebsd.org/changeset/base/331336 Log: Add mergeinfo. This should have been part of r331320. Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-all@freebsd.org Thu Mar 22 00:54:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBC05F54652; Thu, 22 Mar 2018 00:54:13 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8181F729C5; Thu, 22 Mar 2018 00:54:13 +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 7C26D1FBA; Thu, 22 Mar 2018 00:54:13 +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 w2M0sD0C006125; Thu, 22 Mar 2018 00:54:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0sD3P006124; Thu, 22 Mar 2018 00:54:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803220054.w2M0sD3P006124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 00:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331337 - stable/11/sys/dev/bktr X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/bktr X-SVN-Commit-Revision: 331337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:54:14 -0000 Author: emaste Date: Thu Mar 22 00:54:13 2018 New Revision: 331337 URL: https://svnweb.freebsd.org/changeset/base/331337 Log: MFC r330668: bktr: correct Japan IF frequency PR: 36451 Submitted by: Hijiri Umemoto Modified: stable/11/sys/dev/bktr/bktr_tuner.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bktr/bktr_tuner.c ============================================================================== --- stable/11/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:52:53 2018 (r331336) +++ stable/11/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:54:13 2018 (r331337) @@ -566,12 +566,10 @@ static int weurope[] = { * 8: 193.25MHz - 12: 217.25MHz (VHF) * 13: 471.25MHz - 62: 765.25MHz (UHF) * - * IF freq: 45.75 mHz - * OR * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpnbcst[] = { 62, (int)(IF_FREQ * FREQFACTOR), 0, 13, (int)(471.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), @@ -593,10 +591,10 @@ static int jpnbcst[] = { * 22: 165.25MHz * 23: 223.25MHz - 63: 463.25MHz * - * IF freq: 45.75 mHz + * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpncable[] = { 63, (int)(IF_FREQ * FREQFACTOR), 0, 23, (int)(223.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), From owner-svn-src-all@freebsd.org Thu Mar 22 00:55:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9DC1F54812; Thu, 22 Mar 2018 00:55:36 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7EC2D72B54; Thu, 22 Mar 2018 00:55:36 +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 7989C1FBD; Thu, 22 Mar 2018 00:55:36 +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 w2M0ta3A006272; Thu, 22 Mar 2018 00:55:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0taCo006271; Thu, 22 Mar 2018 00:55:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803220055.w2M0taCo006271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 00:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331338 - stable/10/sys/dev/bktr X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/bktr X-SVN-Commit-Revision: 331338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:55:37 -0000 Author: emaste Date: Thu Mar 22 00:55:36 2018 New Revision: 331338 URL: https://svnweb.freebsd.org/changeset/base/331338 Log: MFC r330668: bktr: correct Japan IF frequency PR: 36451 Submitted by: Hijiri Umemoto Modified: stable/10/sys/dev/bktr/bktr_tuner.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bktr/bktr_tuner.c ============================================================================== --- stable/10/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:54:13 2018 (r331337) +++ stable/10/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:55:36 2018 (r331338) @@ -564,12 +564,10 @@ static int weurope[] = { * 8: 193.25MHz - 12: 217.25MHz (VHF) * 13: 471.25MHz - 62: 765.25MHz (UHF) * - * IF freq: 45.75 mHz - * OR * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpnbcst[] = { 62, (int)(IF_FREQ * FREQFACTOR), 0, 13, (int)(471.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), @@ -591,10 +589,10 @@ static int jpnbcst[] = { * 22: 165.25MHz * 23: 223.25MHz - 63: 463.25MHz * - * IF freq: 45.75 mHz + * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpncable[] = { 63, (int)(IF_FREQ * FREQFACTOR), 0, 23, (int)(223.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), From owner-svn-src-all@freebsd.org Thu Mar 22 01:00:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5841FF54E5A; Thu, 22 Mar 2018 01:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DFE572EC7; Thu, 22 Mar 2018 01:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07F521FE5; Thu, 22 Mar 2018 01:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M10tEd006565; Thu, 22 Mar 2018 01:00:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M10tNT006564; Thu, 22 Mar 2018 01:00:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803220100.w2M10tNT006564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 01:00:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331339 - head/sys/dev/drm X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/drm X-SVN-Commit-Revision: 331339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 01:00:56 -0000 Author: emaste Date: Thu Mar 22 01:00:55 2018 New Revision: 331339 URL: https://svnweb.freebsd.org/changeset/base/331339 Log: Correct signedness bug in drm_modeset_ctl drm_modeset_ctl() takes a signed in from userland, does a boundscheck, and then uses it to index into a structure and write to it. The boundscheck only checks upper bound, and never checks for nagative values. If the int coming from userland is negative [after conversion] it will bypass the boundscheck, perform a negative index into an array and write to it, causing memory corruption. Note that this is in the "old" drm driver; this issue does not exist in drm2. Reported by: Ilja Van Sprundel Reviewed by: cem MFC after: 1 day Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Thu Mar 22 00:55:36 2018 (r331338) +++ head/sys/dev/drm/drm_irq.c Thu Mar 22 01:00:55 2018 (r331339) @@ -351,7 +351,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data goto out; crtc = modeset->crtc; - if (crtc >= dev->num_crtcs) { + if (crtc < 0 || crtc >= dev->num_crtcs) { ret = EINVAL; goto out; } From owner-svn-src-all@freebsd.org Thu Mar 22 01:10:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49871F55929; Thu, 22 Mar 2018 01:10:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC2077364F; Thu, 22 Mar 2018 01:10:18 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x230.google.com with SMTP id w3-v6so9232471itc.4; Wed, 21 Mar 2018 18:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=cGIUlgPPto73nP5cqs3OGJ9Lt5eE6aVH5+cWy+ra+ls=; b=XGzAnVOSskDVtlyIrqkMzncz0nsNYUF3kRLg+7w2c1gfki5Gj99mfddOcexG2SjJMu +t9MgAUc0T4Q32GnIr1snUD89PKsbhkah59+L15+3Pj6aDL71wWNlZTLbWD08oUdukcE PJGkbmCWuuXx6uTyj98IWWnfl/E5XAAd/SXEh+x+UHRNi9JG/w31UiEqwlaum2453lpN aVr3N7fhO5k+P4svxPIcse9YrqoHy/01lSFR4GOYrhzayjpZqu79Gl1T4APk/lHD4iq2 3tg/4U3/dHR5FCt6MONWoweKjKclclKuA9JwlJCj/IOJEIqeZSqZTtmmH4VAuOtn2+E6 kpJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=cGIUlgPPto73nP5cqs3OGJ9Lt5eE6aVH5+cWy+ra+ls=; b=WCWf9Shp2yWBSO5xN9USe6l2I/8aYisuJjLa3Xqy04GKTeh6smybtMwuKNa8e6owGp LnnCG6f7tBceqoaK021UV/ZBFPghsdoAFhETgAH9TN+KWcaZyqt0VHOtzhvKqoUYKo2v B2DNDFRL349O7r2VKeZsp9DAqFQMq1Mbe9FHDCTtO0/CcTncfk8uLBDSG5cX+0jY/hVO gN+I/eaBUiRCgAt7ZwfrRJwTHS+76T8BKHtrvXd6gmNFCudNfx/vDirzTIY+NqXuYUZu lnnTHIhEb0hWpw++QVoQpyZsIA5ZCnHKT0h3CmpcKRNBHxixc6YnRXEfN3m/jwwiKoFf SD5g== X-Gm-Message-State: AElRT7EOWV9l3oTb/TUD6bDehJ9ggum3/NTE58SR6g+KhCyL+2r8poJy T9gJSg5H+bVyBmYe+eLNcLdfipbhpx684ZMqO6epXdun X-Google-Smtp-Source: AIpwx4+jAzuCXPTLMyom441eZtHRPJVfytC1w/uiwo/s6+NcxPVT+LafqrbrJd55/1GJeDFBSprwNzUajkhR4FKnSxc= X-Received: by 2002:a24:d241:: with SMTP id z62-v6mr6518825itf.49.1521681018133; Wed, 21 Mar 2018 18:10:18 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Wed, 21 Mar 2018 18:09:57 -0700 (PDT) In-Reply-To: <201803220100.w2M10tNT006564@repo.freebsd.org> References: <201803220100.w2M10tNT006564@repo.freebsd.org> From: Ed Maste Date: Wed, 21 Mar 2018 21:09:57 -0400 X-Google-Sender-Auth: HwA60Gnbtmc6DMmdVip39VC8qgo Message-ID: Subject: Re: svn commit: r331339 - head/sys/dev/drm To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 01:10:19 -0000 On 21 March 2018 at 21:00, Ed Maste wrote: > Author: emaste > Date: Thu Mar 22 01:00:55 2018 > New Revision: 331339 > URL: https://svnweb.freebsd.org/changeset/base/331339 > > Log: > Correct signedness bug in drm_modeset_ctl > > Reported by: Ilja Van Sprundel Also reported by: anonymous from the shellphish grill team From owner-svn-src-all@freebsd.org Thu Mar 22 02:04:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E266F5AC7A; Thu, 22 Mar 2018 02:04:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E06D5761D8; Thu, 22 Mar 2018 02:04:57 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB81E2C2B; Thu, 22 Mar 2018 02:04:57 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M24vfC040773; Thu, 22 Mar 2018 02:04:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M24vLm040772; Thu, 22 Mar 2018 02:04:57 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803220204.w2M24vLm040772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Mar 2018 02:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331340 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 331340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 02:04:58 -0000 Author: np Date: Thu Mar 22 02:04:57 2018 New Revision: 331340 URL: https://svnweb.freebsd.org/changeset/base/331340 Log: cxgbe(4): Tunnel congestion drops on a port should be cleared when the stats for that port are cleared. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Mar 22 01:00:55 2018 (r331339) +++ head/sys/dev/cxgbe/t4_main.c Thu Mar 22 02:04:57 2018 (r331340) @@ -9650,7 +9650,7 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t rc = read_i2c(sc, (struct t4_i2c_data *)data); break; case CHELSIO_T4_CLEAR_STATS: { - int i, v; + int i, v, bg_map; u_int port_id = *(uint32_t *)data; struct port_info *pi; struct vi_info *vi; @@ -9664,10 +9664,19 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t /* MAC stats */ t4_clr_port_stats(sc, pi->tx_chan); pi->tx_parse_error = 0; + pi->tnl_cong_drops = 0; mtx_lock(&sc->reg_lock); for_each_vi(pi, v, vi) { if (vi->flags & VI_INIT_DONE) t4_clr_vi_stats(sc, vi->viid); + } + bg_map = pi->mps_bg_map; + v = 0; /* reuse */ + while (bg_map) { + i = ffs(bg_map) - 1; + t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, + 1, A_TP_MIB_TNL_CNG_DROP_0 + i); + bg_map &= ~(1 << i); } mtx_unlock(&sc->reg_lock); From owner-svn-src-all@freebsd.org Thu Mar 22 04:16:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D7E6F655B6; Thu, 22 Mar 2018 04:16:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E8AB7C3B3; Thu, 22 Mar 2018 04:16:15 +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 0952548BE; Thu, 22 Mar 2018 04:16:15 +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 w2M4GEW9006377; Thu, 22 Mar 2018 04:16:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M4GEWH006376; Thu, 22 Mar 2018 04:16:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803220416.w2M4GEWH006376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Mar 2018 04:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331341 - head/stand/forth X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/forth X-SVN-Commit-Revision: 331341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:16:15 -0000 Author: kevans Date: Thu Mar 22 04:16:14 2018 New Revision: 331341 URL: https://svnweb.freebsd.org/changeset/base/331341 Log: forthloader: Don't break BIOS boots... I thought I tested this scenario, but clearly I failed to. =( BIOS boots won't have efi-autoresizecons, so trying to use it as a forth word fails during include. Use evaluate on "efi-autoresizecons" as a string instead to move any potential errors to runtime- safely after we've already checked that we're booting UEFI. Pointy hat to: me Reported by: cy Modified: head/stand/forth/efi.4th Modified: head/stand/forth/efi.4th ============================================================================== --- head/stand/forth/efi.4th Thu Mar 22 02:04:57 2018 (r331340) +++ head/stand/forth/efi.4th Thu Mar 22 04:16:14 2018 (r331341) @@ -34,7 +34,7 @@ only forth definitions : maybe-efi-resizecons efiboot? if - efi-autoresizecons + s" efi-autoresizecons" evaluate then ; From owner-svn-src-all@freebsd.org Thu Mar 22 03:30:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15CD5F6270D; Thu, 22 Mar 2018 03:30:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BB0F7A3D8; Thu, 22 Mar 2018 03:30:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id yqw2ePy1CXziTyqw4e6ENq; Wed, 21 Mar 2018 21:30:40 -0600 X-Authority-Analysis: v=2.3 cv=X6B81lbe c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EMgYP5mRnpT9skovMisA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 75D796FC; Wed, 21 Mar 2018 20:30:38 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2M3UbWM004639; Wed, 21 Mar 2018 20:30:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2M3Ubdx004626; Wed, 21 Mar 2018 20:30:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803220330.w2M3Ubdx004626@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Kyle Evans cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331326 - in head/stand: forth i386/loader In-Reply-To: Message from Kyle Evans of "Wed, 21 Mar 2018 22:01:51 -0000." <201803212201.w2LM1pvl020202@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Mar 2018 20:30:37 -0700 X-CMAE-Envelope: MS4wfPWLc06PAHgWOy7niO16lX4CkcXfRYzrb+y0+AwkPwYPsJ5IbBq9dihLY+FvubNjb1iMQdXGiB5++JTHNMtGSibA1l0MlW6kVP4bcnwjm4oGTFkfOpYv gFNTL3cj4UkXTehOhTaKMAGfa2g88SfqWyPmE1R4tnJgTAVhr2VJfkVZ/Z+NnxcmFS6XKPgiTXOE9cYkMoUSw+FMkoWvofys06du02M5+5X+8DkVatzIrtlH YCBsgMw0xxToWtLywC85V7pbJb7+S4rFKay728o07MGikJROY3bAwrE9URt5Hj7X X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 03:30:49 -0000 In message <201803212201.w2LM1pvl020202@repo.freebsd.org>, Kyle Evans writes: > Author: kevans > Date: Wed Mar 21 22:01:51 2018 > New Revision: 331326 > URL: https://svnweb.freebsd.org/changeset/base/331326 > > Log: > Forth version of EFI autoresizing > > r331321 delegated autoresizing to an efi-autoresizecons command that > currently is expected to be done in forth/lua prior to drawing anything > useful. > > Add the Forth version of the lua addition in r331321, hook efi.4th up to be > installed. > > efiboot? was written by dteske@; anything outside of that may be blamed on > me. > > Modified: > head/stand/forth/Makefile > head/stand/forth/efi.4th > head/stand/forth/loader.rc > head/stand/i386/loader/loader.rc > > Modified: head/stand/forth/Makefile > ============================================================================= > = > --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) > +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) > @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th > FILES+= check-password.4th > FILES+= color.4th > FILES+= delay.4th > +FILES+= efi.4th > FILES+= frames.4th > FILES+= loader.4th > FILES+= logo-beastie.4th > > Modified: head/stand/forth/efi.4th > ============================================================================= > = > --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) > +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) > @@ -26,5 +26,16 @@ > > only forth definitions > > -\ Place holder for more functions > +: efiboot? ( -- flag ) > + s" efi-version" getenv -1 <> dup if > + swap drop ( c-addr flag -- flag ) > + then > +; > + > +: maybe-efi-resizecons > + efiboot? if > + efi-autoresizecons This statement breaks boot on my BIOS machines. It cannot find efi-autoresizecons, causing a bare kernel without modules to load or kenv variables set. > + then > +; > + > .( EFI boot environment) cr > > Modified: head/stand/forth/loader.rc > ============================================================================= > = > --- head/stand/forth/loader.rc Wed Mar 21 21:15:43 2018 (r33132 > 5) > +++ head/stand/forth/loader.rc Wed Mar 21 22:01:51 2018 (r33132 > 6) > @@ -6,11 +6,14 @@ > \ > \ Includes additional commands > include /boot/loader.4th > +include /boot/efi.4th > try-include /boot/loader.rc.local > > \ Reads and processes loader.conf variables > \ NOTE: Change to `initialize' if you enable the below boot menu > start > + > +maybe-efi-resizecons > > \ Tests for password -- executes autoboot first if a password was defined > check-password > > Modified: head/stand/i386/loader/loader.rc > ============================================================================= > = > --- head/stand/i386/loader/loader.rc Wed Mar 21 21:15:43 2018 (r33132 > 5) > +++ head/stand/i386/loader/loader.rc Wed Mar 21 22:01:51 2018 (r33132 > 6) > @@ -3,10 +3,13 @@ > \ > \ Includes additional commands > include /boot/loader.4th > +include /boot/efi.4th > try-include /boot/loader.rc.local > > \ Reads and processes loader.conf variables > initialize > + > +maybe-efi-resizecons > > \ Tests for password -- executes autoboot first if a password was defined > check-password > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Thu Mar 22 04:42:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D8D2F677C4; Thu, 22 Mar 2018 04:42:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E34397DA1F; Thu, 22 Mar 2018 04:42:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE2AA4D96; Thu, 22 Mar 2018 04:42:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M4gTOD021155; Thu, 22 Mar 2018 04:42:29 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M4gTDM021154; Thu, 22 Mar 2018 04:42:29 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803220442.w2M4gTDM021154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Mar 2018 04:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331342 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 331342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:42:30 -0000 Author: np Date: Thu Mar 22 04:42:29 2018 New Revision: 331342 URL: https://svnweb.freebsd.org/changeset/base/331342 Log: cxgbe(4): Do not read MFG diags information from custom boards. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Thu Mar 22 04:16:14 2018 (r331341) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Mar 22 04:42:29 2018 (r331342) @@ -2960,7 +2960,7 @@ static int get_vpd_keyword_val(const u8 *vpd, const ch * Reads card parameters stored in VPD EEPROM. */ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p, - u32 *buf) + uint16_t device_id, u32 *buf) { int i, ret, addr; int ec, sn, pn, na, md; @@ -3028,12 +3028,16 @@ static int get_vpd_params(struct adapter *adapter, str memcpy(p->na, vpd + na, min(i, MACADDR_LEN)); strstrip((char *)p->na); + if (device_id & 0x80) + return 0; /* Custom card */ + md = get_vpd_keyword_val(vpd, "VF", 1); if (md < 0) { snprintf(p->md, sizeof(p->md), "unknown"); } else { i = vpd[md - VPD_INFO_FLD_HDR_SIZE + 2]; memcpy(p->md, vpd + md, min(i, MD_LEN)); + strstrip((char *)p->md); } return 0; @@ -8053,10 +8057,6 @@ int t4_prep_adapter(struct adapter *adapter, u32 *buf) if (ret < 0) return ret; - ret = get_vpd_params(adapter, &adapter->params.vpd, buf); - if (ret < 0) - return ret; - /* Cards with real ASICs have the chipid in the PCIe device id */ t4_os_pci_read_cfg2(adapter, PCI_DEVICE_ID, &device_id); if (device_id >> 12 == chip_id(adapter)) @@ -8066,6 +8066,10 @@ int t4_prep_adapter(struct adapter *adapter, u32 *buf) adapter->params.fpga = 1; adapter->params.cim_la_size = 2 * CIMLA_SIZE; } + + ret = get_vpd_params(adapter, &adapter->params.vpd, device_id, buf); + if (ret < 0) + return ret; init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd); From owner-svn-src-all@freebsd.org Thu Mar 22 04:39:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33B77F674EE; Thu, 22 Mar 2018 04:39:39 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E046C7D687; Thu, 22 Mar 2018 04:39:38 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id BB3EC2992; Thu, 22 Mar 2018 04:39:38 +0000 (UTC) Date: Thu, 22 Mar 2018 04:39:38 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: John Baldwin , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r331209 - head Message-ID: <20180322043938.GA8311@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <20180322040316.GB49350@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:39:39 -0000 On Wed, Mar 21, 2018 at 10:34:15PM -0600, Warner Losh wrote: > On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev > wrote: > > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > > ... > > > How does this fit with the recommended installation steps of doing > > > 'make installkernel' and rebooting before doing a 'make installworld'? > > > > Rebooting? I vaguely recall recommended procedure was to switch to single > > user mode prior to `installworld', but personally I've never bothered and > > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? > > Old advice was to do the installworld in single user, as that's the safest > (and also ensures you have a new kernel and don't install before rebooting). > However, we've had enough experience to see that usually an installworld + > reboot is sufficient. Right, but John had mentioned extra reboot *between* installkernel and installworld, which I've never heard of before. ./danfe From owner-svn-src-all@freebsd.org Thu Mar 22 04:47:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 104D1F67C21 for ; Thu, 22 Mar 2018 04:47:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8760B7DECD for ; Thu, 22 Mar 2018 04:47:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x229.google.com with SMTP id g14so9314633iob.13 for ; Wed, 21 Mar 2018 21:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Z3a1PchPwkMULU8w7rskpw+pYwlgQxSea6Ik2tyGvA0=; b=b9/SU114asXYNGbJbZ3ymp4Fh6ww3kFkAp2vBBUch56FtMgkI8GkQRbJka6T647LDF TArkJ8v48BUiyGwW1HQTwcohu4pc2uCoAGIy0DosazmdSAaeaRgk63K0vSdvLxd1/8wd PhIcHUd2aGVucmpDnLC/nbBPOPJu7o3I9DNesXazWnC+QLWNHrGSEi5Bc93nE1e1+2Ac xwEHA5dwJM28jS9zrbnQD4+sRTdyrAR9zhNhudSga9vGK9fEtR0XvsEaGEq9zhWI63un cgP1QamLEwXCdC17Psc/0K+2DePsvH0g+pB0cN/SQwsWQh5JchYKu+z+WHC5Vxv7rawj DM7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Z3a1PchPwkMULU8w7rskpw+pYwlgQxSea6Ik2tyGvA0=; b=MsnC8MUDkBW5kr1Rn98trFljzZcvCX/1I7TM/droGhWmCFlriDJ74IC0650rsb7szg ajwZ2KTH+SLl6Dm4ndAMAC4Ag5ZnVC90oPJiwzjkettWp58XIODjwZfMmFqzlw97h2N4 b6fg2KSZJuEYkDaLeWc+88p0Ii6Oqf/+MM/TBxz8qRSSLkHbZfUKwzn/rX6t6MBgCWfi V9UnLRbxpZA6lnvz9HdXrqRu12/H1Px39B7suK0ZLhb0Lr1alJqYzvBRa1+wJDIqKt54 TA2p20oa4EkiL/kTw7mr6xwmSqcF1x31+ZDLGVkMboigjZO7NxrtNLu5eab47VN3uR6z GVBw== X-Gm-Message-State: AElRT7GAXXPs1WXNPtc7M94V67HidhHpyy2Pgn5pMpeJqiiz5F5g43mD LopBhVZW/JyM/QtPETXMh+Bxn6YSyjl13ZKRmqkzmA== X-Google-Smtp-Source: AG47ELvs8IGV83BQKkVkUrR7Zpqlmzvd2KC67TPHQ92uMaxzTrsLQbdiZlcEWnpEgvxlRxpInw1WMjKNohF3RTGgnBg= X-Received: by 10.107.12.230 with SMTP id 99mr23334850iom.117.1521694047734; Wed, 21 Mar 2018 21:47:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 21:47:27 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180322043938.GA8311@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <20180322040316.GB49350@FreeBSD.org> <20180322043938.GA8311@FreeBSD.org> From: Warner Losh Date: Wed, 21 Mar 2018 22:47:27 -0600 X-Google-Sender-Auth: pvKHAmlqxfARE5ZouoMT3xuaV3I Message-ID: Subject: Re: svn commit: r331209 - head To: Alexey Dokuchaev Cc: John Baldwin , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:47:29 -0000 On Wed, Mar 21, 2018 at 10:39 PM, Alexey Dokuchaev wrote: > On Wed, Mar 21, 2018 at 10:34:15PM -0600, Warner Losh wrote: > > On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev > > wrote: > > > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > > > ... > > > > How does this fit with the recommended installation steps of doing > > > > 'make installkernel' and rebooting before doing a 'make > installworld'? > > > > > > Rebooting? I vaguely recall recommended procedure was to switch to > single > > > user mode prior to `installworld', but personally I've never bothered > and > > > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing > something? > > > > Old advice was to do the installworld in single user, as that's the > safest > > (and also ensures you have a new kernel and don't install before > rebooting). > > However, we've had enough experience to see that usually an installworld > + > > reboot is sufficient. > > Right, but John had mentioned extra reboot *between* installkernel and > installworld, which I've never heard of before. > We've done what we can to make it so you don't brick your system if you don't do that, but the pedantic way is build everything, install a new kernel, reboot single user, install world and bring it up multi-user, though that leaves a copy of the old sh around that doesn't hurt anything. The alternate way is to install kernel, reboot installworld, reboot, but usually people skip the reboot after install kernel. You can usually get away with it, but the ino64 showed that's not always possible (the forward compat code wasn't committed for weeks and even then there's no guarantee that it would). Warner From owner-svn-src-all@freebsd.org Thu Mar 22 05:07:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B649F690DD; Thu, 22 Mar 2018 05:07:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49E437F005; Thu, 22 Mar 2018 05:07:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 445F150CE; Thu, 22 Mar 2018 05:07:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M57wNa031309; Thu, 22 Mar 2018 05:07:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M57wBa031308; Thu, 22 Mar 2018 05:07:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803220507.w2M57wBa031308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 22 Mar 2018 05:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331343 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 331343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 05:07:58 -0000 Author: glebius Date: Thu Mar 22 05:07:57 2018 New Revision: 331343 URL: https://svnweb.freebsd.org/changeset/base/331343 Log: Fix LINT-NOINET build initializing local to false. This is a dead code, since for NOINET build isipv6 is always true, but this dead code makes it compilable. Reported by: rpokala Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Mar 22 04:42:29 2018 (r331342) +++ head/sys/netinet/tcp_timewait.c Thu Mar 22 05:07:57 2018 (r331343) @@ -244,12 +244,12 @@ tcp_twstart(struct tcpcb *tp) #ifdef INET6 if (isipv6) local = in6_localaddr(&inp->in6p_faddr); -#endif -#if defined(INET6) && defined(INET) else #endif #ifdef INET local = in_localip(inp->inp_faddr); +#else + local = false; #endif } else local = false; From owner-svn-src-all@freebsd.org Thu Mar 22 04:03:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99933F64ACC; Thu, 22 Mar 2018 04:03:16 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1857BDDF; Thu, 22 Mar 2018 04:03:16 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 433941CB3; Thu, 22 Mar 2018 04:03:16 +0000 (UTC) Date: Thu, 22 Mar 2018 04:03:16 +0000 From: Alexey Dokuchaev To: John Baldwin Cc: Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r331209 - head Message-ID: <20180322040316.GB49350@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4168709.idJmbTaMPK@ralph.baldwin.cx> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:03:16 -0000 On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > New Revision: 331209 > > URL: https://svnweb.freebsd.org/changeset/base/331209 > > > > Log: > > Add note to UPDATING about UEFI changes requiring loader(8) update > > ... > > How does this fit with the recommended installation steps of doing > 'make installkernel' and rebooting before doing a 'make installworld'? Rebooting? I vaguely recall recommended procedure was to switch to single user mode prior to `installworld', but personally I've never bothered and installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? ./danfe From owner-svn-src-all@freebsd.org Thu Mar 22 05:26:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2877AF6A273; Thu, 22 Mar 2018 05:26:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3E237FCAF; Thu, 22 Mar 2018 05:26:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AED7E541E; Thu, 22 Mar 2018 05:26:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M5QRu5041170; Thu, 22 Mar 2018 05:26:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M5QRjr041169; Thu, 22 Mar 2018 05:26:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803220526.w2M5QRjr041169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 22 Mar 2018 05:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331344 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 05:26:28 -0000 Author: glebius Date: Thu Mar 22 05:26:27 2018 New Revision: 331344 URL: https://svnweb.freebsd.org/changeset/base/331344 Log: Redo r331328. We need to fix not only type but also format. While here again notice that we are fixing regression from r331106. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Mar 22 05:07:57 2018 (r331343) +++ head/sys/kern/vfs_bio.c Thu Mar 22 05:26:27 2018 (r331344) @@ -262,17 +262,17 @@ SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, static int lodirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, lodirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, - __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "I", "How many buffers we want to have free before bufdaemon can sleep"); static int hidirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, hidirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, - __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "I", "When the number of dirty buffers is considered severe"); int dirtybufthresh; SYSCTL_PROC(_vfs, OID_AUTO, dirtybufthresh, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, - __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "I", "Number of bdwrite to bawrite conversions to clear dirty buffers"); static int numfreebuffers; SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, &numfreebuffers, 0, @@ -280,12 +280,12 @@ SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, static int lofreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, lofreebuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, - __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "I", "Target number of free buffers"); static int hifreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, hifreebuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, - __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "I", "Threshold for clean buffer recycling"); static counter_u64_t getnewbufcalls; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RD, From owner-svn-src-all@freebsd.org Thu Mar 22 04:19:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2540DF65847; Thu, 22 Mar 2018 04:19:53 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A44D7C548; Thu, 22 Mar 2018 04:19:52 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f51.google.com with SMTP id e5-v6so11106394lfb.7; Wed, 21 Mar 2018 21:19:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VrbzagRbTmBrOP7RVr8DAQNWiOugo2NpZFD52Re84tk=; b=OCZjSqZ8zi/6pq+zOcyugSPA7YeEU3HKGSmAncqzC0+BAG1bd8ATUIQ1lw97/clOU7 leW139w+4SrKP1JpxNpBBDTKY8ftkIRyh8dIEOg1czS+B7b3RP0ioxzanv21JH08TO3S FqoPNzGQMZQje8jzgEAPBUYbvfsR2YPdeolGuVHVMqlGcVGHcW9oQwKOaQ1BXJAvjMdp PEev5GRgZ9+xEtYrCv3Js0HrcYDk6k3sp/MkbEppcm42EgAKHHD7mQ/iyeeA1GR6rfF4 JyUMsZeGwMS9Hr8NnVKWLZ+8yYa/duc18tNciFis/YfA/zvHmlHhOEG6hqkJEGOO2V4y M89A== X-Gm-Message-State: AElRT7F3mbelG00V96+MZi3lQBNap3AvgRkl02ISQ/3jqgNXOJUQjkHg 9u/IF3UKfVmH8CSe4dQHFvP6i7OH X-Google-Smtp-Source: AG47ELueux+Gw1jQJaSwV3WBz4XZR3v1dwLGxzi4+AKx2IVu4YPNXqWksXcPM2mIRNHCeVG5Izm5iQ== X-Received: by 2002:a19:2655:: with SMTP id m82-v6mr9160791lfm.107.1521692384565; Wed, 21 Mar 2018 21:19:44 -0700 (PDT) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by smtp.gmail.com with ESMTPSA id s87-v6sm1412210lfk.69.2018.03.21.21.19.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 21:19:44 -0700 (PDT) Received: by mail-lf0-f46.google.com with SMTP id l4-v6so6762975lfg.12; Wed, 21 Mar 2018 21:19:44 -0700 (PDT) X-Received: by 2002:a19:e9cc:: with SMTP id j73-v6mr13712384lfk.99.1521692384287; Wed, 21 Mar 2018 21:19:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Wed, 21 Mar 2018 21:19:23 -0700 (PDT) In-Reply-To: <201803220330.w2M3Ubdx004626@slippy.cwsent.com> References: <201803212201.w2LM1pvl020202@repo.freebsd.org> <201803220330.w2M3Ubdx004626@slippy.cwsent.com> From: Kyle Evans Date: Wed, 21 Mar 2018 23:19:23 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331326 - in head/stand: forth i386/loader To: Cy Schubert Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:19:53 -0000 On Wed, Mar 21, 2018 at 10:30 PM, Cy Schubert wrote: > In message <201803212201.w2LM1pvl020202@repo.freebsd.org>, Kyle Evans > writes: >> Author: kevans >> Date: Wed Mar 21 22:01:51 2018 >> New Revision: 331326 >> URL: https://svnweb.freebsd.org/changeset/base/331326 >> >> Log: >> Forth version of EFI autoresizing >> >> r331321 delegated autoresizing to an efi-autoresizecons command that >> currently is expected to be done in forth/lua prior to drawing anything >> useful. >> >> Add the Forth version of the lua addition in r331321, hook efi.4th up to be >> installed. >> >> efiboot? was written by dteske@; anything outside of that may be blamed on >> me. >> >> Modified: >> head/stand/forth/Makefile >> head/stand/forth/efi.4th >> head/stand/forth/loader.rc >> head/stand/i386/loader/loader.rc >> >> Modified: head/stand/forth/Makefile >> ============================================================================= >> = >> --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) >> +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) >> @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th >> FILES+= check-password.4th >> FILES+= color.4th >> FILES+= delay.4th >> +FILES+= efi.4th >> FILES+= frames.4th >> FILES+= loader.4th >> FILES+= logo-beastie.4th >> >> Modified: head/stand/forth/efi.4th >> ============================================================================= >> = >> --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) >> +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) >> @@ -26,5 +26,16 @@ >> >> only forth definitions >> >> -\ Place holder for more functions >> +: efiboot? ( -- flag ) >> + s" efi-version" getenv -1 <> dup if >> + swap drop ( c-addr flag -- flag ) >> + then >> +; >> + >> +: maybe-efi-resizecons >> + efiboot? if >> + efi-autoresizecons > > This statement breaks boot on my BIOS machines. It cannot find > efi-autoresizecons, causing a bare kernel without modules to load or > kenv variables set. > Ugh, sorry about that. =( I've converted that to a runtime evaluation in r331341 and (hopefully) properly observed my failure to succeed. On the plus side, today I learned about `boot-conf` to get back to the Forth-intercepted 'boot' behavior to workaround the breakage. =) From owner-svn-src-all@freebsd.org Thu Mar 22 04:34:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F36DF66CAC for ; Thu, 22 Mar 2018 04:34:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C0D057D254 for ; Thu, 22 Mar 2018 04:34:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x229.google.com with SMTP id z143-v6so577371itc.0 for ; Wed, 21 Mar 2018 21:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=9eF7RgMkdKxGqZlwCtPnYdpr7WqdlBGgg6CgxeotDyQ=; b=z3OLzM9bmx4dbWOaILw/72He9rPSmAUJPaNYg371jAc5YwA9N8ZaICIxAKIgDk6b8/ JPVWB9aEFViVKpdIFhs04vM27Kmgg6MBB69SEIS2kBgoBjcU6Z7AzuXHI4gQpTbFucc3 lA6Bbbs4gb6tPrQCcjJmzytYt45tyd9LjhG4bbRxE/kzbIFv4+l17pWh1NrnvC+rhmQ0 KK66KxRV/f8LFjssqhzLHU4ox8nlkPxxX5zBHE3K4LFuhd2YP/7dd3xnn+2hnVy4J3/0 5k3dqA88MwsMliH5kuN3oYMPfM3ZgMLgXZB4cqCFSbXuAOuU/bPaBRvQ5ohHhOmqnFS3 pfTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=9eF7RgMkdKxGqZlwCtPnYdpr7WqdlBGgg6CgxeotDyQ=; b=mrFSNcUT0PwzDN9qO2SIAgIZAL0XgEehCPMIoGE2oNJe3PixT0LPBzpIQ2YnD02mfw nxsJwjt+TTw53oPIA+LM46BDcNr3zqGyL58BZvfgYbSbId/hyInqc+buwOXRLj3SfxR0 HIkDezGu8qhJN2d7KGAH/M73BPwUbcvxr2a5uSfO9rCDzvGYF1o/Sz+tBkG1E6rlhR3D 47NtaFsYIUY8EYQU1Ln3CYSQGspnDLtBk66L4TOQ8Ufv0zMTokDXwAN9caXRjeY69dJB NU1k5weSHi928YOCT7dFciVZBn9FL30Vd8sMhREbXelXiU6jMFH3uYX7d7bE4ytE0SJz guYQ== X-Gm-Message-State: AElRT7H+EgAQbD5EWTzwT5q4kT6eZXaEJEAnbBngmpSc5w+GtrSz2u2b vepCN736uXiXvpcc1/Kn5UoymyrT3eXePPX0/K46hA== X-Google-Smtp-Source: AG47ELu2bC66OjNIiBsx98caqHTB8M1Y+69b5An/6F+rstyASzUmD14T/l5MTgJ+DOmiLGf9/YZgPpzSon0X2ivMwBY= X-Received: by 2002:a24:fa83:: with SMTP id v125-v6mr7336592ith.36.1521693256066; Wed, 21 Mar 2018 21:34:16 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 21:34:15 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180322040316.GB49350@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <20180322040316.GB49350@FreeBSD.org> From: Warner Losh Date: Wed, 21 Mar 2018 22:34:15 -0600 X-Google-Sender-Auth: OJEJu3gNKT3xePqzT0DRfZz71qY Message-ID: Subject: Re: svn commit: r331209 - head To: Alexey Dokuchaev Cc: John Baldwin , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:34:17 -0000 On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev wrote: > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > > New Revision: 331209 > > > URL: https://svnweb.freebsd.org/changeset/base/331209 > > > > > > Log: > > > Add note to UPDATING about UEFI changes requiring loader(8) update > > > ... > > > > How does this fit with the recommended installation steps of doing > > 'make installkernel' and rebooting before doing a 'make installworld'? > > Rebooting? I vaguely recall recommended procedure was to switch to single > user mode prior to `installworld', but personally I've never bothered and > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? > Old advice was to do the installworld in single user, as that's the safest (and also ensures you have a new kernel and don't install before rebooting). However, we've had enough experience to see that usually an installworld + reboot is sufficient. Warner From owner-svn-src-all@freebsd.org Thu Mar 22 04:51:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 732F9F680B6; Thu, 22 Mar 2018 04:51:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id BC6757E31F; Thu, 22 Mar 2018 04:51:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id D4892101B79; Thu, 22 Mar 2018 15:51:42 +1100 (AEDT) Date: Thu, 22 Mar 2018 15:51:42 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331328 - head/sys/kern In-Reply-To: <201803212321.w2LNLWa1059145@repo.freebsd.org> Message-ID: <20180322144902.M1053@besplex.bde.org> References: <201803212321.w2LNLWa1059145@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=B0bGbaIv-eMvG_GntjcA:9 a=U5YPzu8vfC6-BsS1:21 a=QozMUkue6voaUPMz:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:51:46 -0000 On Wed, 21 Mar 2018, Gleb Smirnoff wrote: > Log: > Fix sysctl types broken in r329612. This is still broken. > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Wed Mar 21 23:17:26 2018 (r331327) > +++ head/sys/kern/vfs_bio.c Wed Mar 21 23:21:32 2018 (r331328) > @@ -261,17 +261,17 @@ SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, > "Number of buffers that are dirty (has unwritten changes) at the moment"); > static int lodirtybuffers; > SYSCTL_PROC(_vfs, OID_AUTO, lodirtybuffers, > - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, > + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, > __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "L", > "How many buffers we want to have free before bufdaemon can sleep"); Now the format letter "L" is even more inconsistent. The letter at least used to even more important. E.g., old versions of i386 machdep.tsc_freq got most things wrong, but reads appeared to work in most cases since the mismached CTLTYPE_QUAD was ignored by sysctl(8) and the format specifier "IU" was used to print the truncated value correctly. Writes appeared to work in most cases although short writes are documented to fail in all cases: from sysctl(3): [EINVAL] A non-null newp is given and its specified length in newlen is too large or too small. because detection of short writes has been broken for more than 20 years. For machdep.tsc_freq, CTLTYPE_QUAD gave 64-bit writes, but the sysctl_handle_int() in the PROC handler attempted to do a 32-bit and the broken short write detection allowed it to succeed. I think the same brokenness prevents detection of the current bug as a short write error -- CTLTYPE_ULONG gives 64-bit writes on 32-bit arches and sysctl_handle_int() in the PROC handler attempts to do a 32-bit short writes. Lower levels of sysctl know the size from the CTLTYPE but don't check it properly. Most PROC handlers don't check it at all, but hard-code sysctl_handle_int/etc(). This is reasonable since they can hard-code the type in this call just as easily as hard-coding it in the sysctl data (which is another bug, but harder to fix -- the size should be decided at runtime). In practice, there are inconsistencies. I use the following fix for short write detection: XX Index: kern_sysctl.c XX =================================================================== XX RCS file: /home/ncvs/src/sys/kern/kern_sysctl.c,v XX retrieving revision 1.157 XX diff -u -2 -r1.157 kern_sysctl.c XX --- kern_sysctl.c 11 Jun 2004 02:20:37 -0000 1.157 XX +++ kern_sysctl.c 11 Jun 2004 07:58:23 -0000 XX @@ -957,6 +949,13 @@ XX if (!req->newptr) XX return 0; XX - if (req->newlen - req->newidx < l) XX + if (req->newlen - req->newidx != l) { XX + if (req->newlen - req->newidx > l) { XX + printf( XX + "sysctl_new_kernel -- short write: %zu - %zu > %zu\n", XX + req->newlen, req->newidx, l); XX + Debugger("sysctl_new_kernel: short write"); XX + } XX return (EINVAL); XX + } XX bcopy((char *)req->newptr + req->newidx, p, l); XX req->newidx += l; XX @@ -1075,6 +1073,13 @@ XX if (!req->newptr) XX return 0; XX - if (req->newlen - req->newidx < l) XX + if (req->newlen - req->newidx != l) { XX + if (req->newlen - req->newidx > l) { XX + printf( XX + "sysctl_new_user -- short write: %zu - %zu > %zu\n", XX + req->newlen, req->newidx, l); XX + Debugger("sysctl_new_user: short write"); XX + } XX return (EINVAL); XX + } XX error = copyin((char *)req->newptr + req->newidx, p, l); XX req->newidx += l; The debugging code is of course only needed to detect inconsistent sysctl handlers and applications depend on the bug. Not many do. After fixing sysctl handlers, most applications work since they get the size using arcane sysctls like sysctl(8), or by reading the variable and assuming tha it can be written back using the same size. Not many applications probe for the size. They should, so that the sizes of at least scalar vairbales aren't part of an ABI and so can be changed easily. (See old mail for patches that add some probing to the kernel -- the kernel attempts to match the sizes. It truncates the sizes iff the value can be represented in the changed size and in some other cases like counters where truncation was the historical misbehaviour. Unfortunately, this interferes with applications probing the size.) The read size is easy to probe for, and it should be possible to probe for a write size that works, but the bug breaks that and corrupts kernel variables instead. The corruption is largest for the little-endian case. For machdep.tsc_freq, the only serious corruption was for changing a variable near the 4G boundary. E.g., if the variable is initially 0xffffffff, then attempting to change it to 0x100000000 actually changed it to 0, by changing only the low 32 bits. Bruce From owner-svn-src-all@freebsd.org Thu Mar 22 06:31:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9704F6E998; Thu, 22 Mar 2018 06:31:05 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 802B782F0F; Thu, 22 Mar 2018 06:31:05 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B3165F2D; Thu, 22 Mar 2018 06:31:05 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M6V5Sb072840; Thu, 22 Mar 2018 06:31:05 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M6V5GH072839; Thu, 22 Mar 2018 06:31:05 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201803220631.w2M6V5GH072839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Thu, 22 Mar 2018 06:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331345 - head/sys/dev/jedec_dimm X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/sys/dev/jedec_dimm X-SVN-Commit-Revision: 331345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:31:06 -0000 Author: rpokala Date: Thu Mar 22 06:31:05 2018 New Revision: 331345 URL: https://svnweb.freebsd.org/changeset/base/331345 Log: jedec_dimm: Use correct string length when populating sc->slotid_str Don't limit the copy to the size of the target string *pointer* (always 4 on 32-bit / 8 on 64-bit). Instead, just use strdup(). Reported by: Coverity CID: 1386912 Reviewed by: cem, imp MFC after: 1 week Modified: head/sys/dev/jedec_dimm/jedec_dimm.c Modified: head/sys/dev/jedec_dimm/jedec_dimm.c ============================================================================== --- head/sys/dev/jedec_dimm/jedec_dimm.c Thu Mar 22 05:26:27 2018 (r331344) +++ head/sys/dev/jedec_dimm/jedec_dimm.c Thu Mar 22 06:31:05 2018 (r331345) @@ -341,10 +341,7 @@ jedec_dimm_attach(device_t dev) if (resource_string_value(device_get_name(dev), device_get_unit(dev), "slotid", &slotid_str) == 0) { if (slotid_str != NULL) { - sc->slotid_str = malloc(strlen(slotid_str) + 1, - M_DEVBUF, (M_WAITOK | M_ZERO)); - strlcpy(sc->slotid_str, slotid_str, - sizeof(sc->slotid_str)); + sc->slotid_str = strdup(slotid_str, M_DEVBUF); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "slotid", CTLFLAG_RD | CTLFLAG_MPSAFE, sc->slotid_str, 0, "DIMM Slot Identifier"); From owner-svn-src-all@freebsd.org Thu Mar 22 06:03:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4343F6CFB1; Thu, 22 Mar 2018 06:03:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 34CAC81CC7; Thu, 22 Mar 2018 06:03:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id EDC0ED48D99; Thu, 22 Mar 2018 17:03:25 +1100 (AEDT) Date: Thu, 22 Mar 2018 17:03:25 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <20180321202752.GO76926@kib.kiev.ua> Message-ID: <20180322155152.O1053@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=SHKZrRbqEoQg_kA9z3AA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:03:36 -0000 On Wed, 21 Mar 2018, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 04:53:22AM +1100, Bruce Evans wrote: >> Serial console drivers with fast interrupt handlers have much more >> broken locking for ddb special keys. It is invalid to either drop locks >> or call the "any" function from a fast interrupt handler, but buggy >> serial console drivers calls kbd_alt_break(), and that now calls >> shutdown_nice() and other functions that cannot be called from a fast >> interrupt handler. ddb keys supply most of the shutdown_nice() >> functionality for serial consoles, and there are no escape sequence to >> get this without ddb or maybe another debugger, so these bugs don't >> affect most users. >> >> Handling this correctly requires much the same fix as an unsafe signal >> handler, and fixes have much the same problems -- not much more than >> setting a flag is safe, and the flag might never be looked at if the >> system is in a bad state. However, if a nice shutdown is possible then >> the sytem must be in a good enough state to poll for flags. > > Are you saying that fast interrupt handlers call shutdown_nice() ? This > is the quite serious bug on its own. To fix it, shutdown_nice() should > use a fast taskqueue to schedule the task which would lock the process > and send the signal. Yes. See kdb_reboot(). This is called for an escape sequence from kdb_alt_break_internal(). The other calls in kdb_alt_break_internal() don't wander into a function that calls shutdown_nice() and are relatively safe. They have to be not completely safe to work in "any" context. kdb_reboot() is the opposite -- we want it to fail if the context is not nice enough to reboot nicely. BTW, I've often wanted to be able to send more general signals to init using keystrokes, independent of being logged in. Mainly SIGHUP to shut down to single user mode. This has some security problems, especially for the "any" signal to the "any" process. At least syscons defaults to allowing Ctrl-Alt-Del to reboot. I like that and miss it on serial consoles and on some non-FreeBSD OS's (the alt-break sequence to reach kdb_reboot() is not equivalent, since it is only available if much more insecure sequences are also allowed). Shutdown isn't as fundamentally insecure as sending arbitrary signals and most systems allow it without much more than a password for users that have physical access to the system. OTOH, I don't like the syscons key that suspends. This is also allowed by default. I sometimes press it by mistake on a system that can suspend but not resume. Unlike the reboot key, there are no knobs for controlling it. There are 3 static configuration knobs, 2 sysctls and the keymap which must be understood for securing the main reboot key in syscons, and a slightly different set of controls in vt :-(. For suspend, there is only the keymap. Syscons also has a standby key and more shutdown keys, but these are in more obscure parts of keymaps and I've never noticed typing them by mistake. Bruce From owner-svn-src-all@freebsd.org Thu Mar 22 06:37:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39FDB1AB; Thu, 22 Mar 2018 06:37:53 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 97DF9834E1; Thu, 22 Mar 2018 06:37:51 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id ytr5eR12sXziTytr6e6fFh; Thu, 22 Mar 2018 00:37:45 -0600 X-Authority-Analysis: v=2.3 cv=X6B81lbe c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=xfDLHkLGAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=ywg3BWjeHnHILdIq2vMA:9 a=CjuIK1q_8ugA:10 a=IfaqVvZgccqrtc8gcwf2:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id D08F53BB; Wed, 21 Mar 2018 23:37:42 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2M6bgBW050700; Wed, 21 Mar 2018 23:37:42 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2M6bgSU050692; Wed, 21 Mar 2018 23:37:42 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803220637.w2M6bgSU050692@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Kyle Evans cc: Cy Schubert , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331326 - in head/stand: forth i386/loader In-Reply-To: Message from Kyle Evans of "Wed, 21 Mar 2018 23:19:23 -0500." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Mar 2018 23:37:42 -0700 X-CMAE-Envelope: MS4wfMkvO4FIF6SyIM2sy4Slt8KhzwLuwWkM4fQ6reHiJ3rgpVFz1hcSfa5qA+4msuKAhjAwgIDwdK9K3DaO2yB8zwwpskf+pDgnGtN/VvJvWEgCSKIO9dX0 bDkBLCnHn59DAJLLsCGyVXmJfeQ7+X09O6SXqNlZR2ysrP2YHTRe8gVZzdLxt9zlbxrudvegQc6Un+vYxZipBB6qVV5ZCUqqZxtncHRENqIPbtPaw+hdjDUT o15qr/AESs/zImssnErlUiO2Q1BnCwYvDHPkBsuFojrl8Mr3H1KBuL+2QbEPBmTm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:37:53 -0000 In message , Kyle Evans writes: > On Wed, Mar 21, 2018 at 10:30 PM, Cy Schubert wro > te: > > In message <201803212201.w2LM1pvl020202@repo.freebsd.org>, Kyle Evans > > writes: > >> Author: kevans > >> Date: Wed Mar 21 22:01:51 2018 > >> New Revision: 331326 > >> URL: https://svnweb.freebsd.org/changeset/base/331326 > >> > >> Log: > >> Forth version of EFI autoresizing > >> > >> r331321 delegated autoresizing to an efi-autoresizecons command that > >> currently is expected to be done in forth/lua prior to drawing anything > >> useful. > >> > >> Add the Forth version of the lua addition in r331321, hook efi.4th up to > be > >> installed. > >> > >> efiboot? was written by dteske@; anything outside of that may be blamed > on > >> me. > >> > >> Modified: > >> head/stand/forth/Makefile > >> head/stand/forth/efi.4th > >> head/stand/forth/loader.rc > >> head/stand/i386/loader/loader.rc > >> > >> Modified: head/stand/forth/Makefile > >> ========================================================================== > === > >> = > >> --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) > >> +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) > >> @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th > >> FILES+= check-password.4th > >> FILES+= color.4th > >> FILES+= delay.4th > >> +FILES+= efi.4th > >> FILES+= frames.4th > >> FILES+= loader.4th > >> FILES+= logo-beastie.4th > >> > >> Modified: head/stand/forth/efi.4th > >> ========================================================================== > === > >> = > >> --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) > >> +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) > >> @@ -26,5 +26,16 @@ > >> > >> only forth definitions > >> > >> -\ Place holder for more functions > >> +: efiboot? ( -- flag ) > >> + s" efi-version" getenv -1 <> dup if > >> + swap drop ( c-addr flag -- flag ) > >> + then > >> +; > >> + > >> +: maybe-efi-resizecons > >> + efiboot? if > >> + efi-autoresizecons > > > > This statement breaks boot on my BIOS machines. It cannot find > > efi-autoresizecons, causing a bare kernel without modules to load or > > kenv variables set. > > > > Ugh, sorry about that. =( I've converted that to a runtime evaluation > in r331341 and (hopefully) properly observed my failure to succeed. No problem. That fixed it. > > On the plus side, today I learned about `boot-conf` to get back to the > Forth-intercepted 'boot' behavior to workaround the breakage. =) Yes. Good point. I'll remember that too. Thanks again. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Thu Mar 22 06:39:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22EAA323; Thu, 22 Mar 2018 06:39:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 94B9B8362A; Thu, 22 Mar 2018 06:39:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 443E8101576; Thu, 22 Mar 2018 17:39:16 +1100 (AEDT) Date: Thu, 22 Mar 2018 17:39:14 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: Message-ID: <20180322170345.J1053@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=ujyv94cRbLZRN1sVS_cA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:39:20 -0000 On Wed, 21 Mar 2018, Warner Losh wrote: > On Wed, Mar 21, 2018 at 11:53 AM, Bruce Evans wrote: > >> On Wed, 21 Mar 2018, Warner Losh wrote: >> >> Log: >>> Unlock giant when calling shutdown_nice() >> >> This breaks the driver. Giant is syscons' driver lock, and also the >> interrupt handler lock for at least the atkbd keyboard driver, so vt >> sometimes holds the lock for. > > OK. I got carried away. You're right. The proper fix is to unlock Giant at > the top of kern_reboot() instead. This handles the case where we call > shutdown_nice() with no init running and have to call kern_reboot directly. > Otherwise it's perfectly fine to just call shutdown_nice() with Giant held > since we just signal init from there. So I'll revert this change and make > that other change instead. > ... > Good point. I think the following change is good for everything except > calling shutdown_nice() from a fast interrupt handler with noinit running: > > diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c > index e5ea9644ad3f..564aecd811be 100644 > --- a/sys/kern/kern_shutdown.c > +++ b/sys/kern/kern_shutdown.c > @@ -366,6 +366,12 @@ kern_reboot(int howto) > { > static int once = 0; > > + /* > + * Drop Giant once and for all. > + */ > + while (mtx_owned(&Giant)) > + mtx_unlock(&Giant); > + > #if defined(SMP) > /* > * Bind us to the first CPU so that all shutdown code runs there. > Some > > Comments? Try putting this in vfs_mountroot_parse() and/or the second clause of shutdown_nice() only. The only other calls are from is from sys_reboot() and vpanic(). sys_reboot() is either MPSAFE or not, and it should know when it is safe to drop its Giant lock if at all. vpanic() sets SCHEDULER_STOPPED() to avoid seeing problems with Giant or any other mutex. Bruce From owner-svn-src-all@freebsd.org Thu Mar 22 07:07:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAA5AF46641; Thu, 22 Mar 2018 07:07:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 4D874848C4; Thu, 22 Mar 2018 07:07:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 1212B1047AC5; Thu, 22 Mar 2018 17:50:58 +1100 (AEDT) Date: Thu, 22 Mar 2018 17:50:57 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Konstantin Belousov , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: Message-ID: <20180322174025.Q1053@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=XDltxdv9FE5UCP5c3OgA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 07:08:00 -0000 On Wed, 21 Mar 2018, Warner Losh wrote: > On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov > wrote: >> ... >> Are you saying that fast interrupt handlers call shutdown_nice() ? This >> is the quite serious bug on its own. To fix it, shutdown_nice() should >> use a fast taskqueue to schedule the task which would lock the process >> and send the signal. > > Is there some way we know we're in a fast interrupt handler? If so, it > should be simple to fix. If not, then there's an API change ahead of us... There is a td_intr_nesting_level flag that might work. (I invented this, but don't like its current use.) > But bde is right: the system has to be in good enough shape to cope. I > wonder if we should put that coping into kdb_reboot() instead. It's only an > issue for TILDE ^R, which is a fairly edge case. shutdown_nice() is also called directly from syscons and vt for the reboot, halt and poweroff keys. This happens in normal interrupt handler context, so there is only a problem when init is not running. Bruce From owner-svn-src-all@freebsd.org Thu Mar 22 08:32:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE08BF4FEE2; Thu, 22 Mar 2018 08:32:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8475D87870; Thu, 22 Mar 2018 08:32:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F50771E5; Thu, 22 Mar 2018 08:32:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M8WdJV036143; Thu, 22 Mar 2018 08:32:39 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M8WddP036142; Thu, 22 Mar 2018 08:32:39 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201803220832.w2M8WddP036142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 22 Mar 2018 08:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331346 - head/sys/modules/blake2 X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/modules/blake2 X-SVN-Commit-Revision: 331346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 08:32:40 -0000 Author: lwhsu (ports committer) Date: Thu Mar 22 08:32:39 2018 New Revision: 331346 URL: https://svnweb.freebsd.org/changeset/base/331346 Log: Fix build. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D14793 Modified: head/sys/modules/blake2/Makefile Modified: head/sys/modules/blake2/Makefile ============================================================================== --- head/sys/modules/blake2/Makefile Thu Mar 22 06:31:05 2018 (r331345) +++ head/sys/modules/blake2/Makefile Thu Mar 22 08:32:39 2018 (r331346) @@ -80,7 +80,7 @@ SRCS += string.h SRCS += blake2_cryptodev.c -SRCS += opt_param.h cryptodev_if.h +SRCS += opt_param.h cryptodev_if.h bus_if.h device_if.h WARNS ?= 6 From owner-svn-src-all@freebsd.org Thu Mar 22 09:40:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D21B4F54CC3; Thu, 22 Mar 2018 09:40:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 873556A8AD; Thu, 22 Mar 2018 09:40:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DC417B0F; Thu, 22 Mar 2018 09:40:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M9e9Mv067729; Thu, 22 Mar 2018 09:40:09 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M9e8T4067719; Thu, 22 Mar 2018 09:40:08 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803220940.w2M9e8T4067719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Thu, 22 Mar 2018 09:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat X-SVN-Commit-Revision: 331347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 09:40:10 -0000 Author: jtl Date: Thu Mar 22 09:40:08 2018 New Revision: 331347 URL: https://svnweb.freebsd.org/changeset/base/331347 Log: Add the "TCP Blackbox Recorder" which we discussed at the developer summits at BSDCan and BSDCam in 2017. The TCP Blackbox Recorder allows you to capture events on a TCP connection in a ring buffer. It stores metadata with the event. It optionally stores the TCP header associated with an event (if the event is associated with a packet) and also optionally stores information on the sockets. It supports setting a log ID on a TCP connection and using this to correlate multiple connections that share a common log ID. You can log connections in different modes. If you are doing a coordinated test with a particular connection, you may tell the system to put it in mode 4 (continuous dump). Or, if you just want to monitor for errors, you can put it in mode 1 (ring buffer) and dump all the ring buffers associated with the connection ID when we receive an error signal for that connection ID. You can set a default mode that will be applied to a particular ratio of incoming connections. You can also manually set a mode using a socket option. This commit includes only basic probes. rrs@ has added quite an abundance of probes in his TCP development work. He plans to commit those soon. There are user-space programs which we plan to commit as ports. These read the data from the log device and output pcapng files, and then let you analyze the data (and metadata) in the pcapng files. Reviewed by: gnn (previous version) Obtained from: Netflix, Inc. Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11085 Added: head/sys/dev/tcp_log/ head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) head/sys/netinet/tcp_log_buf.c (contents, props changed) head/sys/netinet/tcp_log_buf.h (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/sys/conf/files head/sys/kern/subr_witness.c head/sys/netinet/tcp.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/usr.bin/netstat/inet.c head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.1 head/usr.bin/netstat/netstat.h Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 (r331346) +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 (r331347) @@ -158,6 +158,8 @@ .. speaker .. + tcp_log + .. usb .. vkbd Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ - dev/speaker dev/vkbd dev/wi \ + dev/speaker dev/tcp_log dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/syscons/warp/warp_saver.c optional warp_saver +dev/tcp_log/tcp_log_dev.c optional inet | inet6 dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux dev/tdfx/tdfx_pci.c optional tdfx pci dev/ti/if_ti.c optional ti pci @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 netinet/tcp_hostcache.c optional inet | inet6 netinet/tcp_input.c optional inet | inet6 +netinet/tcp_log_buf.c optional inet | inet6 netinet/tcp_lro.c optional inet | inet6 netinet/tcp_output.c optional inet | inet6 netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 Added: head/sys/dev/tcp_log/tcp_log_dev.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 (r331347) @@ -0,0 +1,521 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016-2017 + * Netflix Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef TCPLOG_DEBUG_COUNTERS +extern counter_u64_t tcp_log_que_read; +extern counter_u64_t tcp_log_que_freed; +#endif + +static struct cdev *tcp_log_dev; +static struct selinfo tcp_log_sel; + +static struct log_queueh tcp_log_dev_queue_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); +static struct log_infoh tcp_log_dev_reader_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); + +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data structures"); + +static int tcp_log_dev_listeners = 0; + +static struct mtx tcp_log_dev_queue_lock; + +#define TCP_LOG_DEV_QUEUE_LOCK() mtx_lock(&tcp_log_dev_queue_lock) +#define TCP_LOG_DEV_QUEUE_UNLOCK() mtx_unlock(&tcp_log_dev_queue_lock) +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)->tldq_refcnt)) +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)->tldq_refcnt)) + +static void tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry); +static void tcp_log_dev_clear_cdevpriv(void *data); +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, + int devtype __unused, struct thread *td __unused); +static int tcp_log_dev_write(struct cdev *dev __unused, + struct uio *uio __unused, int flags __unused); +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, + int flags __unused); +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, + caddr_t data, int fflag __unused, struct thread *td __unused); +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, + struct thread *td); + + +enum tcp_log_dev_queue_lock_state { + QUEUE_UNLOCKED = 0, + QUEUE_LOCKED, +}; + +static struct cdevsw tcp_log_cdevsw = { + .d_version = D_VERSION, + .d_read = tcp_log_dev_read, + .d_open = tcp_log_dev_open, + .d_write = tcp_log_dev_write, + .d_poll = tcp_log_dev_poll, + .d_ioctl = tcp_log_dev_ioctl, +#ifdef NOTYET + .d_mmap = tcp_log_dev_mmap, +#endif + .d_name = "tcp_log", +}; + +static __inline void +tcp_log_dev_queue_validate_lock(int lockstate) +{ + +#ifdef INVARIANTS + switch (lockstate) { + case QUEUE_LOCKED: + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + break; + case QUEUE_UNLOCKED: + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); + break; + default: + kassert_panic("%s:%d: unknown queue lock state", __func__, + __LINE__); + } +#endif +} + +/* + * Clear the refcount. If appropriate, it will remove the entry from the + * queue and call the destructor. + * + * This must be called with the queue lock held. + */ +static void +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) +{ + + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); + + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { +#ifdef TCPLOG_DEBUG_COUNTERS + counter_u64_add(tcp_log_que_freed, 1); +#endif + /* Remove the entry from the queue and call the destructor. */ + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, tcp_log_dev_queue, + tldq_queue); + (*entry->tldq_dtor)(entry); + } +} + +static void +tcp_log_dev_clear_cdevpriv(void *data) +{ + struct tcp_log_dev_info *priv; + struct tcp_log_dev_queue *entry, *entry_tmp; + + priv = (struct tcp_log_dev_info *)data; + if (priv == NULL) + return; + + /* + * Lock the queue and drop our references. We hold references to all + * the entries starting with tldi_head (or, if tldi_head == NULL, all + * entries in the queue). + * + * Because we don't want anyone adding addition things to the queue + * while we are doing this, we lock the queue. + */ + TCP_LOG_DEV_QUEUE_LOCK(); + if (priv->tldi_head != NULL) { + entry = priv->tldi_head; + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, + tldq_queue, entry_tmp) { + tcp_log_dev_clear_refcount(entry); + } + } + tcp_log_dev_listeners--; + KASSERT(tcp_log_dev_listeners >= 0, + ("%s: tcp_log_dev_listeners is unexpectedly negative", __func__)); + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, + tldi_list); + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + TCP_LOG_DEV_QUEUE_UNLOCK(); + free(priv, M_TCPLOGDEV); +} + +static int +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype __unused, + struct thread *td __unused) +{ + struct tcp_log_dev_info *priv; + struct tcp_log_dev_queue *entry; + int rv; + + /* + * Ideally, we shouldn't see these because of file system + * permissions. + */ + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) + return (ENODEV); + + /* Allocate space to hold information about where we are. */ + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, + M_ZERO | M_WAITOK); + + /* Stash the private data away. */ + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); + if (!rv) { + /* + * Increase the listener count, add this reader to the list, and + * take references on all current queues. + */ + TCP_LOG_DEV_QUEUE_LOCK(); + tcp_log_dev_listeners++; + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, tldi_list); + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); + if (priv->tldi_head != NULL) + priv->tldi_cur = priv->tldi_head->tldq_buf; + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) + TCP_LOG_DEV_QUEUE_REF(entry); + TCP_LOG_DEV_QUEUE_UNLOCK(); + } else { + /* Free the entry. */ + free(priv, M_TCPLOGDEV); + } + return (rv); +} + +static int +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, + int flags __unused) +{ + + return (ENODEV); +} + +static __inline void +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int *lockstate) +{ + struct tcp_log_dev_queue *entry; + + KASSERT(priv->tldi_head != NULL, + ("%s:%d: priv->tldi_head unexpectedly NULL", + __func__, __LINE__)); + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, + ("%s:%d: buffer mismatch (%p vs %p)", + __func__, __LINE__, priv->tldi_head->tldq_buf, + priv->tldi_cur)); + tcp_log_dev_queue_validate_lock(*lockstate); + + if (*lockstate == QUEUE_UNLOCKED) { + TCP_LOG_DEV_QUEUE_LOCK(); + *lockstate = QUEUE_LOCKED; + } + entry = priv->tldi_head; + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); + tcp_log_dev_clear_refcount(entry); + priv->tldi_cur = NULL; +} + +static int +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int flags) +{ + struct tcp_log_common_header *buf; + struct tcp_log_dev_info *priv; + struct tcp_log_dev_queue *entry; + ssize_t len; + int lockstate, rv; + + /* Get our private info. */ + rv = devfs_get_cdevpriv((void **)&priv); + if (rv) + return (rv); + + lockstate = QUEUE_UNLOCKED; + + /* Do we need to get a new buffer? */ + while (priv->tldi_cur == NULL || + priv->tldi_cur->tlch_length <= priv->tldi_off) { + /* Did we somehow forget to rotate? */ + KASSERT(priv->tldi_cur == NULL, + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, + __LINE__)); + if (priv->tldi_cur != NULL) + tcp_log_dev_rotate_bufs(priv, &lockstate); + + /* + * Before we start looking at tldi_head, we need a lock on the + * queue to make sure tldi_head stays stable. + */ + if (lockstate == QUEUE_UNLOCKED) { + TCP_LOG_DEV_QUEUE_LOCK(); + lockstate = QUEUE_LOCKED; + } + + /* We need the next buffer. Do we have one? */ + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { + rv = EAGAIN; + goto done; + } + if (priv->tldi_head == NULL) { + /* Sleep and wait for more things we can read. */ + rv = mtx_sleep(&tcp_log_dev_listeners, + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", 0); + if (rv) + goto done; + if (priv->tldi_head == NULL) + continue; + } + + /* + * We have an entry to read. We want to try to create a + * buffer, if one doesn't already exist. + */ + entry = priv->tldi_head; + if (entry->tldq_buf == NULL) { + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + buf = (*entry->tldq_xform)(entry); + if (buf == NULL) { + rv = EBUSY; + goto done; + } + entry->tldq_buf = buf; + } + + priv->tldi_cur = entry->tldq_buf; + priv->tldi_off = 0; + } + + /* Copy what we can from this buffer to the output buffer. */ + if (uio->uio_resid > 0) { + /* Drop locks so we can take page faults. */ + if (lockstate == QUEUE_LOCKED) + TCP_LOG_DEV_QUEUE_UNLOCK(); + lockstate = QUEUE_UNLOCKED; + + KASSERT(priv->tldi_cur != NULL, + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); + + /* Copy as much as we can to this uio. */ + len = priv->tldi_cur->tlch_length - priv->tldi_off; + if (len > uio->uio_resid) + len = uio->uio_resid; + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, + len, uio); + if (rv != 0) + goto done; + priv->tldi_off += len; +#ifdef TCPLOG_DEBUG_COUNTERS + counter_u64_add(tcp_log_que_read, len); +#endif + } + /* Are we done with this buffer? If so, find the next one. */ + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, + ("%s: offset (%ju) exceeds length (%ju)", __func__, + (uintmax_t)priv->tldi_off, + (uintmax_t)priv->tldi_cur->tlch_length)); + tcp_log_dev_rotate_bufs(priv, &lockstate); + } +done: + tcp_log_dev_queue_validate_lock(lockstate); + if (lockstate == QUEUE_LOCKED) + TCP_LOG_DEV_QUEUE_UNLOCK(); + return (rv); +} + +static int +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, + int fflag __unused, struct thread *td __unused) +{ + struct tcp_log_dev_info *priv; + int rv; + + /* Get our private info. */ + rv = devfs_get_cdevpriv((void **)&priv); + if (rv) + return (rv); + + /* + * Set things. Here, we are most concerned about the non-blocking I/O + * flag. + */ + rv = 0; + switch (cmd) { + case FIONBIO: + break; + case FIOASYNC: + if (*(int *)data != 0) + rv = EINVAL; + break; + default: + rv = ENOIOCTL; + } + return (rv); +} + +static int +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread *td) +{ + struct tcp_log_dev_info *priv; + int revents; + + /* + * Get our private info. If this fails, claim that all events are + * ready. That should prod the user to do something that will + * make the error evident to them. + */ + if (devfs_get_cdevpriv((void **)&priv)) + return (events); + + revents = 0; + if (events & (POLLIN | POLLRDNORM)) { + /* + * We can (probably) read right now if we are partway through + * a buffer or if we are just about to start a buffer. + * Because we are going to read tldi_head, we should acquire + * a read lock on the queue. + */ + TCP_LOG_DEV_QUEUE_LOCK(); + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || + (priv->tldi_cur != NULL && + priv->tldi_off < priv->tldi_cur->tlch_length)) + revents = events & (POLLIN | POLLRDNORM); + else + selrecord(td, &tcp_log_sel); + TCP_LOG_DEV_QUEUE_UNLOCK(); + } else { + /* + * It only makes sense to poll for reading. So, again, prod the + * user to do something that will make the error of their ways + * apparent. + */ + revents = events; + } + return (revents); +} + +int +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) +{ + struct tcp_log_dev_info *priv; + int rv; + bool wakeup_needed; + + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, + ("%s: Called with both tldq_buf and tldq_xform set to NULL", + __func__)); + KASSERT(entry->tldq_dtor != NULL, + ("%s: Called with tldq_dtor set to NULL", __func__)); + + /* Get a lock on the queue. */ + TCP_LOG_DEV_QUEUE_LOCK(); + + /* If no one is listening, tell the caller to free the resources. */ + if (tcp_log_dev_listeners == 0) { + rv = ENXIO; + goto done; + } + + /* Add this to the end of the tailq. */ + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); + + /* Add references for all current listeners. */ + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); + + /* + * If any listener is currently stuck on NULL, that means they are + * waiting. Point their head to this new entry. + */ + wakeup_needed = false; + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) + if (priv->tldi_head == NULL) { + priv->tldi_head = entry; + wakeup_needed = true; + } + + if (wakeup_needed) { + selwakeup(&tcp_log_sel); + wakeup(&tcp_log_dev_listeners); + } + + rv = 0; + +done: + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + TCP_LOG_DEV_QUEUE_UNLOCK(); + return (rv); +} + +static int +tcp_log_dev_modevent(module_t mod __unused, int type, void *data __unused) +{ + + /* TODO: Support intelligent unloading. */ + switch (type) { + case MOD_LOAD: + if (bootverbose) + printf("tcp_log: tcp_log device\n"); + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", + "tcp_log device queues", MTX_DEF); + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, + "tcp_log"); + break; + default: + return (EOPNOTSUPP); + } + + return (0); +} + +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); +MODULE_VERSION(tcp_log_dev, 1); Added: head/sys/dev/tcp_log/tcp_log_dev.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 (r331347) @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016 + * Netflix Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE 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 __tcp_log_dev_h__ +#define __tcp_log_dev_h__ + +/* + * This is the common header for data streamed from the log device. All + * blocks of data need to start with this header. + */ +struct tcp_log_common_header { + uint32_t tlch_version; /* Version is specific to type. */ + uint32_t tlch_type; /* Type of entry(ies) that follow. */ + uint64_t tlch_length; /* Total length, including header. */ +} __packed; + +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ + +#ifdef _KERNEL +/* + * This is a queue entry. All queue entries need to start with this structure + * so the common code can cast them to this structure; however, other modules + * are free to include additional data after this structure. + * + * The elements are explained here: + * tldq_queue: used by the common code to maintain this entry's position in the + * queue. + * tldq_buf: should be NULL, or a pointer to a chunk of data. The data must be + * as long as the common header indicates. + * tldq_xform: If tldq_buf is NULL, the code will call this to create the + * the tldq_buf object. The function should *not* directly modify tldq_buf, + * but should return the buffer (which must meet the restrictions + * indicated for tldq_buf). + * tldq_dtor: This function is called to free the queue entry. If tldq_buf is + * not NULL, the dtor function must free that, too. + * tldq_refcnt: used by the common code to indicate how many readers still need + * this data. + */ +struct tcp_log_dev_queue { + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; + struct tcp_log_common_header *tldq_buf; + struct tcp_log_common_header *(*tldq_xform)(struct tcp_log_dev_queue *entry); + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); + volatile u_int tldq_refcnt; +}; + +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); + +struct tcp_log_dev_info { + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; + struct tcp_log_dev_queue *tldi_head; + struct tcp_log_common_header *tldi_cur; + off_t tldi_off; +}; +STAILQ_HEAD(log_infoh, tcp_log_dev_info); + + +MALLOC_DECLARE(M_TCPLOGDEV); +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); +#endif /* _KERNEL */ +#endif /* !__tcp_log_dev_h__ */ Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 (r331347) @@ -640,6 +640,14 @@ static struct witness_order_list_entry order_lists[] = { "db->db_mtx", &lock_class_sx }, { NULL, NULL }, /* + * TCP log locks + */ + { "TCP ID tree", &lock_class_rw }, + { "tcp log id bucket", &lock_class_mtx_sleep }, + { "tcpinp", &lock_class_rw }, + { "TCP log expireq", &lock_class_mtx_sleep }, + { NULL, NULL }, + /* * spin locks */ #ifdef SMP Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) @@ -168,6 +168,12 @@ struct tcphdr { #define TCP_NOOPT 8 /* don't use TCP options */ #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ #define TCP_INFO 32 /* retrieve tcp_info structure */ +#define TCP_LOG 34 /* configure event logging for connection */ +#define TCP_LOGBUF 35 /* retrieve event log for connection */ +#define TCP_LOGID 36 /* configure log ID to correlate connections */ +#define TCP_LOGDUMP 37 /* dump connection log events to device */ +#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to + device */ #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ #define TCP_KEEPINIT 128 /* N, time to establish connection */ @@ -188,6 +194,9 @@ struct tcphdr { #define TCPI_OPT_WSCALE 0x04 #define TCPI_OPT_ECN 0x08 #define TCPI_OPT_TOE 0x10 + +/* Maximum length of log ID. */ +#define TCP_LOG_ID_LEN 64 /* * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 (r331347) @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru /* Save segment, if requested. */ tcp_pcap_add(th, m, &(tp->t_inpkts)); #endif + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, + tlen, NULL, true); if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { Added: head/sys/netinet/tcp_log_buf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 (r331347) @@ -0,0 +1,2480 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016-2018 + * Netflix Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE 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 +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Default expiry time */ +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) + +/* Max interval at which to run the expiry timer */ +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) + +bool tcp_log_verbose; +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, tcp_log_zone; +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); +static struct tcp_log_id_tree tcp_log_id_head; +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); +static struct mtx tcp_log_expireq_mtx; +static struct callout tcp_log_expireq_callout; +static uint64_t tcp_log_auto_ratio = 0; +static uint64_t tcp_log_auto_ratio_cur = 0; +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; +static bool tcp_log_auto_all = false; + +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, tcp_log_id_cmp) + +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black Box controls"); + +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, &tcp_log_verbose, + 0, "Force verbose logging for TCP traces"); + +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, + CTLFLAG_RW, &tcp_log_session_limit, 0, + "Maximum number of events maintained for each TCP session"); + +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, CTLFLAG_RW, + &tcp_log_zone, "Maximum number of events maintained for all TCP sessions"); + +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, CTLFLAG_RD, + &tcp_log_zone, "Current number of events maintained for all TCP sessions"); + +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, + &tcp_log_bucket_zone, "Maximum number of log IDs"); + +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, CTLFLAG_RD, + &tcp_log_bucket_zone, "Current number of log IDs"); + +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, CTLFLAG_RW, + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); + +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, CTLFLAG_RD, + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); + +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, + 0, "Version of log formats exported"); + +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); + +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, + "Logging mode for auto-selected sessions (default is TCP_LOG_STATE_HEAD_AUTO)"); + +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, + &tcp_log_auto_all, false, + "Auto-select from all sessions (rather than just those with IDs)"); + +#ifdef TCPLOG_DEBUG_COUNTERS +counter_u64_t tcp_log_queued; +counter_u64_t tcp_log_que_fail1; +counter_u64_t tcp_log_que_fail2; +counter_u64_t tcp_log_que_fail3; +counter_u64_t tcp_log_que_fail4; +counter_u64_t tcp_log_que_fail5; +counter_u64_t tcp_log_que_copyout; +counter_u64_t tcp_log_que_read; +counter_u64_t tcp_log_que_freed; + +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, + &tcp_log_queued, "Number of entries queued"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, + &tcp_log_que_fail1, "Number of entries queued but fail 1"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, + &tcp_log_que_fail2, "Number of entries queued but fail 2"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, + &tcp_log_que_fail3, "Number of entries queued but fail 3"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, + &tcp_log_que_fail4, "Number of entries queued but fail 4"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, + &tcp_log_que_fail5, "Number of entries queued but fail 4"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, + &tcp_log_que_copyout, "Number of entries copied out"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, + &tcp_log_que_read, "Number of entries read from the queue"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, + &tcp_log_que_freed, "Number of entries freed after reading"); +#endif + +#ifdef INVARIANTS +#define TCPLOG_DEBUG_RINGBUF +#endif + +struct tcp_log_mem +{ + STAILQ_ENTRY(tcp_log_mem) tlm_queue; + struct tcp_log_buffer tlm_buf; + struct tcp_log_verbose tlm_v; +#ifdef TCPLOG_DEBUG_RINGBUF + volatile int tlm_refcnt; +#endif +}; + +/* 60 bytes for the header, + 16 bytes for padding */ +static uint8_t zerobuf[76]; + +/* + * Lock order: + * 1. TCPID_TREE + * 2. TCPID_BUCKET + * 3. INP + * + * Rules: + * A. You need a lock on the Tree to add/remove buckets. + * B. You need a lock on the bucket to add/remove nodes from the bucket. + * C. To change information in a node, you need the INP lock if the tln_closed + * field is false. Otherwise, you need the bucket lock. (Note that the + * tln_closed field can change at any point, so you need to recheck the + * entry after acquiring the INP lock.) + * D. To remove a node from the bucket, you must have that entry locked, + * according to the criteria of Rule C. Also, the node must not be on + * the expiry queue. + * E. The exception to C is the expiry queue fields, which are locked by + * the TCPLOG_EXPIREQ lock. + * + * Buckets have a reference count. Each node is a reference. Further, + * other callers may add reference counts to keep a bucket from disappearing. + * You can add a reference as long as you own a lock sufficient to keep the + * bucket from disappearing. For example, a common use is: + * a. Have a locked INP, but need to lock the TCPID_BUCKET. + * b. Add a refcount on the bucket. (Safe because the INP lock prevents + * the TCPID_BUCKET from going away.) + * c. Drop the INP lock. + * d. Acquire a lock on the TCPID_BUCKET. + * e. Acquire a lock on the INP. + * f. Drop the refcount on the bucket. + * (At this point, the bucket may disappear.) + * + * Expire queue lock: + * You can acquire this with either the bucket or INP lock. Don't reverse it. + * When the expire code has committed to freeing a node, it resets the expiry + * time to SBT_MAX. That is the signal to everyone else that they should + * leave that node alone. + */ +static struct rwlock tcp_id_tree_lock; +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) +#define TCPID_TREE_UPGRADE() rw_try_upgrade(&tcp_id_tree_lock) +#define TCPID_TREE_WUNLOCK() rw_wunlock(&tcp_id_tree_lock) +#define TCPID_TREE_RUNLOCK() rw_runlock(&tcp_id_tree_lock) +#define TCPID_TREE_WLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_WLOCKED) +#define TCPID_TREE_RLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_RLOCKED) +#define TCPID_TREE_UNLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) + +#define TCPID_BUCKET_LOCK_INIT(tlb) mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) +#define TCPID_BUCKET_LOCK_DESTROY(tlb) mtx_destroy(&((tlb)->tlb_mtx)) +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) +#define TCPID_BUCKET_UNLOCK(tlb) mtx_unlock(&((tlb)->tlb_mtx)) +#define TCPID_BUCKET_LOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) + +#define TCPID_BUCKET_REF(tlb) refcount_acquire(&((tlb)->tlb_refcnt)) +#define TCPID_BUCKET_UNREF(tlb) refcount_release(&((tlb)->tlb_refcnt)) + +#define TCPLOG_EXPIREQ_LOCK() mtx_lock(&tcp_log_expireq_mtx) +#define TCPLOG_EXPIREQ_UNLOCK() mtx_unlock(&tcp_log_expireq_mtx) + +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); + +struct tcp_log_id_bucket +{ + /* + * tlb_id must be first. This lets us use strcmp on + * (struct tcp_log_id_bucket *) and (char *) interchangeably. + */ + char tlb_id[TCP_LOG_ID_LEN]; + RB_ENTRY(tcp_log_id_bucket) tlb_rb; + struct tcp_log_id_head tlb_head; + struct mtx tlb_mtx; + volatile u_int tlb_refcnt; +}; + +struct tcp_log_id_node +{ + SLIST_ENTRY(tcp_log_id_node) tln_list; + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the expireq lock */ + sbintime_t tln_expiretime; /* Locked by the expireq lock */ + + /* + * If INP is NULL, that means the connection has closed. We've + * saved the connection endpoint information and the log entries + * in the tln_ie and tln_entries members. We've also saved a pointer + * to the enclosing bucket here. If INP is not NULL, the information is + * in the PCB and not here. + */ + struct inpcb *tln_inp; + struct tcpcb *tln_tp; + struct tcp_log_id_bucket *tln_bucket; + struct in_endpoints tln_ie; + struct tcp_log_stailq tln_entries; + int tln_count; + volatile int tln_closed; + uint8_t tln_af; +}; + +enum tree_lock_state { + TREE_UNLOCKED = 0, + TREE_RLOCKED, + TREE_WLOCKED, +}; + +/* Do we want to select this session for auto-logging? */ +static __inline bool +tcp_log_selectauto(void) +{ + + /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Mar 22 09:43:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6AF8F55130; Thu, 22 Mar 2018 09:43:15 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6552A6AE1E; Thu, 22 Mar 2018 09:43:15 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 603707CA3; Thu, 22 Mar 2018 09:43:15 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M9hFSg072345; Thu, 22 Mar 2018 09:43:15 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M9hFmC072344; Thu, 22 Mar 2018 09:43:15 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803220943.w2M9hFmC072344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Thu, 22 Mar 2018 09:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331348 - head/usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/usr.bin/netstat X-SVN-Commit-Revision: 331348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 09:43:15 -0000 Author: jtl Date: Thu Mar 22 09:43:15 2018 New Revision: 331348 URL: https://svnweb.freebsd.org/changeset/base/331348 Log: Bump netstat.1's .Dd after r331347. Modified: head/usr.bin/netstat/netstat.1 Modified: head/usr.bin/netstat/netstat.1 ============================================================================== --- head/usr.bin/netstat/netstat.1 Thu Mar 22 09:40:08 2018 (r331347) +++ head/usr.bin/netstat/netstat.1 Thu Mar 22 09:43:15 2018 (r331348) @@ -28,7 +28,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd September 9, 2017 +.Dd March 22, 2018 .Dt NETSTAT 1 .Os .Sh NAME From owner-svn-src-all@freebsd.org Thu Mar 22 10:57:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 617EAF5A356; Thu, 22 Mar 2018 10:57:52 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12C916DAC4; Thu, 22 Mar 2018 10:57:52 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DB9D107F1; Thu, 22 Mar 2018 10:57:52 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MAvpCR007679; Thu, 22 Mar 2018 10:57:51 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MAvpKt007678; Thu, 22 Mar 2018 10:57:51 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201803221057.w2MAvpKt007678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Thu, 22 Mar 2018 10:57:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331349 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 X-SVN-Commit-Author: garga X-SVN-Commit-Paths: stable/11/sbin/ifconfig X-SVN-Commit-Revision: 331349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 10:57:52 -0000 Author: garga (ports committer) Date: Thu Mar 22 10:57:51 2018 New Revision: 331349 URL: https://svnweb.freebsd.org/changeset/base/331349 Log: MFC r322281: Add missing parenthesis on error message Approved by: loos Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sbin/ifconfig/ifconfig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/11/sbin/ifconfig/ifconfig.c Thu Mar 22 09:43:15 2018 (r331348) +++ stable/11/sbin/ifconfig/ifconfig.c Thu Mar 22 10:57:51 2018 (r331349) @@ -762,7 +762,7 @@ top: if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 && (uafp != NULL || errno != EAFNOSUPPORT || (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0)) - err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family); + err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family); while (argc > 0) { p = cmd_lookup(*argv, iscreate); From owner-svn-src-all@freebsd.org Thu Mar 22 11:42:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C17D5F5D933; Thu, 22 Mar 2018 11:42:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 4B6EB6F6EA; Thu, 22 Mar 2018 11:42:31 +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 w2MBgEcE026609 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Mar 2018 13:42:18 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2MBgEcE026609 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2MBgDcG026607; Thu, 22 Mar 2018 13:42:13 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Mar 2018 13:42:13 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Warner Losh , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons Message-ID: <20180322114213.GR76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322174025.Q1053@besplex.bde.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 11:42:32 -0000 On Thu, Mar 22, 2018 at 05:50:57PM +1100, Bruce Evans wrote: > On Wed, 21 Mar 2018, Warner Losh wrote: > > > On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov > > wrote: > >> ... > >> Are you saying that fast interrupt handlers call shutdown_nice() ? This > >> is the quite serious bug on its own. To fix it, shutdown_nice() should > >> use a fast taskqueue to schedule the task which would lock the process > >> and send the signal. > > > > Is there some way we know we're in a fast interrupt handler? If so, it > > should be simple to fix. If not, then there's an API change ahead of us... > > There is a td_intr_nesting_level flag that might work. (I invented this, > but don't like its current use.) But why do we need to know this ? We can always schedule a task in the fast taskqueue if init is present and can be scheduled. > > > But bde is right: the system has to be in good enough shape to cope. I > > wonder if we should put that coping into kdb_reboot() instead. It's only an > > issue for TILDE ^R, which is a fairly edge case. > > shutdown_nice() is also called directly from syscons and vt for the reboot, > halt and poweroff keys. This happens in normal interrupt handler context, > so there is only a problem when init is not running. diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index e5ea9644ad3..e7c6d4c92b2 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) return (error); } +static void +shutdown_nice_task_fn(void *arg, int pending __unused) +{ + int howto; + + howto = (uintptr_t)arg; + /* Send a signal to init(8) and have it shutdown the world. */ + PROC_LOCK(initproc); + if (howto & RB_POWEROFF) + kern_psignal(initproc, SIGUSR2); + else if (howto & RB_POWERCYCLE) + kern_psignal(initproc, SIGWINCH); + else if (howto & RB_HALT) + kern_psignal(initproc, SIGUSR1); + else + kern_psignal(initproc, SIGINT); + PROC_UNLOCK(initproc); +} + +static struct task shutdown_nice_task = TASK_INITIALIZER(0, + &shutdown_nice_task_fn, NULL); + /* * Called by events that want to shut down.. e.g on a PC */ @@ -283,20 +306,14 @@ void shutdown_nice(int howto) { - if (initproc != NULL) { - /* Send a signal to init(8) and have it shutdown the world. */ - PROC_LOCK(initproc); - if (howto & RB_POWEROFF) - kern_psignal(initproc, SIGUSR2); - else if (howto & RB_POWERCYCLE) - kern_psignal(initproc, SIGWINCH); - else if (howto & RB_HALT) - kern_psignal(initproc, SIGUSR1); - else - kern_psignal(initproc, SIGINT); - PROC_UNLOCK(initproc); + if (initproc != NULL && !SCHEDULER_STOPPED()) { + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); } else { - /* No init(8) running, so simply reboot. */ + /* + * No init(8) running, or scheduler would not allow it + * to run, so simply reboot. + */ kern_reboot(howto | RB_NOSYNC); } } From owner-svn-src-all@freebsd.org Thu Mar 22 11:48:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B46D5F5DF8D; Thu, 22 Mar 2018 11:48:14 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 630176FA2D; Thu, 22 Mar 2018 11:48:14 +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 5E0A810FAE; Thu, 22 Mar 2018 11:48:14 +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 w2MBmEv9032135; Thu, 22 Mar 2018 11:48:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MBmESf032134; Thu, 22 Mar 2018 11:48:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803221148.w2MBmESf032134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 11:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331350 - stable/11/contrib/dma X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/dma X-SVN-Commit-Revision: 331350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 11:48:14 -0000 Author: emaste Date: Thu Mar 22 11:48:14 2018 New Revision: 331350 URL: https://svnweb.freebsd.org/changeset/base/331350 Log: MFC r325047: dma: fix use-after-free Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/dma/dma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/dma/dma.c ============================================================================== --- stable/11/contrib/dma/dma.c Thu Mar 22 10:57:51 2018 (r331349) +++ stable/11/contrib/dma/dma.c Thu Mar 22 11:48:14 2018 (r331350) @@ -331,8 +331,8 @@ retry: switch (error) { case 0: - delqueue(it); syslog(LOG_INFO, "<%s> delivery successful", it->addr); + delqueue(it); exit(EX_OK); case 1: From owner-svn-src-all@freebsd.org Thu Mar 22 11:58:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 199CAF5EC8A; Thu, 22 Mar 2018 11:58:00 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE06F703D8; Thu, 22 Mar 2018 11:57:59 +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 B8D561114C; Thu, 22 Mar 2018 11:57:59 +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 w2MBvxmh037611; Thu, 22 Mar 2018 11:57:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MBvx0h037610; Thu, 22 Mar 2018 11:57:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803221157.w2MBvx0h037610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Mar 2018 11:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331353 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 11:58:00 -0000 Author: kevans Date: Thu Mar 22 11:57:59 2018 New Revision: 331353 URL: https://svnweb.freebsd.org/changeset/base/331353 Log: Partially revert r328780 efi.4th was added to ObsoleteFiles and disconnected from the build, but not removed from hte repo. We've since found a mild use for it that makes some amount of sense, so partially revert r328780 and bring it back to life. Reported by: many X-MFC-With: r331326 Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Mar 22 11:57:12 2018 (r331352) +++ head/ObsoleteFiles.inc Thu Mar 22 11:57:59 2018 (r331353) @@ -59,7 +59,6 @@ OLD_FILES+=usr/share/openssl/man/man1/c_rehash.1.gz # 20180206: remove gdbtui OLD_FILES+=usr/bin/gdbtui # 20180201: Obsolete forth files -OLD_FILES+=boot/efi.4th OLD_FILES+=boot/pcibios.4th # 20180114: new clang import which bumps version from 5.0.1 to 6.0.0. OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h From owner-svn-src-all@freebsd.org Thu Mar 22 12:02:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D74E2F5FA7F; Thu, 22 Mar 2018 12:02:37 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 7599470BC3; Thu, 22 Mar 2018 12:02:36 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2a02:c7f:1e13:cf00:f91e:df97:532a:2e3f] (unknown [IPv6:2a02:c7f:1e13:cf00:f91e:df97:532a:2e3f]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 85DF94EBE3; Thu, 22 Mar 2018 12:02:04 +0000 (UTC) From: Andrew Turner Message-Id: <8722C20F-9581-4C58-98D8-86FD0016BC6B@fubar.geek.nz> Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller Date: Thu, 22 Mar 2018 12:02:03 +0000 In-Reply-To: <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Hans Petter Selasky References: <201803211517.w2LFHsHf007714@repo.freebsd.org> <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> X-Mailer: Apple Mail (2.3445.5.20) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:02:38 -0000 > On 21 Mar 2018, at 21:54, Hans Petter Selasky wrote: >=20 > On 03/21/18 17:45, Andrew Turner wrote: >>> On 21 Mar 2018, at 15:37, Hans Petter Selasky = wrote: >>>=20 >>> On 03/21/18 16:24, Kyle Evans wrote: >>>>> + { >>>>> + .ep_end =3D 7, >>>>> + .ep_fifosz_shift =3D 9, >>>>> + .ep_fifosz_reg =3D MUSB2_VAL_FIFOSZ_512 | = MUSB2_MASK_FIFODB, >>>>> + }, >>>> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >>>> this case drop to 9? frx =3D 10 in the temp < 8 case in the = removals of >>>> the following hunks. Mostly curious because the others seemed to = stay >>>> the same. >>>=20 >>> Hi Andrew, >>>=20 >>> It might be an idea to keep the fifosz_shift at 10, else high-speed = BULK traffic won't be double buffered, and this might affect = performance. >> Should the endpoint 1 size also be fixed? The register has it at 4k, = but it wasn=E2=80=99t an 8k buffer. >=20 > No, because High-Speed BULK will only use 512 byte packets, and 4k is = reserved for isochronous, which doesn't need double buffering at the = moment. Ok, in that case should we remove the double buffer flag on endpoint 1? = The Linux driver seems to always use a 512 byte buffer there, and always = doubles the offset increment when the double buffer flag is set. Andrew From owner-svn-src-all@freebsd.org Thu Mar 22 12:08:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B9E2F60251; Thu, 22 Mar 2018 12:08:14 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 DC37670F2D; Thu, 22 Mar 2018 12:08:13 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 6887B260834; Thu, 22 Mar 2018 13:08:05 +0100 (CET) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Andrew Turner Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803211517.w2LFHsHf007714@repo.freebsd.org> <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> <8722C20F-9581-4C58-98D8-86FD0016BC6B@fubar.geek.nz> From: Hans Petter Selasky Message-ID: Date: Thu, 22 Mar 2018 13:07:59 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <8722C20F-9581-4C58-98D8-86FD0016BC6B@fubar.geek.nz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:08:14 -0000 On 03/22/18 13:02, Andrew Turner wrote: >> On 21 Mar 2018, at 21:54, Hans Petter Selasky wrote: >> >> On 03/21/18 17:45, Andrew Turner wrote: >>>> On 21 Mar 2018, at 15:37, Hans Petter Selasky wrote: >>>> >>>> On 03/21/18 16:24, Kyle Evans wrote: >>>>>> + { >>>>>> + .ep_end = 7, >>>>>> + .ep_fifosz_shift = 9, >>>>>> + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, >>>>>> + }, >>>>> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >>>>> this case drop to 9? frx = 10 in the temp < 8 case in the removals of >>>>> the following hunks. Mostly curious because the others seemed to stay >>>>> the same. >>>> >>>> Hi Andrew, >>>> >>>> It might be an idea to keep the fifosz_shift at 10, else high-speed BULK traffic won't be double buffered, and this might affect performance. >>> Should the endpoint 1 size also be fixed? The register has it at 4k, but it wasn’t an 8k buffer. >> >> No, because High-Speed BULK will only use 512 byte packets, and 4k is reserved for isochronous, which doesn't need double buffering at the moment. > > Ok, in that case should we remove the double buffer flag on endpoint 1? The Linux driver seems to always use a 512 byte buffer there, and always doubles the offset increment when the double buffer flag is set. Hi Andrew, That's a good question. I think you should leave the double buffer flag on for this register. Double buffering is then later on re-programmed by: > static void > musbotg_clear_stall_sub(struct musbotg_softc *sc, uint16_t wMaxPacket, > uint8_t ep_no, uint8_t ep_type, uint8_t ep_dir) If you look at the writes to MUSB2_REG_TXDBDIS and MUSB2_REG_RXDBDIS. I think those registers override the "master" register. You might want to check the PRM to be absolutely sure. --HPS From owner-svn-src-all@freebsd.org Thu Mar 22 12:26:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A88F61A9C; Thu, 22 Mar 2018 12:26:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8626171C5B; Thu, 22 Mar 2018 12:26:27 +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 812181160F; Thu, 22 Mar 2018 12:26:27 +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 w2MCQRqL051873; Thu, 22 Mar 2018 12:26:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MCQRVO051872; Thu, 22 Mar 2018 12:26:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803221226.w2MCQRVO051872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Mar 2018 12:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331355 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 331355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:26:28 -0000 Author: hselasky Date: Thu Mar 22 12:26:27 2018 New Revision: 331355 URL: https://svnweb.freebsd.org/changeset/base/331355 Log: Clear old MSIX IRQ numbers in the LinuxKPI. When disabling the MSIX IRQ vectors for a PCI device through the LinuxKPI, make sure any old MSIX IRQ numbers are no longer visible to the linux_pci_find_irq_dev() function else IRQs can be requested from the wrong PCI device. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 12:01:30 2018 (r331354) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 12:26:27 2018 (r331355) @@ -425,6 +425,15 @@ pci_disable_msix(struct pci_dev *pdev) { pci_release_msi(pdev->dev.bsddev); + + /* + * The MSIX IRQ numbers associated with this PCI device are no + * longer valid and might be re-assigned. Make sure + * linux_pci_find_irq_dev() does no longer see them by + * resetting their references to zero: + */ + pdev->dev.msix = 0; + pdev->dev.msix_max = 0; } static inline bus_addr_t From owner-svn-src-all@freebsd.org Thu Mar 22 12:58:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93E81F646F9; Thu, 22 Mar 2018 12:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CD187313B; Thu, 22 Mar 2018 12:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1376511A98; Thu, 22 Mar 2018 12:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MCwoFf067058; Thu, 22 Mar 2018 12:58:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MCwov4067050; Thu, 22 Mar 2018 12:58:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803221258.w2MCwov4067050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 12:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331356 - in head: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/i386/linux sys/modules/linux_common X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/i386/linux sys/modules/linux_common X-SVN-Commit-Revision: 331356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:58:51 -0000 Author: emaste Date: Thu Mar 22 12:58:49 2018 New Revision: 331356 URL: https://svnweb.freebsd.org/changeset/base/331356 Log: Share Linux errno table with libsysdecode Requested by: jhb Reviewed by: jhb Sponsored by: Turing Robotic Industries Inc. Added: head/sys/compat/linux/linux_errno.inc - copied, changed from r331355, head/sys/compat/linux/linux_errno.c Modified: head/lib/libsysdecode/errno.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_errno.c head/sys/i386/linux/linux_sysvec.c head/sys/modules/linux_common/Makefile Modified: head/lib/libsysdecode/errno.c ============================================================================== --- head/lib/libsysdecode/errno.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/lib/libsysdecode/errno.c Thu Mar 22 12:58:49 2018 (r331356) @@ -37,25 +37,8 @@ __FBSDID("$FreeBSD$"); #include #if defined(__i386__) || defined(__amd64__) -/* - * Linux syscalls return negative errno's, we do positive and map them - * Reference: - * FreeBSD: src/sys/sys/errno.h - * Linux: include/uapi/asm-generic/errno-base.h - * include/uapi/asm-generic/errno.h - */ -static int bsd_to_linux_errno[ELAST + 1] = { - -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, - -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, - -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, - -30, -31, -32, -33, -34, -11,-115,-114, -88, -89, - -90, -91, -92, -93, -94, -95, -96, -97, -98, -99, - -100,-101,-102,-103,-104,-105,-106,-107,-108,-109, - -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, - -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, - -6, -6, -43, -42, -75,-125, -84, -61, -16, -74, - -72, -67, -71, -1, -1, -131, -130 -}; +static +#include #endif #include @@ -156,8 +139,8 @@ sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, * This is imprecise since it returns the first * matching errno. */ - for (i = 0; i < nitems(bsd_to_linux_errno); i++) { - if (error == bsd_to_linux_errno[i]) + for (i = 0; i < nitems(linux_errtbl); i++) { + if (error == linux_errtbl[i]) return (i); } break; @@ -187,7 +170,7 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, case SYSDECODE_ABI_LINUX: case SYSDECODE_ABI_LINUX32: if (error >= 0 && error <= ELAST) - return (bsd_to_linux_errno[error]); + return (linux_errtbl[error]); break; #endif case SYSDECODE_ABI_CLOUDABI32: Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/amd64/linux/linux_sysvec.c Thu Mar 22 12:58:49 2018 (r331356) @@ -752,7 +752,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_rt_sendsig, Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/amd64/linux32/linux32_sysvec.c Thu Mar 22 12:58:49 2018 (r331356) @@ -952,7 +952,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux32_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/compat/linux/linux_emul.h Thu Mar 22 12:58:49 2018 (r331356) @@ -77,6 +77,6 @@ struct linux_pemuldata { struct linux_pemuldata *pem_find(struct proc *); -extern const int bsd_to_linux_errno_generic[]; +extern const int linux_errtbl[]; #endif /* !_LINUX_EMUL_H_ */ Modified: head/sys/compat/linux/linux_errno.c ============================================================================== --- head/sys/compat/linux/linux_errno.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/compat/linux/linux_errno.c Thu Mar 22 12:58:49 2018 (r331356) @@ -1,151 +1,6 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1994-1996 Søren Schmidt - * 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$ - */ +/* $FreeBSD$ */ #include #include -/* - * Linux syscalls return negative errno's, we do positive and map them - * Reference: - * FreeBSD: src/sys/sys/errno.h - * Linux: include/uapi/asm-generic/errno-base.h - * include/uapi/asm-generic/errno.h - */ -const int bsd_to_linux_errno_generic[ELAST + 1] = { - -0, - -1, - -2, - -3, - -4, - -5, - -6, - -7, - -8, - -9, - - -10, - -35, /* EDEADLK */ - -12, - -13, - -14, - -15, - -16, - -17, - -18, - -19, - - -20, - -21, - -22, - -23, - -24, - -25, - -26, - -27, - -28, - -29, - - -30, - -31, - -32, - -33, - -34, - -11, /* EAGAIN */ - -115, - -114, - -88, - -89, - - -90, - -91, - -92, - -93, - -94, - -95, - -96, - -97, - -98, - -99, - - -100, - -101, - -102, - -103, - -104, - -105, - -106, - -107, - -108, - -109, - - -110, - -111, - -40, - -36, - -112, - -113, - -39, - -11, - -87, - -122, - - -116, - -66, - -6, /* EBADRPC -> ENXIO */ - -6, /* ERPCMISMATCH -> ENXIO */ - -6, /* EPROGUNAVAIL -> ENXIO */ - -6, /* EPROGMISMATCH -> ENXIO */ - -6, /* EPROCUNAVAIL -> ENXIO */ - -37, - -38, - -9, - - -6, /* EAUTH -> ENXIO */ - -6, /* ENEEDAUTH -> ENXIO */ - -43, - -42, - -75, - -125, - -84, - -61, - -16, /* EDOOFUS -> EBUSY */ - -74, - - -72, - -67, - -71, - -1, /* ENOTCAPABLE -> EPERM */ - -1, /* ECAPMODE -> EPERM */ - -131, /* ENOTRECOVERABLE */ - -130, /* EOWNERDEAD */ -}; - -_Static_assert(ELAST == 96, - "missing errno entries in bsd_to_linux_errno_generic"); +#include Copied and modified: head/sys/compat/linux/linux_errno.inc (from r331355, head/sys/compat/linux/linux_errno.c) ============================================================================== --- head/sys/compat/linux/linux_errno.c Thu Mar 22 12:26:27 2018 (r331355, copy source) +++ head/sys/compat/linux/linux_errno.inc Thu Mar 22 12:58:49 2018 (r331356) @@ -28,9 +28,6 @@ * $FreeBSD$ */ -#include -#include - /* * Linux syscalls return negative errno's, we do positive and map them * Reference: @@ -38,7 +35,7 @@ * Linux: include/uapi/asm-generic/errno-base.h * include/uapi/asm-generic/errno.h */ -const int bsd_to_linux_errno_generic[ELAST + 1] = { +const int linux_errtbl[ELAST + 1] = { -0, -1, -2, @@ -148,4 +145,4 @@ const int bsd_to_linux_errno_generic[ELAST + 1] = { }; _Static_assert(ELAST == 96, - "missing errno entries in bsd_to_linux_errno_generic"); + "missing errno entries in linux_errtbl"); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/i386/linux/linux_sysvec.c Thu Mar 22 12:58:49 2018 (r331356) @@ -893,7 +893,7 @@ struct sysentvec linux_sysvec = { .sv_table = linux_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup, .sv_sendsig = linux_sendsig, @@ -930,7 +930,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, Modified: head/sys/modules/linux_common/Makefile ============================================================================== --- head/sys/modules/linux_common/Makefile Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/modules/linux_common/Makefile Thu Mar 22 12:58:49 2018 (r331356) @@ -8,8 +8,8 @@ SRCS= linux_common.c linux_mib.c linux_mmap.c linux_ut linux.c opt_compat.h device_if.h vnode_if.h bus_if.h EXPORT_SYMS= -EXPORT_SYMS+= bsd_to_linux_errno_generic EXPORT_SYMS+= linux_emul_path +EXPORT_SYMS+= linux_errtbl EXPORT_SYMS+= linux_ioctl_register_handler EXPORT_SYMS+= linux_ioctl_unregister_handler EXPORT_SYMS+= linux_get_osname From owner-svn-src-all@freebsd.org Thu Mar 22 13:30:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3B75F6751D; Thu, 22 Mar 2018 13:30:35 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 86D0874775; Thu, 22 Mar 2018 13:30:35 +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 81A8D11F21; Thu, 22 Mar 2018 13:30:35 +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 w2MDUZuT082003; Thu, 22 Mar 2018 13:30:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MDUZTD082002; Thu, 22 Mar 2018 13:30:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803221330.w2MDUZTD082002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Mar 2018 13:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331357 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 331357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 13:30:36 -0000 Author: hselasky Date: Thu Mar 22 13:30:35 2018 New Revision: 331357 URL: https://svnweb.freebsd.org/changeset/base/331357 Log: The pci_disable_device() function is also expected to clear the PCI busmaster. This fixes LinuxKPI compliancy with Linux. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 12:58:49 2018 (r331356) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 13:30:35 2018 (r331357) @@ -343,6 +343,7 @@ pci_disable_device(struct pci_dev *pdev) pci_disable_io(pdev->dev.bsddev, SYS_RES_IOPORT); pci_disable_io(pdev->dev.bsddev, SYS_RES_MEMORY); + pci_disable_busmaster(pdev->dev.bsddev); } static inline int From owner-svn-src-all@freebsd.org Thu Mar 22 13:56:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D5EBF697C6; Thu, 22 Mar 2018 13:56:08 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B249F75A38; Thu, 22 Mar 2018 13:56:07 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x231.google.com with SMTP id r18so11062569ioa.1; Thu, 22 Mar 2018 06:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=uakfouoawlKl1TFqxIkqZ1IrFaRs9rQ+4AdTL9GNk7o=; b=OcHvDgJ6bEHCQtV+a3sxiBD4GSXuSUZYdmpqLNDkDMVmfdSAMEoH0lUWr+/nExsI2i 1ViINsiBw20wLYLGkdJ5TpletIgQmx6AUjjJHHfxN662MJ7fvES1AamIYPYIYsVgRSWw HBO2l+gJ8BkqLRJhQ/oOyo7RGaS1WcS8mbAFZKFTHD1GfFo+J8cHdAfo2iNtoPBzZS/v YkmigSxhjV5gSYpOplHXVD4ml56/2MUOaKzLYGMCUvSqrXOe+m64SY8Ibtmg1OZ6bYSH +Qe5R8fEJds2Zr0C9FzxEOxn1jyxMgOfAt+rPRdbd7tjcsQbnkm2WPy40ACFzaRNtJhV EqVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=uakfouoawlKl1TFqxIkqZ1IrFaRs9rQ+4AdTL9GNk7o=; b=I9JTSIkTgwHyGMwHh5oYLFCajqIPfe1dxLNV+wgDno+XIr7VCX8m0GBE6b6/skqEvB 62X+xLJcRGJQumn2rI1+0wa1BqdxMaTpfvIigbDdgmXCTS2xb+kYun23KFSnDt79kBT9 0B8bqXKXyZ2Bk1zEO3/rVDiZ5R7CzwJ7jm0d/Nu62LTeZS5kld9nL6P8qw5dEMVWBjDm QMczw7QPjCWVfKcwJf3Z/EJBBCzjP6qNfmA1/17FYHTVmD78T58Pv/8yvkj/3RsUwrih HKSSoaRkqcPOfNrH4VU2bmD7qatHOah0eIG8Xz62xbX9+SKWh96PRttXmyvccWXTwgAM SFqw== X-Gm-Message-State: AElRT7EXav3LoRAh1QZS4pyFapNTdC6ls0W1GgbYFNrhuSF6r0W9GkHT 4GQYV6rxubNYseY7VWb0NcpMMfYcx1NAQa6MufBTixVD X-Google-Smtp-Source: AG47ELuukn/u9thJ3wP/pcHD2ajMKg+x7vpp7RB6axhIrtQipdT/5dn2e6ivdOWQysBtEL9so7uhvi//cfaXEP+empg= X-Received: by 10.107.46.30 with SMTP id i30mr26172402ioo.288.1521726966887; Thu, 22 Mar 2018 06:56:06 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Thu, 22 Mar 2018 06:55:46 -0700 (PDT) In-Reply-To: <201803221258.w2MCwov4067050@repo.freebsd.org> References: <201803221258.w2MCwov4067050@repo.freebsd.org> From: Ed Maste Date: Thu, 22 Mar 2018 09:55:46 -0400 X-Google-Sender-Auth: Lv1kjfuXu3eOel0uMMZUX4ulMvo Message-ID: Subject: Re: svn commit: r331356 - in head: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/i386/linux sys/modules/linux_common To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 13:56:08 -0000 On 22 March 2018 at 08:58, Ed Maste wrote: > Author: emaste > Date: Thu Mar 22 12:58:49 2018 > New Revision: 331356 > URL: https://svnweb.freebsd.org/changeset/base/331356 > > Log: > Share Linux errno table with libsysdecode I had a question about using ".inc" vs ".h". I followed the ".inc" convention from some examples in llvm and elsewhere, because linux_errno.inc is unlike regular headers - it's not idempotent, and the array has to be the first non-comment content in the file because it's prefixed with "static" before one of the #includes. From owner-svn-src-all@freebsd.org Thu Mar 22 14:21:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D3AFF6B865; Thu, 22 Mar 2018 14:21:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 567C576FA5; Thu, 22 Mar 2018 14:21:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 31DC6104B94; Fri, 23 Mar 2018 01:21:44 +1100 (AEDT) Date: Fri, 23 Mar 2018 01:21:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Warner Losh , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <20180322114213.GR76926@kib.kiev.ua> Message-ID: <20180322235735.J3354@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> <20180322114213.GR76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=gcR34HTtTRcHr_MuQ_EA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:21:48 -0000 On Thu, 22 Mar 2018, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 05:50:57PM +1100, Bruce Evans wrote: >> On Wed, 21 Mar 2018, Warner Losh wrote: >> >>> On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov >>> wrote: >>>> ... >>>> Are you saying that fast interrupt handlers call shutdown_nice() ? This >>>> is the quite serious bug on its own. To fix it, shutdown_nice() should >>>> use a fast taskqueue to schedule the task which would lock the process >>>> and send the signal. >>> >>> Is there some way we know we're in a fast interrupt handler? If so, it >>> should be simple to fix. If not, then there's an API change ahead of us... >> >> There is a td_intr_nesting_level flag that might work. (I invented this, >> but don't like its current use.) > But why do we need to know this ? We can always schedule a task in the > fast taskqueue if init is present and can be scheduled. Not quite always. In my version, fast interrupt handlers are actually fast, so they can interrupt any spin mutex and cannot call any scheduling function. This is enforced by setting the pcpu pointer to NULL. Taskqueues and even SWIs are unavailable for fast interrupt handlers. Scheduling is done by setting a flag that is checked in timeout handlers like it was in FreeBSD-1. > ... >> shutdown_nice() is also called directly from syscons and vt for the reboot, >> halt and poweroff keys. This happens in normal interrupt handler context, >> so there is only a problem when init is not running. > > diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c > index e5ea9644ad3..e7c6d4c92b2 100644 > --- a/sys/kern/kern_shutdown.c > +++ b/sys/kern/kern_shutdown.c > @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) > return (error); > } > > +static void > +shutdown_nice_task_fn(void *arg, int pending __unused) > +{ > + int howto; > + > + howto = (uintptr_t)arg; > + /* Send a signal to init(8) and have it shutdown the world. */ > + PROC_LOCK(initproc); > + if (howto & RB_POWEROFF) > + kern_psignal(initproc, SIGUSR2); > + else if (howto & RB_POWERCYCLE) > + kern_psignal(initproc, SIGWINCH); > + else if (howto & RB_HALT) > + kern_psignal(initproc, SIGUSR1); > + else > + kern_psignal(initproc, SIGINT); > + PROC_UNLOCK(initproc); > +} > + > +static struct task shutdown_nice_task = TASK_INITIALIZER(0, > + &shutdown_nice_task_fn, NULL); > + I don't like having a whole task for this. The whole thing is just a hack to work around some the upper layers of the tty driver and some lower layers not having any input [escape] sequences to control the kernel. Only the syscons and vt lower layers have such sequences (where they are actually key combinations that are converted to control operations instead of to input [escape] sequences). To work around for hardware ttys, the filter for kdb sequences is abused to implement a non-kdb sequence for rebooting. The tty input methods could check for kernel-control sequences and safely signal init. This is a bit too complicated for syscons and vt since they can more easily check for key combinations, but wouldhave to convert these to standard sequences to get the tty layer to do the same thing. (They have many more kernel-control key combinations and the non-kdb one for rebooting is just a bug for them.) This is a bit complicated for hardware tty drivers too -- some use the tty bulk-input method and this shouldn't check for sequences, but should reduce to bcopy(). Hoever, to detect the kdb sequences, these drivers han to check at a low level anyway. They can be clever about this and only check for the console device[s] which are usually only used for for input at a low rate. > /* > * Called by events that want to shut down.. e.g on a PC > */ > @@ -283,20 +306,14 @@ void > shutdown_nice(int howto) > { > > - if (initproc != NULL) { > - /* Send a signal to init(8) and have it shutdown the world. */ > - PROC_LOCK(initproc); > - if (howto & RB_POWEROFF) > - kern_psignal(initproc, SIGUSR2); > - else if (howto & RB_POWERCYCLE) > - kern_psignal(initproc, SIGWINCH); > - else if (howto & RB_HALT) > - kern_psignal(initproc, SIGUSR1); > - else > - kern_psignal(initproc, SIGINT); > - PROC_UNLOCK(initproc); > + if (initproc != NULL && !SCHEDULER_STOPPED()) { > + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; > + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); > } else { > - /* No init(8) running, so simply reboot. */ > + /* > + * No init(8) running, or scheduler would not allow it > + * to run, so simply reboot. > + */ > kern_reboot(howto | RB_NOSYNC); > } > } Calling kern_reboot() from fast interrupt handlers is still invalid. It is quite likely to deadlock. In particular, it should deadlock in when kern_reboot() prints messages to the console. Most console drivers have races instead of deadlocks by dropping their lock[s] in their fast interrupt handler before calling the buggy alt escape function. Bruce From owner-svn-src-all@freebsd.org Thu Mar 22 14:25:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88BB1F6BD44; Thu, 22 Mar 2018 14:25:06 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (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 19FC077279; Thu, 22 Mar 2018 14:25:05 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:63235) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez19M-000zp5-7j (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 14:25:04 +0000 Date: Thu, 22 Mar 2018 14:16:06 +0000 From: Ruslan Bukin To: "Jonathan T. Looney" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322141606.GA4972@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201803220940.w2M9e8T4067719@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:25:07 -0000 We don't have atomic_fetchadd_64 for mips32 I think Ruslan On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > Author: jtl > Date: Thu Mar 22 09:40:08 2018 > New Revision: 331347 > URL: https://svnweb.freebsd.org/changeset/base/331347 > > Log: > Add the "TCP Blackbox Recorder" which we discussed at the developer > summits at BSDCan and BSDCam in 2017. > > The TCP Blackbox Recorder allows you to capture events on a TCP connection > in a ring buffer. It stores metadata with the event. It optionally stores > the TCP header associated with an event (if the event is associated with a > packet) and also optionally stores information on the sockets. > > It supports setting a log ID on a TCP connection and using this to correlate > multiple connections that share a common log ID. > > You can log connections in different modes. If you are doing a coordinated > test with a particular connection, you may tell the system to put it in > mode 4 (continuous dump). Or, if you just want to monitor for errors, you > can put it in mode 1 (ring buffer) and dump all the ring buffers associated > with the connection ID when we receive an error signal for that connection > ID. You can set a default mode that will be applied to a particular ratio > of incoming connections. You can also manually set a mode using a socket > option. > > This commit includes only basic probes. rrs@ has added quite an abundance > of probes in his TCP development work. He plans to commit those soon. > > There are user-space programs which we plan to commit as ports. These read > the data from the log device and output pcapng files, and then let you > analyze the data (and metadata) in the pcapng files. > > Reviewed by: gnn (previous version) > Obtained from: Netflix, Inc. > Relnotes: yes > Differential Revision: https://reviews.freebsd.org/D11085 > > Added: > head/sys/dev/tcp_log/ > head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) > head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) > head/sys/netinet/tcp_log_buf.c (contents, props changed) > head/sys/netinet/tcp_log_buf.h (contents, props changed) > Modified: > head/etc/mtree/BSD.include.dist > head/include/Makefile > head/sys/conf/files > head/sys/kern/subr_witness.c > head/sys/netinet/tcp.h > head/sys/netinet/tcp_input.c > head/sys/netinet/tcp_output.c > head/sys/netinet/tcp_subr.c > head/sys/netinet/tcp_timer.c > head/sys/netinet/tcp_usrreq.c > head/sys/netinet/tcp_var.h > head/usr.bin/netstat/inet.c > head/usr.bin/netstat/main.c > head/usr.bin/netstat/netstat.1 > head/usr.bin/netstat/netstat.h > > Modified: head/etc/mtree/BSD.include.dist > ============================================================================== > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 (r331346) > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 (r331347) > @@ -158,6 +158,8 @@ > .. > speaker > .. > + tcp_log > + .. > usb > .. > vkbd > > Modified: head/include/Makefile > ============================================================================== > --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) > +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > dev/hwpmc dev/hyperv \ > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ > - dev/speaker dev/vkbd dev/wi \ > + dev/speaker dev/tcp_log dev/vkbd dev/wi \ > fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > fs/procfs fs/smbfs fs/udf fs/unionfs \ > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver > dev/syscons/syscons.c optional sc > dev/syscons/sysmouse.c optional sc > dev/syscons/warp/warp_saver.c optional warp_saver > +dev/tcp_log/tcp_log_dev.c optional inet | inet6 > dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux > dev/tdfx/tdfx_pci.c optional tdfx pci > dev/ti/if_ti.c optional ti pci > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug > netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 > netinet/tcp_hostcache.c optional inet | inet6 > netinet/tcp_input.c optional inet | inet6 > +netinet/tcp_log_buf.c optional inet | inet6 > netinet/tcp_lro.c optional inet | inet6 > netinet/tcp_output.c optional inet | inet6 > netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -0,0 +1,521 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2016-2017 > + * Netflix Inc. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE 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 > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#ifdef TCPLOG_DEBUG_COUNTERS > +extern counter_u64_t tcp_log_que_read; > +extern counter_u64_t tcp_log_que_freed; > +#endif > + > +static struct cdev *tcp_log_dev; > +static struct selinfo tcp_log_sel; > + > +static struct log_queueh tcp_log_dev_queue_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > +static struct log_infoh tcp_log_dev_reader_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > + > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data structures"); > + > +static int tcp_log_dev_listeners = 0; > + > +static struct mtx tcp_log_dev_queue_lock; > + > +#define TCP_LOG_DEV_QUEUE_LOCK() mtx_lock(&tcp_log_dev_queue_lock) > +#define TCP_LOG_DEV_QUEUE_UNLOCK() mtx_unlock(&tcp_log_dev_queue_lock) > +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)->tldq_refcnt)) > +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)->tldq_refcnt)) > + > +static void tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry); > +static void tcp_log_dev_clear_cdevpriv(void *data); > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > + int devtype __unused, struct thread *td __unused); > +static int tcp_log_dev_write(struct cdev *dev __unused, > + struct uio *uio __unused, int flags __unused); > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, > + int flags __unused); > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > + caddr_t data, int fflag __unused, struct thread *td __unused); > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > + struct thread *td); > + > + > +enum tcp_log_dev_queue_lock_state { > + QUEUE_UNLOCKED = 0, > + QUEUE_LOCKED, > +}; > + > +static struct cdevsw tcp_log_cdevsw = { > + .d_version = D_VERSION, > + .d_read = tcp_log_dev_read, > + .d_open = tcp_log_dev_open, > + .d_write = tcp_log_dev_write, > + .d_poll = tcp_log_dev_poll, > + .d_ioctl = tcp_log_dev_ioctl, > +#ifdef NOTYET > + .d_mmap = tcp_log_dev_mmap, > +#endif > + .d_name = "tcp_log", > +}; > + > +static __inline void > +tcp_log_dev_queue_validate_lock(int lockstate) > +{ > + > +#ifdef INVARIANTS > + switch (lockstate) { > + case QUEUE_LOCKED: > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + break; > + case QUEUE_UNLOCKED: > + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > + break; > + default: > + kassert_panic("%s:%d: unknown queue lock state", __func__, > + __LINE__); > + } > +#endif > +} > + > +/* > + * Clear the refcount. If appropriate, it will remove the entry from the > + * queue and call the destructor. > + * > + * This must be called with the queue lock held. > + */ > +static void > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > +{ > + > + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); > + > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + > + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > +#ifdef TCPLOG_DEBUG_COUNTERS > + counter_u64_add(tcp_log_que_freed, 1); > +#endif > + /* Remove the entry from the queue and call the destructor. */ > + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, tcp_log_dev_queue, > + tldq_queue); > + (*entry->tldq_dtor)(entry); > + } > +} > + > +static void > +tcp_log_dev_clear_cdevpriv(void *data) > +{ > + struct tcp_log_dev_info *priv; > + struct tcp_log_dev_queue *entry, *entry_tmp; > + > + priv = (struct tcp_log_dev_info *)data; > + if (priv == NULL) > + return; > + > + /* > + * Lock the queue and drop our references. We hold references to all > + * the entries starting with tldi_head (or, if tldi_head == NULL, all > + * entries in the queue). > + * > + * Because we don't want anyone adding addition things to the queue > + * while we are doing this, we lock the queue. > + */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + if (priv->tldi_head != NULL) { > + entry = priv->tldi_head; > + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, > + tldq_queue, entry_tmp) { > + tcp_log_dev_clear_refcount(entry); > + } > + } > + tcp_log_dev_listeners--; > + KASSERT(tcp_log_dev_listeners >= 0, > + ("%s: tcp_log_dev_listeners is unexpectedly negative", __func__)); > + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, > + tldi_list); > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + free(priv, M_TCPLOGDEV); > +} > + > +static int > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype __unused, > + struct thread *td __unused) > +{ > + struct tcp_log_dev_info *priv; > + struct tcp_log_dev_queue *entry; > + int rv; > + > + /* > + * Ideally, we shouldn't see these because of file system > + * permissions. > + */ > + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > + return (ENODEV); > + > + /* Allocate space to hold information about where we are. */ > + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > + M_ZERO | M_WAITOK); > + > + /* Stash the private data away. */ > + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); > + if (!rv) { > + /* > + * Increase the listener count, add this reader to the list, and > + * take references on all current queues. > + */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + tcp_log_dev_listeners++; > + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, tldi_list); > + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); > + if (priv->tldi_head != NULL) > + priv->tldi_cur = priv->tldi_head->tldq_buf; > + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) > + TCP_LOG_DEV_QUEUE_REF(entry); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + } else { > + /* Free the entry. */ > + free(priv, M_TCPLOGDEV); > + } > + return (rv); > +} > + > +static int > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, > + int flags __unused) > +{ > + > + return (ENODEV); > +} > + > +static __inline void > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int *lockstate) > +{ > + struct tcp_log_dev_queue *entry; > + > + KASSERT(priv->tldi_head != NULL, > + ("%s:%d: priv->tldi_head unexpectedly NULL", > + __func__, __LINE__)); > + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > + ("%s:%d: buffer mismatch (%p vs %p)", > + __func__, __LINE__, priv->tldi_head->tldq_buf, > + priv->tldi_cur)); > + tcp_log_dev_queue_validate_lock(*lockstate); > + > + if (*lockstate == QUEUE_UNLOCKED) { > + TCP_LOG_DEV_QUEUE_LOCK(); > + *lockstate = QUEUE_LOCKED; > + } > + entry = priv->tldi_head; > + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > + tcp_log_dev_clear_refcount(entry); > + priv->tldi_cur = NULL; > +} > + > +static int > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int flags) > +{ > + struct tcp_log_common_header *buf; > + struct tcp_log_dev_info *priv; > + struct tcp_log_dev_queue *entry; > + ssize_t len; > + int lockstate, rv; > + > + /* Get our private info. */ > + rv = devfs_get_cdevpriv((void **)&priv); > + if (rv) > + return (rv); > + > + lockstate = QUEUE_UNLOCKED; > + > + /* Do we need to get a new buffer? */ > + while (priv->tldi_cur == NULL || > + priv->tldi_cur->tlch_length <= priv->tldi_off) { > + /* Did we somehow forget to rotate? */ > + KASSERT(priv->tldi_cur == NULL, > + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, > + __LINE__)); > + if (priv->tldi_cur != NULL) > + tcp_log_dev_rotate_bufs(priv, &lockstate); > + > + /* > + * Before we start looking at tldi_head, we need a lock on the > + * queue to make sure tldi_head stays stable. > + */ > + if (lockstate == QUEUE_UNLOCKED) { > + TCP_LOG_DEV_QUEUE_LOCK(); > + lockstate = QUEUE_LOCKED; > + } > + > + /* We need the next buffer. Do we have one? */ > + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { > + rv = EAGAIN; > + goto done; > + } > + if (priv->tldi_head == NULL) { > + /* Sleep and wait for more things we can read. */ > + rv = mtx_sleep(&tcp_log_dev_listeners, > + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", 0); > + if (rv) > + goto done; > + if (priv->tldi_head == NULL) > + continue; > + } > + > + /* > + * We have an entry to read. We want to try to create a > + * buffer, if one doesn't already exist. > + */ > + entry = priv->tldi_head; > + if (entry->tldq_buf == NULL) { > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + buf = (*entry->tldq_xform)(entry); > + if (buf == NULL) { > + rv = EBUSY; > + goto done; > + } > + entry->tldq_buf = buf; > + } > + > + priv->tldi_cur = entry->tldq_buf; > + priv->tldi_off = 0; > + } > + > + /* Copy what we can from this buffer to the output buffer. */ > + if (uio->uio_resid > 0) { > + /* Drop locks so we can take page faults. */ > + if (lockstate == QUEUE_LOCKED) > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + lockstate = QUEUE_UNLOCKED; > + > + KASSERT(priv->tldi_cur != NULL, > + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); > + > + /* Copy as much as we can to this uio. */ > + len = priv->tldi_cur->tlch_length - priv->tldi_off; > + if (len > uio->uio_resid) > + len = uio->uio_resid; > + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, > + len, uio); > + if (rv != 0) > + goto done; > + priv->tldi_off += len; > +#ifdef TCPLOG_DEBUG_COUNTERS > + counter_u64_add(tcp_log_que_read, len); > +#endif > + } > + /* Are we done with this buffer? If so, find the next one. */ > + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, > + ("%s: offset (%ju) exceeds length (%ju)", __func__, > + (uintmax_t)priv->tldi_off, > + (uintmax_t)priv->tldi_cur->tlch_length)); > + tcp_log_dev_rotate_bufs(priv, &lockstate); > + } > +done: > + tcp_log_dev_queue_validate_lock(lockstate); > + if (lockstate == QUEUE_LOCKED) > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + return (rv); > +} > + > +static int > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, > + int fflag __unused, struct thread *td __unused) > +{ > + struct tcp_log_dev_info *priv; > + int rv; > + > + /* Get our private info. */ > + rv = devfs_get_cdevpriv((void **)&priv); > + if (rv) > + return (rv); > + > + /* > + * Set things. Here, we are most concerned about the non-blocking I/O > + * flag. > + */ > + rv = 0; > + switch (cmd) { > + case FIONBIO: > + break; > + case FIOASYNC: > + if (*(int *)data != 0) > + rv = EINVAL; > + break; > + default: > + rv = ENOIOCTL; > + } > + return (rv); > +} > + > +static int > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread *td) > +{ > + struct tcp_log_dev_info *priv; > + int revents; > + > + /* > + * Get our private info. If this fails, claim that all events are > + * ready. That should prod the user to do something that will > + * make the error evident to them. > + */ > + if (devfs_get_cdevpriv((void **)&priv)) > + return (events); > + > + revents = 0; > + if (events & (POLLIN | POLLRDNORM)) { > + /* > + * We can (probably) read right now if we are partway through > + * a buffer or if we are just about to start a buffer. > + * Because we are going to read tldi_head, we should acquire > + * a read lock on the queue. > + */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || > + (priv->tldi_cur != NULL && > + priv->tldi_off < priv->tldi_cur->tlch_length)) > + revents = events & (POLLIN | POLLRDNORM); > + else > + selrecord(td, &tcp_log_sel); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + } else { > + /* > + * It only makes sense to poll for reading. So, again, prod the > + * user to do something that will make the error of their ways > + * apparent. > + */ > + revents = events; > + } > + return (revents); > +} > + > +int > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > +{ > + struct tcp_log_dev_info *priv; > + int rv; > + bool wakeup_needed; > + > + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > + ("%s: Called with both tldq_buf and tldq_xform set to NULL", > + __func__)); > + KASSERT(entry->tldq_dtor != NULL, > + ("%s: Called with tldq_dtor set to NULL", __func__)); > + > + /* Get a lock on the queue. */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + > + /* If no one is listening, tell the caller to free the resources. */ > + if (tcp_log_dev_listeners == 0) { > + rv = ENXIO; > + goto done; > + } > + > + /* Add this to the end of the tailq. */ > + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); > + > + /* Add references for all current listeners. */ > + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > + > + /* > + * If any listener is currently stuck on NULL, that means they are > + * waiting. Point their head to this new entry. > + */ > + wakeup_needed = false; > + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > + if (priv->tldi_head == NULL) { > + priv->tldi_head = entry; > + wakeup_needed = true; > + } > + > + if (wakeup_needed) { > + selwakeup(&tcp_log_sel); > + wakeup(&tcp_log_dev_listeners); > + } > + > + rv = 0; > + > +done: > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + return (rv); > +} > + > +static int > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data __unused) > +{ > + > + /* TODO: Support intelligent unloading. */ > + switch (type) { > + case MOD_LOAD: > + if (bootverbose) > + printf("tcp_log: tcp_log device\n"); > + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); > + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > + "tcp_log device queues", MTX_DEF); > + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, > + "tcp_log"); > + break; > + default: > + return (EOPNOTSUPP); > + } > + > + return (0); > +} > + > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > +MODULE_VERSION(tcp_log_dev, 1); > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 (r331347) > @@ -0,0 +1,88 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2016 > + * Netflix Inc. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE 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 __tcp_log_dev_h__ > +#define __tcp_log_dev_h__ > + > +/* > + * This is the common header for data streamed from the log device. All > + * blocks of data need to start with this header. > + */ > +struct tcp_log_common_header { > + uint32_t tlch_version; /* Version is specific to type. */ > + uint32_t tlch_type; /* Type of entry(ies) that follow. */ > + uint64_t tlch_length; /* Total length, including header. */ > +} __packed; > + > +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ > + > +#ifdef _KERNEL > +/* > + * This is a queue entry. All queue entries need to start with this structure > + * so the common code can cast them to this structure; however, other modules > + * are free to include additional data after this structure. > + * > + * The elements are explained here: > + * tldq_queue: used by the common code to maintain this entry's position in the > + * queue. > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The data must be > + * as long as the common header indicates. > + * tldq_xform: If tldq_buf is NULL, the code will call this to create the > + * the tldq_buf object. The function should *not* directly modify tldq_buf, > + * but should return the buffer (which must meet the restrictions > + * indicated for tldq_buf). > + * tldq_dtor: This function is called to free the queue entry. If tldq_buf is > + * not NULL, the dtor function must free that, too. > + * tldq_refcnt: used by the common code to indicate how many readers still need > + * this data. > + */ > +struct tcp_log_dev_queue { > + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > + struct tcp_log_common_header *tldq_buf; > + struct tcp_log_common_header *(*tldq_xform)(struct tcp_log_dev_queue *entry); > + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); > + volatile u_int tldq_refcnt; > +}; > + > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > + > +struct tcp_log_dev_info { > + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > + struct tcp_log_dev_queue *tldi_head; > + struct tcp_log_common_header *tldi_cur; > + off_t tldi_off; > +}; > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > + > + > +MALLOC_DECLARE(M_TCPLOGDEV); > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > +#endif /* _KERNEL */ > +#endif /* !__tcp_log_dev_h__ */ > > Modified: head/sys/kern/subr_witness.c > ============================================================================== > --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -640,6 +640,14 @@ static struct witness_order_list_entry order_lists[] = > { "db->db_mtx", &lock_class_sx }, > { NULL, NULL }, > /* > + * TCP log locks > + */ > + { "TCP ID tree", &lock_class_rw }, > + { "tcp log id bucket", &lock_class_mtx_sleep }, > + { "tcpinp", &lock_class_rw }, > + { "TCP log expireq", &lock_class_mtx_sleep }, > + { NULL, NULL }, > + /* > * spin locks > */ > #ifdef SMP > > Modified: head/sys/netinet/tcp.h > ============================================================================== > --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) > @@ -168,6 +168,12 @@ struct tcphdr { > #define TCP_NOOPT 8 /* don't use TCP options */ > #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ > #define TCP_INFO 32 /* retrieve tcp_info structure */ > +#define TCP_LOG 34 /* configure event logging for connection */ > +#define TCP_LOGBUF 35 /* retrieve event log for connection */ > +#define TCP_LOGID 36 /* configure log ID to correlate connections */ > +#define TCP_LOGDUMP 37 /* dump connection log events to device */ > +#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to > + device */ > #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ > #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ > #define TCP_KEEPINIT 128 /* N, time to establish connection */ > @@ -188,6 +194,9 @@ struct tcphdr { > #define TCPI_OPT_WSCALE 0x04 > #define TCPI_OPT_ECN 0x08 > #define TCPI_OPT_TOE 0x10 > + > +/* Maximum length of log ID. */ > +#define TCP_LOG_ID_LEN 64 > > /* > * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits > > Modified: head/sys/netinet/tcp_input.c > ============================================================================== > --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru > /* Save segment, if requested. */ > tcp_pcap_add(th, m, &(tp->t_inpkts)); > #endif > + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > + tlen, NULL, true); > > if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > Added: head/sys/netinet/tcp_log_buf.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -0,0 +1,2480 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2016-2018 > + * Netflix Inc. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE 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 > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +/* Default expiry time */ > +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) > + > +/* Max interval at which to run the expiry timer */ > +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) > + > +bool tcp_log_verbose; > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, tcp_log_zone; > +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > +static struct tcp_log_id_tree tcp_log_id_head; > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > +static struct mtx tcp_log_expireq_mtx; > +static struct callout tcp_log_expireq_callout; > +static uint64_t tcp_log_auto_ratio = 0; > +static uint64_t tcp_log_auto_ratio_cur = 0; > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > +static bool tcp_log_auto_all = false; > + > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, tcp_log_id_cmp) > + > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black Box controls"); > + > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, &tcp_log_verbose, > + 0, "Force verbose logging for TCP traces"); > + > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > + CTLFLAG_RW, &tcp_log_session_limit, 0, > + "Maximum number of events maintained for each TCP session"); > + > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, CTLFLAG_RW, > + &tcp_log_zone, "Maximum number of events maintained for all TCP sessions"); > + > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, CTLFLAG_RD, > + &tcp_log_zone, "Current number of events maintained for all TCP sessions"); > + > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, > + &tcp_log_bucket_zone, "Maximum number of log IDs"); > + > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, CTLFLAG_RD, > + &tcp_log_bucket_zone, "Current number of log IDs"); > + > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, CTLFLAG_RW, > + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > + > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, CTLFLAG_RD, > + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > + > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, > + 0, "Version of log formats exported"); > + > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); > + > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > + "Logging mode for auto-selected sessions (default is TCP_LOG_STATE_HEAD_AUTO)"); > + > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > + &tcp_log_auto_all, false, > + "Auto-select from all sessions (rather than just those with IDs)"); > + > +#ifdef TCPLOG_DEBUG_COUNTERS > +counter_u64_t tcp_log_queued; > +counter_u64_t tcp_log_que_fail1; > +counter_u64_t tcp_log_que_fail2; > +counter_u64_t tcp_log_que_fail3; > +counter_u64_t tcp_log_que_fail4; > +counter_u64_t tcp_log_que_fail5; > +counter_u64_t tcp_log_que_copyout; > +counter_u64_t tcp_log_que_read; > +counter_u64_t tcp_log_que_freed; > + > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > + &tcp_log_queued, "Number of entries queued"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > + &tcp_log_que_fail1, "Number of entries queued but fail 1"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > + &tcp_log_que_fail2, "Number of entries queued but fail 2"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > + &tcp_log_que_fail3, "Number of entries queued but fail 3"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > + &tcp_log_que_fail4, "Number of entries queued but fail 4"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > + &tcp_log_que_fail5, "Number of entries queued but fail 4"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > + &tcp_log_que_copyout, "Number of entries copied out"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > + &tcp_log_que_read, "Number of entries read from the queue"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > + &tcp_log_que_freed, "Number of entries freed after reading"); > +#endif > + > +#ifdef INVARIANTS > +#define TCPLOG_DEBUG_RINGBUF > +#endif > + > +struct tcp_log_mem > +{ > + STAILQ_ENTRY(tcp_log_mem) tlm_queue; > + struct tcp_log_buffer tlm_buf; > + struct tcp_log_verbose tlm_v; > +#ifdef TCPLOG_DEBUG_RINGBUF > + volatile int tlm_refcnt; > +#endif > +}; > + > +/* 60 bytes for the header, + 16 bytes for padding */ > +static uint8_t zerobuf[76]; > + > +/* > + * Lock order: > + * 1. TCPID_TREE > + * 2. TCPID_BUCKET > + * 3. INP > + * > + * Rules: > + * A. You need a lock on the Tree to add/remove buckets. > + * B. You need a lock on the bucket to add/remove nodes from the bucket. > + * C. To change information in a node, you need the INP lock if the tln_closed > + * field is false. Otherwise, you need the bucket lock. (Note that the > + * tln_closed field can change at any point, so you need to recheck the > + * entry after acquiring the INP lock.) > + * D. To remove a node from the bucket, you must have that entry locked, > + * according to the criteria of Rule C. Also, the node must not be on > + * the expiry queue. > + * E. The exception to C is the expiry queue fields, which are locked by > + * the TCPLOG_EXPIREQ lock. > + * > + * Buckets have a reference count. Each node is a reference. Further, > + * other callers may add reference counts to keep a bucket from disappearing. > + * You can add a reference as long as you own a lock sufficient to keep the > + * bucket from disappearing. For example, a common use is: > + * a. Have a locked INP, but need to lock the TCPID_BUCKET. > + * b. Add a refcount on the bucket. (Safe because the INP lock prevents > + * the TCPID_BUCKET from going away.) > + * c. Drop the INP lock. > + * d. Acquire a lock on the TCPID_BUCKET. > + * e. Acquire a lock on the INP. > + * f. Drop the refcount on the bucket. > + * (At this point, the bucket may disappear.) > + * > + * Expire queue lock: > + * You can acquire this with either the bucket or INP lock. Don't reverse it. > + * When the expire code has committed to freeing a node, it resets the expiry > + * time to SBT_MAX. That is the signal to everyone else that they should > + * leave that node alone. > + */ > +static struct rwlock tcp_id_tree_lock; > +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) > +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) > +#define TCPID_TREE_UPGRADE() rw_try_upgrade(&tcp_id_tree_lock) > +#define TCPID_TREE_WUNLOCK() rw_wunlock(&tcp_id_tree_lock) > +#define TCPID_TREE_RUNLOCK() rw_runlock(&tcp_id_tree_lock) > +#define TCPID_TREE_WLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > +#define TCPID_TREE_RLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > +#define TCPID_TREE_UNLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > + > +#define TCPID_BUCKET_LOCK_INIT(tlb) mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > +#define TCPID_BUCKET_LOCK_DESTROY(tlb) mtx_destroy(&((tlb)->tlb_mtx)) > +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) > +#define TCPID_BUCKET_UNLOCK(tlb) mtx_unlock(&((tlb)->tlb_mtx)) > +#define TCPID_BUCKET_LOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > + > +#define TCPID_BUCKET_REF(tlb) refcount_acquire(&((tlb)->tlb_refcnt)) > +#define TCPID_BUCKET_UNREF(tlb) refcount_release(&((tlb)->tlb_refcnt)) > + > +#define TCPLOG_EXPIREQ_LOCK() mtx_lock(&tcp_log_expireq_mtx) > +#define TCPLOG_EXPIREQ_UNLOCK() mtx_unlock(&tcp_log_expireq_mtx) > + > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > + > +struct tcp_log_id_bucket > +{ > + /* > + * tlb_id must be first. This lets us use strcmp on > + * (struct tcp_log_id_bucket *) and (char *) interchangeably. > + */ > + char tlb_id[TCP_LOG_ID_LEN]; > + RB_ENTRY(tcp_log_id_bucket) tlb_rb; > + struct tcp_log_id_head tlb_head; > + struct mtx tlb_mtx; > + volatile u_int tlb_refcnt; > +}; > + > +struct tcp_log_id_node > +{ > + SLIST_ENTRY(tcp_log_id_node) tln_list; > + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the expireq lock */ > + sbintime_t tln_expiretime; /* Locked by the expireq lock */ > + > + /* > + * If INP is NULL, that means the connection has closed. We've > + * saved the connection endpoint information and the log entries > + * in the tln_ie and tln_entries members. We've also saved a pointer > + * to the enclosing bucket here. If INP is not NULL, the information is > + * in the PCB and not here. > + */ > + struct inpcb *tln_inp; > + struct tcpcb *tln_tp; > + struct tcp_log_id_bucket *tln_bucket; > + struct in_endpoints tln_ie; > + struct tcp_log_stailq tln_entries; > + int tln_count; > + volatile int tln_closed; > + uint8_t tln_af; > +}; > + > +enum tree_lock_state { > + TREE_UNLOCKED = 0, > + TREE_RLOCKED, > + TREE_WLOCKED, > +}; > + > +/* Do we want to select this session for auto-logging? */ > +static __inline bool > +tcp_log_selectauto(void) > +{ > + > + /* > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-all@freebsd.org Thu Mar 22 14:31:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CB10F6C6F8; Thu, 22 Mar 2018 14:31:25 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (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 CF0EF7787D; Thu, 22 Mar 2018 14:31:24 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:59942) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez1FT-0004R6-8Q (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 14:31:23 +0000 Date: Thu, 22 Mar 2018 14:22:25 +0000 From: Ruslan Bukin To: "Jonathan T. Looney" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322142225.GA5139@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180322141606.GA4972@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:31:25 -0000 Also can this be pluggable ? It looks like it is optional device which means it can free up some space in embedded environment when unused Ruslan On Thu, Mar 22, 2018 at 02:16:06PM +0000, Ruslan Bukin wrote: > We don't have atomic_fetchadd_64 for mips32 I think > > Ruslan > > On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > > Author: jtl > > Date: Thu Mar 22 09:40:08 2018 > > New Revision: 331347 > > URL: https://svnweb.freebsd.org/changeset/base/331347 > > > > Log: > > Add the "TCP Blackbox Recorder" which we discussed at the developer > > summits at BSDCan and BSDCam in 2017. > > > > The TCP Blackbox Recorder allows you to capture events on a TCP connection > > in a ring buffer. It stores metadata with the event. It optionally stores > > the TCP header associated with an event (if the event is associated with a > > packet) and also optionally stores information on the sockets. > > > > It supports setting a log ID on a TCP connection and using this to correlate > > multiple connections that share a common log ID. > > > > You can log connections in different modes. If you are doing a coordinated > > test with a particular connection, you may tell the system to put it in > > mode 4 (continuous dump). Or, if you just want to monitor for errors, you > > can put it in mode 1 (ring buffer) and dump all the ring buffers associated > > with the connection ID when we receive an error signal for that connection > > ID. You can set a default mode that will be applied to a particular ratio > > of incoming connections. You can also manually set a mode using a socket > > option. > > > > This commit includes only basic probes. rrs@ has added quite an abundance > > of probes in his TCP development work. He plans to commit those soon. > > > > There are user-space programs which we plan to commit as ports. These read > > the data from the log device and output pcapng files, and then let you > > analyze the data (and metadata) in the pcapng files. > > > > Reviewed by: gnn (previous version) > > Obtained from: Netflix, Inc. > > Relnotes: yes > > Differential Revision: https://reviews.freebsd.org/D11085 > > > > Added: > > head/sys/dev/tcp_log/ > > head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) > > head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) > > head/sys/netinet/tcp_log_buf.c (contents, props changed) > > head/sys/netinet/tcp_log_buf.h (contents, props changed) > > Modified: > > head/etc/mtree/BSD.include.dist > > head/include/Makefile > > head/sys/conf/files > > head/sys/kern/subr_witness.c > > head/sys/netinet/tcp.h > > head/sys/netinet/tcp_input.c > > head/sys/netinet/tcp_output.c > > head/sys/netinet/tcp_subr.c > > head/sys/netinet/tcp_timer.c > > head/sys/netinet/tcp_usrreq.c > > head/sys/netinet/tcp_var.h > > head/usr.bin/netstat/inet.c > > head/usr.bin/netstat/main.c > > head/usr.bin/netstat/netstat.1 > > head/usr.bin/netstat/netstat.h > > > > Modified: head/etc/mtree/BSD.include.dist > > ============================================================================== > > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 (r331347) > > @@ -158,6 +158,8 @@ > > .. > > speaker > > .. > > + tcp_log > > + .. > > usb > > .. > > vkbd > > > > Modified: head/include/Makefile > > ============================================================================== > > --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) > > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > > dev/hwpmc dev/hyperv \ > > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ > > - dev/speaker dev/vkbd dev/wi \ > > + dev/speaker dev/tcp_log dev/vkbd dev/wi \ > > fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > > fs/procfs fs/smbfs fs/udf fs/unionfs \ > > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > > > Modified: head/sys/conf/files > > ============================================================================== > > --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) > > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver > > dev/syscons/syscons.c optional sc > > dev/syscons/sysmouse.c optional sc > > dev/syscons/warp/warp_saver.c optional warp_saver > > +dev/tcp_log/tcp_log_dev.c optional inet | inet6 > > dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux > > dev/tdfx/tdfx_pci.c optional tdfx pci > > dev/ti/if_ti.c optional ti pci > > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug > > netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 > > netinet/tcp_hostcache.c optional inet | inet6 > > netinet/tcp_input.c optional inet | inet6 > > +netinet/tcp_log_buf.c optional inet | inet6 > > netinet/tcp_lro.c optional inet | inet6 > > netinet/tcp_output.c optional inet | inet6 > > netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -0,0 +1,521 @@ > > +/*- > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > + * > > + * Copyright (c) 2016-2017 > > + * Netflix Inc. All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in the > > + * documentation and/or other materials provided with the distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE 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 > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +#ifdef TCPLOG_DEBUG_COUNTERS > > +extern counter_u64_t tcp_log_que_read; > > +extern counter_u64_t tcp_log_que_freed; > > +#endif > > + > > +static struct cdev *tcp_log_dev; > > +static struct selinfo tcp_log_sel; > > + > > +static struct log_queueh tcp_log_dev_queue_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > > +static struct log_infoh tcp_log_dev_reader_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > > + > > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data structures"); > > + > > +static int tcp_log_dev_listeners = 0; > > + > > +static struct mtx tcp_log_dev_queue_lock; > > + > > +#define TCP_LOG_DEV_QUEUE_LOCK() mtx_lock(&tcp_log_dev_queue_lock) > > +#define TCP_LOG_DEV_QUEUE_UNLOCK() mtx_unlock(&tcp_log_dev_queue_lock) > > +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > > +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > > +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)->tldq_refcnt)) > > +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)->tldq_refcnt)) > > + > > +static void tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry); > > +static void tcp_log_dev_clear_cdevpriv(void *data); > > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > > + int devtype __unused, struct thread *td __unused); > > +static int tcp_log_dev_write(struct cdev *dev __unused, > > + struct uio *uio __unused, int flags __unused); > > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, > > + int flags __unused); > > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > > + caddr_t data, int fflag __unused, struct thread *td __unused); > > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > > + struct thread *td); > > + > > + > > +enum tcp_log_dev_queue_lock_state { > > + QUEUE_UNLOCKED = 0, > > + QUEUE_LOCKED, > > +}; > > + > > +static struct cdevsw tcp_log_cdevsw = { > > + .d_version = D_VERSION, > > + .d_read = tcp_log_dev_read, > > + .d_open = tcp_log_dev_open, > > + .d_write = tcp_log_dev_write, > > + .d_poll = tcp_log_dev_poll, > > + .d_ioctl = tcp_log_dev_ioctl, > > +#ifdef NOTYET > > + .d_mmap = tcp_log_dev_mmap, > > +#endif > > + .d_name = "tcp_log", > > +}; > > + > > +static __inline void > > +tcp_log_dev_queue_validate_lock(int lockstate) > > +{ > > + > > +#ifdef INVARIANTS > > + switch (lockstate) { > > + case QUEUE_LOCKED: > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + break; > > + case QUEUE_UNLOCKED: > > + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > > + break; > > + default: > > + kassert_panic("%s:%d: unknown queue lock state", __func__, > > + __LINE__); > > + } > > +#endif > > +} > > + > > +/* > > + * Clear the refcount. If appropriate, it will remove the entry from the > > + * queue and call the destructor. > > + * > > + * This must be called with the queue lock held. > > + */ > > +static void > > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > > +{ > > + > > + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); > > + > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + > > + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > > +#ifdef TCPLOG_DEBUG_COUNTERS > > + counter_u64_add(tcp_log_que_freed, 1); > > +#endif > > + /* Remove the entry from the queue and call the destructor. */ > > + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, tcp_log_dev_queue, > > + tldq_queue); > > + (*entry->tldq_dtor)(entry); > > + } > > +} > > + > > +static void > > +tcp_log_dev_clear_cdevpriv(void *data) > > +{ > > + struct tcp_log_dev_info *priv; > > + struct tcp_log_dev_queue *entry, *entry_tmp; > > + > > + priv = (struct tcp_log_dev_info *)data; > > + if (priv == NULL) > > + return; > > + > > + /* > > + * Lock the queue and drop our references. We hold references to all > > + * the entries starting with tldi_head (or, if tldi_head == NULL, all > > + * entries in the queue). > > + * > > + * Because we don't want anyone adding addition things to the queue > > + * while we are doing this, we lock the queue. > > + */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + if (priv->tldi_head != NULL) { > > + entry = priv->tldi_head; > > + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, > > + tldq_queue, entry_tmp) { > > + tcp_log_dev_clear_refcount(entry); > > + } > > + } > > + tcp_log_dev_listeners--; > > + KASSERT(tcp_log_dev_listeners >= 0, > > + ("%s: tcp_log_dev_listeners is unexpectedly negative", __func__)); > > + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, > > + tldi_list); > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + free(priv, M_TCPLOGDEV); > > +} > > + > > +static int > > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype __unused, > > + struct thread *td __unused) > > +{ > > + struct tcp_log_dev_info *priv; > > + struct tcp_log_dev_queue *entry; > > + int rv; > > + > > + /* > > + * Ideally, we shouldn't see these because of file system > > + * permissions. > > + */ > > + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > > + return (ENODEV); > > + > > + /* Allocate space to hold information about where we are. */ > > + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > > + M_ZERO | M_WAITOK); > > + > > + /* Stash the private data away. */ > > + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); > > + if (!rv) { > > + /* > > + * Increase the listener count, add this reader to the list, and > > + * take references on all current queues. > > + */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + tcp_log_dev_listeners++; > > + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, tldi_list); > > + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); > > + if (priv->tldi_head != NULL) > > + priv->tldi_cur = priv->tldi_head->tldq_buf; > > + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) > > + TCP_LOG_DEV_QUEUE_REF(entry); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + } else { > > + /* Free the entry. */ > > + free(priv, M_TCPLOGDEV); > > + } > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, > > + int flags __unused) > > +{ > > + > > + return (ENODEV); > > +} > > + > > +static __inline void > > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int *lockstate) > > +{ > > + struct tcp_log_dev_queue *entry; > > + > > + KASSERT(priv->tldi_head != NULL, > > + ("%s:%d: priv->tldi_head unexpectedly NULL", > > + __func__, __LINE__)); > > + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > > + ("%s:%d: buffer mismatch (%p vs %p)", > > + __func__, __LINE__, priv->tldi_head->tldq_buf, > > + priv->tldi_cur)); > > + tcp_log_dev_queue_validate_lock(*lockstate); > > + > > + if (*lockstate == QUEUE_UNLOCKED) { > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + *lockstate = QUEUE_LOCKED; > > + } > > + entry = priv->tldi_head; > > + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > > + tcp_log_dev_clear_refcount(entry); > > + priv->tldi_cur = NULL; > > +} > > + > > +static int > > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int flags) > > +{ > > + struct tcp_log_common_header *buf; > > + struct tcp_log_dev_info *priv; > > + struct tcp_log_dev_queue *entry; > > + ssize_t len; > > + int lockstate, rv; > > + > > + /* Get our private info. */ > > + rv = devfs_get_cdevpriv((void **)&priv); > > + if (rv) > > + return (rv); > > + > > + lockstate = QUEUE_UNLOCKED; > > + > > + /* Do we need to get a new buffer? */ > > + while (priv->tldi_cur == NULL || > > + priv->tldi_cur->tlch_length <= priv->tldi_off) { > > + /* Did we somehow forget to rotate? */ > > + KASSERT(priv->tldi_cur == NULL, > > + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, > > + __LINE__)); > > + if (priv->tldi_cur != NULL) > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > + > > + /* > > + * Before we start looking at tldi_head, we need a lock on the > > + * queue to make sure tldi_head stays stable. > > + */ > > + if (lockstate == QUEUE_UNLOCKED) { > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + lockstate = QUEUE_LOCKED; > > + } > > + > > + /* We need the next buffer. Do we have one? */ > > + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { > > + rv = EAGAIN; > > + goto done; > > + } > > + if (priv->tldi_head == NULL) { > > + /* Sleep and wait for more things we can read. */ > > + rv = mtx_sleep(&tcp_log_dev_listeners, > > + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", 0); > > + if (rv) > > + goto done; > > + if (priv->tldi_head == NULL) > > + continue; > > + } > > + > > + /* > > + * We have an entry to read. We want to try to create a > > + * buffer, if one doesn't already exist. > > + */ > > + entry = priv->tldi_head; > > + if (entry->tldq_buf == NULL) { > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + buf = (*entry->tldq_xform)(entry); > > + if (buf == NULL) { > > + rv = EBUSY; > > + goto done; > > + } > > + entry->tldq_buf = buf; > > + } > > + > > + priv->tldi_cur = entry->tldq_buf; > > + priv->tldi_off = 0; > > + } > > + > > + /* Copy what we can from this buffer to the output buffer. */ > > + if (uio->uio_resid > 0) { > > + /* Drop locks so we can take page faults. */ > > + if (lockstate == QUEUE_LOCKED) > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + lockstate = QUEUE_UNLOCKED; > > + > > + KASSERT(priv->tldi_cur != NULL, > > + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); > > + > > + /* Copy as much as we can to this uio. */ > > + len = priv->tldi_cur->tlch_length - priv->tldi_off; > > + if (len > uio->uio_resid) > > + len = uio->uio_resid; > > + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, > > + len, uio); > > + if (rv != 0) > > + goto done; > > + priv->tldi_off += len; > > +#ifdef TCPLOG_DEBUG_COUNTERS > > + counter_u64_add(tcp_log_que_read, len); > > +#endif > > + } > > + /* Are we done with this buffer? If so, find the next one. */ > > + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > > + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, > > + ("%s: offset (%ju) exceeds length (%ju)", __func__, > > + (uintmax_t)priv->tldi_off, > > + (uintmax_t)priv->tldi_cur->tlch_length)); > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > + } > > +done: > > + tcp_log_dev_queue_validate_lock(lockstate); > > + if (lockstate == QUEUE_LOCKED) > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, > > + int fflag __unused, struct thread *td __unused) > > +{ > > + struct tcp_log_dev_info *priv; > > + int rv; > > + > > + /* Get our private info. */ > > + rv = devfs_get_cdevpriv((void **)&priv); > > + if (rv) > > + return (rv); > > + > > + /* > > + * Set things. Here, we are most concerned about the non-blocking I/O > > + * flag. > > + */ > > + rv = 0; > > + switch (cmd) { > > + case FIONBIO: > > + break; > > + case FIOASYNC: > > + if (*(int *)data != 0) > > + rv = EINVAL; > > + break; > > + default: > > + rv = ENOIOCTL; > > + } > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread *td) > > +{ > > + struct tcp_log_dev_info *priv; > > + int revents; > > + > > + /* > > + * Get our private info. If this fails, claim that all events are > > + * ready. That should prod the user to do something that will > > + * make the error evident to them. > > + */ > > + if (devfs_get_cdevpriv((void **)&priv)) > > + return (events); > > + > > + revents = 0; > > + if (events & (POLLIN | POLLRDNORM)) { > > + /* > > + * We can (probably) read right now if we are partway through > > + * a buffer or if we are just about to start a buffer. > > + * Because we are going to read tldi_head, we should acquire > > + * a read lock on the queue. > > + */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || > > + (priv->tldi_cur != NULL && > > + priv->tldi_off < priv->tldi_cur->tlch_length)) > > + revents = events & (POLLIN | POLLRDNORM); > > + else > > + selrecord(td, &tcp_log_sel); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + } else { > > + /* > > + * It only makes sense to poll for reading. So, again, prod the > > + * user to do something that will make the error of their ways > > + * apparent. > > + */ > > + revents = events; > > + } > > + return (revents); > > +} > > + > > +int > > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > > +{ > > + struct tcp_log_dev_info *priv; > > + int rv; > > + bool wakeup_needed; > > + > > + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > > + ("%s: Called with both tldq_buf and tldq_xform set to NULL", > > + __func__)); > > + KASSERT(entry->tldq_dtor != NULL, > > + ("%s: Called with tldq_dtor set to NULL", __func__)); > > + > > + /* Get a lock on the queue. */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + > > + /* If no one is listening, tell the caller to free the resources. */ > > + if (tcp_log_dev_listeners == 0) { > > + rv = ENXIO; > > + goto done; > > + } > > + > > + /* Add this to the end of the tailq. */ > > + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); > > + > > + /* Add references for all current listeners. */ > > + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > > + > > + /* > > + * If any listener is currently stuck on NULL, that means they are > > + * waiting. Point their head to this new entry. > > + */ > > + wakeup_needed = false; > > + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > > + if (priv->tldi_head == NULL) { > > + priv->tldi_head = entry; > > + wakeup_needed = true; > > + } > > + > > + if (wakeup_needed) { > > + selwakeup(&tcp_log_sel); > > + wakeup(&tcp_log_dev_listeners); > > + } > > + > > + rv = 0; > > + > > +done: > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data __unused) > > +{ > > + > > + /* TODO: Support intelligent unloading. */ > > + switch (type) { > > + case MOD_LOAD: > > + if (bootverbose) > > + printf("tcp_log: tcp_log device\n"); > > + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > > + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); > > + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > > + "tcp_log device queues", MTX_DEF); > > + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > > + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, > > + "tcp_log"); > > + break; > > + default: > > + return (EOPNOTSUPP); > > + } > > + > > + return (0); > > +} > > + > > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > > +MODULE_VERSION(tcp_log_dev, 1); > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 (r331347) > > @@ -0,0 +1,88 @@ > > +/*- > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > + * > > + * Copyright (c) 2016 > > + * Netflix Inc. All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in the > > + * documentation and/or other materials provided with the distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE 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 __tcp_log_dev_h__ > > +#define __tcp_log_dev_h__ > > + > > +/* > > + * This is the common header for data streamed from the log device. All > > + * blocks of data need to start with this header. > > + */ > > +struct tcp_log_common_header { > > + uint32_t tlch_version; /* Version is specific to type. */ > > + uint32_t tlch_type; /* Type of entry(ies) that follow. */ > > + uint64_t tlch_length; /* Total length, including header. */ > > +} __packed; > > + > > +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ > > + > > +#ifdef _KERNEL > > +/* > > + * This is a queue entry. All queue entries need to start with this structure > > + * so the common code can cast them to this structure; however, other modules > > + * are free to include additional data after this structure. > > + * > > + * The elements are explained here: > > + * tldq_queue: used by the common code to maintain this entry's position in the > > + * queue. > > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The data must be > > + * as long as the common header indicates. > > + * tldq_xform: If tldq_buf is NULL, the code will call this to create the > > + * the tldq_buf object. The function should *not* directly modify tldq_buf, > > + * but should return the buffer (which must meet the restrictions > > + * indicated for tldq_buf). > > + * tldq_dtor: This function is called to free the queue entry. If tldq_buf is > > + * not NULL, the dtor function must free that, too. > > + * tldq_refcnt: used by the common code to indicate how many readers still need > > + * this data. > > + */ > > +struct tcp_log_dev_queue { > > + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > > + struct tcp_log_common_header *tldq_buf; > > + struct tcp_log_common_header *(*tldq_xform)(struct tcp_log_dev_queue *entry); > > + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); > > + volatile u_int tldq_refcnt; > > +}; > > + > > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > > + > > +struct tcp_log_dev_info { > > + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > > + struct tcp_log_dev_queue *tldi_head; > > + struct tcp_log_common_header *tldi_cur; > > + off_t tldi_off; > > +}; > > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > > + > > + > > +MALLOC_DECLARE(M_TCPLOGDEV); > > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > > +#endif /* _KERNEL */ > > +#endif /* !__tcp_log_dev_h__ */ > > > > Modified: head/sys/kern/subr_witness.c > > ============================================================================== > > --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -640,6 +640,14 @@ static struct witness_order_list_entry order_lists[] = > > { "db->db_mtx", &lock_class_sx }, > > { NULL, NULL }, > > /* > > + * TCP log locks > > + */ > > + { "TCP ID tree", &lock_class_rw }, > > + { "tcp log id bucket", &lock_class_mtx_sleep }, > > + { "tcpinp", &lock_class_rw }, > > + { "TCP log expireq", &lock_class_mtx_sleep }, > > + { NULL, NULL }, > > + /* > > * spin locks > > */ > > #ifdef SMP > > > > Modified: head/sys/netinet/tcp.h > > ============================================================================== > > --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) > > @@ -168,6 +168,12 @@ struct tcphdr { > > #define TCP_NOOPT 8 /* don't use TCP options */ > > #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ > > #define TCP_INFO 32 /* retrieve tcp_info structure */ > > +#define TCP_LOG 34 /* configure event logging for connection */ > > +#define TCP_LOGBUF 35 /* retrieve event log for connection */ > > +#define TCP_LOGID 36 /* configure log ID to correlate connections */ > > +#define TCP_LOGDUMP 37 /* dump connection log events to device */ > > +#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to > > + device */ > > #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ > > #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ > > #define TCP_KEEPINIT 128 /* N, time to establish connection */ > > @@ -188,6 +194,9 @@ struct tcphdr { > > #define TCPI_OPT_WSCALE 0x04 > > #define TCPI_OPT_ECN 0x08 > > #define TCPI_OPT_TOE 0x10 > > + > > +/* Maximum length of log ID. */ > > +#define TCP_LOG_ID_LEN 64 > > > > /* > > * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits > > > > Modified: head/sys/netinet/tcp_input.c > > ============================================================================== > > --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru > > /* Save segment, if requested. */ > > tcp_pcap_add(th, m, &(tp->t_inpkts)); > > #endif > > + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > > + tlen, NULL, true); > > > > if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { > > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > > > Added: head/sys/netinet/tcp_log_buf.c > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -0,0 +1,2480 @@ > > +/*- > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > + * > > + * Copyright (c) 2016-2018 > > + * Netflix Inc. All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in the > > + * documentation and/or other materials provided with the distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE 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 > > +#include > > +#include > > +#include > > + > > +#include > > + > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/* Default expiry time */ > > +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) > > + > > +/* Max interval at which to run the expiry timer */ > > +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) > > + > > +bool tcp_log_verbose; > > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, tcp_log_zone; > > +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > > +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; > > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > > +static struct tcp_log_id_tree tcp_log_id_head; > > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > > + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > > +static struct mtx tcp_log_expireq_mtx; > > +static struct callout tcp_log_expireq_callout; > > +static uint64_t tcp_log_auto_ratio = 0; > > +static uint64_t tcp_log_auto_ratio_cur = 0; > > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > > +static bool tcp_log_auto_all = false; > > + > > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, tcp_log_id_cmp) > > + > > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black Box controls"); > > + > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, &tcp_log_verbose, > > + 0, "Force verbose logging for TCP traces"); > > + > > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > > + CTLFLAG_RW, &tcp_log_session_limit, 0, > > + "Maximum number of events maintained for each TCP session"); > > + > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, CTLFLAG_RW, > > + &tcp_log_zone, "Maximum number of events maintained for all TCP sessions"); > > + > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, CTLFLAG_RD, > > + &tcp_log_zone, "Current number of events maintained for all TCP sessions"); > > + > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, > > + &tcp_log_bucket_zone, "Maximum number of log IDs"); > > + > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, CTLFLAG_RD, > > + &tcp_log_bucket_zone, "Current number of log IDs"); > > + > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, CTLFLAG_RW, > > + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > > + > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, CTLFLAG_RD, > > + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > > + > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, > > + 0, "Version of log formats exported"); > > + > > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > > + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); > > + > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > > + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > > + "Logging mode for auto-selected sessions (default is TCP_LOG_STATE_HEAD_AUTO)"); > > + > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > > + &tcp_log_auto_all, false, > > + "Auto-select from all sessions (rather than just those with IDs)"); > > + > > +#ifdef TCPLOG_DEBUG_COUNTERS > > +counter_u64_t tcp_log_queued; > > +counter_u64_t tcp_log_que_fail1; > > +counter_u64_t tcp_log_que_fail2; > > +counter_u64_t tcp_log_que_fail3; > > +counter_u64_t tcp_log_que_fail4; > > +counter_u64_t tcp_log_que_fail5; > > +counter_u64_t tcp_log_que_copyout; > > +counter_u64_t tcp_log_que_read; > > +counter_u64_t tcp_log_que_freed; > > + > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > > + &tcp_log_queued, "Number of entries queued"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > > + &tcp_log_que_fail1, "Number of entries queued but fail 1"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > > + &tcp_log_que_fail2, "Number of entries queued but fail 2"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > > + &tcp_log_que_fail3, "Number of entries queued but fail 3"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > > + &tcp_log_que_fail4, "Number of entries queued but fail 4"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > > + &tcp_log_que_fail5, "Number of entries queued but fail 4"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > > + &tcp_log_que_copyout, "Number of entries copied out"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > > + &tcp_log_que_read, "Number of entries read from the queue"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > > + &tcp_log_que_freed, "Number of entries freed after reading"); > > +#endif > > + > > +#ifdef INVARIANTS > > +#define TCPLOG_DEBUG_RINGBUF > > +#endif > > + > > +struct tcp_log_mem > > +{ > > + STAILQ_ENTRY(tcp_log_mem) tlm_queue; > > + struct tcp_log_buffer tlm_buf; > > + struct tcp_log_verbose tlm_v; > > +#ifdef TCPLOG_DEBUG_RINGBUF > > + volatile int tlm_refcnt; > > +#endif > > +}; > > + > > +/* 60 bytes for the header, + 16 bytes for padding */ > > +static uint8_t zerobuf[76]; > > + > > +/* > > + * Lock order: > > + * 1. TCPID_TREE > > + * 2. TCPID_BUCKET > > + * 3. INP > > + * > > + * Rules: > > + * A. You need a lock on the Tree to add/remove buckets. > > + * B. You need a lock on the bucket to add/remove nodes from the bucket. > > + * C. To change information in a node, you need the INP lock if the tln_closed > > + * field is false. Otherwise, you need the bucket lock. (Note that the > > + * tln_closed field can change at any point, so you need to recheck the > > + * entry after acquiring the INP lock.) > > + * D. To remove a node from the bucket, you must have that entry locked, > > + * according to the criteria of Rule C. Also, the node must not be on > > + * the expiry queue. > > + * E. The exception to C is the expiry queue fields, which are locked by > > + * the TCPLOG_EXPIREQ lock. > > + * > > + * Buckets have a reference count. Each node is a reference. Further, > > + * other callers may add reference counts to keep a bucket from disappearing. > > + * You can add a reference as long as you own a lock sufficient to keep the > > + * bucket from disappearing. For example, a common use is: > > + * a. Have a locked INP, but need to lock the TCPID_BUCKET. > > + * b. Add a refcount on the bucket. (Safe because the INP lock prevents > > + * the TCPID_BUCKET from going away.) > > + * c. Drop the INP lock. > > + * d. Acquire a lock on the TCPID_BUCKET. > > + * e. Acquire a lock on the INP. > > + * f. Drop the refcount on the bucket. > > + * (At this point, the bucket may disappear.) > > + * > > + * Expire queue lock: > > + * You can acquire this with either the bucket or INP lock. Don't reverse it. > > + * When the expire code has committed to freeing a node, it resets the expiry > > + * time to SBT_MAX. That is the signal to everyone else that they should > > + * leave that node alone. > > + */ > > +static struct rwlock tcp_id_tree_lock; > > +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_UPGRADE() rw_try_upgrade(&tcp_id_tree_lock) > > +#define TCPID_TREE_WUNLOCK() rw_wunlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_RUNLOCK() rw_runlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_WLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > > +#define TCPID_TREE_RLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > > +#define TCPID_TREE_UNLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > > + > > +#define TCPID_BUCKET_LOCK_INIT(tlb) mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > > +#define TCPID_BUCKET_LOCK_DESTROY(tlb) mtx_destroy(&((tlb)->tlb_mtx)) > > +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) > > +#define TCPID_BUCKET_UNLOCK(tlb) mtx_unlock(&((tlb)->tlb_mtx)) > > +#define TCPID_BUCKET_LOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > > +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > > + > > +#define TCPID_BUCKET_REF(tlb) refcount_acquire(&((tlb)->tlb_refcnt)) > > +#define TCPID_BUCKET_UNREF(tlb) refcount_release(&((tlb)->tlb_refcnt)) > > + > > +#define TCPLOG_EXPIREQ_LOCK() mtx_lock(&tcp_log_expireq_mtx) > > +#define TCPLOG_EXPIREQ_UNLOCK() mtx_unlock(&tcp_log_expireq_mtx) > > + > > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > > + > > +struct tcp_log_id_bucket > > +{ > > + /* > > + * tlb_id must be first. This lets us use strcmp on > > + * (struct tcp_log_id_bucket *) and (char *) interchangeably. > > + */ > > + char tlb_id[TCP_LOG_ID_LEN]; > > + RB_ENTRY(tcp_log_id_bucket) tlb_rb; > > + struct tcp_log_id_head tlb_head; > > + struct mtx tlb_mtx; > > + volatile u_int tlb_refcnt; > > +}; > > + > > +struct tcp_log_id_node > > +{ > > + SLIST_ENTRY(tcp_log_id_node) tln_list; > > + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the expireq lock */ > > + sbintime_t tln_expiretime; /* Locked by the expireq lock */ > > + > > + /* > > + * If INP is NULL, that means the connection has closed. We've > > + * saved the connection endpoint information and the log entries > > + * in the tln_ie and tln_entries members. We've also saved a pointer > > + * to the enclosing bucket here. If INP is not NULL, the information is > > + * in the PCB and not here. > > + */ > > + struct inpcb *tln_inp; > > + struct tcpcb *tln_tp; > > + struct tcp_log_id_bucket *tln_bucket; > > + struct in_endpoints tln_ie; > > + struct tcp_log_stailq tln_entries; > > + int tln_count; > > + volatile int tln_closed; > > + uint8_t tln_af; > > +}; > > + > > +enum tree_lock_state { > > + TREE_UNLOCKED = 0, > > + TREE_RLOCKED, > > + TREE_WLOCKED, > > +}; > > + > > +/* Do we want to select this session for auto-logging? */ > > +static __inline bool > > +tcp_log_selectauto(void) > > +{ > > + > > + /* > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > > From owner-svn-src-all@freebsd.org Thu Mar 22 14:51:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3AC4F4A584; Thu, 22 Mar 2018 14:51:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B5BA78883; Thu, 22 Mar 2018 14:51:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D89712C9E; Thu, 22 Mar 2018 14:51:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MEp6dA025087; Thu, 22 Mar 2018 14:51:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MEp6Jv025086; Thu, 22 Mar 2018 14:51:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803221451.w2MEp6Jv025086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Mar 2018 14:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331358 - head/libexec/tftpd/tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/libexec/tftpd/tests X-SVN-Commit-Revision: 331358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:51:06 -0000 Author: asomers Date: Thu Mar 22 14:51:05 2018 New Revision: 331358 URL: https://svnweb.freebsd.org/changeset/base/331358 Log: tftpd: misc Coverity cleanup in the tests A bunch of unchecked return values from open(2) and read(2) Reported by: Coverity CID: 1386900, 1386911, 1386926, 1386928, 1386932, 1386942 CID: 1386961, 1386979 MFC after: 8 days X-MFC-With: 330696 Modified: head/libexec/tftpd/tests/functional.c Modified: head/libexec/tftpd/tests/functional.c ============================================================================== --- head/libexec/tftpd/tests/functional.c Thu Mar 22 13:30:35 2018 (r331357) +++ head/libexec/tftpd/tests/functional.c Thu Mar 22 14:51:05 2018 (r331358) @@ -224,19 +224,17 @@ do { \ static void cleanup(void) { - int fd = -1; - char buffer[80] = {0}; + FILE *f; pid_t pid; - fd = open(pidfile, O_RDONLY); - if (fd < 0) + f = fopen(pidfile, "r"); + if (f == NULL) return; - if (read(fd, buffer, sizeof(buffer)) > 0) { - sscanf(buffer, "%d", &pid); + if (fscanf(f, "%d", &pid) == 1) { kill(pid, SIGTERM); waitpid(pid, NULL, 0); } - close(fd); + fclose(f); unlink(pidfile); } @@ -698,6 +696,7 @@ TFTPD_TC_DEFINE(w_flag,, w_flag = 1;) recv_ack(1); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); @@ -734,6 +733,7 @@ TFTPD_TC_DEFINE(wrq_dropped_ack,) recv_ack(2); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -766,6 +766,7 @@ TFTPD_TC_DEFINE(wrq_dropped_data,) recv_ack(1); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); @@ -799,6 +800,7 @@ TFTPD_TC_DEFINE(wrq_duped_data,) recv_ack(2); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -862,6 +864,7 @@ TFTPD_TC_DEFINE(wrq_medium,) recv_ack(2); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -894,6 +897,7 @@ TFTPD_TC_DEFINE(wrq_netascii,) recv_ack(1); fd = open("unix.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(expected, sizeof(expected), buffer, r); @@ -931,6 +935,7 @@ TFTPD_TC_DEFINE(wrq_small,) recv_ack(1); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); From owner-svn-src-all@freebsd.org Thu Mar 22 14:57:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 570E9F4B393 for ; Thu, 22 Mar 2018 14:57:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D736C78FCA for ; Thu, 22 Mar 2018 14:57:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22f.google.com with SMTP id q80so414823ioi.13 for ; Thu, 22 Mar 2018 07:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=IKfpoCv2+ZMQrSqOcjqNT/2jCK965pV2H0xxJD0A1P0=; b=iS6brQNsL9aNdBH7JwAZPR4uMHZHCR3HL3yeMVLTTe7x+1GS6wyQoJbjv2ZN8z4Oc5 3L2IODiWg/0GQUH6wX5D0E4VLgeyX7inn8yV7OoMan6e4L199vjhW9XScFXZ12tVcdF5 DnWrsFonARfUjalYUNeEwjyAohdvOy6D59BcOA6KV98XwiIklWZjb/zvDwKTUbR4w4v6 f56kW08DzjV/EPVsbzAxyviQkvwk+FzFVNI6FylhQECmSDbmOG++YVLUcFAIlfKCkJIm SkR1IKC0vBgAVnrZUEALnl6pz/sACdHyCN8QN170hGxaOJZtBVaNU3G0F1A3lq1q/M7B azXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=IKfpoCv2+ZMQrSqOcjqNT/2jCK965pV2H0xxJD0A1P0=; b=Mza+pqchkVlqNlFLrHeOPg1zCK4psx3/hiZjGM7BtwdPiMG7oky2Nx/0bsyktPQTLk r8f/rrMvWnUtBX92XHabCQKY49Ee8dS4D8bEgnLvKKIFWTWZGQ5evXnpv8nCRwYa6tOm jvSwynNWOF5ZE9DNZxonGPSOXUKMddFyl4eXR4fQoBqJgRoCFWgILnZTqL+o/GKultYf MFHr6HRJBDguZVDcKvC34fXPrszMy35RgRJ/BHuf7dtO7fqOfGPjQ42yj/fQjGjzoIuX 7XRldNw05LtQD42dKOUya+1YBfKrlyLeXwNWBpE0SoB/ij8UJTSmq1OlwSO5fPJh8ZRT 0qpA== X-Gm-Message-State: AElRT7GYjPQWi0+7KSFBNjaN71s2Mkq9Gzwdh0UpPxsCOD9tIGzZnChV 2qGBdhKy2PpvuuI4nvAfc/8uIzUdnpaVIhjmkMRpCA== X-Google-Smtp-Source: AG47ELt61niFwEgc4gmfgi3ChVdX/PICs4qhLedsvgxG9W4r+CZUVFMyzkesp29RFVLz+EQTY46wFciHnxD+Cui2UqA= X-Received: by 10.107.12.230 with SMTP id 99mr25324573iom.117.1521730667830; Thu, 22 Mar 2018 07:57:47 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Thu, 22 Mar 2018 07:57:47 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: <20180322114213.GR76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> <20180322114213.GR76926@kib.kiev.ua> From: Warner Losh Date: Thu, 22 Mar 2018 08:57:47 -0600 X-Google-Sender-Auth: vOax_in7ZnGHFQzXf8DMpL9pVoM Message-ID: Subject: Re: svn commit: r331298 - head/sys/dev/syscons To: Konstantin Belousov Cc: Bruce Evans , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:57:49 -0000 On Thu, Mar 22, 2018 at 5:42 AM, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 05:50:57PM +1100, Bruce Evans wrote: > > On Wed, 21 Mar 2018, Warner Losh wrote: > > > > > On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov < > kostikbel@gmail.com> > > > wrote: > > >> ... > > >> Are you saying that fast interrupt handlers call shutdown_nice() ? > This > > >> is the quite serious bug on its own. To fix it, shutdown_nice() > should > > >> use a fast taskqueue to schedule the task which would lock the process > > >> and send the signal. > > > > > > Is there some way we know we're in a fast interrupt handler? If so, it > > > should be simple to fix. If not, then there's an API change ahead of > us... > > > > There is a td_intr_nesting_level flag that might work. (I invented this, > > but don't like its current use.) > But why do we need to know this ? We can always schedule a task in the > fast taskqueue if init is present and can be scheduled. Ah, good point. Seems like a poster child example of doing a fast task queue deferment. That's always safe, except maybe in BDE's fast interrupt world. > > But bde is right: the system has to be in good enough shape to cope. I > > > wonder if we should put that coping into kdb_reboot() instead. It's > only an > > > issue for TILDE ^R, which is a fairly edge case. > > > > shutdown_nice() is also called directly from syscons and vt for the > reboot, > > halt and poweroff keys. This happens in normal interrupt handler > context, > > so there is only a problem when init is not running. > > diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c > index e5ea9644ad3..e7c6d4c92b2 100644 > --- a/sys/kern/kern_shutdown.c > +++ b/sys/kern/kern_shutdown.c > @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) > return (error); > } > > +static void > +shutdown_nice_task_fn(void *arg, int pending __unused) > +{ > + int howto; > + > + howto = (uintptr_t)arg; > + /* Send a signal to init(8) and have it shutdown the world. */ > + PROC_LOCK(initproc); > + if (howto & RB_POWEROFF) > + kern_psignal(initproc, SIGUSR2); > + else if (howto & RB_POWERCYCLE) > + kern_psignal(initproc, SIGWINCH); > + else if (howto & RB_HALT) > + kern_psignal(initproc, SIGUSR1); > + else > + kern_psignal(initproc, SIGINT); > + PROC_UNLOCK(initproc); > +} > + > +static struct task shutdown_nice_task = TASK_INITIALIZER(0, > + &shutdown_nice_task_fn, NULL); > + > /* > * Called by events that want to shut down.. e.g on a PC > */ > @@ -283,20 +306,14 @@ void > shutdown_nice(int howto) > { > > - if (initproc != NULL) { > - /* Send a signal to init(8) and have it shutdown the > world. */ > - PROC_LOCK(initproc); > - if (howto & RB_POWEROFF) > - kern_psignal(initproc, SIGUSR2); > - else if (howto & RB_POWERCYCLE) > - kern_psignal(initproc, SIGWINCH); > - else if (howto & RB_HALT) > - kern_psignal(initproc, SIGUSR1); > - else > - kern_psignal(initproc, SIGINT); > - PROC_UNLOCK(initproc); > + if (initproc != NULL && !SCHEDULER_STOPPED()) { > + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; > + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); > } else { > - /* No init(8) running, so simply reboot. */ > + /* > + * No init(8) running, or scheduler would not allow it > + * to run, so simply reboot. > + */ > kern_reboot(howto | RB_NOSYNC); > } > } > I like this elegance. I think we should commit this. While it would be nice to support the super-fast interrupts that bde has done, we already don't support it in a number of places. Conceptually, I like the notion of the tilde escape machine in the tty layer, but I don't like the trade offs. Here we only defer to reboot, which requires a fair amount of machinery working to work right. it's not the dependencies I'd prefer, but usually it doesn't matter. However, to do that, it would also mean that breaking to the debugger would need to be done in the tty layer, which requires more of the context switching mechanisms to be working, which would be a bigger loss. So this is a good trade-off. If kern_reboot() can't be called from a fast interrupt handler in bdeBSD, it would be a simple matter to put a wrapper around it here so his kernel can context switch. Though, if the scheduler isn't running, I'm not sure what you can do in this situation. The system is already hung or in a really bad way, so it would have to jump to somewhere late in the kern_reboot() code, though I'm not sure. It's kinda hard to know what's safe just from descriptions from bde. We're already not synching the data to the disks, so I'm not sure what more can be done. I think we should commit this change. It makes things better, but Warner From owner-svn-src-all@freebsd.org Thu Mar 22 15:09:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 043D3F4C425; Thu, 22 Mar 2018 15:09:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 78373796B8; Thu, 22 Mar 2018 15:09:18 +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 w2MF96o8072517 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Mar 2018 17:09:09 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2MF96o8072517 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2MF96wO072516; Thu, 22 Mar 2018 17:09:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Mar 2018 17:09:06 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Warner Losh , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons Message-ID: <20180322150906.GV76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> <20180322114213.GR76926@kib.kiev.ua> <20180322235735.J3354@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322235735.J3354@besplex.bde.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:09:19 -0000 On Fri, Mar 23, 2018 at 01:21:43AM +1100, Bruce Evans wrote: > I don't like having a whole task for this. The whole thing is just a > hack to work around some the upper layers of the tty driver and some > lower layers not having any input [escape] sequences to control the > kernel. Only the syscons and vt lower layers have such sequences > (where they are actually key combinations that are converted to control > operations instead of to input [escape] sequences). To work around for > hardware ttys, the filter for kdb sequences is abused to implement a > non-kdb sequence for rebooting. > > The tty input methods could check for kernel-control sequences and safely > signal init. This is a bit too complicated for syscons and vt since they > can more easily check for key combinations, but wouldhave to convert these > to standard sequences to get the tty layer to do the same thing. (They > have many more kernel-control key combinations and the non-kdb one for > rebooting is just a bug for them.) This is a bit complicated for hardware > tty drivers too -- some use the tty bulk-input method and this shouldn't > check for sequences, but should reduce to bcopy(). Hoever, to detect the > kdb sequences, these drivers han to check at a low level anyway. They > can be clever about this and only check for the console device[s] which are > usually only used for for input at a low rate. This is both complicated and mostly pointless. The task mechanism provides the easy solution, and more, the task mechanism was specifically designed to allow to schedule activities in the more allowing context, from a more restrictive context. I have no intent to start the self-inflicting activity to code the attempt to modify a lot of drivers to do what can be done in 10 lines of code. > Calling kern_reboot() from fast interrupt handlers is still invalid. > It is quite likely to deadlock. In particular, it should deadlock in > when kern_reboot() prints messages to the console. Most console drivers > have races instead of deadlocks by dropping their lock[s] in their > fast interrupt handler before calling the buggy alt escape function. I agree that it is mostly invalid. If SCHEDULER_STOPPED() evaluates to true, then the clean shutdown is not possible at all on modern hardware. Most drivers are asynchronous, and even the hardware reboot command management is async. Similarly, if initproc is not yet initialized, it is silly to expect clean shutdown to occur. I just keep the existing behavior for these corner cases, perhaps it was added for some reasons and might sometime work. From owner-svn-src-all@freebsd.org Thu Mar 22 15:11:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DF44F4C9A9; Thu, 22 Mar 2018 15:11:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4136E79B03; Thu, 22 Mar 2018 15:11:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C39212FD3; Thu, 22 Mar 2018 15:11:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MFBsk5033829; Thu, 22 Mar 2018 15:11:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFBsX4033828; Thu, 22 Mar 2018 15:11:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803221511.w2MFBsX4033828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Mar 2018 15:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331359 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 331359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:11:54 -0000 Author: imp Date: Thu Mar 22 15:11:53 2018 New Revision: 331359 URL: https://svnweb.freebsd.org/changeset/base/331359 Log: Revert r331298 Normally, shutdown_nice() just signals init. However, sometimes it calls kern_reboot directly. For that case, r331298 dropped the Giant lock before calling it. This turns out to be incorrect for the more common case where init exists and we just signal it. Restore the old behavior. The direct call to kern_reboot() doesn't sync buffers to the disk, so should work with Giant held, so we don't need to drop locks here for that. Noticed by: bde@ Sponsored by: Netflix Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Thu Mar 22 14:51:05 2018 (r331358) +++ head/sys/dev/syscons/syscons.c Thu Mar 22 15:11:53 2018 (r331359) @@ -3858,28 +3858,22 @@ next_code: case RBT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) { - mtx_unlock(&Giant); + if (enable_reboot && !(flags & SCGETC_CN)) shutdown_nice(0); - } #endif break; case HALT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) { - mtx_unlock(&Giant); + if (enable_reboot && !(flags & SCGETC_CN)) shutdown_nice(RB_HALT); - } #endif break; case PDWN: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) { - mtx_unlock(&Giant); + if (enable_reboot && !(flags & SCGETC_CN)) shutdown_nice(RB_HALT|RB_POWEROFF); - } #endif break; From owner-svn-src-all@freebsd.org Thu Mar 22 15:24:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C74DF4E1B3; Thu, 22 Mar 2018 15:24:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E31617AA49; Thu, 22 Mar 2018 15:24:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE0D91317D; Thu, 22 Mar 2018 15:24:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MFOQjL041955; Thu, 22 Mar 2018 15:24:26 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFOQjT041954; Thu, 22 Mar 2018 15:24:26 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803221524.w2MFOQjT041954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 22 Mar 2018 15:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331360 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 331360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:24:27 -0000 Author: andrew Date: Thu Mar 22 15:24:26 2018 New Revision: 331360 URL: https://svnweb.freebsd.org/changeset/base/331360 Log: Increase the size of the endpoint buffers. They are double buffered so need to be twice the size. Sponsored by: DARPA, AFRL Modified: head/sys/dev/usb/controller/musb_otg.c Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Thu Mar 22 15:11:53 2018 (r331359) +++ head/sys/dev/usb/controller/musb_otg.c Thu Mar 22 15:24:26 2018 (r331360) @@ -157,7 +157,7 @@ static const struct musb_otg_ep_cfg musbotg_ep_default }, { .ep_end = 7, - .ep_fifosz_shift = 9, + .ep_fifosz_shift = 10, .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, }, { From owner-svn-src-all@freebsd.org Thu Mar 22 15:32:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2797BF4EEAE; Thu, 22 Mar 2018 15:32:58 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8C0E7B2BD; Thu, 22 Mar 2018 15:32:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2483132F4; Thu, 22 Mar 2018 15:32:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MFWv2p047089; Thu, 22 Mar 2018 15:32:57 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFWv8W047088; Thu, 22 Mar 2018 15:32:57 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803221532.w2MFWv8W047088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 22 Mar 2018 15:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331361 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 331361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:32:58 -0000 Author: andrew Date: Thu Mar 22 15:32:57 2018 New Revision: 331361 URL: https://svnweb.freebsd.org/changeset/base/331361 Log: Enter into the EFI environment before dereferencing the runtime services pointer. This may be within the EFI address space and not the FreeBSD kernel address space. X-MFC-With: r330868 Sponsored by: DARPA, AFRL Modified: head/sys/dev/efidev/efirt.c Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Thu Mar 22 15:24:26 2018 (r331360) +++ head/sys/dev/efidev/efirt.c Thu Mar 22 15:32:57 2018 (r331361) @@ -88,6 +88,9 @@ static int efi_status2err[25] = { EPROTO /* EFI_PROTOCOL_ERROR */ }; +static int efi_enter(void); +static void efi_leave(void); + static int efi_status_to_errno(efi_status status) { @@ -190,9 +193,14 @@ efi_init(void) * call RS->SetVirtualAddressMap. As this is not always the case, e.g. * with an old loader.efi, check if the RS->GetTime function is within * the EFI map, and fail to attach if not. + * + * We need to enter into the EFI environment as efi_runtime may point + * to an EFI address. */ + efi_enter(); if (!efi_is_in_map(map, efihdr->memory_size / efihdr->descriptor_size, efihdr->descriptor_size, (vm_offset_t)efi_runtime->rt_gettime)) { + efi_leave(); if (bootverbose) printf( "EFI runtime services table has an invalid pointer\n"); @@ -200,6 +208,7 @@ efi_init(void) efi_destroy_1t1_map(); return (ENXIO); } + efi_leave(); return (0); } From owner-svn-src-all@freebsd.org Thu Mar 22 15:34:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF7D8F4F117; Thu, 22 Mar 2018 15:34:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0B137B492; Thu, 22 Mar 2018 15:34:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AE83132FD; Thu, 22 Mar 2018 15:34:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MFYbxe047215; Thu, 22 Mar 2018 15:34:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFYbC8047214; Thu, 22 Mar 2018 15:34:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803221534.w2MFYbC8047214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Mar 2018 15:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331362 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:34:38 -0000 Author: imp Date: Thu Mar 22 15:34:37 2018 New Revision: 331362 URL: https://svnweb.freebsd.org/changeset/base/331362 Log: Drop any recursed taking of Giant once and for all at the top of kern_reboot(). The shutdown path is now safe to run without Giant. Discussed with: kib@ Sponsored by: Netflix Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Mar 22 15:32:57 2018 (r331361) +++ head/sys/kern/kern_shutdown.c Thu Mar 22 15:34:37 2018 (r331362) @@ -366,6 +366,17 @@ kern_reboot(int howto) { static int once = 0; + /* + * Normal paths here don't hold Giant, but we can wind up here + * unexpectedly with it held. Drop it now so we don't have to + * drop and pick it up elsewhere. The paths it is locking will + * never be returned to, and it is preferable to preclude + * deadlock than to lock against code that won't ever + * continue. + */ + while (mtx_owned(&Giant)) + mtx_unlock(&Giant); + #if defined(SMP) /* * Bind us to the first CPU so that all shutdown code runs there. Some From owner-svn-src-all@freebsd.org Thu Mar 22 15:39:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C9D5F4F79D; Thu, 22 Mar 2018 15:39:26 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4EEF7B915; Thu, 22 Mar 2018 15:39:25 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id x82so16913718wmg.1; Thu, 22 Mar 2018 08:39:25 -0700 (PDT) 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=t7apYKAZ/U6t+UiSvzDVT5hq6Jv1hVSNFojhz4PQwP0=; b=A1emKm8mBW/s/upx7uVXED4Tq+dGayXWG52NmgjrGMdquxmKhUly0bNCjzhIJ5qR0E JwcUbXVpgP5EacDU6B4xx2r6PxL2A1TH9e1fO623U2tnzbFLunmLRnfNGOdXnqK08g8U DCukQ89hweFQxgyZTNjMuXdLorrE7jjTPpXp937mJIRSZewEuIqz6tYqX0T+K/YfvbpW jLSKWX+i8bMl8K68dhh/vFjPLhEONwdXEc4IHSVSYCx7n72AraaMHYUSCYwxNmxRjwYk bga+rBDCUDn3L+JFZQLNKMN/9y3fIbkVKR4LiESIdi7OVvdO7kILQf0QbE8948CkkRsy dPTA== 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=t7apYKAZ/U6t+UiSvzDVT5hq6Jv1hVSNFojhz4PQwP0=; b=nfdyq3S5/5OxVbJosmuKFEIoli+yHLxzNC8xLgWMyThUmCh6x4HSGH0knhLIY5x0OL kzGD73XRydFD7igd1IQbLZoP2vA1GBN3iqCKfRphnWK7uR15oIm265sGy/FT6hjAlWIr lHGEyFf1MQuzjjBYEjoIthNU9wYWistTuLOXGQPwWz1qTt/2CTHnK+b3lhcxUcl/XuAD rhQw8x2Cfo+HP4f2SaYRoZRHvyxg5VFJ4pU0rHvEWwrjD9gk+OMbiOz6rS/u3A5dKJrs fK1IedYsRKKRRILSFxWx2QWpavM0ATz2cL/p6TBogMgGCkTSky8gVMQXBQ0NQb/NwOjq lYHA== X-Gm-Message-State: AElRT7HJvNVqoUKtSGW+7y4hc6FQJpd3y4PVVIn05frWKFiKkPI4FoDI 1j+nB9mhiW4SFGAEPOrTV9W38luxp3QDa2OnWQI= X-Google-Smtp-Source: AG47ELuEgPErZF/UEIhKVo88k/iHe/8Pxi16nUOxIafxtvQCq0y3EJZ6X4zMHqWN6FukXwdfrOs6YU0pYHaQnkOW0pQ= X-Received: by 10.28.160.9 with SMTP id j9mr6408272wme.51.1521733164472; Thu, 22 Mar 2018 08:39:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.192.2 with HTTP; Thu, 22 Mar 2018 08:39:23 -0700 (PDT) In-Reply-To: <20180322142225.GA5139@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> From: Jonathan Looney Date: Thu, 22 Mar 2018 15:39:23 +0000 Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Ruslan Bukin Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:39:27 -0000 A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it is OK. Yes, this can be made optional, if there is a need for that. Jonathan On Thu, Mar 22, 2018 at 2:22 PM, Ruslan Bukin wrote: > Also can this be pluggable ? > It looks like it is optional device which means it can free up some space > in embedded environment when unused > > Ruslan > > On Thu, Mar 22, 2018 at 02:16:06PM +0000, Ruslan Bukin wrote: > > We don't have atomic_fetchadd_64 for mips32 I think > > > > Ruslan > > > > On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > > > Author: jtl > > > Date: Thu Mar 22 09:40:08 2018 > > > New Revision: 331347 > > > URL: https://svnweb.freebsd.org/changeset/base/331347 > > > > > > Log: > > > Add the "TCP Blackbox Recorder" which we discussed at the developer > > > summits at BSDCan and BSDCam in 2017. > > > > > > The TCP Blackbox Recorder allows you to capture events on a TCP > connection > > > in a ring buffer. It stores metadata with the event. It optionally > stores > > > the TCP header associated with an event (if the event is associated > with a > > > packet) and also optionally stores information on the sockets. > > > > > > It supports setting a log ID on a TCP connection and using this to > correlate > > > multiple connections that share a common log ID. > > > > > > You can log connections in different modes. If you are doing a > coordinated > > > test with a particular connection, you may tell the system to put it > in > > > mode 4 (continuous dump). Or, if you just want to monitor for > errors, you > > > can put it in mode 1 (ring buffer) and dump all the ring buffers > associated > > > with the connection ID when we receive an error signal for that > connection > > > ID. You can set a default mode that will be applied to a particular > ratio > > > of incoming connections. You can also manually set a mode using a > socket > > > option. > > > > > > This commit includes only basic probes. rrs@ has added quite an > abundance > > > of probes in his TCP development work. He plans to commit those soon. > > > > > > There are user-space programs which we plan to commit as ports. > These read > > > the data from the log device and output pcapng files, and then let > you > > > analyze the data (and metadata) in the pcapng files. > > > > > > Reviewed by: gnn (previous version) > > > Obtained from: Netflix, Inc. > > > Relnotes: yes > > > Differential Revision: https://reviews.freebsd.org/D11085 > > > > > > Added: > > > head/sys/dev/tcp_log/ > > > head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) > > > head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) > > > head/sys/netinet/tcp_log_buf.c (contents, props changed) > > > head/sys/netinet/tcp_log_buf.h (contents, props changed) > > > Modified: > > > head/etc/mtree/BSD.include.dist > > > head/include/Makefile > > > head/sys/conf/files > > > head/sys/kern/subr_witness.c > > > head/sys/netinet/tcp.h > > > head/sys/netinet/tcp_input.c > > > head/sys/netinet/tcp_output.c > > > head/sys/netinet/tcp_subr.c > > > head/sys/netinet/tcp_timer.c > > > head/sys/netinet/tcp_usrreq.c > > > head/sys/netinet/tcp_var.h > > > head/usr.bin/netstat/inet.c > > > head/usr.bin/netstat/main.c > > > head/usr.bin/netstat/netstat.1 > > > head/usr.bin/netstat/netstat.h > > > > > > Modified: head/etc/mtree/BSD.include.dist > > > ============================================================ > ================== > > > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 > (r331346) > > > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -158,6 +158,8 @@ > > > .. > > > speaker > > > .. > > > + tcp_log > > > + .. > > > usb > > > .. > > > vkbd > > > > > > Modified: head/include/Makefile > > > ============================================================ > ================== > > > --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) > > > +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) > > > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > > > dev/hwpmc dev/hyperv \ > > > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > > > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus > dev/smbus \ > > > - dev/speaker dev/vkbd dev/wi \ > > > + dev/speaker dev/tcp_log dev/vkbd dev/wi \ > > > fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > > > fs/procfs fs/smbfs fs/udf fs/unionfs \ > > > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > > > > > Modified: head/sys/conf/files > > > ============================================================ > ================== > > > --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) > > > +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) > > > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver > > > dev/syscons/syscons.c optional sc > > > dev/syscons/sysmouse.c optional sc > > > dev/syscons/warp/warp_saver.c optional warp_saver > > > +dev/tcp_log/tcp_log_dev.c optional inet | inet6 > > > dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx > compat_linux > > > dev/tdfx/tdfx_pci.c optional tdfx pci > > > dev/ti/if_ti.c optional ti pci > > > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug > > > netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 > tcp_rfc7413 > > > netinet/tcp_hostcache.c optional inet | inet6 > > > netinet/tcp_input.c optional inet | inet6 > > > +netinet/tcp_log_buf.c optional inet | inet6 > > > netinet/tcp_lro.c optional inet | inet6 > > > netinet/tcp_output.c optional inet | inet6 > > > netinet/tcp_offload.c optional tcp_offload inet | > tcp_offload inet6 > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > > > ============================================================ > ================== > > > --- /dev/null 00:00:00 1970 (empty, because file is newly > added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -0,0 +1,521 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2017 > > > + * Netflix Inc. All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or without > > > + * modification, are permitted provided that the following conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above copyright > > > + * notice, this list of conditions and the following disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + * notice, this list of conditions and the following disclaimer in > the > > > + * documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE 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 > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +extern counter_u64_t tcp_log_que_read; > > > +extern counter_u64_t tcp_log_que_freed; > > > +#endif > > > + > > > +static struct cdev *tcp_log_dev; > > > +static struct selinfo tcp_log_sel; > > > + > > > +static struct log_queueh tcp_log_dev_queue_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > > > +static struct log_infoh tcp_log_dev_reader_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > > > + > > > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data > structures"); > > > + > > > +static int tcp_log_dev_listeners = 0; > > > + > > > +static struct mtx tcp_log_dev_queue_lock; > > > + > > > +#define TCP_LOG_DEV_QUEUE_LOCK() > mtx_lock(&tcp_log_dev_queue_lock) > > > +#define TCP_LOG_DEV_QUEUE_UNLOCK() > mtx_unlock(&tcp_log_dev_queue_lock) > > > +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > > > +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > > > +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)-> > tldq_refcnt)) > > > +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)-> > tldq_refcnt)) > > > + > > > +static void tcp_log_dev_clear_refcount(struct > tcp_log_dev_queue *entry); > > > +static void tcp_log_dev_clear_cdevpriv(void *data); > > > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > > > + int devtype __unused, struct thread *td __unused); > > > +static int tcp_log_dev_write(struct cdev *dev __unused, > > > + struct uio *uio __unused, int flags __unused); > > > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio > *uio, > > > + int flags __unused); > > > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > > > + caddr_t data, int fflag __unused, struct thread *td __unused); > > > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > > > + struct thread *td); > > > + > > > + > > > +enum tcp_log_dev_queue_lock_state { > > > + QUEUE_UNLOCKED = 0, > > > + QUEUE_LOCKED, > > > +}; > > > + > > > +static struct cdevsw tcp_log_cdevsw = { > > > + .d_version = D_VERSION, > > > + .d_read = tcp_log_dev_read, > > > + .d_open = tcp_log_dev_open, > > > + .d_write = tcp_log_dev_write, > > > + .d_poll = tcp_log_dev_poll, > > > + .d_ioctl = tcp_log_dev_ioctl, > > > +#ifdef NOTYET > > > + .d_mmap = tcp_log_dev_mmap, > > > +#endif > > > + .d_name = "tcp_log", > > > +}; > > > + > > > +static __inline void > > > +tcp_log_dev_queue_validate_lock(int lockstate) > > > +{ > > > + > > > +#ifdef INVARIANTS > > > + switch (lockstate) { > > > + case QUEUE_LOCKED: > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + break; > > > + case QUEUE_UNLOCKED: > > > + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > > > + break; > > > + default: > > > + kassert_panic("%s:%d: unknown queue lock state", __func__, > > > + __LINE__); > > > + } > > > +#endif > > > +} > > > + > > > +/* > > > + * Clear the refcount. If appropriate, it will remove the entry from > the > > > + * queue and call the destructor. > > > + * > > > + * This must be called with the queue lock held. > > > + */ > > > +static void > > > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > > > +{ > > > + > > > + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); > > > + > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + > > > + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > + counter_u64_add(tcp_log_que_freed, 1); > > > +#endif > > > + /* Remove the entry from the queue and call the > destructor. */ > > > + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, > tcp_log_dev_queue, > > > + tldq_queue); > > > + (*entry->tldq_dtor)(entry); > > > + } > > > +} > > > + > > > +static void > > > +tcp_log_dev_clear_cdevpriv(void *data) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + struct tcp_log_dev_queue *entry, *entry_tmp; > > > + > > > + priv = (struct tcp_log_dev_info *)data; > > > + if (priv == NULL) > > > + return; > > > + > > > + /* > > > + * Lock the queue and drop our references. We hold references to > all > > > + * the entries starting with tldi_head (or, if tldi_head == NULL, > all > > > + * entries in the queue). > > > + * > > > + * Because we don't want anyone adding addition things to the queue > > > + * while we are doing this, we lock the queue. > > > + */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + if (priv->tldi_head != NULL) { > > > + entry = priv->tldi_head; > > > + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, > > > + tldq_queue, entry_tmp) { > > > + tcp_log_dev_clear_refcount(entry); > > > + } > > > + } > > > + tcp_log_dev_listeners--; > > > + KASSERT(tcp_log_dev_listeners >= 0, > > > + ("%s: tcp_log_dev_listeners is unexpectedly negative", > __func__)); > > > + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, > > > + tldi_list); > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + free(priv, M_TCPLOGDEV); > > > +} > > > + > > > +static int > > > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype > __unused, > > > + struct thread *td __unused) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + struct tcp_log_dev_queue *entry; > > > + int rv; > > > + > > > + /* > > > + * Ideally, we shouldn't see these because of file system > > > + * permissions. > > > + */ > > > + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > > > + return (ENODEV); > > > + > > > + /* Allocate space to hold information about where we are. */ > > > + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > > > + M_ZERO | M_WAITOK); > > > + > > > + /* Stash the private data away. */ > > > + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); > > > + if (!rv) { > > > + /* > > > + * Increase the listener count, add this reader to the > list, and > > > + * take references on all current queues. > > > + */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + tcp_log_dev_listeners++; > > > + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, > tldi_list); > > > + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); > > > + if (priv->tldi_head != NULL) > > > + priv->tldi_cur = priv->tldi_head->tldq_buf; > > > + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) > > > + TCP_LOG_DEV_QUEUE_REF(entry); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + } else { > > > + /* Free the entry. */ > > > + free(priv, M_TCPLOGDEV); > > > + } > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, > > > + int flags __unused) > > > +{ > > > + > > > + return (ENODEV); > > > +} > > > + > > > +static __inline void > > > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int > *lockstate) > > > +{ > > > + struct tcp_log_dev_queue *entry; > > > + > > > + KASSERT(priv->tldi_head != NULL, > > > + ("%s:%d: priv->tldi_head unexpectedly NULL", > > > + __func__, __LINE__)); > > > + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > > > + ("%s:%d: buffer mismatch (%p vs %p)", > > > + __func__, __LINE__, priv->tldi_head->tldq_buf, > > > + priv->tldi_cur)); > > > + tcp_log_dev_queue_validate_lock(*lockstate); > > > + > > > + if (*lockstate == QUEUE_UNLOCKED) { > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + *lockstate = QUEUE_LOCKED; > > > + } > > > + entry = priv->tldi_head; > > > + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > > > + tcp_log_dev_clear_refcount(entry); > > > + priv->tldi_cur = NULL; > > > +} > > > + > > > +static int > > > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int > flags) > > > +{ > > > + struct tcp_log_common_header *buf; > > > + struct tcp_log_dev_info *priv; > > > + struct tcp_log_dev_queue *entry; > > > + ssize_t len; > > > + int lockstate, rv; > > > + > > > + /* Get our private info. */ > > > + rv = devfs_get_cdevpriv((void **)&priv); > > > + if (rv) > > > + return (rv); > > > + > > > + lockstate = QUEUE_UNLOCKED; > > > + > > > + /* Do we need to get a new buffer? */ > > > + while (priv->tldi_cur == NULL || > > > + priv->tldi_cur->tlch_length <= priv->tldi_off) { > > > + /* Did we somehow forget to rotate? */ > > > + KASSERT(priv->tldi_cur == NULL, > > > + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, > > > + __LINE__)); > > > + if (priv->tldi_cur != NULL) > > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > > + > > > + /* > > > + * Before we start looking at tldi_head, we need a lock on > the > > > + * queue to make sure tldi_head stays stable. > > > + */ > > > + if (lockstate == QUEUE_UNLOCKED) { > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + lockstate = QUEUE_LOCKED; > > > + } > > > + > > > + /* We need the next buffer. Do we have one? */ > > > + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { > > > + rv = EAGAIN; > > > + goto done; > > > + } > > > + if (priv->tldi_head == NULL) { > > > + /* Sleep and wait for more things we can read. */ > > > + rv = mtx_sleep(&tcp_log_dev_listeners, > > > + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", > 0); > > > + if (rv) > > > + goto done; > > > + if (priv->tldi_head == NULL) > > > + continue; > > > + } > > > + > > > + /* > > > + * We have an entry to read. We want to try to create a > > > + * buffer, if one doesn't already exist. > > > + */ > > > + entry = priv->tldi_head; > > > + if (entry->tldq_buf == NULL) { > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + buf = (*entry->tldq_xform)(entry); > > > + if (buf == NULL) { > > > + rv = EBUSY; > > > + goto done; > > > + } > > > + entry->tldq_buf = buf; > > > + } > > > + > > > + priv->tldi_cur = entry->tldq_buf; > > > + priv->tldi_off = 0; > > > + } > > > + > > > + /* Copy what we can from this buffer to the output buffer. */ > > > + if (uio->uio_resid > 0) { > > > + /* Drop locks so we can take page faults. */ > > > + if (lockstate == QUEUE_LOCKED) > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + lockstate = QUEUE_UNLOCKED; > > > + > > > + KASSERT(priv->tldi_cur != NULL, > > > + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); > > > + > > > + /* Copy as much as we can to this uio. */ > > > + len = priv->tldi_cur->tlch_length - priv->tldi_off; > > > + if (len > uio->uio_resid) > > > + len = uio->uio_resid; > > > + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, > > > + len, uio); > > > + if (rv != 0) > > > + goto done; > > > + priv->tldi_off += len; > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > + counter_u64_add(tcp_log_que_read, len); > > > +#endif > > > + } > > > + /* Are we done with this buffer? If so, find the next one. */ > > > + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > > > + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, > > > + ("%s: offset (%ju) exceeds length (%ju)", __func__, > > > + (uintmax_t)priv->tldi_off, > > > + (uintmax_t)priv->tldi_cur->tlch_length)); > > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > > + } > > > +done: > > > + tcp_log_dev_queue_validate_lock(lockstate); > > > + if (lockstate == QUEUE_LOCKED) > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, > > > + int fflag __unused, struct thread *td __unused) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + int rv; > > > + > > > + /* Get our private info. */ > > > + rv = devfs_get_cdevpriv((void **)&priv); > > > + if (rv) > > > + return (rv); > > > + > > > + /* > > > + * Set things. Here, we are most concerned about the non-blocking > I/O > > > + * flag. > > > + */ > > > + rv = 0; > > > + switch (cmd) { > > > + case FIONBIO: > > > + break; > > > + case FIOASYNC: > > > + if (*(int *)data != 0) > > > + rv = EINVAL; > > > + break; > > > + default: > > > + rv = ENOIOCTL; > > > + } > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread > *td) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + int revents; > > > + > > > + /* > > > + * Get our private info. If this fails, claim that all events are > > > + * ready. That should prod the user to do something that will > > > + * make the error evident to them. > > > + */ > > > + if (devfs_get_cdevpriv((void **)&priv)) > > > + return (events); > > > + > > > + revents = 0; > > > + if (events & (POLLIN | POLLRDNORM)) { > > > + /* > > > + * We can (probably) read right now if we are partway > through > > > + * a buffer or if we are just about to start a buffer. > > > + * Because we are going to read tldi_head, we should > acquire > > > + * a read lock on the queue. > > > + */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || > > > + (priv->tldi_cur != NULL && > > > + priv->tldi_off < priv->tldi_cur->tlch_length)) > > > + revents = events & (POLLIN | POLLRDNORM); > > > + else > > > + selrecord(td, &tcp_log_sel); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + } else { > > > + /* > > > + * It only makes sense to poll for reading. So, again, > prod the > > > + * user to do something that will make the error of their > ways > > > + * apparent. > > > + */ > > > + revents = events; > > > + } > > > + return (revents); > > > +} > > > + > > > +int > > > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + int rv; > > > + bool wakeup_needed; > > > + > > > + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > > > + ("%s: Called with both tldq_buf and tldq_xform set to NULL", > > > + __func__)); > > > + KASSERT(entry->tldq_dtor != NULL, > > > + ("%s: Called with tldq_dtor set to NULL", __func__)); > > > + > > > + /* Get a lock on the queue. */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + > > > + /* If no one is listening, tell the caller to free the resources. > */ > > > + if (tcp_log_dev_listeners == 0) { > > > + rv = ENXIO; > > > + goto done; > > > + } > > > + > > > + /* Add this to the end of the tailq. */ > > > + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); > > > + > > > + /* Add references for all current listeners. */ > > > + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > > > + > > > + /* > > > + * If any listener is currently stuck on NULL, that means they are > > > + * waiting. Point their head to this new entry. > > > + */ > > > + wakeup_needed = false; > > > + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > > > + if (priv->tldi_head == NULL) { > > > + priv->tldi_head = entry; > > > + wakeup_needed = true; > > > + } > > > + > > > + if (wakeup_needed) { > > > + selwakeup(&tcp_log_sel); > > > + wakeup(&tcp_log_dev_listeners); > > > + } > > > + > > > + rv = 0; > > > + > > > +done: > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data > __unused) > > > +{ > > > + > > > + /* TODO: Support intelligent unloading. */ > > > + switch (type) { > > > + case MOD_LOAD: > > > + if (bootverbose) > > > + printf("tcp_log: tcp_log device\n"); > > > + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > > > + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); > > > + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > > > + "tcp_log device queues", MTX_DEF); > > > + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > > > + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, > > > + "tcp_log"); > > > + break; > > > + default: > > > + return (EOPNOTSUPP); > > > + } > > > + > > > + return (0); > > > +} > > > + > > > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > > > +MODULE_VERSION(tcp_log_dev, 1); > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > > > ============================================================ > ================== > > > --- /dev/null 00:00:00 1970 (empty, because file is newly > added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -0,0 +1,88 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016 > > > + * Netflix Inc. All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or without > > > + * modification, are permitted provided that the following conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above copyright > > > + * notice, this list of conditions and the following disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + * notice, this list of conditions and the following disclaimer in > the > > > + * documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE 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 __tcp_log_dev_h__ > > > +#define __tcp_log_dev_h__ > > > + > > > +/* > > > + * This is the common header for data streamed from the log device. > All > > > + * blocks of data need to start with this header. > > > + */ > > > +struct tcp_log_common_header { > > > + uint32_t tlch_version; /* Version is specific to type. */ > > > + uint32_t tlch_type; /* Type of entry(ies) that follow. > */ > > > + uint64_t tlch_length; /* Total length, including header. > */ > > > +} __packed; > > > + > > > +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ > > > + > > > +#ifdef _KERNEL > > > +/* > > > + * This is a queue entry. All queue entries need to start with this > structure > > > + * so the common code can cast them to this structure; however, other > modules > > > + * are free to include additional data after this structure. > > > + * > > > + * The elements are explained here: > > > + * tldq_queue: used by the common code to maintain this entry's > position in the > > > + * queue. > > > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The > data must be > > > + * as long as the common header indicates. > > > + * tldq_xform: If tldq_buf is NULL, the code will call this to create > the > > > + * the tldq_buf object. The function should *not* directly modify > tldq_buf, > > > + * but should return the buffer (which must meet the restrictions > > > + * indicated for tldq_buf). > > > + * tldq_dtor: This function is called to free the queue entry. If > tldq_buf is > > > + * not NULL, the dtor function must free that, too. > > > + * tldq_refcnt: used by the common code to indicate how many readers > still need > > > + * this data. > > > + */ > > > +struct tcp_log_dev_queue { > > > + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > > > + struct tcp_log_common_header *tldq_buf; > > > + struct tcp_log_common_header *(*tldq_xform)(struct > tcp_log_dev_queue *entry); > > > + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); > > > + volatile u_int tldq_refcnt; > > > +}; > > > + > > > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > > > + > > > +struct tcp_log_dev_info { > > > + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > > > + struct tcp_log_dev_queue *tldi_head; > > > + struct tcp_log_common_header *tldi_cur; > > > + off_t tldi_off; > > > +}; > > > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > > > + > > > + > > > +MALLOC_DECLARE(M_TCPLOGDEV); > > > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > > > +#endif /* _KERNEL */ > > > +#endif /* !__tcp_log_dev_h__ */ > > > > > > Modified: head/sys/kern/subr_witness.c > > > ============================================================ > ================== > > > --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 > (r331346) > > > +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -640,6 +640,14 @@ static struct witness_order_list_entry > order_lists[] = > > > { "db->db_mtx", &lock_class_sx }, > > > { NULL, NULL }, > > > /* > > > + * TCP log locks > > > + */ > > > + { "TCP ID tree", &lock_class_rw }, > > > + { "tcp log id bucket", &lock_class_mtx_sleep }, > > > + { "tcpinp", &lock_class_rw }, > > > + { "TCP log expireq", &lock_class_mtx_sleep }, > > > + { NULL, NULL }, > > > + /* > > > * spin locks > > > */ > > > #ifdef SMP > > > > > > Modified: head/sys/netinet/tcp.h > > > ============================================================ > ================== > > > --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) > > > +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) > > > @@ -168,6 +168,12 @@ struct tcphdr { > > > #define TCP_NOOPT 8 /* don't use TCP options */ > > > #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ > > > #define TCP_INFO 32 /* retrieve tcp_info structure */ > > > +#define TCP_LOG 34 /* configure event logging for > connection */ > > > +#define TCP_LOGBUF 35 /* retrieve event log for > connection */ > > > +#define TCP_LOGID 36 /* configure log ID to correlate > connections */ > > > +#define TCP_LOGDUMP 37 /* dump connection log events to > device */ > > > +#define TCP_LOGDUMPID 38 /* dump events from connections > with same ID to > > > + device */ > > > #define TCP_CONGESTION 64 /* get/set congestion control > algorithm */ > > > #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific > options */ > > > #define TCP_KEEPINIT 128 /* N, time to establish connection > */ > > > @@ -188,6 +194,9 @@ struct tcphdr { > > > #define TCPI_OPT_WSCALE 0x04 > > > #define TCPI_OPT_ECN 0x08 > > > #define TCPI_OPT_TOE 0x10 > > > + > > > +/* Maximum length of log ID. */ > > > +#define TCP_LOG_ID_LEN 64 > > > > > > /* > > > * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and > permits > > > > > > Modified: head/sys/netinet/tcp_input.c > > > ============================================================ > ================== > > > --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 > (r331346) > > > +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr > *th, stru > > > /* Save segment, if requested. */ > > > tcp_pcap_add(th, m, &(tp->t_inpkts)); > > > #endif > > > + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > > > + tlen, NULL, true); > > > > > > if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { > > > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > > > > > Added: head/sys/netinet/tcp_log_buf.c > > > ============================================================ > ================== > > > --- /dev/null 00:00:00 1970 (empty, because file is newly > added) > > > +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -0,0 +1,2480 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2018 > > > + * Netflix Inc. All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or without > > > + * modification, are permitted provided that the following conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above copyright > > > + * notice, this list of conditions and the following disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + * notice, this list of conditions and the following disclaimer in > the > > > + * documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE 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 > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +/* Default expiry time */ > > > +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) > > > + > > > +/* Max interval at which to run the expiry timer */ > > > +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) > > > + > > > +bool tcp_log_verbose; > > > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, > tcp_log_zone; > > > +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > > > +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; > > > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > > > +static struct tcp_log_id_tree tcp_log_id_head; > > > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > > > + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > > > +static struct mtx tcp_log_expireq_mtx; > > > +static struct callout tcp_log_expireq_callout; > > > +static uint64_t tcp_log_auto_ratio = 0; > > > +static uint64_t tcp_log_auto_ratio_cur = 0; > > > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > > > +static bool tcp_log_auto_all = false; > > > + > > > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, > tcp_log_id_cmp) > > > + > > > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black > Box controls"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, > &tcp_log_verbose, > > > + 0, "Force verbose logging for TCP traces"); > > > + > > > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > > > + CTLFLAG_RW, &tcp_log_session_limit, 0, > > > + "Maximum number of events maintained for each TCP session"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, > CTLFLAG_RW, > > > + &tcp_log_zone, "Maximum number of events maintained for all TCP > sessions"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, > CTLFLAG_RD, > > > + &tcp_log_zone, "Current number of events maintained for all TCP > sessions"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, > > > + &tcp_log_bucket_zone, "Maximum number of log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, > CTLFLAG_RD, > > > + &tcp_log_bucket_zone, "Current number of log IDs"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, > CTLFLAG_RW, > > > + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, > CTLFLAG_RD, > > > + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, > &tcp_log_version, > > > + 0, "Version of log formats exported"); > > > + > > > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > > > + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N > sessions"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > > > + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > > > + "Logging mode for auto-selected sessions (default is > TCP_LOG_STATE_HEAD_AUTO)"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > > > + &tcp_log_auto_all, false, > > > + "Auto-select from all sessions (rather than just those with > IDs)"); > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +counter_u64_t tcp_log_queued; > > > +counter_u64_t tcp_log_que_fail1; > > > +counter_u64_t tcp_log_que_fail2; > > > +counter_u64_t tcp_log_que_fail3; > > > +counter_u64_t tcp_log_que_fail4; > > > +counter_u64_t tcp_log_que_fail5; > > > +counter_u64_t tcp_log_que_copyout; > > > +counter_u64_t tcp_log_que_read; > > > +counter_u64_t tcp_log_que_freed; > > > + > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > > > + &tcp_log_queued, "Number of entries queued"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > > > + &tcp_log_que_fail1, "Number of entries queued but fail 1"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > > > + &tcp_log_que_fail2, "Number of entries queued but fail 2"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > > > + &tcp_log_que_fail3, "Number of entries queued but fail 3"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > > > + &tcp_log_que_fail4, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > > > + &tcp_log_que_fail5, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > > > + &tcp_log_que_copyout, "Number of entries copied out"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > > > + &tcp_log_que_read, "Number of entries read from the queue"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > > > + &tcp_log_que_freed, "Number of entries freed after reading"); > > > +#endif > > > + > > > +#ifdef INVARIANTS > > > +#define TCPLOG_DEBUG_RINGBUF > > > +#endif > > > + > > > +struct tcp_log_mem > > > +{ > > > + STAILQ_ENTRY(tcp_log_mem) tlm_queue; > > > + struct tcp_log_buffer tlm_buf; > > > + struct tcp_log_verbose tlm_v; > > > +#ifdef TCPLOG_DEBUG_RINGBUF > > > + volatile int tlm_refcnt; > > > +#endif > > > +}; > > > + > > > +/* 60 bytes for the header, + 16 bytes for padding */ > > > +static uint8_t zerobuf[76]; > > > + > > > +/* > > > + * Lock order: > > > + * 1. TCPID_TREE > > > + * 2. TCPID_BUCKET > > > + * 3. INP > > > + * > > > + * Rules: > > > + * A. You need a lock on the Tree to add/remove buckets. > > > + * B. You need a lock on the bucket to add/remove nodes from the > bucket. > > > + * C. To change information in a node, you need the INP lock if the > tln_closed > > > + * field is false. Otherwise, you need the bucket lock. (Note that > the > > > + * tln_closed field can change at any point, so you need to > recheck the > > > + * entry after acquiring the INP lock.) > > > + * D. To remove a node from the bucket, you must have that entry > locked, > > > + * according to the criteria of Rule C. Also, the node must not be > on > > > + * the expiry queue. > > > + * E. The exception to C is the expiry queue fields, which are locked > by > > > + * the TCPLOG_EXPIREQ lock. > > > + * > > > + * Buckets have a reference count. Each node is a reference. Further, > > > + * other callers may add reference counts to keep a bucket from > disappearing. > > > + * You can add a reference as long as you own a lock sufficient to > keep the > > > + * bucket from disappearing. For example, a common use is: > > > + * a. Have a locked INP, but need to lock the TCPID_BUCKET. > > > + * b. Add a refcount on the bucket. (Safe because the INP lock > prevents > > > + * the TCPID_BUCKET from going away.) > > > + * c. Drop the INP lock. > > > + * d. Acquire a lock on the TCPID_BUCKET. > > > + * e. Acquire a lock on the INP. > > > + * f. Drop the refcount on the bucket. > > > + * (At this point, the bucket may disappear.) > > > + * > > > + * Expire queue lock: > > > + * You can acquire this with either the bucket or INP lock. Don't > reverse it. > > > + * When the expire code has committed to freeing a node, it resets > the expiry > > > + * time to SBT_MAX. That is the signal to everyone else that they > should > > > + * leave that node alone. > > > + */ > > > +static struct rwlock tcp_id_tree_lock; > > > +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_UPGRADE() > rw_try_upgrade(&tcp_id_tree_lock) > > > +#define TCPID_TREE_WUNLOCK() > rw_wunlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_RUNLOCK() > rw_runlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_WLOCK_ASSERT() > rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > > > +#define TCPID_TREE_RLOCK_ASSERT() > rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > > > +#define TCPID_TREE_UNLOCK_ASSERT() > rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > > > + > > > +#define TCPID_BUCKET_LOCK_INIT(tlb) > mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > > > +#define TCPID_BUCKET_LOCK_DESTROY(tlb) > mtx_destroy(&((tlb)->tlb_mtx)) > > > +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) > > > +#define TCPID_BUCKET_UNLOCK(tlb) > mtx_unlock(&((tlb)->tlb_mtx)) > > > +#define TCPID_BUCKET_LOCK_ASSERT(tlb) > mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > > > +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) > mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > > > + > > > +#define TCPID_BUCKET_REF(tlb) > refcount_acquire(&((tlb)->tlb_refcnt)) > > > +#define TCPID_BUCKET_UNREF(tlb) > refcount_release(&((tlb)->tlb_refcnt)) > > > + > > > +#define TCPLOG_EXPIREQ_LOCK() > mtx_lock(&tcp_log_expireq_mtx) > > > +#define TCPLOG_EXPIREQ_UNLOCK() > mtx_unlock(&tcp_log_expireq_mtx) > > > + > > > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > > > + > > > +struct tcp_log_id_bucket > > > +{ > > > + /* > > > + * tlb_id must be first. This lets us use strcmp on > > > + * (struct tcp_log_id_bucket *) and (char *) interchangeably. > > > + */ > > > + char tlb_id[TCP_LOG_ID_LEN]; > > > + RB_ENTRY(tcp_log_id_bucket) tlb_rb; > > > + struct tcp_log_id_head tlb_head; > > > + struct mtx tlb_mtx; > > > + volatile u_int tlb_refcnt; > > > +}; > > > + > > > +struct tcp_log_id_node > > > +{ > > > + SLIST_ENTRY(tcp_log_id_node) tln_list; > > > + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the > expireq lock */ > > > + sbintime_t tln_expiretime; /* Locked by the expireq > lock */ > > > + > > > + /* > > > + * If INP is NULL, that means the connection has closed. We've > > > + * saved the connection endpoint information and the log entries > > > + * in the tln_ie and tln_entries members. We've also saved a > pointer > > > + * to the enclosing bucket here. If INP is not NULL, the > information is > > > + * in the PCB and not here. > > > + */ > > > + struct inpcb *tln_inp; > > > + struct tcpcb *tln_tp; > > > + struct tcp_log_id_bucket *tln_bucket; > > > + struct in_endpoints tln_ie; > > > + struct tcp_log_stailq tln_entries; > > > + int tln_count; > > > + volatile int tln_closed; > > > + uint8_t tln_af; > > > +}; > > > + > > > +enum tree_lock_state { > > > + TREE_UNLOCKED = 0, > > > + TREE_RLOCKED, > > > + TREE_WLOCKED, > > > +}; > > > + > > > +/* Do we want to select this session for auto-logging? */ > > > +static __inline bool > > > +tcp_log_selectauto(void) > > > +{ > > > + > > > + /* > > > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > > > > > From owner-svn-src-all@freebsd.org Thu Mar 22 17:46:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B7ADF5AE7C; Thu, 22 Mar 2018 17:46:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BADA81999; Thu, 22 Mar 2018 17:46:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 068D5147A6; Thu, 22 Mar 2018 17:46:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MHkc34012616; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MHkcBT012615; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803221746.w2MHkcBT012615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 22 Mar 2018 17:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331363 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/tools 11/release/tools X-SVN-Commit-Revision: 331363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 17:46:39 -0000 Author: gjb Date: Thu Mar 22 17:46:38 2018 New Revision: 331363 URL: https://svnweb.freebsd.org/changeset/base/331363 Log: MFC r322794: Use py-google-compute-engine instead for releasing Google Compute Engine (GCE) images with an updated version of Google's tools. PR: 221714 Sponsored by: The FreeBSD Foundation Modified: stable/11/release/tools/gce.conf Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/tools/gce.conf Directory Properties: stable/10/ (props changed) Modified: stable/11/release/tools/gce.conf ============================================================================== --- stable/11/release/tools/gce.conf Thu Mar 22 15:34:37 2018 (r331362) +++ stable/11/release/tools/gce.conf Thu Mar 22 17:46:38 2018 (r331363) @@ -5,12 +5,15 @@ # Set to a list of packages to install. export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs \ - google-cloud-sdk google-daemon panicmail sudo firstboot-growfs \ - google-startup-scripts" + google-cloud-sdk panicmail sudo firstboot-growfs \ + sysutils/py-google-compute-engine" # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="google_accounts_manager ntpd sshd firstboot_growfs \ - firstboot_pkgs firstboot_freebsd_update google_startup" + firstboot_pkgs firstboot_freebsd_update google_startup \ + google_accounts_daemon google_clock_skew_daemon + google_instance_setup google_ip_forwarding_daemon + google_network_setup" vm_extra_install_base() { echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf From owner-svn-src-all@freebsd.org Thu Mar 22 17:46:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14792F5AE74; Thu, 22 Mar 2018 17:46:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BDBCC81998; Thu, 22 Mar 2018 17:46:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4595147A5; Thu, 22 Mar 2018 17:46:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MHkcqv012610; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MHkcaf012609; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803221746.w2MHkcaf012609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 22 Mar 2018 17:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331363 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/tools 11/release/tools X-SVN-Commit-Revision: 331363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 17:46:39 -0000 Author: gjb Date: Thu Mar 22 17:46:38 2018 New Revision: 331363 URL: https://svnweb.freebsd.org/changeset/base/331363 Log: MFC r322794: Use py-google-compute-engine instead for releasing Google Compute Engine (GCE) images with an updated version of Google's tools. PR: 221714 Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/gce.conf Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/tools/gce.conf Directory Properties: stable/11/ (props changed) Modified: stable/10/release/tools/gce.conf ============================================================================== --- stable/10/release/tools/gce.conf Thu Mar 22 15:34:37 2018 (r331362) +++ stable/10/release/tools/gce.conf Thu Mar 22 17:46:38 2018 (r331363) @@ -5,12 +5,15 @@ # Set to a list of packages to install. export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs \ - google-cloud-sdk google-daemon panicmail sudo firstboot-growfs \ - google-startup-scripts" + google-cloud-sdk panicmail sudo firstboot-growfs \ + sysutils/py-google-compute-engine" # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="google_accounts_manager ntpd sshd firstboot_growfs \ - firstboot_pkgs firstboot_freebsd_update google_startup" + firstboot_pkgs firstboot_freebsd_update google_startup \ + google_accounts_daemon google_clock_skew_daemon + google_instance_setup google_ip_forwarding_daemon + google_network_setup" vm_extra_install_base() { echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf From owner-svn-src-all@freebsd.org Thu Mar 22 17:49:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 803A6F5B28C; Thu, 22 Mar 2018 17:49:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DCC981D25; Thu, 22 Mar 2018 17:49:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 287FE147B7; Thu, 22 Mar 2018 17:49:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MHnRSD012756; Thu, 22 Mar 2018 17:49:27 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MHnRNR012755; Thu, 22 Mar 2018 17:49:27 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803221749.w2MHnRNR012755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 22 Mar 2018 17:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331364 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 331364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 17:49:28 -0000 Author: gjb Date: Thu Mar 22 17:49:27 2018 New Revision: 331364 URL: https://svnweb.freebsd.org/changeset/base/331364 Log: Remove google_accounts_manager from VM_RC_LIST in the GCE configuration file, no longer needed. PR: 221714 MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/gce.conf Modified: head/release/tools/gce.conf ============================================================================== --- head/release/tools/gce.conf Thu Mar 22 17:46:38 2018 (r331363) +++ head/release/tools/gce.conf Thu Mar 22 17:49:27 2018 (r331364) @@ -9,7 +9,7 @@ export VM_EXTRA_PACKAGES="firstboot-freebsd-update fir sysutils/py-google-compute-engine" # Set to a list of third-party software to enable in rc.conf(5). -export VM_RC_LIST="google_accounts_manager ntpd sshd firstboot_growfs \ +export VM_RC_LIST="ntpd sshd firstboot_growfs \ firstboot_pkgs firstboot_freebsd_update google_startup \ google_accounts_daemon google_clock_skew_daemon google_instance_setup google_ip_forwarding_daemon From owner-svn-src-all@freebsd.org Thu Mar 22 18:13:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8E30F5D2DB for ; Thu, 22 Mar 2018 18:13:00 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CFEA830FB for ; Thu, 22 Mar 2018 18:13:00 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wr0-x235.google.com with SMTP id z73so9671545wrb.0 for ; Thu, 22 Mar 2018 11:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=dbMg26+8QMVVAAmclmVuYLj11uMaRB4D/K9SMlPfMyk=; b=NkvdOLgv/7whh1G4+mnQUa1yYkcAHtImbrzKEgcqwUr52pPIQoGR6mWDmzSzABjYQ0 8diAxtK+Wezz0kFKJFCroJBvrtHwyEiN9MRukR5FJUERqZBrx7201FBHgMbDLqga4njz FHgg7i61Ooq3L4LNlbXIG7waHrPVA5WSlkwa0R5l6jGIDeOcyMmqphJO01v7GR6KiqKk 924xOfJipendArXIJHXDU0gTjCtwhFk2QZ6u9QduaTf8qJgtt1L4KqR/psDLTrAUxA0i xn25ESNgFp7fkIwcS+c/kH+DR7uPKOCpZTmsp195YwKo66SDAKXqUqStzWoXMtOzTpbV 9UGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=dbMg26+8QMVVAAmclmVuYLj11uMaRB4D/K9SMlPfMyk=; b=S9qkWHoAgFrHQV//h1EJPWD17f38uy6omU2fuUoHRc4LWo5phDMQ5yn3JyVdsI8Ahk /xJF4/QNIx/G8z69DcIfLu7L6btCYBpckp2vOvS7rY8+GsSF35xiuK6MW1bff4V8Ipg2 PTVoh6pj1oAc38Vi0hyjXyrT5gBm4Ru8YDkoiLTJ0NTsnxNqKsb4KFY2iTRqhdvl5XbA +dY211MnL5UfA/08UhrtgNudqqPXg0e/fpJRtHgpnNnKUdokkuIKVJTV8pBWX+s8DvhU 7zdaW4y7EDLnbJ6y1ql6qQXp6MUkKwhl9ae4q9aL6bxJI69m2kT2R1aLQAllBreBPa4Q tWqw== X-Gm-Message-State: AElRT7E8sRy6yrwdeVlIzpGNVilVL+UB9W1yRHGUEY41soyDlop+mBo0 M0vuTsdP1VhVuyMtxEKEsTJMOm4Q7Ug= X-Google-Smtp-Source: AG47ELvzgn0HGCmX8Xd+wvq54/8anPaS8d7j6PFpdT+Ov79uocA3didhlMnGDdv+LdzFMUkYnqDdoQ== X-Received: by 10.223.179.9 with SMTP id j9mr16857496wrd.276.1521742378718; Thu, 22 Mar 2018 11:12:58 -0700 (PDT) Received: from [10.10.1.111] ([185.97.61.1]) by smtp.gmail.com with ESMTPSA id t132sm8648783wme.8.2018.03.22.11.12.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 11:12:57 -0700 (PDT) Subject: Re: svn commit: r331209 - head To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803191527.w2JFRr7B058668@repo.freebsd.org> From: Steven Hartland Message-ID: <8d9b163b-fcaa-3e9c-5972-8dc300f64b52@multiplay.co.uk> Date: Thu, 22 Mar 2018 18:13:29 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201803191527.w2JFRr7B058668@repo.freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:13:01 -0000 I think it would be worth specifically detailing the steps to achieve this, as its not immediately obvious how this would be done. On 19/03/2018 15:27, Kyle Evans wrote: > Author: kevans > Date: Mon Mar 19 15:27:53 2018 > New Revision: 331209 > URL: https://svnweb.freebsd.org/changeset/base/331209 > > Log: > Add note to UPDATING about UEFI changes requiring loader(8) update > > These problems have only been observed with boards using U-Boot (e.g. ARM) > where virtual addresses are already set in the memory map by the firmware > and the firmware is expecting a call to SetVirtualAddressMap to be made. > I refrain from mentioning this in the note because this could also be the > case on some not-yet-tested firmware on amd64 and it's not a bad > recommendation for the general case. > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Mon Mar 19 15:11:10 2018 (r331208) > +++ head/UPDATING Mon Mar 19 15:27:53 2018 (r331209) > @@ -51,6 +51,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: > > ****************************** SPECIAL WARNING: ****************************** > > +20180319: > + For UEFI systems: the UEFI loader(8), loader.efi, should be updated in > + conjunction with installing a new kernel after r330868. The kernel, > + after this revision, will be more lenient when mapping addresses for > + UEFI Runtime Services and this may result in a kernel panic without the > + corresponding loader(8) update. > + > 20180212: > FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for > now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf. > From owner-svn-src-all@freebsd.org Thu Mar 22 18:16:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E3BDF5D7D2; Thu, 22 Mar 2018 18:16:17 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D0E3D834E5; Thu, 22 Mar 2018 18:16:16 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id t132-v6so14584838lfe.2; Thu, 22 Mar 2018 11:16:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8JMwZbBfLBgXyN6hdWbFmymAucU2KEpsZZQ3SwHL1lE=; b=KDSCDRCvXLFff2A6t+kn5t7CSfm47ytrpWbds9aAQ9Al76UiHflULgwjF2Xyjori/H 2FI1xFrnmTNSXrroFWOAiaqL/9W0RcItnNdIkNufc3Sp7vYxdax+kCPqRfpi4DkZgife TDTvXplq0qh1CjLC+2Ni6ED109lPuwypxrUzoBXzFEssCR62nUf9+/2qEr4sk2RF1/1V GhDfC/HBxZD1zOTWLiiZES18BFfxrzdYo68sfu8WRAfDzZEBItl+WfDp/AM53SB1k27N eft8TR6gBKNu72dxAa6zDuLLxv7qRSlGWPCkOP6F+++XqD8Xr+kXR8SKsFizYM0ow46Y DihA== X-Gm-Message-State: AElRT7FzexC8o4pir8w911YBr1HnaTCZIDtP2h9RoqPNNpNc/DDYM0xB 5c1HB42YPa0NQOjHQ/LG0YMT+02Ym7I= X-Google-Smtp-Source: AIpwx4/p3WoT0X3apH2GnUXhNuJFDxqcZ3Zs0d0iqEBXOoyr8yqYs0MCcXrkwZIoIFivS57s48QPhA== X-Received: by 10.46.17.23 with SMTP id f23mr2586820lje.43.1521742574507; Thu, 22 Mar 2018 11:16:14 -0700 (PDT) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by smtp.gmail.com with ESMTPSA id l77-v6sm1751064lfk.62.2018.03.22.11.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 11:16:14 -0700 (PDT) Received: by mail-lf0-f46.google.com with SMTP id z143-v6so14579727lff.3; Thu, 22 Mar 2018 11:16:14 -0700 (PDT) X-Received: by 10.46.127.30 with SMTP id a30mr2507228ljd.93.1521742574243; Thu, 22 Mar 2018 11:16:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Thu, 22 Mar 2018 11:15:53 -0700 (PDT) In-Reply-To: <8d9b163b-fcaa-3e9c-5972-8dc300f64b52@multiplay.co.uk> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <8d9b163b-fcaa-3e9c-5972-8dc300f64b52@multiplay.co.uk> From: Kyle Evans Date: Thu, 22 Mar 2018 13:15:53 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331209 - head To: Steven Hartland Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:16:17 -0000 On Thu, Mar 22, 2018 at 1:13 PM, Steven Hartland wrote: > I think it would be worth specifically detailing the steps to achieve this, > as its not immediately obvious how this would be done. > Hi, A later commit clarified, but then an even later commit made these instructions obsolete. =) The problem this entry was made for has been eradicated, and the entry has since been removed. Thanks, Kyle Evans From owner-svn-src-all@freebsd.org Thu Mar 22 18:23:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04647F5E379; Thu, 22 Mar 2018 18:23:15 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (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 7FBA783B50; Thu, 22 Mar 2018 18:23:14 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:35633) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez4rp-000sJt-jZ (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 18:23:13 +0000 Date: Thu, 22 Mar 2018 18:14:15 +0000 From: Ruslan Bukin To: Jonathan Looney Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322181415.GA8657@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:23:15 -0000 Look at these https://ci.freebsd.org/job/FreeBSD-head-mips-build/lastBuild/console https://ci.freebsd.org/job/FreeBSD-head-powerpc-build/lastBuild/console Example make -j5 TARGET=mips TARGET_ARCH=mipsel kernel-toolchain make -j5 TARGET=mips TARGET_ARCH=mipsel KERNCONF=CANNA buildkernel Ruslan On Thu, Mar 22, 2018 at 03:39:23PM +0000, Jonathan Looney wrote: > A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it > is OK. > Yes, this can be made optional, if there is a need for that. > Jonathan > On Thu, Mar 22, 2018 at 2:22 PM, Ruslan Bukin > <[1]ruslan.bukin@cl.cam.ac.uk> wrote: > > Also can this be pluggable ? > It looks like it is optional device which means it can free up some > space in embedded environment when unused > Ruslan > On Thu, Mar 22, 2018 at 02:16:06PM +0000, Ruslan Bukin wrote: > > We don't have atomic_fetchadd_64 for mips32 I think > > > > Ruslan > > > > On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > > > Author: jtl > > > Date: Thu Mar 22 09:40:08 2018 > > > New Revision: 331347 > > > URL: [2]https://svnweb.freebsd.org/changeset/base/331347 > > > > > > Log: > > >   Add the "TCP Blackbox Recorder" which we discussed at the > developer > > >   summits at BSDCan and BSDCam in 2017. > > > > > >   The TCP Blackbox Recorder allows you to capture events on a TCP > connection > > >   in a ring buffer. It stores metadata with the event. It > optionally stores > > >   the TCP header associated with an event (if the event is > associated with a > > >   packet) and also optionally stores information on the sockets. > > > > > >   It supports setting a log ID on a TCP connection and using this > to correlate > > >   multiple connections that share a common log ID. > > > > > >   You can log connections in different modes. If you are doing a > coordinated > > >   test with a particular connection, you may tell the system to > put it in > > >   mode 4 (continuous dump). Or, if you just want to monitor for > errors, you > > >   can put it in mode 1 (ring buffer) and dump all the ring buffers > associated > > >   with the connection ID when we receive an error signal for that > connection > > >   ID. You can set a default mode that will be applied to a > particular ratio > > >   of incoming connections. You can also manually set a mode using > a socket > > >   option. > > > > > >   This commit includes only basic probes. rrs@ has added quite an > abundance > > >   of probes in his TCP development work. He plans to commit those > soon. > > > > > >   There are user-space programs which we plan to commit as ports. > These read > > >   the data from the log device and output pcapng files, and then > let you > > >   analyze the data (and metadata) in the pcapng files. > > > > > >   Reviewed by:      gnn (previous version) > > >   Obtained from:    Netflix, Inc. > > >   Relnotes: yes > > >   Differential Revision:    > [3]https://reviews.freebsd.org/D11085 > > > > > > Added: > > >   head/sys/dev/tcp_log/ > > >   head/sys/dev/tcp_log/tcp_log_dev.c   (contents, props changed) > > >   head/sys/dev/tcp_log/tcp_log_dev.h   (contents, props changed) > > >   head/sys/netinet/tcp_log_buf.c   (contents, props changed) > > >   head/sys/netinet/tcp_log_buf.h   (contents, props changed) > > > Modified: > > >   head/etc/mtree/BSD.include.dist > > >   head/include/Makefile > > >   head/sys/conf/files > > >   head/sys/kern/subr_witness.c > > >   head/sys/netinet/tcp.h > > >   head/sys/netinet/tcp_input.c > > >   head/sys/netinet/tcp_output.c > > >   head/sys/netinet/tcp_subr.c > > >   head/sys/netinet/tcp_timer.c > > >   head/sys/netinet/tcp_usrreq.c > > >   head/sys/netinet/tcp_var.h > > >   head/usr.bin/netstat/inet.c > > >   head/usr.bin/netstat/main.c > > >   head/usr.bin/netstat/netstat.1 > > >   head/usr.bin/netstat/netstat.h > > > > > > Modified: head/etc/mtree/BSD.include.dist > > > > ============================================================================== > > > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018      >   (r331346) > > > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018      >   (r331347) > > > @@ -158,6 +158,8 @@ > > >          .. > > >          speaker > > >          .. > > > +        tcp_log > > > +        .. > > >          usb > > >          .. > > >          vkbd > > > > > > Modified: head/include/Makefile > > > > ============================================================================== > > > --- head/include/Makefile   Thu Mar 22 08:32:39 2018        > (r331346) > > > +++ head/include/Makefile   Thu Mar 22 09:40:08 2018        > (r331347) > > > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > > >     dev/hwpmc dev/hyperv \ > > >     dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > > >     dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus > dev/smbus \ > > > -   dev/speaker dev/vkbd dev/wi \ > > > +   dev/speaker dev/tcp_log dev/vkbd dev/wi \ > > >     fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > > >     fs/procfs fs/smbfs fs/udf fs/unionfs \ > > >     geom/cache geom/concat geom/eli geom/gate geom/journal > geom/label \ > > > > > > Modified: head/sys/conf/files > > > > ============================================================================== > > > --- head/sys/conf/files     Thu Mar 22 08:32:39 2018        > (r331346) > > > +++ head/sys/conf/files     Thu Mar 22 09:40:08 2018        > (r331347) > > > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional > star_saver > > >  dev/syscons/syscons.c              optional sc > > >  dev/syscons/sysmouse.c             optional sc > > >  dev/syscons/warp/warp_saver.c      optional warp_saver > > > +dev/tcp_log/tcp_log_dev.c  optional inet | inet6 > > >  dev/tdfx/tdfx_linux.c              optional tdfx_linux tdfx > compat_linux > > >  dev/tdfx/tdfx_pci.c                optional tdfx pci > > >  dev/ti/if_ti.c                     optional ti pci > > > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c           optional > tcpdebug > > >  netinet/tcp_fastopen.c             optional inet > tcp_rfc7413 | inet6 tcp_rfc7413 > > >  netinet/tcp_hostcache.c            optional inet | inet6 > > >  netinet/tcp_input.c                optional inet | inet6 > > > +netinet/tcp_log_buf.c              optional inet | inet6 > > >  netinet/tcp_lro.c          optional inet | inet6 > > >  netinet/tcp_output.c               optional inet | inet6 > > >  netinet/tcp_offload.c              optional tcp_offload > inet | tcp_offload inet6 > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > > > > ============================================================================== > > > --- /dev/null       00:00:00 1970   (empty, because file is > newly added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.c      Thu Mar 22 09:40:08 > 2018        (r331347) > > > @@ -0,0 +1,521 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2017 > > > + * Netflix Inc.  All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or > without > > > + * modification, are permitted provided that the following > conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer in the > > > + *    documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE 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 > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +extern counter_u64_t tcp_log_que_read; > > > +extern counter_u64_t tcp_log_que_freed; > > > +#endif > > > + > > > +static struct cdev *tcp_log_dev; > > > +static struct selinfo tcp_log_sel; > > > + > > > +static struct log_queueh tcp_log_dev_queue_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > > > +static struct log_infoh tcp_log_dev_reader_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > > > + > > > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data > structures"); > > > + > > > +static int tcp_log_dev_listeners = 0; > > > + > > > +static struct mtx tcp_log_dev_queue_lock; > > > + > > > +#define    TCP_LOG_DEV_QUEUE_LOCK()        > mtx_lock(&tcp_log_dev_queue_lock) > > > +#define    TCP_LOG_DEV_QUEUE_UNLOCK()      > mtx_unlock(&tcp_log_dev_queue_lock) > > > +#define    TCP_LOG_DEV_QUEUE_LOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > > > +#define    TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > > > +#define    TCP_LOG_DEV_QUEUE_REF(tldq)    >  refcount_acquire(&((tldq)->tldq_refcnt)) > > > +#define    TCP_LOG_DEV_QUEUE_UNREF(tldq)  >  refcount_release(&((tldq)->tldq_refcnt)) > > > + > > > +static void        tcp_log_dev_clear_refcount(struct > tcp_log_dev_queue *entry); > > > +static void        tcp_log_dev_clear_cdevpriv(void *data); > > > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > > > +    int devtype __unused, struct thread *td __unused); > > > +static int tcp_log_dev_write(struct cdev *dev __unused, > > > +    struct uio *uio __unused, int flags __unused); > > > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio > *uio, > > > +    int flags __unused); > > > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > > > +    caddr_t data, int fflag __unused, struct thread *td > __unused); > > > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > > > +    struct thread *td); > > > + > > > + > > > +enum tcp_log_dev_queue_lock_state { > > > +   QUEUE_UNLOCKED = 0, > > > +   QUEUE_LOCKED, > > > +}; > > > + > > > +static struct cdevsw tcp_log_cdevsw = { > > > +   .d_version =    D_VERSION, > > > +   .d_read =       tcp_log_dev_read, > > > +   .d_open =       tcp_log_dev_open, > > > +   .d_write =      tcp_log_dev_write, > > > +   .d_poll =       tcp_log_dev_poll, > > > +   .d_ioctl =      tcp_log_dev_ioctl, > > > +#ifdef NOTYET > > > +   .d_mmap =       tcp_log_dev_mmap, > > > +#endif > > > +   .d_name =       "tcp_log", > > > +}; > > > + > > > +static __inline void > > > +tcp_log_dev_queue_validate_lock(int lockstate) > > > +{ > > > + > > > +#ifdef INVARIANTS > > > +   switch (lockstate) { > > > +   case QUEUE_LOCKED: > > > +           TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +           break; > > > +   case QUEUE_UNLOCKED: > > > +           TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > > > +           break; > > > +   default: > > > +           kassert_panic("%s:%d: unknown queue lock state", > __func__, > > > +               __LINE__); > > > +   } > > > +#endif > > > +} > > > + > > > +/* > > > + * Clear the refcount. If appropriate, it will remove the entry > from the > > > + * queue and call the destructor. > > > + * > > > + * This must be called with the queue lock held. > > > + */ > > > +static void > > > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > > > +{ > > > + > > > +   KASSERT(entry != NULL, ("%s: called with NULL entry", > __func__)); > > > + > > > +   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + > > > +   if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +           counter_u64_add(tcp_log_que_freed, 1); > > > +#endif > > > +           /* Remove the entry from the queue and call the > destructor. */ > > > +           STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, > tcp_log_dev_queue, > > > +               tldq_queue); > > > +           (*entry->tldq_dtor)(entry); > > > +   } > > > +} > > > + > > > +static void > > > +tcp_log_dev_clear_cdevpriv(void *data) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   struct tcp_log_dev_queue *entry, *entry_tmp; > > > + > > > +   priv = (struct tcp_log_dev_info *)data; > > > +   if (priv == NULL) > > > +           return; > > > + > > > +   /* > > > +    * Lock the queue and drop our references. We hold references > to all > > > +    * the entries starting with tldi_head (or, if tldi_head == > NULL, all > > > +    * entries in the queue). > > > +    * > > > +    * Because we don't want anyone adding addition things to the > queue > > > +    * while we are doing this, we lock the queue. > > > +    */ > > > +   TCP_LOG_DEV_QUEUE_LOCK(); > > > +   if (priv->tldi_head != NULL) { > > > +           entry = priv->tldi_head; > > > +           STAILQ_FOREACH_FROM_SAFE(entry, > &tcp_log_dev_queue_head, > > > +               tldq_queue, entry_tmp) { > > > +                   tcp_log_dev_clear_refcount(entry); > > > +           } > > > +   } > > > +   tcp_log_dev_listeners--; > > > +   KASSERT(tcp_log_dev_listeners >= 0, > > > +       ("%s: tcp_log_dev_listeners is unexpectedly negative", > __func__)); > > > +   STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, > tcp_log_dev_info, > > > +       tldi_list); > > > +   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +   TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   free(priv, M_TCPLOGDEV); > > > +} > > > + > > > +static int > > > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype > __unused, > > > +    struct thread *td __unused) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   struct tcp_log_dev_queue *entry; > > > +   int rv; > > > + > > > +   /* > > > +    * Ideally, we shouldn't see these because of file system > > > +    * permissions. > > > +    */ > > > +   if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > > > +           return (ENODEV); > > > + > > > +   /* Allocate space to hold information about where we are. */ > > > +   priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > > > +       M_ZERO | M_WAITOK); > > > + > > > +   /* Stash the private data away. */ > > > +   rv = devfs_set_cdevpriv((void *)priv, > tcp_log_dev_clear_cdevpriv); > > > +   if (!rv) { > > > +           /* > > > +            * Increase the listener count, add this reader to > the list, and > > > +            * take references on all current queues. > > > +            */ > > > +           TCP_LOG_DEV_QUEUE_LOCK(); > > > +           tcp_log_dev_listeners++; > > > +           STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, > tldi_list); > > > +           priv->tldi_head = > STAILQ_FIRST(&tcp_log_dev_queue_head); > > > +           if (priv->tldi_head != NULL) > > > +                   priv->tldi_cur = > priv->tldi_head->tldq_buf; > > > +           STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, > tldq_queue) > > > +                   TCP_LOG_DEV_QUEUE_REF(entry); > > > +           TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   } else { > > > +           /* Free the entry. */ > > > +           free(priv, M_TCPLOGDEV); > > > +   } > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio > __unused, > > > +    int flags __unused) > > > +{ > > > + > > > +   return (ENODEV); > > > +} > > > + > > > +static __inline void > > > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int > *lockstate) > > > +{ > > > +   struct tcp_log_dev_queue *entry; > > > + > > > +   KASSERT(priv->tldi_head != NULL, > > > +       ("%s:%d: priv->tldi_head unexpectedly NULL", > > > +       __func__, __LINE__)); > > > +   KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > > > +       ("%s:%d: buffer mismatch (%p vs %p)", > > > +       __func__, __LINE__, priv->tldi_head->tldq_buf, > > > +       priv->tldi_cur)); > > > +   tcp_log_dev_queue_validate_lock(*lockstate); > > > + > > > +   if (*lockstate == QUEUE_UNLOCKED) { > > > +           TCP_LOG_DEV_QUEUE_LOCK(); > > > +           *lockstate = QUEUE_LOCKED; > > > +   } > > > +   entry = priv->tldi_head; > > > +   priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > > > +   tcp_log_dev_clear_refcount(entry); > > > +   priv->tldi_cur = NULL; > > > +} > > > + > > > +static int > > > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int > flags) > > > +{ > > > +   struct tcp_log_common_header *buf; > > > +   struct tcp_log_dev_info *priv; > > > +   struct tcp_log_dev_queue *entry; > > > +   ssize_t len; > > > +   int lockstate, rv; > > > + > > > +   /* Get our private info. */ > > > +   rv = devfs_get_cdevpriv((void **)&priv); > > > +   if (rv) > > > +           return (rv); > > > + > > > +   lockstate = QUEUE_UNLOCKED; > > > + > > > +   /* Do we need to get a new buffer? */ > > > +   while (priv->tldi_cur == NULL || > > > +       priv->tldi_cur->tlch_length <= priv->tldi_off) { > > > +           /* Did we somehow forget to rotate? */ > > > +           KASSERT(priv->tldi_cur == NULL, > > > +               ("%s:%d: tldi_cur is unexpectedly non-NULL", > __func__, > > > +               __LINE__)); > > > +           if (priv->tldi_cur != NULL) > > > +                   tcp_log_dev_rotate_bufs(priv, > &lockstate); > > > + > > > +           /* > > > +            * Before we start looking at tldi_head, we need a > lock on the > > > +            * queue to make sure tldi_head stays stable. > > > +            */ > > > +           if (lockstate == QUEUE_UNLOCKED) { > > > +                   TCP_LOG_DEV_QUEUE_LOCK(); > > > +                   lockstate = QUEUE_LOCKED; > > > +           } > > > + > > > +           /* We need the next buffer. Do we have one? */ > > > +           if (priv->tldi_head == NULL && (flags & > FNONBLOCK)) { > > > +                   rv = EAGAIN; > > > +                   goto done; > > > +           } > > > +           if (priv->tldi_head == NULL) { > > > +                   /* Sleep and wait for more things we > can read. */ > > > +                   rv = mtx_sleep(&tcp_log_dev_listeners, > > > +                       &tcp_log_dev_queue_lock, PCATCH, > "tcplogdev", 0); > > > +                   if (rv) > > > +                           goto done; > > > +                   if (priv->tldi_head == NULL) > > > +                           continue; > > > +           } > > > + > > > +           /* > > > +            * We have an entry to read. We want to try to > create a > > > +            * buffer, if one doesn't already exist. > > > +            */ > > > +           entry = priv->tldi_head; > > > +           if (entry->tldq_buf == NULL) { > > > +                   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +                   buf = (*entry->tldq_xform)(entry); > > > +                   if (buf == NULL) { > > > +                           rv = EBUSY; > > > +                           goto done; > > > +                   } > > > +                   entry->tldq_buf = buf; > > > +           } > > > + > > > +           priv->tldi_cur = entry->tldq_buf; > > > +           priv->tldi_off = 0; > > > +   } > > > + > > > +   /* Copy what we can from this buffer to the output buffer. */ > > > +   if (uio->uio_resid > 0) { > > > +           /* Drop locks so we can take page faults. */ > > > +           if (lockstate == QUEUE_LOCKED) > > > +                   TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +           lockstate = QUEUE_UNLOCKED; > > > + > > > +           KASSERT(priv->tldi_cur != NULL, > > > +               ("%s: priv->tldi_cur is unexpectedly NULL", > __func__)); > > > + > > > +           /* Copy as much as we can to this uio. */ > > > +           len = priv->tldi_cur->tlch_length - > priv->tldi_off; > > > +           if (len > uio->uio_resid) > > > +                   len = uio->uio_resid; > > > +           rv = uiomove(((uint8_t *)priv->tldi_cur) + > priv->tldi_off, > > > +               len, uio); > > > +           if (rv != 0) > > > +                   goto done; > > > +           priv->tldi_off += len; > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +           counter_u64_add(tcp_log_que_read, len); > > > +#endif > > > +   } > > > +   /* Are we done with this buffer? If so, find the next one. */ > > > +   if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > > > +           KASSERT(priv->tldi_off == > priv->tldi_cur->tlch_length, > > > +               ("%s: offset (%ju) exceeds length (%ju)", > __func__, > > > +               (uintmax_t)priv->tldi_off, > > > +               (uintmax_t)priv->tldi_cur->tlch_length)); > > > +           tcp_log_dev_rotate_bufs(priv, &lockstate); > > > +   } > > > +done: > > > +   tcp_log_dev_queue_validate_lock(lockstate); > > > +   if (lockstate == QUEUE_LOCKED) > > > +           TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t > data, > > > +    int fflag __unused, struct thread *td __unused) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   int rv; > > > + > > > +   /* Get our private info. */ > > > +   rv = devfs_get_cdevpriv((void **)&priv); > > > +   if (rv) > > > +           return (rv); > > > + > > > +   /* > > > +    * Set things. Here, we are most concerned about the > non-blocking I/O > > > +    * flag. > > > +    */ > > > +   rv = 0; > > > +   switch (cmd) { > > > +   case FIONBIO: > > > +           break; > > > +   case FIOASYNC: > > > +           if (*(int *)data != 0) > > > +                   rv = EINVAL; > > > +           break; > > > +   default: > > > +           rv = ENOIOCTL; > > > +   } > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct > thread *td) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   int revents; > > > + > > > +   /* > > > +    * Get our private info. If this fails, claim that all events > are > > > +    * ready. That should prod the user to do something that will > > > +    * make the error evident to them. > > > +    */ > > > +   if (devfs_get_cdevpriv((void **)&priv)) > > > +           return (events); > > > + > > > +   revents = 0; > > > +   if (events & (POLLIN | POLLRDNORM)) { > > > +           /* > > > +            * We can (probably) read right now if we are > partway through > > > +            * a buffer or if we are just about to start a > buffer. > > > +            * Because we are going to read tldi_head, we > should acquire > > > +            * a read lock on the queue. > > > +            */ > > > +           TCP_LOG_DEV_QUEUE_LOCK(); > > > +           if ((priv->tldi_head != NULL && priv->tldi_cur == > NULL) || > > > +               (priv->tldi_cur != NULL && > > > +               priv->tldi_off < > priv->tldi_cur->tlch_length)) > > > +                   revents = events & (POLLIN | > POLLRDNORM); > > > +           else > > > +                   selrecord(td, &tcp_log_sel); > > > +           TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   } else { > > > +           /* > > > +            * It only makes sense to poll for reading. So, > again, prod the > > > +            * user to do something that will make the error > of their ways > > > +            * apparent. > > > +            */ > > > +           revents = events; > > > +   } > > > +   return (revents); > > > +} > > > + > > > +int > > > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   int rv; > > > +   bool wakeup_needed; > > > + > > > +   KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > > > +       ("%s: Called with both tldq_buf and tldq_xform set to > NULL", > > > +       __func__)); > > > +   KASSERT(entry->tldq_dtor != NULL, > > > +       ("%s: Called with tldq_dtor set to NULL", __func__)); > > > + > > > +   /* Get a lock on the queue. */ > > > +   TCP_LOG_DEV_QUEUE_LOCK(); > > > + > > > +   /* If no one is listening, tell the caller to free the > resources. */ > > > +   if (tcp_log_dev_listeners == 0) { > > > +           rv = ENXIO; > > > +           goto done; > > > +   } > > > + > > > +   /* Add this to the end of the tailq. */ > > > +   STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, > tldq_queue); > > > + > > > +   /* Add references for all current listeners. */ > > > +   refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > > > + > > > +   /* > > > +    * If any listener is currently stuck on NULL, that means they > are > > > +    * waiting. Point their head to this new entry. > > > +    */ > > > +   wakeup_needed = false; > > > +   STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > > > +           if (priv->tldi_head == NULL) { > > > +                   priv->tldi_head = entry; > > > +                   wakeup_needed = true; > > > +           } > > > + > > > +   if (wakeup_needed) { > > > +           selwakeup(&tcp_log_sel); > > > +           wakeup(&tcp_log_dev_listeners); > > > +   } > > > + > > > +   rv = 0; > > > + > > > +done: > > > +   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +   TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data > __unused) > > > +{ > > > + > > > +   /* TODO: Support intelligent unloading. */ > > > +   switch (type) { > > > +   case MOD_LOAD: > > > +           if (bootverbose) > > > +                   printf("tcp_log: tcp_log device\n"); > > > +           memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > > > +           memset(&tcp_log_dev_queue_lock, 0, sizeof(struct > mtx)); > > > +           mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > > > +                    "tcp_log device queues", MTX_DEF); > > > +           tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > > > +               &tcp_log_cdevsw, 0, NULL, UID_ROOT, > GID_WHEEL, 0400, > > > +               "tcp_log"); > > > +           break; > > > +   default: > > > +           return (EOPNOTSUPP); > > > +   } > > > + > > > +   return (0); > > > +} > > > + > > > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > > > +MODULE_VERSION(tcp_log_dev, 1); > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > > > > ============================================================================== > > > --- /dev/null       00:00:00 1970   (empty, because file is > newly added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.h      Thu Mar 22 09:40:08 > 2018        (r331347) > > > @@ -0,0 +1,88 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016 > > > + * Netflix Inc.  All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or > without > > > + * modification, are permitted provided that the following > conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer in the > > > + *    documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE 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 __tcp_log_dev_h__ > > > +#define    __tcp_log_dev_h__ > > > + > > > +/* > > > + * This is the common header for data streamed from the log device. > All > > > + * blocks of data need to start with this header. > > > + */ > > > +struct tcp_log_common_header { > > > +   uint32_t        tlch_version;   /* Version is specific > to type. */ > > > +   uint32_t        tlch_type;      /* Type of entry(ies) > that follow. */ > > > +   uint64_t        tlch_length;    /* Total length, > including header. */ > > > +} __packed; > > > + > > > +#define    TCP_LOG_DEV_TYPE_BBR    1       /* black box > recorder */ > > > + > > > +#ifdef _KERNEL > > > +/* > > > + * This is a queue entry. All queue entries need to start with this > structure > > > + * so the common code can cast them to this structure; however, > other modules > > > + * are free to include additional data after this structure. > > > + * > > > + * The elements are explained here: > > > + * tldq_queue: used by the common code to maintain this entry's > position in the > > > + *     queue. > > > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The > data must be > > > + *     as long as the common header indicates. > > > + * tldq_xform: If tldq_buf is NULL, the code will call this to > create the > > > + *     the tldq_buf object. The function should *not* directly > modify tldq_buf, > > > + *     but should return the buffer (which must meet the > restrictions > > > + *     indicated for tldq_buf). > > > + * tldq_dtor: This function is called to free the queue entry. If > tldq_buf is > > > + *     not NULL, the dtor function must free that, too. > > > + * tldq_refcnt: used by the common code to indicate how many > readers still need > > > + *     this data. > > > + */ > > > +struct tcp_log_dev_queue { > > > +   STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > > > +   struct tcp_log_common_header *tldq_buf; > > > +   struct tcp_log_common_header *(*tldq_xform)(struct > tcp_log_dev_queue *entry); > > > +   void    (*tldq_dtor)(struct tcp_log_dev_queue *entry); > > > +   volatile u_int tldq_refcnt; > > > +}; > > > + > > > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > > > + > > > +struct tcp_log_dev_info { > > > +   STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > > > +   struct tcp_log_dev_queue *tldi_head; > > > +   struct tcp_log_common_header *tldi_cur; > > > +   off_t                   tldi_off; > > > +}; > > > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > > > + > > > + > > > +MALLOC_DECLARE(M_TCPLOGDEV); > > > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > > > +#endif /* _KERNEL */ > > > +#endif /* !__tcp_log_dev_h__ */ > > > > > > Modified: head/sys/kern/subr_witness.c > > > > ============================================================================== > > > --- head/sys/kern/subr_witness.c    Thu Mar 22 08:32:39 2018    >     (r331346) > > > +++ head/sys/kern/subr_witness.c    Thu Mar 22 09:40:08 2018    >     (r331347) > > > @@ -640,6 +640,14 @@ static struct witness_order_list_entry > order_lists[] = > > >     { "db->db_mtx", &lock_class_sx }, > > >     { NULL, NULL }, > > >     /* > > > +    * TCP log locks > > > +    */ > > > +   { "TCP ID tree", &lock_class_rw }, > > > +   { "tcp log id bucket", &lock_class_mtx_sleep }, > > > +   { "tcpinp", &lock_class_rw }, > > > +   { "TCP log expireq", &lock_class_mtx_sleep }, > > > +   { NULL, NULL }, > > > +   /* > > >      * spin locks > > >      */ > > >  #ifdef SMP > > > > > > Modified: head/sys/netinet/tcp.h > > > > ============================================================================== > > > --- head/sys/netinet/tcp.h  Thu Mar 22 08:32:39 2018        > (r331346) > > > +++ head/sys/netinet/tcp.h  Thu Mar 22 09:40:08 2018        > (r331347) > > > @@ -168,6 +168,12 @@ struct tcphdr { > > >  #define TCP_NOOPT  8       /* don't use TCP options */ > > >  #define TCP_MD5SIG 16      /* use MD5 digests (RFC2385) */ > > >  #define    TCP_INFO        32      /* retrieve tcp_info > structure */ > > > +#define    TCP_LOG         34      /* configure event > logging for connection */ > > > +#define    TCP_LOGBUF      35      /* retrieve event log > for connection */ > > > +#define    TCP_LOGID       36      /* configure log ID to > correlate connections */ > > > +#define    TCP_LOGDUMP     37      /* dump connection log > events to device */ > > > +#define    TCP_LOGDUMPID   38      /* dump events from > connections with same ID to > > > +                              device */ > > >  #define    TCP_CONGESTION  64      /* get/set congestion > control algorithm */ > > >  #define    TCP_CCALGOOPT   65      /* get/set cc algorithm > specific options */ > > >  #define    TCP_KEEPINIT    128     /* N, time to establish > connection */ > > > @@ -188,6 +194,9 @@ struct tcphdr { > > >  #define    TCPI_OPT_WSCALE         0x04 > > >  #define    TCPI_OPT_ECN            0x08 > > >  #define    TCPI_OPT_TOE            0x10 > > > + > > > +/* Maximum length of log ID. */ > > > +#define TCP_LOG_ID_LEN     64 > > > > > >  /* > > >   * The TCP_INFO socket option comes from the Linux 2.6 TCP API, > and permits > > > > > > Modified: head/sys/netinet/tcp_input.c > > > > ============================================================================== > > > --- head/sys/netinet/tcp_input.c    Thu Mar 22 08:32:39 2018    >     (r331346) > > > +++ head/sys/netinet/tcp_input.c    Thu Mar 22 09:40:08 2018    >     (r331347) > > > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > > >  #include > > >  #include > > >  #include > > > +#include > > >  #include > > >  #include > > >  #include > > > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr > *th, stru > > >     /* Save segment, if requested. */ > > >     tcp_pcap_add(th, m, &(tp->t_inpkts)); > > >  #endif > > > +   TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > > > +       tlen, NULL, true); > > > > > >     if ((thflags & TH_SYN) && (thflags & TH_FIN) && > V_drop_synfin) { > > >             if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > > > > > Added: head/sys/netinet/tcp_log_buf.c > > > > ============================================================================== > > > --- /dev/null       00:00:00 1970   (empty, because file is > newly added) > > > +++ head/sys/netinet/tcp_log_buf.c  Thu Mar 22 09:40:08 2018    >     (r331347) > > > @@ -0,0 +1,2480 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2018 > > > + * Netflix Inc.  All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or > without > > > + * modification, are permitted provided that the following > conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer in the > > > + *    documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE 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 > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +/* Default expiry time */ > > > +#define    TCP_LOG_EXPIRE_TIME     ((sbintime_t)60 * SBT_1S) > > > + > > > +/* Max interval at which to run the expiry timer */ > > > +#define    TCP_LOG_EXPIRE_INTVL    ((sbintime_t)5 * SBT_1S) > > > + > > > +bool       tcp_log_verbose; > > > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, > tcp_log_zone; > > > +static int tcp_log_session_limit = > TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > > > +static uint32_t    tcp_log_version = TCP_LOG_BUF_VER; > > > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > > > +static struct tcp_log_id_tree tcp_log_id_head; > > > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > > > +    STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > > > +static struct mtx tcp_log_expireq_mtx; > > > +static struct callout tcp_log_expireq_callout; > > > +static uint64_t tcp_log_auto_ratio = 0; > > > +static uint64_t tcp_log_auto_ratio_cur = 0; > > > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > > > +static bool tcp_log_auto_all = false; > > > + > > > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, > tcp_log_id_cmp) > > > + > > > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black > Box controls"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, > &tcp_log_verbose, > > > +    0, "Force verbose logging for TCP traces"); > > > + > > > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > > > +    CTLFLAG_RW, &tcp_log_session_limit, 0, > > > +    "Maximum number of events maintained for each TCP session"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, > CTLFLAG_RW, > > > +    &tcp_log_zone, "Maximum number of events maintained for all > TCP sessions"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, > CTLFLAG_RD, > > > +    &tcp_log_zone, "Current number of events maintained for all > TCP sessions"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, > CTLFLAG_RW, > > > +    &tcp_log_bucket_zone, "Maximum number of log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, > CTLFLAG_RD, > > > +    &tcp_log_bucket_zone, "Current number of log IDs"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, > CTLFLAG_RW, > > > +    &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, > CTLFLAG_RD, > > > +    &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, > &tcp_log_version, > > > +    0, "Version of log formats exported"); > > > + > > > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > > > +    &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N > sessions"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > > > +    &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > > > +    "Logging mode for auto-selected sessions (default is > TCP_LOG_STATE_HEAD_AUTO)"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > > > +    &tcp_log_auto_all, false, > > > +    "Auto-select from all sessions (rather than just those with > IDs)"); > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +counter_u64_t tcp_log_queued; > > > +counter_u64_t tcp_log_que_fail1; > > > +counter_u64_t tcp_log_que_fail2; > > > +counter_u64_t tcp_log_que_fail3; > > > +counter_u64_t tcp_log_que_fail4; > > > +counter_u64_t tcp_log_que_fail5; > > > +counter_u64_t tcp_log_que_copyout; > > > +counter_u64_t tcp_log_que_read; > > > +counter_u64_t tcp_log_que_freed; > > > + > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > > > +    &tcp_log_queued, "Number of entries queued"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > > > +    &tcp_log_que_fail1, "Number of entries queued but fail 1"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > > > +    &tcp_log_que_fail2, "Number of entries queued but fail 2"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > > > +    &tcp_log_que_fail3, "Number of entries queued but fail 3"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > > > +    &tcp_log_que_fail4, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > > > +    &tcp_log_que_fail5, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > > > +    &tcp_log_que_copyout, "Number of entries copied out"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > > > +    &tcp_log_que_read, "Number of entries read from the queue"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > > > +    &tcp_log_que_freed, "Number of entries freed after reading"); > > > +#endif > > > + > > > +#ifdef INVARIANTS > > > +#define    TCPLOG_DEBUG_RINGBUF > > > +#endif > > > + > > > +struct tcp_log_mem > > > +{ > > > +   STAILQ_ENTRY(tcp_log_mem) tlm_queue; > > > +   struct tcp_log_buffer   tlm_buf; > > > +   struct tcp_log_verbose  tlm_v; > > > +#ifdef TCPLOG_DEBUG_RINGBUF > > > +   volatile int            tlm_refcnt; > > > +#endif > > > +}; > > > + > > > +/* 60 bytes for the header, + 16 bytes for padding */ > > > +static uint8_t     zerobuf[76]; > > > + > > > +/* > > > + * Lock order: > > > + * 1. TCPID_TREE > > > + * 2. TCPID_BUCKET > > > + * 3. INP > > > + * > > > + * Rules: > > > + * A. You need a lock on the Tree to add/remove buckets. > > > + * B. You need a lock on the bucket to add/remove nodes from the > bucket. > > > + * C. To change information in a node, you need the INP lock if the > tln_closed > > > + *    field is false. Otherwise, you need the bucket lock. (Note > that the > > > + *    tln_closed field can change at any point, so you need to > recheck the > > > + *    entry after acquiring the INP lock.) > > > + * D. To remove a node from the bucket, you must have that entry > locked, > > > + *    according to the criteria of Rule C. Also, the node must > not be on > > > + *    the expiry queue. > > > + * E. The exception to C is the expiry queue fields, which are > locked by > > > + *    the TCPLOG_EXPIREQ lock. > > > + * > > > + * Buckets have a reference count. Each node is a reference. > Further, > > > + * other callers may add reference counts to keep a bucket from > disappearing. > > > + * You can add a reference as long as you own a lock sufficient to > keep the > > > + * bucket from disappearing. For example, a common use is: > > > + *   a. Have a locked INP, but need to lock the TCPID_BUCKET. > > > + *   b. Add a refcount on the bucket. (Safe because the INP lock > prevents > > > + *      the TCPID_BUCKET from going away.) > > > + *   c. Drop the INP lock. > > > + *   d. Acquire a lock on the TCPID_BUCKET. > > > + *   e. Acquire a lock on the INP. > > > + *   f. Drop the refcount on the bucket. > > > + *      (At this point, the bucket may disappear.) > > > + * > > > + * Expire queue lock: > > > + * You can acquire this with either the bucket or INP lock. Don't > reverse it. > > > + * When the expire code has committed to freeing a node, it resets > the expiry > > > + * time to SBT_MAX. That is the signal to everyone else that they > should > > > + * leave that node alone. > > > + */ > > > +static struct rwlock tcp_id_tree_lock; > > > +#define    TCPID_TREE_WLOCK()              > rw_wlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_RLOCK()              > rw_rlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_UPGRADE()            > rw_try_upgrade(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_WUNLOCK()            > rw_wunlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_RUNLOCK()            > rw_runlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_WLOCK_ASSERT()      >  rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > > > +#define    TCPID_TREE_RLOCK_ASSERT()      >  rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > > > +#define    TCPID_TREE_UNLOCK_ASSERT()      > rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > > > + > > > +#define    TCPID_BUCKET_LOCK_INIT(tlb)    >  mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > > > +#define    TCPID_BUCKET_LOCK_DESTROY(tlb)  > mtx_destroy(&((tlb)->tlb_mtx)) > > > +#define    TCPID_BUCKET_LOCK(tlb)          > mtx_lock(&((tlb)->tlb_mtx)) > > > +#define    TCPID_BUCKET_UNLOCK(tlb)        > mtx_unlock(&((tlb)->tlb_mtx)) > > > +#define    TCPID_BUCKET_LOCK_ASSERT(tlb)  >  mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > > > +#define    TCPID_BUCKET_UNLOCK_ASSERT(tlb) > mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > > > + > > > +#define    TCPID_BUCKET_REF(tlb)          >  refcount_acquire(&((tlb)->tlb_refcnt)) > > > +#define    TCPID_BUCKET_UNREF(tlb)        >  refcount_release(&((tlb)->tlb_refcnt)) > > > + > > > +#define    TCPLOG_EXPIREQ_LOCK()          >  mtx_lock(&tcp_log_expireq_mtx) > > > +#define    TCPLOG_EXPIREQ_UNLOCK()        >  mtx_unlock(&tcp_log_expireq_mtx) > > > + > > > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > > > + > > > +struct tcp_log_id_bucket > > > +{ > > > +   /* > > > +    * tlb_id must be first. This lets us use strcmp on > > > +    * (struct tcp_log_id_bucket *) and (char *) interchangeably. > > > +    */ > > > +   char                            > tlb_id[TCP_LOG_ID_LEN]; > > > +   RB_ENTRY(tcp_log_id_bucket)     tlb_rb; > > > +   struct tcp_log_id_head          tlb_head; > > > +   struct mtx                      tlb_mtx; > > > +   volatile u_int                  tlb_refcnt; > > > +}; > > > + > > > +struct tcp_log_id_node > > > +{ > > > +   SLIST_ENTRY(tcp_log_id_node) tln_list; > > > +   STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the > expireq lock */ > > > +   sbintime_t              tln_expiretime; /* Locked by > the expireq lock */ > > > + > > > +   /* > > > +    * If INP is NULL, that means the connection has closed. We've > > > +    * saved the connection endpoint information and the log > entries > > > +    * in the tln_ie and tln_entries members. We've also saved a > pointer > > > +    * to the enclosing bucket here. If INP is not NULL, the > information is > > > +    * in the PCB and not here. > > > +    */ > > > +   struct inpcb            *tln_inp; > > > +   struct tcpcb            *tln_tp; > > > +   struct tcp_log_id_bucket *tln_bucket; > > > +   struct in_endpoints     tln_ie; > > > +   struct tcp_log_stailq   tln_entries; > > > +   int                     tln_count; > > > +   volatile int            tln_closed; > > > +   uint8_t                 tln_af; > > > +}; > > > + > > > +enum tree_lock_state { > > > +   TREE_UNLOCKED = 0, > > > +   TREE_RLOCKED, > > > +   TREE_WLOCKED, > > > +}; > > > + > > > +/* Do we want to select this session for auto-logging? */ > > > +static __inline bool > > > +tcp_log_selectauto(void) > > > +{ > > > + > > > +   /* > > > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > > > > > > References > > Visible links > 1. mailto:ruslan.bukin@cl.cam.ac.uk > 2. https://svnweb.freebsd.org/changeset/base/331347 > 3. https://reviews.freebsd.org/D11085 From owner-svn-src-all@freebsd.org Thu Mar 22 18:24:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1242AF5E4CA; Thu, 22 Mar 2018 18:24:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4C7183CBB; Thu, 22 Mar 2018 18:24:00 +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 957DB14E43; Thu, 22 Mar 2018 18:24:00 +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 w2MIO0XX032989; Thu, 22 Mar 2018 18:24:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MIO0EL032986; Thu, 22 Mar 2018 18:24:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803221824.w2MIO0EL032986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Mar 2018 18:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331365 - in head/sys: amd64/amd64 dev/efidev X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: amd64/amd64 dev/efidev X-SVN-Commit-Revision: 331365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:24:01 -0000 Author: kevans Date: Thu Mar 22 18:24:00 2018 New Revision: 331365 URL: https://svnweb.freebsd.org/changeset/base/331365 Log: Re-work efidev ordering to fix efirt preloaded by loader on amd64 On amd64, efi_enter calls fpu_kern_enter(). This may not be called until fpuinitstate has been invoked, resulting in a kernel panic with efirt_load="YES" in loader.conf(5). Move fpuinitstate a little earlier in SI_SUB_DRIVERS so that we can squeeze efirt between it and efirtc at SI_SUB_DRIVERS, SI_ORDER_ANY. efidev must be after efirt and doesn't really need to be at SI_SUB_DEVFS, so drop it at SI_SUB_DRIVER, SI_ORDER_ANY. The not immediately obvious dependency of fpuinitstate by efirt has been noted in both places. Discussed with: kib, andrew Reported by: Jakob Alvermark X-MFC-With: r330868 Modified: head/sys/amd64/amd64/fpu.c head/sys/dev/efidev/efidev.c head/sys/dev/efidev/efirt.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Thu Mar 22 17:49:27 2018 (r331364) +++ head/sys/amd64/amd64/fpu.c Thu Mar 22 18:24:00 2018 (r331365) @@ -366,7 +366,8 @@ fpuinitstate(void *arg __unused) start_emulating(); intr_restore(saveintr); } -SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_ANY, fpuinitstate, NULL); +/* EFIRT needs this to be initialized before we can enter our EFI environment */ +SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_FIRST, fpuinitstate, NULL); /* * Free coprocessor (if we have it). Modified: head/sys/dev/efidev/efidev.c ============================================================================== --- head/sys/dev/efidev/efidev.c Thu Mar 22 17:49:27 2018 (r331364) +++ head/sys/dev/efidev/efidev.c Thu Mar 22 18:24:00 2018 (r331365) @@ -216,6 +216,6 @@ static moduledata_t efidev_moddata = { .priv = NULL, }; -DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DEVFS, SI_ORDER_ANY); +DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(efidev, 1); MODULE_DEPEND(efidev, efirt, 1, 1, 1); Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Thu Mar 22 17:49:27 2018 (r331364) +++ head/sys/dev/efidev/efirt.c Thu Mar 22 18:24:00 2018 (r331365) @@ -450,5 +450,6 @@ static moduledata_t efirt_moddata = { .evhand = efirt_modevents, .priv = NULL, }; -DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_VM_CONF, SI_ORDER_ANY); +/* After fpuinitstate, before efidev */ +DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_DRIVERS, SI_ORDER_SECOND); MODULE_VERSION(efirt, 1); From owner-svn-src-all@freebsd.org Thu Mar 22 18:42:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59BC4F5FC02; Thu, 22 Mar 2018 18:42:14 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (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 EA35D8478C; Thu, 22 Mar 2018 18:42:13 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:13669) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez5AC-00085K-kG (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 18:42:12 +0000 Date: Thu, 22 Mar 2018 18:33:14 +0000 From: Ruslan Bukin To: Jonathan Looney Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322183314.GA8919@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:42:14 -0000 On Thu, Mar 22, 2018 at 03:39:23PM +0000, Jonathan Looney wrote: > Yes, this can be made optional, if there is a need for that. It may be good to have kernel option for that I think. As we target embedded market it is good to have things pluggable. Example: I able to fit freebsd kernel and minimalistic world to 2MB flash device (compressed). But I think if some code added I unable to fit anymore. But I agree that ROM memory is almost free, however some ASICs has this memory only and you may have no space for external chips on PCB. Ruslan From owner-svn-src-all@freebsd.org Thu Mar 22 18:58:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A8F8F61019; Thu, 22 Mar 2018 18:58:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC0FE8519B; Thu, 22 Mar 2018 18:58:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6C36152DE; Thu, 22 Mar 2018 18:58:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MIwZKF048051; Thu, 22 Mar 2018 18:58:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MIwYcg048038; Thu, 22 Mar 2018 18:58:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201803221858.w2MIwYcg048038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 22 Mar 2018 18:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331366 - in head/contrib/llvm: include/llvm/MC lib/MC lib/MC/MCParser lib/Object X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm: include/llvm/MC lib/MC lib/MC/MCParser lib/Object X-SVN-Commit-Revision: 331366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:58:36 -0000 Author: dim Date: Thu Mar 22 18:58:34 2018 New Revision: 331366 URL: https://svnweb.freebsd.org/changeset/base/331366 Log: Pull in r327101 from upstream llvm trunk (by Rafael Espindola): Don't treat .symver as a regular alias definition. This patch starts simplifying the handling of .symver. For now it just moves the responsibility for creating an alias down to the streamer. With that the asm streamer can pass a .symver unchanged, which is nice since gas cannot parse "foo@bar = zed". In a followup I hope to move the handling down to the writer so that we don't need special hacks for avoiding breaking names with @@@ on windows. Pull in r327160 from upstream llvm trunk (by Rafael Espindola): Delay creating an alias for @@@. With this we only create an alias for @@@ once we know if it should use @ or @@. This avoids last minutes renames and hacks to handle MS names. This only handles the ELF writer. LTO still has issues with @@@ aliases. Pull in r327928 from upstream llvm trunk (by Vitaly Buka): Object: Move attribute calculation into RecordStreamer. NFC Summary: Preparation for D44274 Reviewers: pcc, espindola Subscribers: hiraditya Differential Revision: https://reviews.llvm.org/D44276 Pull in r327930 from upstream llvm trunk (by Vitaly Buka): Object: Fix handling of @@@ in .symver directive Summary: name@@@nodename is going to be replaced with name@@nodename if symbols is defined in the assembled file, or name@nodename if undefined. https://sourceware.org/binutils/docs/as/Symver.html Fixes PR36623 Reviewers: pcc, espindola Subscribers: mehdi_amini, hiraditya Differential Revision: https://reviews.llvm.org/D44274 Together, these changes fix handling of @@@ in .symver directives when doing Link Time Optimization. Reported by: Shawn Webb MFC after: 3 months X-MFC-With: r327952 Modified: head/contrib/llvm/include/llvm/MC/MCAssembler.h head/contrib/llvm/include/llvm/MC/MCELFStreamer.h head/contrib/llvm/include/llvm/MC/MCStreamer.h head/contrib/llvm/lib/MC/ELFObjectWriter.cpp head/contrib/llvm/lib/MC/MCAsmStreamer.cpp head/contrib/llvm/lib/MC/MCELFStreamer.cpp head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp head/contrib/llvm/lib/MC/MCStreamer.cpp head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp head/contrib/llvm/lib/Object/RecordStreamer.cpp head/contrib/llvm/lib/Object/RecordStreamer.h Modified: head/contrib/llvm/include/llvm/MC/MCAssembler.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCAssembler.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/include/llvm/MC/MCAssembler.h Thu Mar 22 18:58:34 2018 (r331366) @@ -206,6 +206,8 @@ class MCAssembler { (private) handleFixup(const MCAsmLayout &Layout, MCFragment &F, const MCFixup &Fixup); public: + std::vector> Symvers; + /// Construct a new assembler instance. // // FIXME: How are we going to parameterize this? Two obvious options are stay Modified: head/contrib/llvm/include/llvm/MC/MCELFStreamer.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCELFStreamer.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/include/llvm/MC/MCELFStreamer.h Thu Mar 22 18:58:34 2018 (r331366) @@ -51,6 +51,8 @@ class MCELFStreamer : public MCObjectStreamer { (publi unsigned ByteAlignment) override; void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override; + void emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) override; void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override; Modified: head/contrib/llvm/include/llvm/MC/MCStreamer.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCStreamer.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/include/llvm/MC/MCStreamer.h Thu Mar 22 18:58:34 2018 (r331366) @@ -519,9 +519,10 @@ class MCStreamer { (public) /// /// This corresponds to an assembler statement such as: /// .symver _start, foo@@SOME_VERSION - /// \param Alias - The versioned alias (i.e. "foo@@SOME_VERSION") + /// \param AliasName - The versioned alias (i.e. "foo@@SOME_VERSION") /// \param Aliasee - The aliased symbol (i.e. "_start") - virtual void emitELFSymverDirective(MCSymbol *Alias, const MCSymbol *Aliasee); + virtual void emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee); /// \brief Emit a Linker Optimization Hint (LOH) directive. /// \param Args - Arguments of the LOH. Modified: head/contrib/llvm/lib/MC/ELFObjectWriter.cpp ============================================================================== --- head/contrib/llvm/lib/MC/ELFObjectWriter.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/ELFObjectWriter.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -128,8 +128,6 @@ class ELFObjectWriter : public MCObjectWriter { /// @name Symbol Table Data /// @{ - BumpPtrAllocator Alloc; - StringSaver VersionSymSaver{Alloc}; StringTableBuilder StrTabBuilder{StringTableBuilder::ELF}; /// @} @@ -391,27 +389,29 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssem const MCAsmLayout &Layout) { // The presence of symbol versions causes undefined symbols and // versions declared with @@@ to be renamed. - for (const MCSymbol &A : Asm.symbols()) { - const auto &Alias = cast(A); - // Not an alias. - if (!Alias.isVariable()) - continue; - auto *Ref = dyn_cast(Alias.getVariableValue()); - if (!Ref) - continue; - const auto &Symbol = cast(Ref->getSymbol()); - - StringRef AliasName = Alias.getName(); + for (const std::pair &P : Asm.Symvers) { + StringRef AliasName = P.first; + const auto &Symbol = cast(*P.second); size_t Pos = AliasName.find('@'); - if (Pos == StringRef::npos) - continue; + assert(Pos != StringRef::npos); + StringRef Prefix = AliasName.substr(0, Pos); + StringRef Rest = AliasName.substr(Pos); + StringRef Tail = Rest; + if (Rest.startswith("@@@")) + Tail = Rest.substr(Symbol.isUndefined() ? 2 : 1); + + auto *Alias = + cast(Asm.getContext().getOrCreateSymbol(Prefix + Tail)); + Asm.registerSymbol(*Alias); + const MCExpr *Value = MCSymbolRefExpr::create(&Symbol, Asm.getContext()); + Alias->setVariableValue(Value); + // Aliases defined with .symvar copy the binding from the symbol they alias. // This is the first place we are able to copy this information. - Alias.setExternal(Symbol.isExternal()); - Alias.setBinding(Symbol.getBinding()); + Alias->setExternal(Symbol.isExternal()); + Alias->setBinding(Symbol.getBinding()); - StringRef Rest = AliasName.substr(Pos); if (!Symbol.isUndefined() && !Rest.startswith("@@@")) continue; @@ -420,7 +420,7 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssem !Rest.startswith("@@@")) report_fatal_error("A @@ version cannot be undefined"); - Renames.insert(std::make_pair(&Symbol, &Alias)); + Renames.insert(std::make_pair(&Symbol, Alias)); } } @@ -836,44 +836,7 @@ void ELFObjectWriter::computeSymbolTable( HasLargeSectionIndex = true; } - // The @@@ in symbol version is replaced with @ in undefined symbols and @@ - // in defined ones. - // - // FIXME: All name handling should be done before we get to the writer, - // including dealing with GNU-style version suffixes. Fixing this isn't - // trivial. - // - // We thus have to be careful to not perform the symbol version replacement - // blindly: - // - // The ELF format is used on Windows by the MCJIT engine. Thus, on - // Windows, the ELFObjectWriter can encounter symbols mangled using the MS - // Visual Studio C++ name mangling scheme. Symbols mangled using the MSVC - // C++ name mangling can legally have "@@@" as a sub-string. In that case, - // the EFLObjectWriter should not interpret the "@@@" sub-string as - // specifying GNU-style symbol versioning. The ELFObjectWriter therefore - // checks for the MSVC C++ name mangling prefix which is either "?", "@?", - // "__imp_?" or "__imp_@?". - // - // It would have been interesting to perform the MS mangling prefix check - // only when the target triple is of the form *-pc-windows-elf. But, it - // seems that this information is not easily accessible from the - // ELFObjectWriter. StringRef Name = Symbol.getName(); - SmallString<32> Buf; - if (!Name.startswith("?") && !Name.startswith("@?") && - !Name.startswith("__imp_?") && !Name.startswith("__imp_@?")) { - // This symbol isn't following the MSVC C++ name mangling convention. We - // can thus safely interpret the @@@ in symbol names as specifying symbol - // versioning. - size_t Pos = Name.find("@@@"); - if (Pos != StringRef::npos) { - Buf += Name.substr(0, Pos); - unsigned Skip = MSD.SectionIndex == ELF::SHN_UNDEF ? 2 : 1; - Buf += Name.substr(Pos + Skip); - Name = VersionSymSaver.save(Buf.c_str()); - } - } // Sections have their own string table if (Symbol.getType() != ELF::STT_SECTION) { Modified: head/contrib/llvm/lib/MC/MCAsmStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCAsmStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCAsmStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -129,6 +129,9 @@ class MCAsmStreamer final : public MCStreamer { (publi void ChangeSection(MCSection *Section, const MCExpr *Subsection) override; + void emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) override; + void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; @@ -409,6 +412,14 @@ void MCAsmStreamer::ChangeSection(MCSection *Section, *MAI, getContext().getObjectFileInfo()->getTargetTriple(), OS, Subsection); } +} + +void MCAsmStreamer::emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) { + OS << ".symver "; + Aliasee->print(OS, MAI); + OS << ", " << AliasName; + EmitEOL(); } void MCAsmStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) { Modified: head/contrib/llvm/lib/MC/MCELFStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCELFStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCELFStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -337,6 +337,11 @@ void MCELFStreamer::emitELFSize(MCSymbol *Symbol, cons cast(Symbol)->setSize(Value); } +void MCELFStreamer::emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) { + getAssembler().Symvers.push_back({AliasName, Aliasee}); +} + void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size, unsigned ByteAlignment) { auto *Symbol = cast(S); Modified: head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -767,12 +767,8 @@ bool ELFAsmParser::ParseDirectiveSymver(StringRef, SML if (AliasName.find('@') == StringRef::npos) return TokError("expected a '@' in the name"); - MCSymbol *Alias = getContext().getOrCreateSymbol(AliasName); MCSymbol *Sym = getContext().getOrCreateSymbol(Name); - const MCExpr *Value = MCSymbolRefExpr::create(Sym, getContext()); - - getStreamer().EmitAssignment(Alias, Value); - getStreamer().emitELFSymverDirective(Alias, Sym); + getStreamer().emitELFSymverDirective(AliasName, Sym); return false; } Modified: head/contrib/llvm/lib/MC/MCStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -925,7 +925,7 @@ void MCStreamer::EmitCOFFSymbolType(int Type) { llvm_unreachable("this directive only supported on COFF targets"); } void MCStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} -void MCStreamer::emitELFSymverDirective(MCSymbol *Alias, +void MCStreamer::emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee) {} void MCStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) {} Modified: head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp ============================================================================== --- head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -24,7 +24,6 @@ #include "llvm/IR/GlobalAlias.h" #include "llvm/IR/GlobalValue.h" #include "llvm/IR/GlobalVariable.h" -#include "llvm/IR/Mangler.h" #include "llvm/IR/Module.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" @@ -69,81 +68,6 @@ void ModuleSymbolTable::addModule(Module *M) { }); } -// Ensure ELF .symver aliases get the same binding as the defined symbol -// they alias with. -static void handleSymverAliases(const Module &M, RecordStreamer &Streamer) { - if (Streamer.symverAliases().empty()) - return; - - // The name in the assembler will be mangled, but the name in the IR - // might not, so we first compute a mapping from mangled name to GV. - Mangler Mang; - SmallString<64> MangledName; - StringMap MangledNameMap; - auto GetMangledName = [&](const GlobalValue &GV) { - if (!GV.hasName()) - return; - - MangledName.clear(); - MangledName.reserve(GV.getName().size() + 1); - Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false); - MangledNameMap[MangledName] = &GV; - }; - for (const Function &F : M) - GetMangledName(F); - for (const GlobalVariable &GV : M.globals()) - GetMangledName(GV); - for (const GlobalAlias &GA : M.aliases()) - GetMangledName(GA); - - // Walk all the recorded .symver aliases, and set up the binding - // for each alias. - for (auto &Symver : Streamer.symverAliases()) { - const MCSymbol *Aliasee = Symver.first; - MCSymbolAttr Attr = MCSA_Invalid; - - // First check if the aliasee binding was recorded in the asm. - RecordStreamer::State state = Streamer.getSymbolState(Aliasee); - switch (state) { - case RecordStreamer::Global: - case RecordStreamer::DefinedGlobal: - Attr = MCSA_Global; - break; - case RecordStreamer::UndefinedWeak: - case RecordStreamer::DefinedWeak: - Attr = MCSA_Weak; - break; - default: - break; - } - - // If we don't have a symbol attribute from assembly, then check if - // the aliasee was defined in the IR. - if (Attr == MCSA_Invalid) { - const auto *GV = M.getNamedValue(Aliasee->getName()); - if (!GV) { - auto MI = MangledNameMap.find(Aliasee->getName()); - if (MI != MangledNameMap.end()) - GV = MI->second; - else - continue; - } - if (GV->hasExternalLinkage()) - Attr = MCSA_Global; - else if (GV->hasLocalLinkage()) - Attr = MCSA_Local; - else if (GV->isWeakForLinker()) - Attr = MCSA_Weak; - } - if (Attr == MCSA_Invalid) - continue; - - // Set the detected binding on each alias with this aliasee. - for (auto &Alias : Symver.second) - Streamer.EmitSymbolAttribute(Alias, Attr); - } -} - void ModuleSymbolTable::CollectAsmSymbols( const Module &M, function_ref AsmSymbol) { @@ -176,7 +100,7 @@ void ModuleSymbolTable::CollectAsmSymbols( MCObjectFileInfo MOFI; MCContext MCCtx(MAI.get(), MRI.get(), &MOFI); MOFI.InitMCObjectFileInfo(TT, /*PIC*/ false, MCCtx); - RecordStreamer Streamer(MCCtx); + RecordStreamer Streamer(MCCtx, M); T->createNullTargetStreamer(Streamer); std::unique_ptr Buffer(MemoryBuffer::getMemBuffer(InlineAsm)); @@ -195,7 +119,7 @@ void ModuleSymbolTable::CollectAsmSymbols( if (Parser->Run(false)) return; - handleSymverAliases(M, Streamer); + Streamer.flushSymverDirectives(); for (auto &KV : Streamer) { StringRef Key = KV.first(); Modified: head/contrib/llvm/lib/Object/RecordStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/Object/RecordStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/Object/RecordStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -8,6 +8,9 @@ //===----------------------------------------------------------------------===// #include "RecordStreamer.h" +#include "llvm/IR/Mangler.h" +#include "llvm/IR/Module.h" +#include "llvm/MC/MCContext.h" #include "llvm/MC/MCSymbol.h" using namespace llvm; @@ -70,7 +73,8 @@ void RecordStreamer::markUsed(const MCSymbol &Symbol) void RecordStreamer::visitUsedSymbol(const MCSymbol &Sym) { markUsed(Sym); } -RecordStreamer::RecordStreamer(MCContext &Context) : MCStreamer(Context) {} +RecordStreamer::RecordStreamer(MCContext &Context, const Module &M) + : MCStreamer(Context), M(M) {} RecordStreamer::const_iterator RecordStreamer::begin() { return Symbols.begin(); @@ -112,7 +116,109 @@ void RecordStreamer::EmitCommonSymbol(MCSymbol *Symbol markDefined(*Symbol); } -void RecordStreamer::emitELFSymverDirective(MCSymbol *Alias, +RecordStreamer::State RecordStreamer::getSymbolState(const MCSymbol *Sym) { + auto SI = Symbols.find(Sym->getName()); + if (SI == Symbols.end()) + return NeverSeen; + return SI->second; +} + +void RecordStreamer::emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee) { - SymverAliasMap[Aliasee].push_back(Alias); + SymverAliasMap[Aliasee].push_back(AliasName); +} + +void RecordStreamer::flushSymverDirectives() { + // Mapping from mangled name to GV. + StringMap MangledNameMap; + // The name in the assembler will be mangled, but the name in the IR + // might not, so we first compute a mapping from mangled name to GV. + Mangler Mang; + SmallString<64> MangledName; + for (const GlobalValue &GV : M.global_values()) { + if (!GV.hasName()) + continue; + MangledName.clear(); + MangledName.reserve(GV.getName().size() + 1); + Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false); + MangledNameMap[MangledName] = &GV; + } + + // Walk all the recorded .symver aliases, and set up the binding + // for each alias. + for (auto &Symver : SymverAliasMap) { + const MCSymbol *Aliasee = Symver.first; + MCSymbolAttr Attr = MCSA_Invalid; + bool IsDefined = false; + + // First check if the aliasee binding was recorded in the asm. + RecordStreamer::State state = getSymbolState(Aliasee); + switch (state) { + case RecordStreamer::Global: + case RecordStreamer::DefinedGlobal: + Attr = MCSA_Global; + break; + case RecordStreamer::UndefinedWeak: + case RecordStreamer::DefinedWeak: + Attr = MCSA_Weak; + break; + default: + break; + } + + switch (state) { + case RecordStreamer::Defined: + case RecordStreamer::DefinedGlobal: + case RecordStreamer::DefinedWeak: + IsDefined = true; + break; + case RecordStreamer::NeverSeen: + case RecordStreamer::Global: + case RecordStreamer::Used: + case RecordStreamer::UndefinedWeak: + break; + } + + if (Attr == MCSA_Invalid || !IsDefined) { + const GlobalValue *GV = M.getNamedValue(Aliasee->getName()); + if (!GV) { + auto MI = MangledNameMap.find(Aliasee->getName()); + if (MI != MangledNameMap.end()) + GV = MI->second; + } + if (GV) { + // If we don't have a symbol attribute from assembly, then check if + // the aliasee was defined in the IR. + if (Attr == MCSA_Invalid) { + if (GV->hasExternalLinkage()) + Attr = MCSA_Global; + else if (GV->hasLocalLinkage()) + Attr = MCSA_Local; + else if (GV->isWeakForLinker()) + Attr = MCSA_Weak; + } + IsDefined = IsDefined || !GV->isDeclarationForLinker(); + } + } + + // Set the detected binding on each alias with this aliasee. + for (auto AliasName : Symver.second) { + std::pair Split = AliasName.split("@@@"); + SmallString<128> NewName; + if (!Split.second.empty() && !Split.second.startswith("@")) { + // Special processing for "@@@" according + // https://sourceware.org/binutils/docs/as/Symver.html + const char *Separator = IsDefined ? "@@" : "@"; + AliasName = + (Split.first + Separator + Split.second).toStringRef(NewName); + } + MCSymbol *Alias = getContext().getOrCreateSymbol(AliasName); + // TODO: Handle "@@@". Depending on SymbolAttribute value it needs to be + // converted into @ or @@. + const MCExpr *Value = MCSymbolRefExpr::create(Aliasee, getContext()); + EmitAssignment(Alias, Value); + if (Attr != MCSA_Invalid) + EmitSymbolAttribute(Alias, Attr); + } + } } Modified: head/contrib/llvm/lib/Object/RecordStreamer.h ============================================================================== --- head/contrib/llvm/lib/Object/RecordStreamer.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/Object/RecordStreamer.h Thu Mar 22 18:58:34 2018 (r331366) @@ -20,25 +20,32 @@ namespace llvm { +class GlobalValue; +class Module; + class RecordStreamer : public MCStreamer { public: enum State { NeverSeen, Global, Defined, DefinedGlobal, DefinedWeak, Used, UndefinedWeak}; private: + const Module &M; StringMap Symbols; // Map of aliases created by .symver directives, saved so we can update // their symbol binding after parsing complete. This maps from each // aliasee to its list of aliases. - DenseMap> SymverAliasMap; + DenseMap> SymverAliasMap; + /// Get the state recorded for the given symbol. + State getSymbolState(const MCSymbol *Sym); + void markDefined(const MCSymbol &Symbol); void markGlobal(const MCSymbol &Symbol, MCSymbolAttr Attribute); void markUsed(const MCSymbol &Symbol); void visitUsedSymbol(const MCSymbol &Sym) override; public: - RecordStreamer(MCContext &Context); + RecordStreamer(MCContext &Context, const Module &M); using const_iterator = StringMap::const_iterator; @@ -54,20 +61,11 @@ class RecordStreamer : public MCStreamer { (public) void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override; /// Record .symver aliases for later processing. - void emitELFSymverDirective(MCSymbol *Alias, + void emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee) override; - /// Return the map of .symver aliasee to associated aliases. - DenseMap> &symverAliases() { - return SymverAliasMap; - } - - /// Get the state recorded for the given symbol. - State getSymbolState(const MCSymbol *Sym) { - auto SI = Symbols.find(Sym->getName()); - if (SI == Symbols.end()) - return NeverSeen; - return SI->second; - } + // Emit ELF .symver aliases and ensure they have the same binding as the + // defined symbol they alias with. + void flushSymverDirectives(); }; } // end namespace llvm From owner-svn-src-all@freebsd.org Thu Mar 22 19:06:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47997F61DA6; Thu, 22 Mar 2018 19:06:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA8C2859EA; Thu, 22 Mar 2018 19:06: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 E57201545C; Thu, 22 Mar 2018 19:06: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 w2MJ6oJo052899; Thu, 22 Mar 2018 19:06:50 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MJ6o3v052898; Thu, 22 Mar 2018 19:06:50 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803221906.w2MJ6o3v052898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 22 Mar 2018 19:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331367 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 19:06:51 -0000 Author: jeff Date: Thu Mar 22 19:06:50 2018 New Revision: 331367 URL: https://svnweb.freebsd.org/changeset/base/331367 Log: Use read_mostly and alignment tags to eliminate or limit false sharing. Reviewed by: markj (Part of D14707) Sponsored by: Netflix, Dell/EMC Isilon Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Thu Mar 22 18:58:34 2018 (r331366) +++ head/sys/vm/vm_phys.c Thu Mar 22 19:06:50 2018 (r331367) @@ -73,14 +73,14 @@ _Static_assert(sizeof(long) * NBBY >= VM_PHYSSEG_MAX, "Too many physsegs."); #ifdef NUMA -struct mem_affinity *mem_affinity; -int *mem_locality; +struct mem_affinity __read_mostly *mem_affinity; +int __read_mostly *mem_locality; #endif -int vm_ndomains = 1; +int __read_mostly vm_ndomains = 1; -struct vm_phys_seg vm_phys_segs[VM_PHYSSEG_MAX]; -int vm_phys_nsegs; +struct vm_phys_seg __read_mostly vm_phys_segs[VM_PHYSSEG_MAX]; +int __read_mostly vm_phys_nsegs; struct vm_phys_fictitious_seg; static int vm_phys_fictitious_cmp(struct vm_phys_fictitious_seg *, @@ -100,18 +100,18 @@ struct vm_phys_fictitious_seg { RB_GENERATE_STATIC(fict_tree, vm_phys_fictitious_seg, node, vm_phys_fictitious_cmp); -static struct rwlock vm_phys_fictitious_reg_lock; +static struct rwlock_padalign vm_phys_fictitious_reg_lock; MALLOC_DEFINE(M_FICT_PAGES, "vm_fictitious", "Fictitious VM pages"); -static struct vm_freelist +static struct vm_freelist __aligned(CACHE_LINE_SIZE) vm_phys_free_queues[MAXMEMDOM][VM_NFREELIST][VM_NFREEPOOL][VM_NFREEORDER]; -static int vm_nfreelists; +static int __read_mostly vm_nfreelists; /* * Provides the mapping from VM_FREELIST_* to free list indices (flind). */ -static int vm_freelist_to_flind[VM_NFREELIST]; +static int __read_mostly vm_freelist_to_flind[VM_NFREELIST]; CTASSERT(VM_FREELIST_DEFAULT == 0); From owner-svn-src-all@freebsd.org Thu Mar 22 19:11:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE954F62485; Thu, 22 Mar 2018 19:11:44 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 616C685ED1; Thu, 22 Mar 2018 19:11:44 +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 5C3AF155CF; Thu, 22 Mar 2018 19:11:44 +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 w2MJBit3056727; Thu, 22 Mar 2018 19:11:44 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MJBirP056724; Thu, 22 Mar 2018 19:11:44 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803221911.w2MJBirP056724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 22 Mar 2018 19:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331368 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 331368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 19:11:44 -0000 Author: jeff Date: Thu Mar 22 19:11:43 2018 New Revision: 331368 URL: https://svnweb.freebsd.org/changeset/base/331368 Log: Start witness much earlier in boot so that we can shrink the pend list and make it more immune to further change. Reviewed by: markj, imp (Part of D14707) Sponsored by: Netflix, Dell/EMC Isilon Modified: head/sys/kern/subr_witness.c head/sys/sys/lock.h head/sys/vm/vm_page.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Thu Mar 22 19:06:50 2018 (r331367) +++ head/sys/kern/subr_witness.c Thu Mar 22 19:11:43 2018 (r331368) @@ -139,7 +139,7 @@ __FBSDID("$FreeBSD$"); #define WITNESS_COUNT 1536 #endif #define WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ -#define WITNESS_PENDLIST (2048 + (MAXCPU * 4)) +#define WITNESS_PENDLIST (512 + (MAXCPU * 4)) /* Allocate 256 KB of stack data space */ #define WITNESS_LO_DATA_COUNT 2048 @@ -752,27 +752,45 @@ fixup_filename(const char *file) } /* + * Calculate the size of early witness structures. + */ +int +witness_startup_count(void) +{ + int sz; + + sz = sizeof(struct witness) * witness_count; + sz += sizeof(*w_rmatrix) * (witness_count + 1); + sz += sizeof(*w_rmatrix[0]) * (witness_count + 1) * + (witness_count + 1); + + return (sz); +} + +/* * The WITNESS-enabled diagnostic code. Note that the witness code does * assume that the early boot is single-threaded at least until after this * routine is completed. */ -static void -witness_initialize(void *dummy __unused) +void +witness_startup(void *mem) { struct lock_object *lock; struct witness_order_list_entry *order; struct witness *w, *w1; + uintptr_t p; int i; - w_data = malloc(sizeof (struct witness) * witness_count, M_WITNESS, - M_WAITOK | M_ZERO); + p = (uintptr_t)mem; + w_data = (void *)p; + p += sizeof(struct witness) * witness_count; - w_rmatrix = malloc(sizeof(*w_rmatrix) * (witness_count + 1), - M_WITNESS, M_WAITOK | M_ZERO); + w_rmatrix = (void *)p; + p += sizeof(*w_rmatrix) * (witness_count + 1); for (i = 0; i < witness_count + 1; i++) { - w_rmatrix[i] = malloc(sizeof(*w_rmatrix[i]) * - (witness_count + 1), M_WITNESS, M_WAITOK | M_ZERO); + w_rmatrix[i] = (void *)p; + p += sizeof(*w_rmatrix[i]) * (witness_count + 1); } badstack_sbuf_size = witness_count * 256; @@ -840,8 +858,6 @@ witness_initialize(void *dummy __unused) mtx_lock(&Giant); } -SYSINIT(witness_init, SI_SUB_WITNESS, SI_ORDER_FIRST, witness_initialize, - NULL); void witness_init(struct lock_object *lock, const char *type) Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Thu Mar 22 19:06:50 2018 (r331367) +++ head/sys/sys/lock.h Thu Mar 22 19:11:43 2018 (r331368) @@ -277,6 +277,8 @@ const char *witness_file(struct lock_object *); void witness_thread_exit(struct thread *); #ifdef WITNESS +int witness_startup_count(void); +void witness_startup(void *); /* Flags for witness_warn(). */ #define WARN_GIANTOK 0x01 /* Giant is exempt from this check. */ Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Mar 22 19:06:50 2018 (r331367) +++ head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) @@ -539,6 +539,15 @@ vm_page_startup(vm_offset_t vaddr) bzero((void *)mapped, end - new_end); uma_startup((void *)mapped, boot_pages); +#ifdef WITNESS + end = new_end; + new_end = end - round_page(witness_startup_count()); + mapped = pmap_map(&vaddr, new_end, end, + VM_PROT_READ | VM_PROT_WRITE); + bzero((void *)mapped, end - new_end); + witness_startup((void *)mapped); +#endif + #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ defined(__i386__) || defined(__mips__) /* From owner-svn-src-all@freebsd.org Thu Mar 22 19:21:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1CFAF632AF; Thu, 22 Mar 2018 19:21:11 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A468C864DD; Thu, 22 Mar 2018 19:21:11 +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 9D8E01566A; Thu, 22 Mar 2018 19:21:11 +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 w2MJLBNI058564; Thu, 22 Mar 2018 19:21:11 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MJLBi7058560; Thu, 22 Mar 2018 19:21:11 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803221921.w2MJLBi7058560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 22 Mar 2018 19:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331369 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 19:21:12 -0000 Author: jeff Date: Thu Mar 22 19:21:11 2018 New Revision: 331369 URL: https://svnweb.freebsd.org/changeset/base/331369 Log: Lock reservations with a dedicated lock in each reservation. Protect the vmd_free_count with atomics. This allows us to allocate and free from reservations without the free lock except where a superpage is allocated from the physical layer, which is roughly 1/512 of the operations on amd64. Use the counter api to eliminate cache conention on counters. Reviewed by: markj Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14707 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_pagequeue.h head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_enqueue(uint8_t queue, vm_page_t m); -static void vm_page_free_phys(struct vm_domain *vmd, 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); @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi * for the request class and false otherwise. */ int -vm_domain_available(struct vm_domain *vmd, int req, int npages) +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) { + u_int limit, old, new; - vm_domain_free_assert_locked(vmd); req = req & VM_ALLOC_CLASS_MASK; /* @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req, in */ if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) req = VM_ALLOC_SYSTEM; + if (req == VM_ALLOC_INTERRUPT) + limit = 0; + else if (req == VM_ALLOC_SYSTEM) + limit = vmd->vmd_interrupt_free_min; + else + limit = vmd->vmd_free_reserved; - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || - (req == VM_ALLOC_SYSTEM && - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || - (req == VM_ALLOC_INTERRUPT && - vmd->vmd_free_count >= npages)) - return (1); + /* + * Attempt to reserve the pages. Fail if we're below the limit. + */ + limit += npages; + old = vmd->vmd_free_count; + do { + if (old < limit) + return (0); + new = old - npages; + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0); - return (0); + /* Wake the page daemon if we've crossed the threshold. */ + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) + pagedaemon_wakeup(vmd->vmd_domain); + + /* Only update bitsets on transitions. */ + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) + vm_domain_set(vmd); + + return (1); } vm_page_t @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind again: m = NULL; #if VM_NRESERVLEVEL > 0 + /* + * Can we allocate the page from a reservation? + */ if (vm_object_reserv(object) && - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) - != NULL) { + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { domain = vm_phys_domain(m); vmd = VM_DOMAIN(domain); goto found; } #endif vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1)) { + if (vm_domain_allocate(vmd, req, 1)) { /* - * Can we allocate the page from a reservation? + * If not, allocate it from the free page queues. */ + vm_domain_free_lock(vmd); + m = vm_phys_alloc_pages(domain, object != NULL ? + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, 1); #if VM_NRESERVLEVEL > 0 - if (!vm_object_reserv(object) || - (m = vm_reserv_alloc_page(object, pindex, - domain, mpred)) == NULL) + if (vm_reserv_reclaim_inactive(domain)) + goto again; #endif - { - /* - * If not, allocate it from the free page queues. - */ - m = vm_phys_alloc_pages(domain, object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); -#if VM_NRESERVLEVEL > 0 - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { - m = vm_phys_alloc_pages(domain, - object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, - 0); - } -#endif } } - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); - vm_domain_free_unlock(vmd); if (m == NULL) { /* * Not allocatable, give up. @@ -1775,9 +1783,7 @@ again: */ KASSERT(m != NULL, ("missing page")); -#if VM_NRESERVLEVEL > 0 found: -#endif vm_page_alloc_check(m); /* @@ -1934,9 +1940,14 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pin */ again: #if VM_NRESERVLEVEL > 0 + /* + * Can we allocate the pages from a reservation? + */ if (vm_object_reserv(object) && - (m_ret = vm_reserv_extend_contig(req, object, pindex, domain, - npages, low, high, alignment, boundary, mpred)) != NULL) { + ((m_ret = vm_reserv_extend_contig(req, object, pindex, domain, + npages, low, high, alignment, boundary, mpred)) != NULL || + (m_ret = vm_reserv_alloc_contig(req, object, pindex, domain, + npages, low, high, alignment, boundary, mpred)) != NULL)) { domain = vm_phys_domain(m_ret); vmd = VM_DOMAIN(domain); goto found; @@ -1944,31 +1955,23 @@ again: #endif m_ret = NULL; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, npages)) { + if (vm_domain_allocate(vmd, req, npages)) { /* - * Can we allocate the pages from a reservation? + * allocate them from the free page queues. */ + vm_domain_free_lock(vmd); + m_ret = vm_phys_alloc_contig(domain, npages, low, high, + alignment, boundary); + vm_domain_free_unlock(vmd); + if (m_ret == NULL) { + vm_domain_freecnt_inc(vmd, npages); #if VM_NRESERVLEVEL > 0 -retry: - if (!vm_object_reserv(object) || - (m_ret = vm_reserv_alloc_contig(object, pindex, domain, - npages, low, high, alignment, boundary, mpred)) == NULL) + if (vm_reserv_reclaim_contig(domain, npages, low, + high, alignment, boundary)) + goto again; #endif - /* - * If not, allocate them from the free page queues. - */ - m_ret = vm_phys_alloc_contig(domain, npages, low, high, - alignment, boundary); -#if VM_NRESERVLEVEL > 0 - if (m_ret == NULL && vm_reserv_reclaim_contig( - domain, npages, low, high, alignment, boundary)) - goto retry; -#endif + } } - if (m_ret != NULL) - vm_domain_freecnt_dec(vmd, npages); - vm_domain_free_unlock(vmd); if (m_ret == NULL) { if (vm_domain_alloc_fail(vmd, object, req)) goto again; @@ -2109,13 +2112,14 @@ vm_page_alloc_freelist_domain(int domain, int freelist */ vmd = VM_DOMAIN(domain); again: - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1)) + if (vm_domain_allocate(vmd, req, 1)) { + vm_domain_free_lock(vmd); m = vm_phys_alloc_freelist_pages(domain, freelist, VM_FREEPOOL_DIRECT, 0); - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); - vm_domain_free_unlock(vmd); + vm_domain_free_unlock(vmd); + if (m == NULL) + vm_domain_freecnt_inc(vmd, 1); + } if (m == NULL) { if (vm_domain_alloc_fail(vmd, NULL, req)) goto again; @@ -2491,8 +2495,9 @@ retry: vm_page_remque(m); vm_page_replace_checked(m_new, object, m->pindex, m); - m->valid = 0; - vm_page_undirty(m); + if (vm_page_free_prep(m, false)) + SLIST_INSERT_HEAD(&free, m, + plinks.s.ss); /* * The new page must be deactivated @@ -2504,10 +2509,12 @@ retry: m->flags &= ~PG_ZERO; vm_page_remque(m); vm_page_remove(m); + if (vm_page_free_prep(m, false)) + SLIST_INSERT_HEAD(&free, m, + plinks.s.ss); KASSERT(m->dirty == 0, ("page %p is dirty", m)); } - SLIST_INSERT_HEAD(&free, m, plinks.s.ss); } else error = EBUSY; unlock: @@ -2548,7 +2555,7 @@ unlock: do { MPASS(vm_phys_domain(m) == domain); SLIST_REMOVE_HEAD(&free, plinks.s.ss); - vm_page_free_phys(vmd, m); + vm_phys_free_pages(m, 0); cnt++; } while ((m = SLIST_FIRST(&free)) != NULL); vm_domain_free_unlock(vmd); @@ -3159,24 +3166,12 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked) if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); - return (true); -} - -/* - * Insert the page into the physical memory allocator's free page - * queues. This is the last step to free a page. The caller is - * responsible for adjusting the free page count. - */ -static void -vm_page_free_phys(struct vm_domain *vmd, vm_page_t m) -{ - - vm_domain_free_assert_locked(vmd); - #if VM_NRESERVLEVEL > 0 - if (!vm_reserv_free_page(m)) + if (vm_reserv_free_page(m)) + return (false); #endif - vm_phys_free_pages(m, 0); + + return (true); } void @@ -3200,7 +3195,7 @@ vm_page_free_phys_pglist(struct pglist *tq) vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); } - vm_page_free_phys(vmd, m); + vm_phys_free_pages(m, 0); cnt++; } if (vmd != NULL) { @@ -3227,7 +3222,7 @@ vm_page_free_toq(vm_page_t m) return; vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); - vm_page_free_phys(vmd, m); + vm_phys_free_pages(m, 0); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, 1); } Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Thu Mar 22 19:11:43 2018 (r331368) +++ head/sys/vm/vm_pagequeue.h Thu Mar 22 19:21:11 2018 (r331369) @@ -180,7 +180,7 @@ vm_pagequeue_cnt_add(struct vm_pagequeue *pq, int adde void vm_domain_set(struct vm_domain *vmd); void vm_domain_clear(struct vm_domain *vmd); -int vm_domain_available(struct vm_domain *vmd, int req, int npages); +int vm_domain_allocate(struct vm_domain *vmd, int req, int npages); /* * vm_pagequeue_domain: @@ -265,23 +265,6 @@ vm_domain_freecnt_inc(struct vm_domain *vmd, int adj) new >= vmd->vmd_pageout_free_min))) vm_domain_clear(vmd); } - -static inline void -vm_domain_freecnt_dec(struct vm_domain *vmd, int adj) -{ - u_int old, new; - - old = atomic_fetchadd_int(&vmd->vmd_free_count, -adj); - new = old - adj; - KASSERT(new >= 0, ("vm_domain_freecnt_dec: free count underflow")); - if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) - pagedaemon_wakeup(vmd->vmd_domain); - /* Only update bitsets on transitions. */ - if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || - (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) - vm_domain_set(vmd); -} - #endif /* _KERNEL */ #endif /* !_VM_PAGEQUEUE_ */ Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Thu Mar 22 19:11:43 2018 (r331368) +++ head/sys/vm/vm_reserv.c Thu Mar 22 19:21:11 2018 (r331369) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -54,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -166,22 +169,37 @@ popmap_is_set(popmap_t popmap[], int i) * * A partially populated reservation can be broken and reclaimed at any time. * - * f - vm_domain_free_lock + * r - vm_reserv_lock + * d - vm_reserv_domain_lock * o - vm_reserv_object_lock * c - constant after boot */ struct vm_reserv { - TAILQ_ENTRY(vm_reserv) partpopq; /* (f) per-domain queue. */ - LIST_ENTRY(vm_reserv) objq; /* (o, f) object queue */ - vm_object_t object; /* (o, f) containing object */ - vm_pindex_t pindex; /* (o, f) offset in object */ + struct mtx lock; /* reservation lock. */ + TAILQ_ENTRY(vm_reserv) partpopq; /* (d) per-domain queue. */ + LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ + vm_object_t object; /* (o, r) containing object */ + vm_pindex_t pindex; /* (o, r) offset in object */ vm_page_t pages; /* (c) first page */ - int domain; /* (c) NUMA domain. */ - int popcnt; /* (f) # of pages in use */ - char inpartpopq; /* (f) */ - popmap_t popmap[NPOPMAP]; /* (f) bit vector, used pages */ + uint16_t domain; /* (c) NUMA domain. */ + uint16_t popcnt; /* (r) # of pages in use */ + char inpartpopq; /* (d) */ + popmap_t popmap[NPOPMAP]; /* (r) bit vector, used pages */ }; +#define vm_reserv_lockptr(rv) (&(rv)->lock) +#define vm_reserv_assert_locked(rv) \ + mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) +#define vm_reserv_lock(rv) mtx_lock(vm_reserv_lockptr(rv)) +#define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) +#define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) + +static struct mtx_padalign vm_reserv_domain_locks[MAXMEMDOM]; + +#define vm_reserv_domain_lockptr(d) &vm_reserv_domain_locks[(d)] +#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) + /* * The reservation array * @@ -218,13 +236,13 @@ static TAILQ_HEAD(, vm_reserv) vm_rvq_partpop[MAXMEMDO static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); -static long vm_reserv_broken; -SYSCTL_LONG(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, - &vm_reserv_broken, 0, "Cumulative number of broken reservations"); +static counter_u64_t vm_reserv_broken = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, + &vm_reserv_broken, "Cumulative number of broken reservations"); -static long vm_reserv_freed; -SYSCTL_LONG(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, - &vm_reserv_freed, 0, "Cumulative number of freed reservations"); +static counter_u64_t vm_reserv_freed = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, + &vm_reserv_freed, "Cumulative number of freed reservations"); static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS); @@ -236,9 +254,9 @@ static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_AR SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_vm_reserv_partpopq, "A", "Partially populated reservation queues"); -static long vm_reserv_reclaimed; -SYSCTL_LONG(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, - &vm_reserv_reclaimed, 0, "Cumulative number of reclaimed reservations"); +static counter_u64_t vm_reserv_reclaimed = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, + &vm_reserv_reclaimed, "Cumulative number of reclaimed reservations"); /* * The object lock pool is used to synchronize the rvq. We can not use a @@ -313,12 +331,12 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) for (level = -1; level <= VM_NRESERVLEVEL - 2; level++) { counter = 0; unused_pages = 0; - vm_domain_free_lock(VM_DOMAIN(domain)); + vm_reserv_domain_lock(domain); TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } - vm_domain_free_unlock(VM_DOMAIN(domain)); + vm_reserv_domain_unlock(domain); sbuf_printf(&sbuf, "%6d, %7d, %6dK, %6d\n", domain, level, unused_pages * ((int)PAGE_SIZE / 1024), counter); @@ -337,6 +355,9 @@ vm_reserv_remove(vm_reserv_t rv) { vm_object_t object; + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_remove: reserv %p is free", rv)); KASSERT(!rv->inpartpopq, @@ -356,6 +377,11 @@ vm_reserv_insert(vm_reserv_t rv, vm_object_t object, v { int i; + vm_reserv_assert_locked(rv); + CTR6(KTR_VM, + "%s: rv %p(%p) object %p new %p popcnt %d", + __FUNCTION__, rv, rv->pages, rv->object, object, + rv->popcnt); KASSERT(rv->object == NULL, ("vm_reserv_insert: reserv %p isn't free", rv)); KASSERT(rv->popcnt == 0, @@ -377,14 +403,15 @@ vm_reserv_insert(vm_reserv_t rv, vm_object_t object, v * becomes zero, the reservation is destroyed. Additionally, moves the * reservation to the tail of the partially populated reservation queue if the * population count is non-zero. - * - * The free page queue lock must be held. */ static void vm_reserv_depopulate(vm_reserv_t rv, int index) { + struct vm_domain *vmd; - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_depopulate: reserv %p is free", rv)); KASSERT(popmap_is_set(rv->popmap, index), @@ -395,10 +422,7 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, ("vm_reserv_depopulate: reserv %p's domain is corrupted %d", rv, rv->domain)); - if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); - rv->inpartpopq = FALSE; - } else { + if (rv->popcnt == VM_LEVEL_0_NPAGES) { KASSERT(rv->pages->psind == 1, ("vm_reserv_depopulate: reserv %p is already demoted", rv)); @@ -406,14 +430,25 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) } popmap_clear(rv->popmap, index); rv->popcnt--; + vm_reserv_domain_lock(rv->domain); + if (rv->inpartpopq) { + TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + rv->inpartpopq = FALSE; + } + if (rv->popcnt != 0) { + rv->inpartpopq = TRUE; + TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + } + vm_reserv_domain_unlock(rv->domain); + vmd = VM_DOMAIN(rv->domain); if (rv->popcnt == 0) { vm_reserv_remove(rv); + vm_domain_free_lock(vmd); vm_phys_free_pages(rv->pages, VM_LEVEL_0_ORDER); - vm_reserv_freed++; - } else { - rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + vm_domain_free_unlock(vmd); + counter_u64_add(vm_reserv_freed, 1); } + vm_domain_freecnt_inc(vmd, 1); } /* @@ -484,7 +519,9 @@ static void vm_reserv_populate(vm_reserv_t rv, int index) { - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_populate: reserv %p is free", rv)); KASSERT(popmap_is_clear(rv->popmap, index), @@ -497,17 +534,23 @@ vm_reserv_populate(vm_reserv_t rv, int index) KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, ("vm_reserv_populate: reserv %p's domain is corrupted %d", rv, rv->domain)); + popmap_set(rv->popmap, index); + rv->popcnt++; + vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; } - popmap_set(rv->popmap, index); - rv->popcnt++; if (rv->popcnt < VM_LEVEL_0_NPAGES) { rv->inpartpopq = TRUE; TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); - } else + } else { + KASSERT(rv->pages->psind == 0, + ("vm_reserv_populate: reserv %p is already promoted", + rv)); rv->pages->psind = 1; + } + vm_reserv_domain_unlock(rv->domain); } /* @@ -572,31 +615,29 @@ vm_reserv_extend_contig(int req, vm_object_t object, v return (NULL); domain = rv->domain; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (rv->object != object || !vm_domain_available(vmd, req, npages)) { - m = NULL; + vm_reserv_lock(rv); + if (rv->object != object) goto out; - } m = &rv->pages[index]; pa = VM_PAGE_TO_PHYS(m); if (pa < low || pa + size > high || (pa & (alignment - 1)) != 0 || - ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) { - m = NULL; + ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) goto out; - } /* Handle vm_page_rename(m, new_object, ...). */ for (i = 0; i < npages; i++) { - if (popmap_is_set(rv->popmap, index + i)) { - m = NULL; + if (popmap_is_set(rv->popmap, index + i)) goto out; - } } + if (!vm_domain_allocate(vmd, req, npages)) + goto out; for (i = 0; i < npages; i++) vm_reserv_populate(rv, index + i); - vm_domain_freecnt_dec(vmd, npages); -out: - vm_domain_free_unlock(vmd); + vm_reserv_unlock(rv); return (m); + +out: + vm_reserv_unlock(rv); + return (NULL); } /* @@ -618,10 +659,11 @@ out: * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, int domain, +vm_reserv_alloc_contig(int req, vm_object_t object, vm_pindex_t pindex, int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_page_t mpred) { + struct vm_domain *vmd; vm_paddr_t pa, size; vm_page_t m, m_ret, msucc; vm_pindex_t first, leftcap, rightcap; @@ -629,7 +671,6 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t u_long allocpages, maxpages, minpages; int i, index, n; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(npages != 0, ("vm_reserv_alloc_contig: npages is 0")); @@ -737,9 +778,19 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t * specified index may not be the first page within the first new * reservation. */ - m = vm_phys_alloc_contig(domain, allocpages, low, high, ulmax(alignment, - VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0); - if (m == NULL) + m = NULL; + vmd = VM_DOMAIN(domain); + if (vm_domain_allocate(vmd, req, npages)) { + vm_domain_free_lock(vmd); + m = vm_phys_alloc_contig(domain, allocpages, low, high, + ulmax(alignment, VM_LEVEL_0_SIZE), + boundary > VM_LEVEL_0_SIZE ? boundary : 0); + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, npages); + return (NULL); + } + } else return (NULL); KASSERT(vm_phys_domain(m) == domain, ("vm_reserv_alloc_contig: Page domain does not match requested.")); @@ -757,6 +808,7 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t KASSERT(rv->pages == m, ("vm_reserv_alloc_contig: reserv %p's pages is corrupted", rv)); + vm_reserv_lock(rv); vm_reserv_insert(rv, object, first); n = ulmin(VM_LEVEL_0_NPAGES - index, npages); for (i = 0; i < n; i++) @@ -766,6 +818,7 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t m_ret = &rv->pages[index]; index = 0; } + vm_reserv_unlock(rv); m += VM_LEVEL_0_NPAGES; first += VM_LEVEL_0_NPAGES; allocpages -= VM_LEVEL_0_NPAGES; @@ -813,18 +866,20 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde vmd = VM_DOMAIN(domain); index = VM_RESERV_INDEX(object, pindex); m = &rv->pages[index]; - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1) == 0 || - /* Handle reclaim race. */ - rv->object != object || + vm_reserv_lock(rv); + /* Handle reclaim race. */ + if (rv->object != object || /* Handle vm_page_rename(m, new_object, ...). */ - popmap_is_set(rv->popmap, index)) + popmap_is_set(rv->popmap, index)) { m = NULL; - if (m != NULL) { - vm_reserv_populate(rv, index); - vm_domain_freecnt_dec(vmd, 1); + goto out; } - vm_domain_free_unlock(vmd); + if (vm_domain_allocate(vmd, req, 1) == 0) + m = NULL; + else + vm_reserv_populate(rv, index); +out: + vm_reserv_unlock(rv); return (m); } @@ -840,15 +895,15 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex, int domain, +vm_reserv_alloc_page(int req, vm_object_t object, vm_pindex_t pindex, int domain, vm_page_t mpred) { + struct vm_domain *vmd; vm_page_t m, msucc; vm_pindex_t first, leftcap, rightcap; vm_reserv_t rv; int index; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); VM_OBJECT_ASSERT_WLOCKED(object); /* @@ -917,15 +972,28 @@ vm_reserv_alloc_page(vm_object_t object, vm_pindex_t p /* * Allocate and populate the new reservation. */ - m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); - if (m == NULL) + m = NULL; + vmd = VM_DOMAIN(domain); + if (vm_domain_allocate(vmd, req, 1)) { + vm_domain_free_lock(vmd); + m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, + VM_LEVEL_0_ORDER); + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, 1); + return (NULL); + } + } else return (NULL); rv = vm_reserv_from_page(m); + vm_reserv_lock(rv); KASSERT(rv->pages == m, ("vm_reserv_alloc_page: reserv %p's pages is corrupted", rv)); vm_reserv_insert(rv, object, first); index = VM_RESERV_INDEX(object, pindex); vm_reserv_populate(rv, index); + vm_reserv_unlock(rv); + return (&rv->pages[index]); } @@ -942,7 +1010,9 @@ vm_reserv_break(vm_reserv_t rv) { int begin_zeroes, hi, i, lo; - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); vm_reserv_remove(rv); rv->pages->psind = 0; i = hi = 0; @@ -981,12 +1051,14 @@ vm_reserv_break(vm_reserv_t rv) if (i != NPOPMAP) /* Convert from ffsl() to ordinary bit numbering. */ hi--; + vm_domain_free_lock(VM_DOMAIN(rv->domain)); vm_phys_free_contig(&rv->pages[begin_zeroes], NBPOPMAP * i + hi - begin_zeroes); + vm_domain_free_unlock(VM_DOMAIN(rv->domain)); } while (i < NPOPMAP); KASSERT(rv->popcnt == 0, ("vm_reserv_break: reserv %p's popcnt is corrupted", rv)); - vm_reserv_broken++; + counter_u64_add(vm_reserv_broken, 1); } /* @@ -996,7 +1068,6 @@ void vm_reserv_break_all(vm_object_t object) { vm_reserv_t rv; - struct vm_domain *vmd; /* * This access of object->rvq is unsynchronized so that the @@ -1005,27 +1076,22 @@ vm_reserv_break_all(vm_object_t object) * lock prevents new additions, so we are guaranteed that when * it returns NULL the object is properly empty. */ - vmd = NULL; while ((rv = LIST_FIRST(&object->rvq)) != NULL) { - if (vmd != VM_DOMAIN(rv->domain)) { - if (vmd != NULL) - vm_domain_free_unlock(vmd); - vmd = VM_DOMAIN(rv->domain); - vm_domain_free_lock(vmd); - } + vm_reserv_lock(rv); /* Reclaim race. */ - if (rv->object != object) + if (rv->object != object) { + vm_reserv_unlock(rv); continue; - KASSERT(rv->object == object, - ("vm_reserv_break_all: reserv %p is corrupted", rv)); + } + vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; } + vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); + vm_reserv_unlock(rv); } - if (vmd != NULL) - vm_domain_free_unlock(vmd); } /* @@ -1038,13 +1104,21 @@ boolean_t vm_reserv_free_page(vm_page_t m) { vm_reserv_t rv; + boolean_t ret; rv = vm_reserv_from_page(m); if (rv->object == NULL) return (FALSE); - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); - vm_reserv_depopulate(rv, m - rv->pages); - return (TRUE); + vm_reserv_lock(rv); + /* Re-validate after lock. */ + if (rv->object != NULL) { + vm_reserv_depopulate(rv, m - rv->pages); + ret = TRUE; + } else + ret = FALSE; + vm_reserv_unlock(rv); + + return (ret); } /* @@ -1058,6 +1132,7 @@ vm_reserv_init(void) { vm_paddr_t paddr; struct vm_phys_seg *seg; + struct vm_reserv *rv; int i, segind; /* @@ -1068,15 +1143,22 @@ vm_reserv_init(void) seg = &vm_phys_segs[segind]; paddr = roundup2(seg->start, VM_LEVEL_0_SIZE); while (paddr + VM_LEVEL_0_SIZE <= seg->end) { - vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].pages = - PHYS_TO_VM_PAGE(paddr); - vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].domain = - seg->domain; + rv = &vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT]; + rv->pages = PHYS_TO_VM_PAGE(paddr); + rv->domain = seg->domain; + mtx_init(&rv->lock, "vm reserv", NULL, MTX_DEF); paddr += VM_LEVEL_0_SIZE; } } - for (i = 0; i < MAXMEMDOM; i++) + for (i = 0; i < MAXMEMDOM; i++) { + mtx_init(&vm_reserv_domain_locks[i], "VM reserv domain", NULL, + MTX_DEF); TAILQ_INIT(&vm_rvq_partpop[i]); + } + + for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) + mtx_init(&vm_reserv_object_mtx[i], "resv obj lock", NULL, + MTX_DEF); } /* @@ -1091,7 +1173,6 @@ vm_reserv_is_page_free(vm_page_t m) rv = vm_reserv_from_page(m); if (rv->object == NULL) return (false); - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); return (popmap_is_clear(rv->popmap, m - rv->pages)); } @@ -1131,7 +1212,10 @@ static void vm_reserv_reclaim(vm_reserv_t rv) { - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); + vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, @@ -1139,8 +1223,9 @@ vm_reserv_reclaim(vm_reserv_t rv) rv, rv->domain)); TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; + vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); - vm_reserv_reclaimed++; + counter_u64_add(vm_reserv_reclaimed, 1); } /* @@ -1155,9 +1240,14 @@ vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); - if ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + while ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + vm_reserv_lock(rv); + if (rv != TAILQ_FIRST(&vm_rvq_partpop[domain])) { + vm_reserv_unlock(rv); + continue; + } vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } return (FALSE); @@ -1176,14 +1266,16 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { vm_paddr_t pa, size; - vm_reserv_t rv; + vm_reserv_t rv, rvn; int hi, i, lo, low_index, next_free; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); if (npages > VM_LEVEL_0_NPAGES - 1) return (FALSE); size = npages << PAGE_SHIFT; - TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { + vm_reserv_domain_lock(domain); +again: + for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { + rvn = TAILQ_NEXT(rv, partpopq); pa = VM_PAGE_TO_PHYS(&rv->pages[VM_LEVEL_0_NPAGES - 1]); if (pa + PAGE_SIZE - size < low) { /* This entire reservation is too low; go to next. */ @@ -1194,6 +1286,17 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm /* This entire reservation is too high; go to next. */ continue; } + if (vm_reserv_trylock(rv) == 0) { + vm_reserv_domain_unlock(domain); + vm_reserv_lock(rv); + if (!rv->inpartpopq) { + vm_reserv_domain_lock(domain); + if (!rvn->inpartpopq) + goto again; + continue; + } + } else + vm_reserv_domain_unlock(domain); if (pa < low) { /* Start the search for free pages at "low". */ low_index = (low + PAGE_MASK - pa) >> PAGE_SHIFT; @@ -1239,6 +1342,7 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm if ((NBPOPMAP * i - next_free) * PAGE_SIZE >= size) { vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } hi = ffsl(rv->popmap[i]); @@ -1249,10 +1353,16 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm if ((NBPOPMAP * i + hi - next_free) * PAGE_SIZE >= size) { vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } } while (i < NPOPMAP); + vm_reserv_unlock(rv); + vm_reserv_domain_lock(domain); + if (rvn != NULL && !rvn->inpartpopq) + goto again; } + vm_reserv_domain_unlock(domain); return (FALSE); } @@ -1270,7 +1380,11 @@ vm_reserv_rename(vm_page_t m, vm_object_t new_object, VM_OBJECT_ASSERT_WLOCKED(new_object); rv = vm_reserv_from_page(m); if (rv->object == old_object) { - vm_domain_free_lock(VM_DOMAIN(rv->domain)); + vm_reserv_lock(rv); + CTR6(KTR_VM, + "%s: rv %p object %p new %p popcnt %d inpartpop %d", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Mar 22 20:21:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 730CAF6835E; Thu, 22 Mar 2018 20:21:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2432A69746; Thu, 22 Mar 2018 20:21:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F2FA1609D; Thu, 22 Mar 2018 20:21:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MKL6Pa090789; Thu, 22 Mar 2018 20:21:06 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MKL5Aa090788; Thu, 22 Mar 2018 20:21:05 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222021.w2MKL5Aa090788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 20:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331373 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:21:06 -0000 Author: sbruno Date: Thu Mar 22 20:21:05 2018 New Revision: 331373 URL: https://svnweb.freebsd.org/changeset/base/331373 Log: Improve write locking in ip6_ctloutput() with macros. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14620 Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 19:49:37 2018 (r331372) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 20:21:05 2018 (r331373) @@ -1596,23 +1596,34 @@ do { \ } while (/*CONSTCOND*/ 0) #define OPTBIT(bit) (in6p->inp_flags & (bit) ? 1 : 0) -#define OPTSET2(bit, val) do { \ - INP_WLOCK(in6p); \ +#define OPTSET2_N(bit, val) do { \ if (val) \ in6p->inp_flags2 |= bit; \ else \ in6p->inp_flags2 &= ~bit; \ +} while (0) +#define OPTSET2(bit, val) do { \ + INP_WLOCK(in6p); \ + OPTSET2_N(bit, val); \ INP_WUNLOCK(in6p); \ } while (0) #define OPTBIT2(bit) (in6p->inp_flags2 & (bit) ? 1 : 0) +#define OPTSET2292_EXCLUSIVE(bit) \ +do { \ + INP_WLOCK(in6p); \ + if (OPTBIT(IN6P_RFC2292)) { \ + error = EINVAL; \ + } else { \ + if (optval) \ + in6p->inp_flags |= (bit); \ + else \ + in6p->inp_flags &= ~(bit); \ + } \ + INP_WUNLOCK(in6p); \ +} while (/*CONSTCOND*/ 0) case IPV6_RECVPKTINFO: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_PKTINFO); + OPTSET2292_EXCLUSIVE(IN6P_PKTINFO); break; case IPV6_HOPLIMIT: @@ -1633,48 +1644,23 @@ do { \ } case IPV6_RECVHOPLIMIT: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_HOPLIMIT); + OPTSET2292_EXCLUSIVE(IN6P_HOPLIMIT); break; case IPV6_RECVHOPOPTS: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_HOPOPTS); + OPTSET2292_EXCLUSIVE(IN6P_HOPOPTS); break; case IPV6_RECVDSTOPTS: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_DSTOPTS); + OPTSET2292_EXCLUSIVE(IN6P_DSTOPTS); break; case IPV6_RECVRTHDRDSTOPTS: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_RTHDRDSTOPTS); + OPTSET2292_EXCLUSIVE(IN6P_RTHDRDSTOPTS); break; case IPV6_RECVRTHDR: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_RTHDR); + OPTSET2292_EXCLUSIVE(IN6P_RTHDR); break; case IPV6_RECVPATHMTU: @@ -1717,11 +1703,7 @@ do { \ break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_TCLASS); + OPTSET2292_EXCLUSIVE(IN6P_TCLASS); break; case IPV6_AUTOFLOWLABEL: OPTSET(IN6P_AUTOFLOWLABEL); @@ -1741,8 +1723,10 @@ do { \ case IPV6_RSS_LISTEN_BUCKET: if ((optval >= 0) && (optval < rss_getnumbuckets())) { + INP_WLOCK(in6p); in6p->inp_rss_listen_bucket = optval; - OPTSET2(INP_RSS_BUCKET_SET, 1); + OPTSET2_N(INP_RSS_BUCKET_SET, 1); + INP_WUNLOCK(in6p); } else { error = EINVAL; } From owner-svn-src-all@freebsd.org Thu Mar 22 20:44:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47C2CF6A1C6; Thu, 22 Mar 2018 20:44:26 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ABF6C6A889; Thu, 22 Mar 2018 20:44:25 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f41.google.com with SMTP id l4-v6so10854755lfg.12; Thu, 22 Mar 2018 13:44:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WDlPqANqI77ugioLd4k5c/YOghLJFg4m9EZTINy94pw=; b=KF6xV48MYPTPs3CAfa+BwTwrdVHRrVOMLoEgfDdu2YNdjZFyzi88c0M4XwqX7MjKbp 1g9xv8Kj41yl4Nv3z6I4xbNtRvfB2Rt2b/bqrLr4sb0IDoXKdMBDCUNdrA9aaZefIhpW lbLENfe4sl5k3PzOY8+obQitou36vWEePDiq6g6OqQgARf3HFvMERLwXd4824Xf4EUTP fbdZKbYyS9yCqgYMi8r3ZEiBz7Yj/3QndUwWuKsjRSjdff4efJuHadszP/PvNr6/F5in qTYAZVst52JnOcunvaXOHUKGQ0GI0M/WnQtnRHHpvHWRBPJgOZgTusQ6emWdQk79Hizm 6L7g== X-Gm-Message-State: AElRT7Gtl9XhIdjhYofq3hN8TY9myqwFcf8xWNJ96bcFvHSot6JDj4xn W9pRihrFXB7TRmh6wry2wekoxRFch0I= X-Google-Smtp-Source: AG47ELuuFjNXfiRRHfdSyjzq/ZJUk3Jaim2yA19Iq0PC+kLxAyB4LE1b/RjmQ51XDJuBMMFALJ+zBA== X-Received: by 2002:a19:1d12:: with SMTP id d18-v6mr17026281lfd.128.1521751457978; Thu, 22 Mar 2018 13:44:17 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id 94-v6sm1831371lft.85.2018.03.22.13.44.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 13:44:17 -0700 (PDT) Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Jonathan Looney , Ruslan Bukin Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> From: Andriy Gapon Message-ID: <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> Date: Thu, 22 Mar 2018 22:44:15 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:44:26 -0000 On 22/03/2018 17:39, Jonathan Looney wrote: > A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it is OK. > > Yes, this can be made optional, if there is a need for that. > FWWI, TARGET=powerpc TARGET_ARCH=powerpc build failed for me. cc1: warnings being treated as errors /usr/devel/svn/head/sys/netinet/tcp_log_buf.c: In function 'tcp_log_selectauto': /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: implicit declaration of function 'atomic_fetchadd_64' /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: nested extern declaration of 'atomic_fetchadd_64' [-Wnested-externs] -- Andriy Gapon From owner-svn-src-all@freebsd.org Thu Mar 22 20:44:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19282F6A1D4; Thu, 22 Mar 2018 20:44:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C0B8D6A88D; Thu, 22 Mar 2018 20:44:27 +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 A17D016423; Thu, 22 Mar 2018 20:44:27 +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 w2MKiRs4003854; Thu, 22 Mar 2018 20:44:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MKiRDZ003853; Thu, 22 Mar 2018 20:44:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803222044.w2MKiRDZ003853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 22 Mar 2018 20:44:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331374 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 331374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:44:28 -0000 Author: kib Date: Thu Mar 22 20:44:27 2018 New Revision: 331374 URL: https://svnweb.freebsd.org/changeset/base/331374 Log: Fixes for ptrace(PT_GETXSTATE_INFO) related to the padding in struct ptrace_xstate_info). struct ptrace_xstate_info has 64bit member but ends up with 32bit one. As result, on amd64 there is a 32bit padding at the end, but not on i386. We must clear the padding before doing the copyout. For compat32 case, we must copyout the structure which does not have the padding at the end. The later fixes 32bit gdb display of the YMM registers when running on amd64 kernel. Reported by: Vlad Tsyrklevich Reviewed by: brooks (previous version) Sponsored by: The FreeBSD Foundation admbugs: 765 MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14794 Modified: head/sys/amd64/amd64/ptrace_machdep.c Modified: head/sys/amd64/amd64/ptrace_machdep.c ============================================================================== --- head/sys/amd64/amd64/ptrace_machdep.c Thu Mar 22 20:21:05 2018 (r331373) +++ head/sys/amd64/amd64/ptrace_machdep.c Thu Mar 22 20:44:27 2018 (r331374) @@ -45,10 +45,20 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef COMPAT_FREEBSD32 +struct ptrace_xstate_info32 { + uint32_t xsave_mask1, xsave_mask2; + uint32_t xsave_len; +}; +#endif + static int cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data) { struct ptrace_xstate_info info; +#ifdef COMPAT_FREEBSD32 + struct ptrace_xstate_info32 info32; +#endif char *savefpu; int error; @@ -78,13 +88,28 @@ cpu_ptrace_xstate(struct thread *td, int req, void *ad break; case PT_GETXSTATE_INFO: - if (data != sizeof(info)) { - error = EINVAL; - break; +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + if (data != sizeof(info32)) { + error = EINVAL; + } else { + info32.xsave_len = cpu_max_ext_state_size; + info32.xsave_mask1 = xsave_mask; + info32.xsave_mask2 = xsave_mask >> 32; + error = copyout(&info32, addr, data); + } + } else +#endif + { + if (data != sizeof(info)) { + error = EINVAL; + } else { + bzero(&info, sizeof(info)); + info.xsave_len = cpu_max_ext_state_size; + info.xsave_mask = xsave_mask; + error = copyout(&info, addr, data); + } } - info.xsave_len = cpu_max_ext_state_size; - info.xsave_mask = xsave_mask; - error = copyout(&info, addr, data); break; case PT_GETXSTATE: From owner-svn-src-all@freebsd.org Thu Mar 22 20:47:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D38F8F6A663; Thu, 22 Mar 2018 20:47:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 774996AC32; Thu, 22 Mar 2018 20:47:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70A9916437; Thu, 22 Mar 2018 20:47:25 +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 w2MKlPHj004000; Thu, 22 Mar 2018 20:47:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MKlPrQ003999; Thu, 22 Mar 2018 20:47:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803222047.w2MKlPrQ003999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 22 Mar 2018 20:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331375 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:47:26 -0000 Author: kib Date: Thu Mar 22 20:47:25 2018 New Revision: 331375 URL: https://svnweb.freebsd.org/changeset/base/331375 Log: Do not send signals to init directly from shutdown_nice(9), do it from the task context. shutdown_nice() is used from the fast interrupt handlers, mostly for console drivers, where we cannot lock blockable locks. Schedule the task in the fast queue to send the signal from the proper context. Reviewed by: imp Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Mar 22 20:44:27 2018 (r331374) +++ head/sys/kern/kern_shutdown.c Thu Mar 22 20:47:25 2018 (r331375) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) return (error); } +static void +shutdown_nice_task_fn(void *arg, int pending __unused) +{ + int howto; + + howto = (uintptr_t)arg; + /* Send a signal to init(8) and have it shutdown the world. */ + PROC_LOCK(initproc); + if (howto & RB_POWEROFF) + kern_psignal(initproc, SIGUSR2); + else if (howto & RB_POWERCYCLE) + kern_psignal(initproc, SIGWINCH); + else if (howto & RB_HALT) + kern_psignal(initproc, SIGUSR1); + else + kern_psignal(initproc, SIGINT); + PROC_UNLOCK(initproc); +} + +static struct task shutdown_nice_task = TASK_INITIALIZER(0, + &shutdown_nice_task_fn, NULL); + /* * Called by events that want to shut down.. e.g on a PC */ @@ -283,20 +306,14 @@ void shutdown_nice(int howto) { - if (initproc != NULL) { - /* Send a signal to init(8) and have it shutdown the world. */ - PROC_LOCK(initproc); - if (howto & RB_POWEROFF) - kern_psignal(initproc, SIGUSR2); - else if (howto & RB_POWERCYCLE) - kern_psignal(initproc, SIGWINCH); - else if (howto & RB_HALT) - kern_psignal(initproc, SIGUSR1); - else - kern_psignal(initproc, SIGINT); - PROC_UNLOCK(initproc); + if (initproc != NULL && !SCHEDULER_STOPPED()) { + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); } else { - /* No init(8) running, so simply reboot. */ + /* + * No init(8) running, or scheduler would not allow it + * to run, so simply reboot. + */ kern_reboot(howto | RB_NOSYNC); } } From owner-svn-src-all@freebsd.org Thu Mar 22 21:06:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8573F6C0D2; Thu, 22 Mar 2018 21:06:02 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F9CD6BB2D; Thu, 22 Mar 2018 21:06:02 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x22e.google.com with SMTP id z143-v6so15266186lff.3; Thu, 22 Mar 2018 14:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/bzaCmnkkanJC2WkgWLAxsgS/KtHmZFKmJ1pypjyGTc=; b=lUKshBA8MaYz2RQtuLQICdzPlK6Dtvo7QIuBIWQNS3pj9hIgq6RizIwonJuWCxCROi +3Ior6aGJS/x8euIa0DHpoxWkfjUtsIiNJUHNETExY6aKaPqorcHRi+AuLB4JwdCcbmo A93sJzj58gxIFZvsXFw18PSJYj/frAIs7GSxxOtprwKtJMW99XfqqeyFRypDjwFLeE4+ oLeF7CZGWGOB1FINTw841KWcNQJOg/b9neyeN4M0dzzjKAJtaNkWuqnygmSl/u2U61a/ Y+73LxldLNaLsBfvEnQERGO4ngWMg77sY6vAHeNjAmsn1FdL9t+zfsF6kOG+V53AM9jt FOPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/bzaCmnkkanJC2WkgWLAxsgS/KtHmZFKmJ1pypjyGTc=; b=DRWu3+QoEGRwm1XZBHcNWWuMiqLdFSUkPks6lf6kqyNmzV8/AdJRQ5P1gxP93Wwpbe 5ur4itFBjnMCUEWXl4eujDaHWDQvVTsYBrVhXxCPhQcFkWd7GNkqClGtwM1KFc+X+Hu4 sqD5JOkDBqqqVonuK7n4TIafpmyPkWUEolCxat9hJ1psDJ/yXlmxUFJO8G+3BvX1rC0X IVAa4iJrbw3i4+g5E1RjcPCgrx0taeVKjTkkw1YrMTKj9rPWdt1d+HNZg3PLmYxZQzB7 SoGwkw5C6iQUQ6jOHfXg0EJfwHuYKHTyGB491On3O1xKoxJnjunzyBvP2kGRdJq2RBA7 ecuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=/bzaCmnkkanJC2WkgWLAxsgS/KtHmZFKmJ1pypjyGTc=; b=N3L2pXCzpjZUREQ+MFQVsQR+J6ZSS/tNlr+oh930DMNZffkiUpUxW+Bigk4SHKd+vG zevc3jlIFUcp7ZsY/YHP94HpJCUXGWyTd3TvsbWpsqvYd5383uF4qqvy2jKvGlnoJurP HX5BB7hwA8cWiQgdcZ1aNyp06CKBydWDATqyd1/NB1iMom0gYC22K7Wvo0cL5/FiwOgY S8gEOIptOwcAcUEERMoVpPYXqBuUrQz8gj3wxcJN+YCT/rUDw/emW2J3e/htFAwqy0+Q 3FM5s9kl6DNRUh7niNLAEtq+HoKTXOmG9qFvQcVFnbfrriE9ncRIuSp24+AGsNTM5dyX avUg== X-Gm-Message-State: AElRT7FEAz4gWHZnda4sRDF5M8v8HwgyLKNQcOV2Y/Yfw/NQW+dH0zNF 71witZB5t/wYN/yMcIP8EMVzzOisf1xLTu5UCEQ= X-Google-Smtp-Source: AG47ELukVoDTBzmNfAOJaJDwvEE7hd1Xd/l9SEICFrLztZzBjECc/kgSkgIWsk6+zcaxGtAAZxcGpEC73kNwXfk4N1E= X-Received: by 2002:a19:d50e:: with SMTP id m14-v6mr12449145lfg.5.1521752760425; Thu, 22 Mar 2018 14:06:00 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.46.85.13 with HTTP; Thu, 22 Mar 2018 14:05:59 -0700 (PDT) In-Reply-To: <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> From: Justin Hibbits Date: Thu, 22 Mar 2018 16:05:59 -0500 X-Google-Sender-Auth: bu-bEA5kFeU8EjRXKq62tEmPc0c Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Andriy Gapon Cc: Jonathan Looney , Ruslan Bukin , "Jonathan T. Looney" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 21:06:03 -0000 On Thu, Mar 22, 2018 at 3:44 PM, Andriy Gapon wrote: > On 22/03/2018 17:39, Jonathan Looney wrote: >> A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it is OK. >> >> Yes, this can be made optional, if there is a need for that. >> > > FWWI, TARGET=powerpc TARGET_ARCH=powerpc build failed for me. > > cc1: warnings being treated as errors > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c: In function 'tcp_log_selectauto': > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: implicit declaration > of function 'atomic_fetchadd_64' > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: nested extern > declaration of 'atomic_fetchadd_64' [-Wnested-externs] > > -- > Andriy Gapon > mips complains, too. Check out https://ci.freebsd.org/tinderbox . - Justin From owner-svn-src-all@freebsd.org Thu Mar 22 21:18:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64897F6D0B0; Thu, 22 Mar 2018 21:18:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 164236C3B4; Thu, 22 Mar 2018 21:18:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1133D168D1; Thu, 22 Mar 2018 21:18:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MLIYeK019125; Thu, 22 Mar 2018 21:18:34 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MLIYIm019124; Thu, 22 Mar 2018 21:18:34 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222118.w2MLIYIm019124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 21:18:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331376 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 21:18:35 -0000 Author: sbruno Date: Thu Mar 22 21:18:34 2018 New Revision: 331376 URL: https://svnweb.freebsd.org/changeset/base/331376 Log: Handle locking and memory safety for IPV6_PATHMTU in ip6_ctloutput(). Submitted by: Jason Eggleston Reviewed by: ae Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14622 Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 20:47:25 2018 (r331375) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 21:18:34 2018 (r331376) @@ -2053,6 +2053,7 @@ do { \ { u_long pmtu = 0; struct ip6_mtuinfo mtuinfo; + struct in6_addr addr; if (!(so->so_state & SS_ISCONNECTED)) return (ENOTCONN); @@ -2060,9 +2061,14 @@ do { \ * XXX: we dot not consider the case of source * routing, or optional information to specify * the outgoing interface. + * Copy faddr out of in6p to avoid holding lock + * on inp during route lookup. */ + INP_RLOCK(in6p); + bcopy(&in6p->in6p_faddr, &addr, sizeof(addr)); + INP_RUNLOCK(in6p); error = ip6_getpmtu_ctl(so->so_fibnum, - &in6p->in6p_faddr, &pmtu); + &addr, &pmtu); if (error) break; if (pmtu > IPV6_MAXPACKET) From owner-svn-src-all@freebsd.org Thu Mar 22 21:25:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 484DBF6D99E; Thu, 22 Mar 2018 21:25:34 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com [IPv6:2a00:1450:4010:c07::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BE746C98D; Thu, 22 Mar 2018 21:25:33 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x22a.google.com with SMTP id m16-v6so11588686lfc.4; Thu, 22 Mar 2018 14:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=dCTFzcYAWBlh5KFSliE6F/kmzRf+zl+Ez+vwf28Bj+6ylk9PM8wPoQ5Oj8+c4TI5g4 PNvkQpZC0ftM7u+s4YgdPV6ntrbAu/xCK/4gEFmWD/S6tJ3PaBa8ISXReRE2kag6N/OH fXEJibi8KstFbY5pq6fh1C8oir9BeI2PaQEe6G8jk3zCi4kDkaUYw/pVVFwPbJuDsq8r pBSPpjQ/esVHVoIK+DdmKJmDpDRsnqkBXedfawK3OLlDpvJ2+SfbC2VWdrH9GfuXrVnF C4YFceDiQK4hQzwa0LweouvIm+dcaMkXAphoWmiK/RJi+MCGht54KVhYbS1krClr4Jg6 CEKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=QAP89QRxSV0FaJw2PMVT7n3reDkNNBHFtppCrsc9KRX/Ryumc8NKV5O3+fV2iyXfL2 nGfrr5texE3pxa91xuAmZK5UO7dfg3ny8KwN0HoS5p/zZLEgsBZxJP/O6sOqne2AWXEY OyyIVpDX1Qw41Q3LpUpcva3h4ouo6rf36XHRJ+bxPePqzkomqswhXV94YQqmzgnbShrm itFDb+3mg8HtBqMbXpdApqCw2rc2BY1D3WA00eNZSpuHfqVeamyTZCMXEZXdKqYzgomz g5Wy2n80m0reBtsPo13LURxEPfwDBRiGAhVC/fmi+9s4RKld3dvyRkSPVxkYOHZhLZMl gIOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=Tcdk5O0rPMMcCsRMcjfn+et9AmOsNdhX3OTStUZEqXszPbTUG+MWNgznsjDd2LkEri 8eC5/s5W6VoHVifknHAd1uYXd/hSh4l0+SSvVKTjuh+U6bMxhZ2+vjhzp5AYLRa0aIDr PB1Rs8s4Lo6149eeCuzdHnFSU1DI/OuguOpUz6Wbn71c//Fd5xtzZ4ZE1Xm2r6ZSPSF7 DJEWroj3JggAEPi8cXM8OHoGiRhQe/8DhCsBGNk4olvM1yA8KXJz++vCCLci6W040Unl YfbxLE6LKvMlGgRrRYSvmPn78+1TSNUZU68Lz6yc+zjvElQKg3GAkpfz5VtLfa5Y0iZa CsMw== X-Gm-Message-State: AElRT7FhEcnOmuKpOSI357IGEWcVCsG2aldMixoaFUoF69R4R4Jt7lmY I7vXaljS5iXSF7JR/rk4+g9Eg5TpNWJSLwtN+rb90Q== X-Google-Smtp-Source: AG47ELvC0Rz8U3R32LPwLd2RGlo4ZRZURz4bA5AGFGR+2zR1ZwpfodIE4YuQ6/34MgYHYaB6H3NokNWBCCtpz4doeLE= X-Received: by 10.46.60.23 with SMTP id j23mr17175110lja.18.1521753931414; Thu, 22 Mar 2018 14:25:31 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.46.85.13 with HTTP; Thu, 22 Mar 2018 14:25:30 -0700 (PDT) In-Reply-To: <201803221921.w2MJLBi7058560@repo.freebsd.org> References: <201803221921.w2MJLBi7058560@repo.freebsd.org> From: Justin Hibbits Date: Thu, 22 Mar 2018 16:25:30 -0500 X-Google-Sender-Auth: cNNp4cKer7YtozdbquVcyAogTe4 Message-ID: Subject: Re: svn commit: r331369 - head/sys/vm To: Jeff Roberson Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 21:25:34 -0000 This broke gcc builds. On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > Author: jeff > Date: Thu Mar 22 19:21:11 2018 > New Revision: 331369 > URL: https://svnweb.freebsd.org/changeset/base/331369 > > Log: > Lock reservations with a dedicated lock in each reservation. Protect the > vmd_free_count with atomics. > > This allows us to allocate and free from reservations without the free lock > except where a superpage is allocated from the physical layer, which is > roughly 1/512 of the operations on amd64. > > Use the counter api to eliminate cache conention on counters. > > Reviewed by: markj > Tested by: pho > Sponsored by: Netflix, Dell/EMC Isilon > Differential Revision: https://reviews.freebsd.org/D14707 > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_pagequeue.h > head/sys/vm/vm_reserv.c > head/sys/vm/vm_reserv.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) > +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) > @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > static void vm_page_alloc_check(vm_page_t m); > static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); > static void vm_page_enqueue(uint8_t queue, vm_page_t m); > -static void vm_page_free_phys(struct vm_domain *vmd, 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); > @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi > * for the request class and false otherwise. > */ > int > -vm_domain_available(struct vm_domain *vmd, int req, int npages) > +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > { > + u_int limit, old, new; > > - vm_domain_free_assert_locked(vmd); > req = req & VM_ALLOC_CLASS_MASK; > > /* > @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req, in > */ > if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > req = VM_ALLOC_SYSTEM; > + if (req == VM_ALLOC_INTERRUPT) > + limit = 0; > + else if (req == VM_ALLOC_SYSTEM) > + limit = vmd->vmd_interrupt_free_min; > + else > + limit = vmd->vmd_free_reserved; > > - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > - (req == VM_ALLOC_SYSTEM && > - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || > - (req == VM_ALLOC_INTERRUPT && > - vmd->vmd_free_count >= npages)) > - return (1); > + /* > + * Attempt to reserve the pages. Fail if we're below the limit. > + */ > + limit += npages; > + old = vmd->vmd_free_count; > + do { > + if (old < limit) > + return (0); > + new = old - npages; > + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0); > > - return (0); > + /* Wake the page daemon if we've crossed the threshold. */ > + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > + pagedaemon_wakeup(vmd->vmd_domain); > + > + /* Only update bitsets on transitions. */ > + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > + vm_domain_set(vmd); > + > + return (1); > } > > vm_page_t > @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind > again: > m = NULL; > #if VM_NRESERVLEVEL > 0 > + /* > + * Can we allocate the page from a reservation? > + */ > if (vm_object_reserv(object) && > - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > - != NULL) { > + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || > + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { > domain = vm_phys_domain(m); > vmd = VM_DOMAIN(domain); > goto found; > } > #endif > vmd = VM_DOMAIN(domain); > - vm_domain_free_lock(vmd); > - if (vm_domain_available(vmd, req, 1)) { > + if (vm_domain_allocate(vmd, req, 1)) { > /* > - * Can we allocate the page from a reservation? > + * If not, allocate it from the free page queues. > */ > + vm_domain_free_lock(vmd); > + m = vm_phys_alloc_pages(domain, object != NULL ? > + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > + vm_domain_free_unlock(vmd); > + if (m == NULL) { > + vm_domain_freecnt_inc(vmd, 1); > #if VM_NRESERVLEVEL > 0 > - if (!vm_object_reserv(object) || > - (m = vm_reserv_alloc_page(object, pindex, > - domain, mpred)) == NULL) > + if (vm_reserv_reclaim_inactive(domain)) > + goto again; > #endif > - { > - /* > - * If not, allocate it from the free page queues. > - */ > - m = vm_phys_alloc_pages(domain, object != NULL ? > - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > -#if VM_NRESERVLEVEL > 0 > - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { > - m = vm_phys_alloc_pages(domain, > - object != NULL ? > - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, > - 0); > - } > -#endif > } > } > - if (m != NULL) > - vm_domain_freecnt_dec(vmd, 1); > - vm_domain_free_unlock(vmd); > if (m == NULL) { > /* > * Not allocatable, give up. > @@ -1775,9 +1783,7 @@ again: > */ > KASSERT(m != NULL, ("missing page")); > > -#if VM_NRESERVLEVEL > 0 > found: > -#endif 'found' is now declared, but unused on powerpc64. - Justin From owner-svn-src-all@freebsd.org Thu Mar 22 22:13:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A120F4D583; Thu, 22 Mar 2018 22:13:47 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B97626E7A8; Thu, 22 Mar 2018 22:13:46 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B19A11726B; Thu, 22 Mar 2018 22:13:46 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MMDk9w048459; Thu, 22 Mar 2018 22:13:46 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MMDk07048458; Thu, 22 Mar 2018 22:13:46 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201803222213.w2MMDk07048458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Thu, 22 Mar 2018 22:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331378 - head/sys/dev/bhnd/nvram X-SVN-Group: head X-SVN-Commit-Author: landonf X-SVN-Commit-Paths: head/sys/dev/bhnd/nvram X-SVN-Commit-Revision: 331378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 22:13:47 -0000 Author: landonf Date: Thu Mar 22 22:13:46 2018 New Revision: 331378 URL: https://svnweb.freebsd.org/changeset/base/331378 Log: Add missing NULL checks when calling malloc(M_NOWAIT) in bhnd_nv_strdup/bhnd_nv_strndup. If malloc(9) failed during initial bhnd(4) attach, while allocating the root NVRAM path string ("/"), the returned NULL pointer would be passed as the destination to memcpy(). Reported by: Ilja Van Sprundel Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_private.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Thu Mar 22 21:57:10 2018 (r331377) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Thu Mar 22 22:13:46 2018 (r331378) @@ -91,6 +91,9 @@ bhnd_nv_strdup(const char *str) len = strlen(str); dest = malloc(len + 1, M_BHND_NVRAM, M_NOWAIT); + if (dest == NULL) + return (NULL); + memcpy(dest, str, len); dest[len] = '\0'; @@ -105,6 +108,9 @@ bhnd_nv_strndup(const char *str, size_t len) len = strnlen(str, len); dest = malloc(len + 1, M_BHND_NVRAM, M_NOWAIT); + if (dest == NULL) + return (NULL); + memcpy(dest, str, len); dest[len] = '\0'; From owner-svn-src-all@freebsd.org Thu Mar 22 22:29:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1A6CF4EA6B; Thu, 22 Mar 2018 22:29:32 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F73A6F629; Thu, 22 Mar 2018 22:29:32 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98AE21740C; Thu, 22 Mar 2018 22:29:32 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MMTWIW054630; Thu, 22 Mar 2018 22:29:32 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MMTWWx054627; Thu, 22 Mar 2018 22:29:32 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222229.w2MMTWWx054627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 22:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331379 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 331379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 22:29:33 -0000 Author: sbruno Date: Thu Mar 22 22:29:32 2018 New Revision: 331379 URL: https://svnweb.freebsd.org/changeset/base/331379 Log: Simple locking fixes in ip_ctloutput, ip6_ctloutput, rip_ctloutput. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14624 Modified: head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Mar 22 22:13:46 2018 (r331378) +++ head/sys/netinet/ip_output.c Thu Mar 22 22:29:32 2018 (r331379) @@ -1314,12 +1314,14 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; case IP_PORTRANGE: + INP_RLOCK(inp); if (inp->inp_flags & INP_HIGHPORT) optval = IP_PORTRANGE_HIGH; else if (inp->inp_flags & INP_LOWPORT) optval = IP_PORTRANGE_LOW; else optval = 0; + INP_RUNLOCK(inp); break; case IP_ONESBCAST: @@ -1345,9 +1347,11 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; #ifdef RSS case IP_RSSBUCKETID: + INP_RLOCK(inp); retval = rss_hash2bucket(inp->inp_flowid, inp->inp_flowtype, &rss_bucket); + INP_RUNLOCK(inp); if (retval == 0) optval = rss_bucket; else Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Thu Mar 22 22:13:46 2018 (r331378) +++ head/sys/netinet/raw_ip.c Thu Mar 22 22:29:32 2018 (r331379) @@ -639,10 +639,12 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt) sizeof optval); if (error) break; + INP_WLOCK(inp); if (optval) inp->inp_flags |= INP_HDRINCL; else inp->inp_flags &= ~INP_HDRINCL; + INP_WUNLOCK(inp); break; case IP_FW3: /* generic ipfw v.3 functions */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 22:13:46 2018 (r331378) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 22:29:32 2018 (r331379) @@ -1498,8 +1498,10 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt) error = soopt_mcopyin(sopt, m); /* XXX */ if (error != 0) break; + INP_WLOCK(in6p); error = ip6_pcbopts(&in6p->in6p_outputopts, m, so, sopt); + INP_WUNLOCK(in6p); m_freem(m); /* XXX */ break; } @@ -1635,11 +1637,13 @@ do { \ error = EINVAL; break; } + INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(IPV6_HOPLIMIT, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); + INP_WUNLOCK(in6p); break; } @@ -1690,8 +1694,10 @@ do { \ * available only prior to bind(2). * see ipng mailing list, Jun 22 2001. */ + INP_WLOCK(in6p); if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { + INP_WUNLOCK(in6p); error = EINVAL; break; } @@ -1700,6 +1706,7 @@ do { \ in6p->inp_vflag &= ~INP_IPV4; else in6p->inp_vflag |= INP_IPV4; + INP_WUNLOCK(in6p); break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ @@ -1749,11 +1756,13 @@ do { \ break; { struct ip6_pktopts **optp; + INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); + INP_WUNLOCK(in6p); break; } @@ -1818,12 +1827,6 @@ do { \ int optlen; struct ip6_pktopts **optp; - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - /* * We only ensure valsize is not too large * here. Further validation will be done @@ -1833,12 +1836,21 @@ do { \ sizeof(optbuf_storage), 0); if (error) break; + + INP_WLOCK(in6p); + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + INP_WUNLOCK(in6p); + error = EINVAL; + break; + } optlen = sopt->sopt_valsize; optbuf = optbuf_storage; optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, optbuf, optlen, optp, (td != NULL) ? td->td_ucred : NULL, uproto); + INP_WUNLOCK(in6p); break; } #undef OPTSET @@ -2023,10 +2035,12 @@ do { \ break; #ifdef RSS case IPV6_RSSBUCKETID: + INP_RLOCK(in6p); retval = rss_hash2bucket(in6p->inp_flowid, in6p->inp_flowtype, &rss_bucket); + INP_RUNLOCK(in6p); if (retval == 0) optval = rss_bucket; else @@ -2230,6 +2244,8 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf * int error = 0; struct thread *td = sopt->sopt_td; + INP_WLOCK_ASSERT(sotoinpcb(so)); + /* turn off any old options. */ if (opt) { #ifdef DIAGNOSTIC @@ -3073,6 +3089,8 @@ int ip6_optlen(struct inpcb *in6p) { int len; + + INP_WLOCK_ASSERT(in6p); if (!in6p->in6p_outputopts) return 0; From owner-svn-src-all@freebsd.org Thu Mar 22 23:34:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D090FF534E8; Thu, 22 Mar 2018 23:34:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8261C719C0; Thu, 22 Mar 2018 23:34:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7968317F5A; Thu, 22 Mar 2018 23:34:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNYm5u089613; Thu, 22 Mar 2018 23:34:48 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNYma9089612; Thu, 22 Mar 2018 23:34:48 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222334.w2MNYma9089612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 23:34:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331380 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:34:49 -0000 Author: sbruno Date: Thu Mar 22 23:34:48 2018 New Revision: 331380 URL: https://svnweb.freebsd.org/changeset/base/331380 Log: Refactor ip6_getpcbopt() for better locking and memory management Created GET_PKTOPT_EXT_HDR() and GET_PKTOPT_SOCKADDR() macros to handle safely fetching options from in6p_outputopts, including properly dealing with in6p locking and preparing memory for sooptcopyout(). Changed the function signature of ip6_getpcbopt() to allow the function to acquire and release locks on in6p as needed. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14619 Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 22:29:32 2018 (r331379) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 23:34:48 2018 (r331380) @@ -135,7 +135,7 @@ static int ip6_pcbopt(int, u_char *, int, struct ip6_p struct ucred *, int); static int ip6_pcbopts(struct ip6_pktopts **, struct mbuf *, struct socket *, struct sockopt *); -static int ip6_getpcbopt(struct ip6_pktopts *, int, struct sockopt *); +static int ip6_getpcbopt(struct inpcb *, int, struct sockopt *); static int ip6_setpktopt(int, u_char *, int, struct ip6_pktopts *, struct ucred *, int, int, int); @@ -2132,8 +2132,7 @@ do { \ case IPV6_DONTFRAG: case IPV6_USE_MIN_MTU: case IPV6_PREFER_TEMPADDR: - error = ip6_getpcbopt(in6p->in6p_outputopts, - optname, sopt); + error = ip6_getpcbopt(in6p, optname, sopt); break; case IPV6_MULTICAST_IF: @@ -2310,18 +2309,51 @@ ip6_pcbopt(int optname, u_char *buf, int len, struct i return (ip6_setpktopt(optname, buf, len, opt, cred, 1, 0, uproto)); } +#define GET_PKTOPT_VAR(field, lenexpr) do { \ + if (pktopt && pktopt->field) { \ + INP_RUNLOCK(in6p); \ + optdata = malloc(sopt->sopt_valsize, M_TEMP, M_WAITOK); \ + malloc_optdata = true; \ + INP_RLOCK(in6p); \ + if (in6p->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \ + INP_RUNLOCK(in6p); \ + free(optdata, M_TEMP); \ + return (ECONNRESET); \ + } \ + pktopt = in6p->in6p_outputopts; \ + if (pktopt && pktopt->field) { \ + optdatalen = min(lenexpr, sopt->sopt_valsize); \ + bcopy(&pktopt->field, optdata, optdatalen); \ + } else { \ + free(optdata, M_TEMP); \ + optdata = NULL; \ + malloc_optdata = false; \ + } \ + } \ +} while(0) + +#define GET_PKTOPT_EXT_HDR(field) GET_PKTOPT_VAR(field, \ + (((struct ip6_ext *)pktopt->field)->ip6e_len + 1) << 3) + +#define GET_PKTOPT_SOCKADDR(field) GET_PKTOPT_VAR(field, \ + pktopt->field->sa_len) + static int -ip6_getpcbopt(struct ip6_pktopts *pktopt, int optname, struct sockopt *sopt) +ip6_getpcbopt(struct inpcb *in6p, int optname, struct sockopt *sopt) { void *optdata = NULL; + bool malloc_optdata = false; int optdatalen = 0; - struct ip6_ext *ip6e; int error = 0; struct in6_pktinfo null_pktinfo; int deftclass = 0, on; int defminmtu = IP6PO_MINMTU_MCASTONLY; int defpreftemp = IP6PO_TEMPADDR_SYSTEM; + struct ip6_pktopts *pktopt; + INP_RLOCK(in6p); + pktopt = in6p->in6p_outputopts; + switch (optname) { case IPV6_PKTINFO: optdata = (void *)&null_pktinfo; @@ -2337,50 +2369,29 @@ ip6_getpcbopt(struct ip6_pktopts *pktopt, int optname, break; case IPV6_TCLASS: if (pktopt && pktopt->ip6po_tclass >= 0) - optdata = (void *)&pktopt->ip6po_tclass; - else - optdata = (void *)&deftclass; + deftclass = pktopt->ip6po_tclass; + optdata = (void *)&deftclass; optdatalen = sizeof(int); break; case IPV6_HOPOPTS: - if (pktopt && pktopt->ip6po_hbh) { - optdata = (void *)pktopt->ip6po_hbh; - ip6e = (struct ip6_ext *)pktopt->ip6po_hbh; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_hbh); break; case IPV6_RTHDR: - if (pktopt && pktopt->ip6po_rthdr) { - optdata = (void *)pktopt->ip6po_rthdr; - ip6e = (struct ip6_ext *)pktopt->ip6po_rthdr; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_rthdr); break; case IPV6_RTHDRDSTOPTS: - if (pktopt && pktopt->ip6po_dest1) { - optdata = (void *)pktopt->ip6po_dest1; - ip6e = (struct ip6_ext *)pktopt->ip6po_dest1; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_dest1); break; case IPV6_DSTOPTS: - if (pktopt && pktopt->ip6po_dest2) { - optdata = (void *)pktopt->ip6po_dest2; - ip6e = (struct ip6_ext *)pktopt->ip6po_dest2; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_dest2); break; case IPV6_NEXTHOP: - if (pktopt && pktopt->ip6po_nexthop) { - optdata = (void *)pktopt->ip6po_nexthop; - optdatalen = pktopt->ip6po_nexthop->sa_len; - } + GET_PKTOPT_SOCKADDR(ip6po_nexthop); break; case IPV6_USE_MIN_MTU: if (pktopt) - optdata = (void *)&pktopt->ip6po_minmtu; - else - optdata = (void *)&defminmtu; + defminmtu = pktopt->ip6po_minmtu; + optdata = (void *)&defminmtu; optdatalen = sizeof(int); break; case IPV6_DONTFRAG: @@ -2393,19 +2404,22 @@ ip6_getpcbopt(struct ip6_pktopts *pktopt, int optname, break; case IPV6_PREFER_TEMPADDR: if (pktopt) - optdata = (void *)&pktopt->ip6po_prefer_tempaddr; - else - optdata = (void *)&defpreftemp; + defpreftemp = pktopt->ip6po_prefer_tempaddr; + optdata = (void *)&defpreftemp; optdatalen = sizeof(int); break; default: /* should not happen */ #ifdef DIAGNOSTIC panic("ip6_getpcbopt: unexpected option\n"); #endif + INP_RUNLOCK(in6p); return (ENOPROTOOPT); } + INP_RUNLOCK(in6p); error = sooptcopyout(sopt, optdata, optdatalen); + if (malloc_optdata) + free(optdata, M_TEMP); return (error); } From owner-svn-src-all@freebsd.org Thu Mar 22 23:38:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11084F53902; Thu, 22 Mar 2018 23:38:04 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA27F71D1C; Thu, 22 Mar 2018 23:38:03 +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 B50F217FE6; Thu, 22 Mar 2018 23:38:03 +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 w2MNc373089802; Thu, 22 Mar 2018 23:38:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNc3Do089801; Thu, 22 Mar 2018 23:38:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222338.w2MNc3Do089801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331381 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:38:04 -0000 Author: mav Date: Thu Mar 22 23:38:03 2018 New Revision: 331381 URL: https://svnweb.freebsd.org/changeset/base/331381 Log: MFC r329505: MFV r323911: 8502 illumos#7955 broke delegated datasets when libshare is not present illumos/illumos-gate@1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://github.com/illumos/illumos-gate/commit/1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://www.illumos.org/issues/8502 The code in lib/libzfs/common/libzfs_mount.c already basically handles the case when libshare is not installed. We just need to not fail in zfs_init_libshare_impl. I tested this in lx and things work as expected. I also tested there trying to set sharenfs and sharesmb on the delegated dataset. Neither is allowed from within a zone. The spew of msgs from a native zone is not ZFS specific. I see the same spew simply running the share command. Reviewed by: Robert Mustacchi Reviewed by: Yuri Pankov Approved by: Richard Lowe Author: Jerry Jelinek Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:34:48 2018 (r331380) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:38:03 2018 (r331381) @@ -24,6 +24,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov + * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. */ @@ -610,8 +611,14 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic int ret = SA_OK; #ifdef illumos + /* + * libshare is either not installed or we're in a branded zone. The + * rest of the wrapper functions around the libshare calls already + * handle NULL function pointers, but we don't want the callers of + * zfs_init_libshare() to fail prematurely if libshare is not available. + */ if (_sa_init == NULL) - ret = SA_CONFIG_ERR; + return (SA_OK); if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { /* From owner-svn-src-all@freebsd.org Thu Mar 22 23:39:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C2D4F53B25; Thu, 22 Mar 2018 23:39:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 493ED71EC7; Thu, 22 Mar 2018 23:39:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E13017FE7; Thu, 22 Mar 2018 23:39:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNdoIM089919; Thu, 22 Mar 2018 23:39:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNdn94089914; Thu, 22 Mar 2018 23:39:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222339.w2MNdn94089914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331382 - in stable/11/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common/sys X-SVN-Commit-Revision: 331382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:39:51 -0000 Author: mav Date: Thu Mar 22 23:39:49 2018 New Revision: 331382 URL: https://svnweb.freebsd.org/changeset/base/331382 Log: MFC r329508: MFV r324198: 8081 Compiler warnings in zdb illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://www.illumos.org/issues/8081 zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD, which uses -WError, the only way to build it is to disable all compiler warnings. This makes it much harder to detect newly introduced bugs. We should cleanup all the warnings. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Richard Lowe Author: Alan Somers Added: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.h - copied unchanged from r329508, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:39:49 2018 (r331382) @@ -67,6 +67,8 @@ #undef verify #include +#include "zdb.h" + #define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ zio_compress_table[(idx)].ci_name : "UNKNOWN") #define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ @@ -90,14 +92,13 @@ uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; #endif -const char cmdname[] = "zdb"; +static const char cmdname[] = "zdb"; uint8_t dump_opt[256]; typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); -extern void dump_intent_log(zilog_t *); static uint64_t *zopt_object = NULL; -static int zopt_objects = 0; +static unsigned zopt_objects = 0; static libzfs_handle_t *g_zfs; static uint64_t max_inflight = 1000; @@ -285,8 +286,8 @@ zdb_nicenum(uint64_t num, char *buf, size_t buflen) nicenum(num, buf, sizeof (buf)); } -const char histo_stars[] = "****************************************"; -const int histo_width = sizeof (histo_stars) - 1; +static const char histo_stars[] = "****************************************"; +static const uint64_t histo_width = sizeof (histo_stars) - 1; static void dump_histogram(const uint64_t *histo, int size, int offset) @@ -392,7 +393,7 @@ dump_unknown(objset_t *os, uint64_t object, void *data } /*ARGSUSED*/ -void +static void dump_uint8(objset_t *os, uint64_t object, void *data, size_t size) { } @@ -410,7 +411,7 @@ dump_zap(objset_t *os, uint64_t object, void *data, si zap_cursor_t zc; zap_attribute_t attr; void *prop; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -573,7 +574,7 @@ dump_sa_layouts(objset_t *os, uint64_t object, void *d zap_cursor_t zc; zap_attribute_t attr; uint16_t *layout_attrs; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -642,7 +643,7 @@ dump_zpldir(objset_t *os, uint64_t object, void *data, zap_cursor_fini(&zc); } -int +static int get_dtl_refcount(vdev_t *vd) { int refcount = 0; @@ -656,18 +657,18 @@ get_dtl_refcount(vdev_t *vd) return (0); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_dtl_refcount(vd->vdev_child[c]); return (refcount); } -int +static int get_metaslab_refcount(vdev_t *vd) { int refcount = 0; if (vd->vdev_top == vd && !vd->vdev_removing) { - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -675,7 +676,7 @@ get_metaslab_refcount(vdev_t *vd) refcount++; } } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_metaslab_refcount(vd->vdev_child[c]); return (refcount); @@ -707,7 +708,7 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" }; if (sm == NULL) @@ -844,7 +845,7 @@ dump_metaslab_groups(spa_t *spa) metaslab_class_histogram_verify(mc); - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; @@ -923,7 +924,7 @@ dump_dde(const ddt_t *ddt, const ddt_entry_t *dde, uin { const ddt_phys_t *ddp = dde->dde_phys; const ddt_key_t *ddk = &dde->dde_key; - char *types[4] = { "ditto", "single", "double", "triple" }; + const char *types[4] = { "ditto", "single", "double", "triple" }; char blkbuf[BP_SPRINTF_LEN]; blkptr_t blk; @@ -1016,9 +1017,12 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_clas static void dump_all_ddts(spa_t *spa) { - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); + for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { ddt_t *ddt = spa->spa_ddt[c]; for (enum ddt_type type = 0; type < DDT_TYPES; type++) { @@ -1064,7 +1068,8 @@ dump_dtl(vdev_t *vd, int indent) { spa_t *spa = vd->vdev_spa; boolean_t required; - char *name[DTL_TYPES] = { "missing", "partial", "scrub", "outage" }; + const char *name[DTL_TYPES] = { "missing", "partial", "scrub", + "outage" }; char prefix[256]; spa_vdev_state_enter(spa, SCL_NONE); @@ -1092,7 +1097,7 @@ dump_dtl(vdev_t *vd, int indent) dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) dump_dtl(vd->vdev_child[c], indent + 4); } @@ -1150,7 +1155,7 @@ dump_history(spa_t *spa) free(buf); (void) printf("\nHistory:\n"); - for (int i = 0; i < num; i++) { + for (unsigned i = 0; i < num; i++) { uint64_t time, txg, ievent; char *cmd, *intstr; boolean_t printed = B_FALSE; @@ -1172,8 +1177,8 @@ dump_history(spa_t *spa) (void) snprintf(internalstr, sizeof (internalstr), - "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, + "[internal %s txg:%ju] %s", + zfs_history_event_names[ievent], (uintmax_t)txg, intstr); cmd = internalstr; } @@ -1490,7 +1495,7 @@ dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_bptree(objset_t *os, uint64_t obj, char *name) +dump_bptree(objset_t *os, uint64_t obj, const char *name) { char bytes[32]; bptree_phys_t *bt; @@ -1530,7 +1535,7 @@ dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_full_bpobj(bpobj_t *bpo, char *name, int indent) +dump_full_bpobj(bpobj_t *bpo, const char *name, int indent) { char bytes[32]; char comp[32]; @@ -2034,7 +2039,7 @@ dump_object(objset_t *os, uint64_t object, int verbosi dmu_buf_rele(db, FTAG); } -static char *objset_types[DMU_OST_NUMTYPES] = { +static const char *objset_types[DMU_OST_NUMTYPES] = { "NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" }; static void @@ -2046,10 +2051,11 @@ dump_dir(objset_t *os) char numbuf[32]; char blkbuf[BP_SPRINTF_LEN + 20]; char osname[ZFS_MAX_DATASET_NAME_LEN]; - char *type = "UNKNOWN"; + const char *type = "UNKNOWN"; int verbosity = dump_opt['d']; int print_header = 1; - int i, error; + unsigned i; + int error; /* make sure nicenum has enough space */ CTASSERT(sizeof (numbuf) >= NN_NUMBUF_SZ); @@ -2139,7 +2145,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co { time_t timestamp = ub->ub_timestamp; - (void) printf(header ? header : ""); + (void) printf("%s", header ? header : ""); (void) printf("\tmagic = %016llx\n", (u_longlong_t)ub->ub_magic); (void) printf("\tversion = %llu\n", (u_longlong_t)ub->ub_version); (void) printf("\ttxg = %llu\n", (u_longlong_t)ub->ub_txg); @@ -2151,7 +2157,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); (void) printf("\trootbp = %s\n", blkbuf); } - (void) printf(footer ? footer : ""); + (void) printf("%s", footer ? footer : ""); } static void @@ -2494,7 +2500,7 @@ typedef struct zdb_blkstats { #define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2) #define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3) -static char *zdb_ot_extname[] = { +static const char *zdb_ot_extname[] = { "deferred free", "dedup ditto", "other", @@ -2511,7 +2517,7 @@ typedef struct zdb_cb { uint64_t zcb_embedded_histogram[NUM_BP_EMBEDDED_TYPES] [BPE_PAYLOAD_SIZE]; uint64_t zcb_start; - uint64_t zcb_lastprint; + hrtime_t zcb_lastprint; uint64_t zcb_totalasize; uint64_t zcb_errors[256]; int zcb_readfails; @@ -2546,7 +2552,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b * SPA_OLD_MAXBLOCKSIZE; larger blocks go into the last, * "other", bucket. */ - int idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; + unsigned idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; idx = MIN(idx, SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1); zb->zb_psize_histogram[idx]++; @@ -2753,10 +2759,11 @@ static metaslab_ops_t zdb_metaslab_ops = { static void zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) { - ddt_bookmark_t ddb = { 0 }; + ddt_bookmark_t ddb; ddt_entry_t dde; int error; + bzero(&ddb, sizeof (ddb)); while ((error = ddt_walk(spa, &ddb, &dde)) == 0) { blkptr_t blk; ddt_phys_t *ddp = dde.dde_phys; @@ -2864,10 +2871,10 @@ zdb_leak_fini(spa_t *spa) { if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; metaslab_group_t *mg = vd->vdev_mg; - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; ASSERT3P(mg, ==, msp->ms_group); mutex_enter(&msp->ms_lock); @@ -2913,12 +2920,13 @@ count_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t static int dump_block_stats(spa_t *spa) { - zdb_cb_t zcb = { 0 }; + zdb_cb_t zcb; zdb_blkstats_t *zb, *tzb; uint64_t norm_alloc, norm_space, total_alloc, total_found; int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; boolean_t leaks = B_FALSE; + bzero(&zcb, sizeof (zcb)); (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", (dump_opt['c'] == 1) ? "metadata " : "", @@ -3069,7 +3077,7 @@ dump_block_stats(spa_t *spa) for (t = 0; t <= ZDB_OT_TOTAL; t++) { char csize[32], lsize[32], psize[32], asize[32]; char avg[32], gang[32]; - char *typename; + const char *typename; /* make sure nicenum has enough space */ CTASSERT(sizeof (csize) >= NN_NUMBUF_SZ); @@ -3220,9 +3228,11 @@ dump_simulated_ddt(spa_t *spa) avl_tree_t t; void *cookie = NULL; zdb_ddt_entry_t *zdde; - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); avl_create(&t, ddt_entry_compare, sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node)); @@ -3369,7 +3379,7 @@ dump_zpool(spa_t *spa) #define ZDB_FLAG_RAW 0x0040 #define ZDB_FLAG_PRINT_BLKPTR 0x0080 -int flagbits[256]; +static int flagbits[256]; static void zdb_print_blkptr(blkptr_t *bp, int flags) @@ -3410,10 +3420,11 @@ static void zdb_dump_block(char *label, void *buf, uint64_t size, int flags) { uint64_t *d = (uint64_t *)buf; - int nwords = size / sizeof (uint64_t); + unsigned nwords = size / sizeof (uint64_t); int do_bswap = !!(flags & ZDB_FLAG_BSWAP); - int i, j; - char *hdr, *c; + unsigned i, j; + const char *hdr; + char *c; if (do_bswap) @@ -3446,19 +3457,19 @@ zdb_dump_block(char *label, void *buf, uint64_t size, * RAID-Zs, you can specify either RAID-Z vdev with 0.0 or 0.1 . */ static vdev_t * -zdb_vdev_lookup(vdev_t *vdev, char *path) +zdb_vdev_lookup(vdev_t *vdev, const char *path) { char *s, *p, *q; - int i; + unsigned i; if (vdev == NULL) return (NULL); /* First, assume the x.x.x.x format */ - i = (int)strtoul(path, &s, 10); + i = strtoul(path, &s, 10); if (s == path || (s && *s != '.' && *s != '\0')) goto name; - if (i < 0 || i >= vdev->vdev_children) + if (i >= vdev->vdev_children) return (NULL); vdev = vdev->vdev_child[i]; @@ -3533,7 +3544,8 @@ zdb_read_block(char *thing, spa_t *spa) vdev_t *vd; abd_t *pabd; void *lbuf, *buf; - char *s, *p, *dup, *vdev, *flagstr; + const char *s, *vdev; + char *p, *dup, *flagstr; int i, error; dup = strdup(thing); @@ -3544,7 +3556,10 @@ zdb_read_block(char *thing, spa_t *spa) s = strtok(NULL, ":"); size = strtoull(s ? s : "", NULL, 16); s = strtok(NULL, ":"); - flagstr = s ? s : ""; + if (s) + flagstr = strdup(s); + else + flagstr = strdup(""); s = NULL; if (size == 0) @@ -3586,6 +3601,7 @@ zdb_read_block(char *thing, spa_t *spa) i += p - &flagstr[i + 1]; /* skip over the number */ } } + free(flagstr); vd = zdb_vdev_lookup(spa->spa_root_vdev, vdev); if (vd == NULL) { @@ -3722,11 +3738,12 @@ out: static void zdb_embedded_block(char *thing) { - blkptr_t bp = { 0 }; + blkptr_t bp; unsigned long long *words = (void *)&bp; char *buf; int err; + bzero(&bp, sizeof (bp)); err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:" "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx", words + 0, words + 1, words + 2, words + 3, @@ -3779,8 +3796,9 @@ find_zpool(char **target, nvlist_t **configp, int dirc char *sepp = NULL; char sep = '\0'; int count = 0; - importargs_t args = { 0 }; + importargs_t args; + bzero(&args, sizeof (args)); args.paths = dirc; args.path = dirv; args.can_be_active = B_TRUE; @@ -3840,7 +3858,7 @@ find_zpool(char **target, nvlist_t **configp, int dirc int main(int argc, char **argv) { - int i, c; + int c; struct rlimit rl = { 1024, 1024 }; spa_t *spa = NULL; objset_t *os = NULL; @@ -4121,7 +4139,7 @@ main(int argc, char **argv) if (argc > 0) { zopt_objects = argc; zopt_object = calloc(zopt_objects, sizeof (uint64_t)); - for (i = 0; i < zopt_objects; i++) { + for (unsigned i = 0; i < zopt_objects; i++) { errno = 0; zopt_object[i] = strtoull(argv[i], NULL, 0); if (zopt_object[i] == 0 && errno != 0) @@ -4146,7 +4164,7 @@ main(int argc, char **argv) flagbits['p'] = ZDB_FLAG_PHYS; flagbits['r'] = ZDB_FLAG_RAW; - for (i = 0; i < argc; i++) + for (int i = 0; i < argc; i++) zdb_read_block(argv[i], spa); } Copied: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.h (from r329508, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.h Thu Mar 22 23:39:49 2018 (r331382, copy of r329508, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h) @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2017 Spectra Logic Corp Inc. All rights reserved. + * Use is subject to license terms. + */ + + +#ifndef _ZDB_H +#define _ZDB_H + +void dump_intent_log(zilog_t *); +extern uint8_t dump_opt[256]; + +#endif /* _ZDB_H */ Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Thu Mar 22 23:39:49 2018 (r331382) @@ -43,9 +43,11 @@ #include #include +#include "zdb.h" + extern uint8_t dump_opt[256]; -static char prefix[4] = "\t\t\t"; +static char tab_prefix[4] = "\t\t\t"; static void print_log_bp(const blkptr_t *bp, const char *prefix) @@ -58,8 +60,9 @@ print_log_bp(const blkptr_t *bp, const char *prefix) /* ARGSUSED */ static void -zil_prt_rec_create(zilog_t *zilog, int txtype, lr_create_t *lr) +zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg) { + lr_create_t *lr = arg; time_t crtime = lr->lr_crtime[0]; char *name, *link; lr_attr_t *lrattr; @@ -74,47 +77,53 @@ zil_prt_rec_create(zilog_t *zilog, int txtype, lr_crea if (txtype == TX_SYMLINK) { link = name + strlen(name) + 1; - (void) printf("%s%s -> %s\n", prefix, name, link); + (void) printf("%s%s -> %s\n", tab_prefix, name, link); } else if (txtype != TX_MKXATTR) { - (void) printf("%s%s\n", prefix, name); + (void) printf("%s%s\n", tab_prefix, name); } - (void) printf("%s%s", prefix, ctime(&crtime)); - (void) printf("%sdoid %llu, foid %llu, mode %llo\n", prefix, + (void) printf("%s%s", tab_prefix, ctime(&crtime)); + (void) printf("%sdoid %llu, foid %llu, mode %llo\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_mode); - (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", prefix, + (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", + tab_prefix, (u_longlong_t)lr->lr_uid, (u_longlong_t)lr->lr_gid, (u_longlong_t)lr->lr_gen, (u_longlong_t)lr->lr_rdev); } /* ARGSUSED */ static void -zil_prt_rec_remove(zilog_t *zilog, int txtype, lr_remove_t *lr) +zil_prt_rec_remove(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, name %s\n", prefix, + lr_remove_t *lr = arg; + + (void) printf("%sdoid %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_link(zilog_t *zilog, int txtype, lr_link_t *lr) +zil_prt_rec_link(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, link_obj %llu, name %s\n", prefix, + lr_link_t *lr = arg; + + (void) printf("%sdoid %llu, link_obj %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_link_obj, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_rename(zilog_t *zilog, int txtype, lr_rename_t *lr) +zil_prt_rec_rename(zilog_t *zilog, int txtype, void *arg) { + lr_rename_t *lr = arg; char *snm = (char *)(lr + 1); char *tnm = snm + strlen(snm) + 1; - (void) printf("%ssdoid %llu, tdoid %llu\n", prefix, + (void) printf("%ssdoid %llu, tdoid %llu\n", tab_prefix, (u_longlong_t)lr->lr_sdoid, (u_longlong_t)lr->lr_tdoid); - (void) printf("%ssrc %s tgt %s\n", prefix, snm, tnm); + (void) printf("%ssrc %s tgt %s\n", tab_prefix, snm, tnm); } /* ARGSUSED */ @@ -122,7 +131,7 @@ static int zil_prt_rec_write_cb(void *data, size_t len, void *unused) { char *cdata = data; - for (int i = 0; i < len; i++) { + for (size_t i = 0; i < len; i++) { if (isprint(*cdata)) (void) printf("%c ", *cdata); else @@ -134,15 +143,16 @@ zil_prt_rec_write_cb(void *data, size_t len, void *unu /* ARGSUSED */ static void -zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr) +zil_prt_rec_write(zilog_t *zilog, int txtype, void *arg) { + lr_write_t *lr = arg; abd_t *data; blkptr_t *bp = &lr->lr_blkptr; zbookmark_phys_t zb; int verbose = MAX(dump_opt['d'], dump_opt['i']); int error; - (void) printf("%sfoid %llu, offset %llx, length %llx\n", prefix, + (void) printf("%sfoid %llu, offset %llx, length %llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); @@ -150,20 +160,21 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write return; if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { - (void) printf("%shas blkptr, %s\n", prefix, + (void) printf("%shas blkptr, %s\n", tab_prefix, !BP_IS_HOLE(bp) && bp->blk_birth >= spa_first_txg(zilog->zl_spa) ? "will claim" : "won't claim"); - print_log_bp(bp, prefix); + print_log_bp(bp, tab_prefix); if (BP_IS_HOLE(bp)) { (void) printf("\t\t\tLSIZE 0x%llx\n", (u_longlong_t)BP_GET_LSIZE(bp)); - (void) printf("%s\n", prefix); + (void) printf("%s\n", tab_prefix); return; } if (bp->blk_birth < zilog->zl_header->zh_claim_txg) { - (void) printf("%s\n", prefix); + (void) printf("%s\n", + tab_prefix); return; } @@ -183,7 +194,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write abd_copy_from_buf(data, lr + 1, lr->lr_length); } - (void) printf("%s", prefix); + (void) printf("%s", tab_prefix); (void) abd_iterate_func(data, 0, MIN(lr->lr_length, (verbose < 6 ? 20 : SPA_MAXBLOCKSIZE)), zil_prt_rec_write_cb, NULL); @@ -195,52 +206,55 @@ out: /* ARGSUSED */ static void -zil_prt_rec_truncate(zilog_t *zilog, int txtype, lr_truncate_t *lr) +zil_prt_rec_truncate(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", prefix, + lr_truncate_t *lr = arg; + + (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); } /* ARGSUSED */ static void -zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_setattr_t *lr) +zil_prt_rec_setattr(zilog_t *zilog, int txtype, void *arg) { + lr_setattr_t *lr = arg; time_t atime = (time_t)lr->lr_atime[0]; time_t mtime = (time_t)lr->lr_mtime[0]; - (void) printf("%sfoid %llu, mask 0x%llx\n", prefix, + (void) printf("%sfoid %llu, mask 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_mask); if (lr->lr_mask & AT_MODE) { - (void) printf("%sAT_MODE %llo\n", prefix, + (void) printf("%sAT_MODE %llo\n", tab_prefix, (longlong_t)lr->lr_mode); } if (lr->lr_mask & AT_UID) { - (void) printf("%sAT_UID %llu\n", prefix, + (void) printf("%sAT_UID %llu\n", tab_prefix, (u_longlong_t)lr->lr_uid); } if (lr->lr_mask & AT_GID) { - (void) printf("%sAT_GID %llu\n", prefix, + (void) printf("%sAT_GID %llu\n", tab_prefix, (u_longlong_t)lr->lr_gid); } if (lr->lr_mask & AT_SIZE) { - (void) printf("%sAT_SIZE %llu\n", prefix, + (void) printf("%sAT_SIZE %llu\n", tab_prefix, (u_longlong_t)lr->lr_size); } if (lr->lr_mask & AT_ATIME) { - (void) printf("%sAT_ATIME %llu.%09llu %s", prefix, + (void) printf("%sAT_ATIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_atime[0], (u_longlong_t)lr->lr_atime[1], ctime(&atime)); } if (lr->lr_mask & AT_MTIME) { - (void) printf("%sAT_MTIME %llu.%09llu %s", prefix, + (void) printf("%sAT_MTIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_mtime[0], (u_longlong_t)lr->lr_mtime[1], ctime(&mtime)); @@ -249,41 +263,43 @@ zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_set /* ARGSUSED */ static void -zil_prt_rec_acl(zilog_t *zilog, int txtype, lr_acl_t *lr) +zil_prt_rec_acl(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, aclcnt %llu\n", prefix, + lr_acl_t *lr = arg; + + (void) printf("%sfoid %llu, aclcnt %llu\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_aclcnt); } -typedef void (*zil_prt_rec_func_t)(); +typedef void (*zil_prt_rec_func_t)(zilog_t *, int, void *); typedef struct zil_rec_info { zil_prt_rec_func_t zri_print; - char *zri_name; + const char *zri_name; uint64_t zri_count; } zil_rec_info_t; static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = { - { NULL, "Total " }, - { zil_prt_rec_create, "TX_CREATE " }, - { zil_prt_rec_create, "TX_MKDIR " }, - { zil_prt_rec_create, "TX_MKXATTR " }, - { zil_prt_rec_create, "TX_SYMLINK " }, - { zil_prt_rec_remove, "TX_REMOVE " }, - { zil_prt_rec_remove, "TX_RMDIR " }, - { zil_prt_rec_link, "TX_LINK " }, - { zil_prt_rec_rename, "TX_RENAME " }, - { zil_prt_rec_write, "TX_WRITE " }, - { zil_prt_rec_truncate, "TX_TRUNCATE " }, - { zil_prt_rec_setattr, "TX_SETATTR " }, - { zil_prt_rec_acl, "TX_ACL_V0 " }, - { zil_prt_rec_acl, "TX_ACL_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ATTR " }, - { zil_prt_rec_create, "TX_CREATE_ACL_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL " }, - { zil_prt_rec_create, "TX_MKDIR_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL_ATTR " }, - { zil_prt_rec_write, "TX_WRITE2 " }, + {.zri_print = NULL, .zri_name = "Total "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKXATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_SYMLINK "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_REMOVE "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_RMDIR "}, + {.zri_print = zil_prt_rec_link, .zri_name = "TX_LINK "}, + {.zri_print = zil_prt_rec_rename, .zri_name = "TX_RENAME "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE "}, + {.zri_print = zil_prt_rec_truncate, .zri_name = "TX_TRUNCATE "}, + {.zri_print = zil_prt_rec_setattr, .zri_name = "TX_SETATTR "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_V0 "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL_ATTR "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE2 "}, }; /* ARGSUSED */ @@ -321,7 +337,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar { char blkbuf[BP_SPRINTF_LEN + 10]; int verbose = MAX(dump_opt['d'], dump_opt['i']); - char *claim; + const char *claim; if (verbose <= 3) return (0); @@ -350,7 +366,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar static void print_log_stats(int verbose) { - int i, w, p10; + unsigned i, w, p10; if (verbose > 3) (void) printf("\n"); Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:39:49 2018 (r331382) @@ -1425,8 +1425,10 @@ ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_set * ZIL replay ops */ static int -ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, boolean_t byteswap) +ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_create_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; ztest_block_tag_t *bbt; @@ -1509,8 +1511,10 @@ ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, b } static int -ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, boolean_t byteswap) +ztest_replay_remove(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_remove_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; dmu_object_info_t doi; @@ -1560,8 +1564,10 @@ ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, b } static int -ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boolean_t byteswap) +ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_write_t *lr = arg2; objset_t *os = zd->zd_os; void *data = lr + 1; /* data follows lr */ uint64_t offset, length; @@ -1685,8 +1691,10 @@ ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boo } static int -ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *lr, boolean_t byteswap) +ztest_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_truncate_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; uint64_t txg; @@ -1724,8 +1732,10 @@ ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *l } static int -ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap) +ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_setattr_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; dmu_buf_t *db; Modified: stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Mar 22 23:39:49 2018 (r331382) @@ -237,7 +237,7 @@ extern struct proc p0; #define PS_NONE -1 -extern kthread_t *zk_thread_create(void (*func)(), void *arg); +extern kthread_t *zk_thread_create(void (*func)(void*), void *arg); #define issig(why) (FALSE) #define ISSIG(thr, why) (FALSE) From owner-svn-src-all@freebsd.org Thu Mar 22 23:41:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94CFAF53DD0; Thu, 22 Mar 2018 23:41:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45D2C72271; Thu, 22 Mar 2018 23:41:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26EDF1811E; Thu, 22 Mar 2018 23:41:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNfRlu090757; Thu, 22 Mar 2018 23:41:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNfRkF090756; Thu, 22 Mar 2018 23:41:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222341.w2MNfRkF090756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331383 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:41:27 -0000 Author: mav Date: Thu Mar 22 23:41:26 2018 New Revision: 331383 URL: https://svnweb.freebsd.org/changeset/base/331383 Log: MFC r329623: MFV r302649: 7016 arc_available_memory is not 32-bit safe illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190 https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190 https://www.illumos.org/issues/7016 upstream DLPX-39446 arc_available_memory is not 32-bit safe https://github.com/delphix/delphix-os/commit/ 6b353ea3b8a1610be22e71e657d051743c64190b related to this upstream: DLPX-38547 delphix engine hang https://github.com/delphix/delphix-os/commit/ 3183a567b3e8c62a74a65885ca60c86f3d693783 DLPX-38547 delphix engine hang (fix static global) https://github.com/delphix/delphix-os/commit/ 22ac551d8ef085ad66cc8f65e51ac372b12993b9 DLPX-38882 system hung waiting on free segment https://github.com/delphix/delphix-os/commit/ cdd6beef7548cd3b12f0fc0328eeb3af540079c2 Reviewed by: Igor Kozhukhov Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: George Wilson Approved by: Gordon Ross Author: Prakash Surya Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:39:49 2018 (r331382) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:41:26 2018 (r331383) @@ -350,6 +350,11 @@ extern boolean_t zfs_prefetch_disable; static boolean_t arc_warm; /* + * log2 fraction of the zio arena to keep free. + */ +int arc_zio_arena_free_shift = 2; + +/* * These tunables are for performance analysis. */ uint64_t zfs_arc_max; @@ -4326,15 +4331,16 @@ arc_available_memory(void) /* * If zio data pages are being allocated out of a separate heap segment, * then enforce that the size of available vmem for this arena remains - * above about 1/16th free. + * above about 1/4th (1/(2^arc_zio_arena_free_shift)) free. * - * Note: The 1/16th arena free requirement was put in place - * to aggressively evict memory from the arc in order to avoid - * memory fragmentation issues. + * Note that reducing the arc_zio_arena_free_shift keeps more virtual + * memory (in the zio_arena) free, which can avoid memory + * fragmentation issues. */ if (zio_arena != NULL) { n = (int64_t)vmem_size(zio_arena, VMEM_FREE) - - (vmem_size(zio_arena, VMEM_ALLOC) >> 4); + (vmem_size(zio_arena, VMEM_ALLOC) >> + arc_zio_arena_free_shift); if (n < lowest) { lowest = n; r = FMR_ZIO_ARENA; From owner-svn-src-all@freebsd.org Thu Mar 22 23:43:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C93CF5415B; Thu, 22 Mar 2018 23:43:06 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AB05725F9; Thu, 22 Mar 2018 23:43:06 +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 2598118177; Thu, 22 Mar 2018 23:43:06 +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 w2MNh60L094698; Thu, 22 Mar 2018 23:43:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNh5vx094693; Thu, 22 Mar 2018 23:43:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222343.w2MNh5vx094693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331384 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 331384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:43:06 -0000 Author: mav Date: Thu Mar 22 23:43:05 2018 New Revision: 331384 URL: https://svnweb.freebsd.org/changeset/base/331384 Log: MFC r329625: MFV r307315: 7301 zpool export -f should be able to interrupt file freeing Reviewed by: Matthew Ahrens Reviewed by: Sanjay Nadkarni Reviewed by: Saso Kiselkov Reviewed by: John Kennedy Author: Alek Pinchuk Closes #175 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Mar 22 23:43:05 2018 (r331384) @@ -24,7 +24,7 @@ */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ -/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #include #include @@ -723,6 +723,22 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t return (0); } +/* + * If this objset is of type OST_ZFS return true if vfs's unmounted flag is set, + * otherwise return false. + * Used below in dmu_free_long_range_impl() to enable abort when unmounting + */ +/*ARGSUSED*/ +static boolean_t +dmu_objset_zfs_unmounting(objset_t *os) +{ +#ifdef _KERNEL + if (dmu_objset_type(os) == DMU_OST_ZFS) + return (zfs_get_vfs_flag_unmounted(os)); +#endif + return (B_FALSE); +} + static int dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, uint64_t length) @@ -748,6 +764,9 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, ui uint64_t chunk_end, chunk_begin, chunk_len; uint64_t long_free_dirty_all_txgs = 0; dmu_tx_t *tx; + + if (dmu_objset_zfs_unmounting(dn->dn_objset)) + return (SET_ERROR(EINTR)); chunk_end = chunk_begin = offset + length; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Thu Mar 22 23:43:05 2018 (r331384) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #ifndef _SYS_FS_ZFS_ZNODE_H @@ -321,6 +322,7 @@ extern int zfs_create_op_tables(); extern dev_t zfs_cmpldev(uint64_t); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); extern int zfs_get_stats(objset_t *os, nvlist_t *nv); +extern boolean_t zfs_get_vfs_flag_unmounted(objset_t *os); extern void zfs_znode_dmu_fini(znode_t *); extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:43:05 2018 (r331384) @@ -428,8 +428,8 @@ zfs_rmnode(znode_t *zp) error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); if (error) { /* - * Not enough space. Leave the file in the unlinked - * set. + * Not enough space or we were interrupted by unmount. + * Leave the file in the unlinked set. */ zfs_znode_dmu_fini(zp); zfs_znode_free(zp); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Mar 22 23:43:05 2018 (r331384) @@ -24,6 +24,7 @@ * All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1846,7 +1847,7 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) /* * Teardown the zfsvfs::z_os. * - * Note, if 'unmounting' if FALSE, we return with the 'z_teardown_lock' + * Note, if 'unmounting' is FALSE, we return with the 'z_teardown_lock' * and 'z_teardown_inactive_lock' held. */ static int @@ -1914,8 +1915,8 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting */ if (unmounting) { zfsvfs->z_unmounted = B_TRUE; - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); } /* @@ -2505,6 +2506,29 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_ error = 0; } return (error); +} + +/* + * Return true if the coresponding vfs's unmounted flag is set. + * Otherwise return false. + * If this function returns true we know VFS unmount has been initiated. + */ +boolean_t +zfs_get_vfs_flag_unmounted(objset_t *os) +{ + zfsvfs_t *zfvp; + boolean_t unmounted = B_FALSE; + + ASSERT(dmu_objset_type(os) == DMU_OST_ZFS); + + mutex_enter(&os->os_user_ptr_lock); + zfvp = dmu_objset_get_user(os); + if (zfvp != NULL && zfvp->z_vfs != NULL && + (zfvp->z_vfs->mnt_kern_flag & MNTK_UNMOUNT)) + unmounted = B_TRUE; + mutex_exit(&os->os_user_ptr_lock); + + return (unmounted); } #ifdef _KERNEL From owner-svn-src-all@freebsd.org Thu Mar 22 23:43:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11EB4F5427F; Thu, 22 Mar 2018 23:43:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9741F72733; Thu, 22 Mar 2018 23:43:49 +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 920A018178; Thu, 22 Mar 2018 23:43:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNhnq5094778; Thu, 22 Mar 2018 23:43:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNhnYL094775; Thu, 22 Mar 2018 23:43:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222343.w2MNhnYL094775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:43:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331385 - in stable/11/sys/cddl/contrib/opensolaris: common/nvpair uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris: common/nvpair uts/common/fs/zfs X-SVN-Commit-Revision: 331385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:43:50 -0000 Author: mav Date: Thu Mar 22 23:43:48 2018 New Revision: 331385 URL: https://svnweb.freebsd.org/changeset/base/331385 Log: MFC r329628: MFC r316910: 7812 Remove gender specific language illumos/illumos-gate@48bbca816818409505a6e214d0911fda44e622e3 https://github.com/illumos/illumos-gate/commit/48bbca816818409505a6e214d0911fda44e622e3 https://www.illumos.org/issues/7812 This change removes all gendered language that did not refer specifically to an individual person or pet. The convention taken was to use variations on "they" when referring to users and/or human beings, while using "it" when referring to code, functions, and/or libraries. Additionally, we took the liberty to fix up any whitespace issues that were found in any files that were already being modified. Reviewed by: Matt Ahrens Reviewed by: Prakash Surya Reviewed by: Steve Gonczi Reviewed by: Chris Williamson Reviewed by: George Wilson Reviewed by: Igor Kozhukhov Reviewed by: Dan McDonald Reviewed by: Robert Mustacchi Approved by: Richard Lowe Author: Daniel Hoffman Modified: stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Thu Mar 22 23:43:05 2018 (r331384) +++ stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Thu Mar 22 23:43:48 2018 (r331385) @@ -2379,7 +2379,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *bufle * 1. The nvlist has fixed allocator properties. * All other nvlist routines (like nvlist_add_*, ...) use * these properties. - * 2. When using nvlist_pack() the user can specify his own + * 2. When using nvlist_pack() the user can specify their own * allocator properties (e.g. by using KM_NOSLEEP). * * We use the user specified properties (2). A clearer solution Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:43:05 2018 (r331384) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:43:48 2018 (r331385) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 22 23:43:05 2018 (r331384) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 22 23:43:48 2018 (r331385) @@ -1812,7 +1812,7 @@ zio_reexecute(zio_t *pio) /* * Now that all children have been reexecuted, execute the parent. * We don't reexecute "The Godfather" I/O here as it's the - * responsibility of the caller to wait on him. + * responsibility of the caller to wait on it. */ if (!(pio->io_flags & ZIO_FLAG_GODFATHER)) { pio->io_queued_timestamp = gethrtime(); From owner-svn-src-all@freebsd.org Thu Mar 22 23:45:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4D19F54412; Thu, 22 Mar 2018 23:45:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51D82728A4; Thu, 22 Mar 2018 23:45:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CE0118179; Thu, 22 Mar 2018 23:45:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNj111094911; Thu, 22 Mar 2018 23:45:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNj1i6094910; Thu, 22 Mar 2018 23:45:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222345.w2MNj1i6094910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331386 - stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Commit-Revision: 331386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:45:01 -0000 Author: mav Date: Thu Mar 22 23:45:01 2018 New Revision: 331386 URL: https://svnweb.freebsd.org/changeset/base/331386 Log: MFC r329657 (by asomers): Fix memory leaks in zdb introduced by r329508 Reported by: Coverity CID: 1386185 Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:43:48 2018 (r331385) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:45:01 2018 (r331386) @@ -3570,6 +3570,7 @@ zdb_read_block(char *thing, spa_t *spa) s = "offset must be a multiple of sector size"; if (s) { (void) printf("Invalid block specifier: %s - %s\n", thing, s); + free(flagstr); free(dup); return; } @@ -3595,6 +3596,7 @@ zdb_read_block(char *thing, spa_t *spa) blkptr_offset = strtoull(p, &p, 16); if (*p != ':' && *p != '\0') { (void) printf("***Invalid flag arg: '%s'\n", s); + free(flagstr); free(dup); return; } From owner-svn-src-all@freebsd.org Thu Mar 22 23:45:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BD7BF54563; Thu, 22 Mar 2018 23:45:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4218172A0D; Thu, 22 Mar 2018 23:45:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CD921817A; Thu, 22 Mar 2018 23:45:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNjlEX094988; Thu, 22 Mar 2018 23:45:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNjlAt094987; Thu, 22 Mar 2018 23:45:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222345.w2MNjlAt094987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:45:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331387 - stable/11/cddl/contrib/opensolaris/cmd/ztest X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/ztest X-SVN-Commit-Revision: 331387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:45:47 -0000 Author: mav Date: Thu Mar 22 23:45:46 2018 New Revision: 331387 URL: https://svnweb.freebsd.org/changeset/base/331387 Log: MFC r329658: MFV r316872: 7502 ztest should run zdb with -G (debug mode) illumos/illumos-gate@c3c65d17f7b6689bbd6568a1a1fcc0c4a3bac127 https://github.com/illumos/illumos-gate/commit/c3c65d17f7b6689bbd6568a1a1fcc0c4a3bac127 https://www.illumos.org/issues/7502 Right now ztest executes zdb without -G, so when it has errors, the messages are often not very helpful: Executing zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest zdb: can't open 'ztest': Operation not supported ztest: '/usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest' exit code 1 With -G, we'd have: /usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache -G ztest zdb: can't open 'ztest': Operation not supported ZFS_DBGMSG(zdb): spa_open_common: opening ztest spa_load(ztest): LOADING spa_load(ztest): FAILED: unable to parse config [error=48] spa_load(ztest): UNLOADING Which indicates where the error came from Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Gordon Ross Author: Pavel Zakharov Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:45:01 2018 (r331386) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:45:46 2018 (r331387) @@ -5277,7 +5277,7 @@ ztest_run_zdb(char *pool) isa = strdup(isa); /* LINTED */ (void) sprintf(bin, - "/usr/sbin%.*s/zdb -bcc%s%s -d -U %s %s", + "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s %s", isalen, isa, ztest_opts.zo_verbose >= 3 ? "s" : "", From owner-svn-src-all@freebsd.org Thu Mar 22 23:47:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB236F54794; Thu, 22 Mar 2018 23:47:04 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C7C172C9E; Thu, 22 Mar 2018 23:47:04 +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 9766618193; Thu, 22 Mar 2018 23:47:04 +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 w2MNl4AN095229; Thu, 22 Mar 2018 23:47:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNl44k095228; Thu, 22 Mar 2018 23:47:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222347.w2MNl44k095228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331388 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:47:05 -0000 Author: mav Date: Thu Mar 22 23:47:04 2018 New Revision: 331388 URL: https://svnweb.freebsd.org/changeset/base/331388 Log: MFC r329659: MFV r316873: 7233 dir_is_empty should open directory with CLOEXEC illumos/illumos-gate@d420209d9c807f782c1d31f5683be74798142198 https://github.com/illumos/illumos-gate/commit/d420209d9c807f782c1d31f5683be74798142198 https://www.illumos.org/issues/7233 This fixes a race where one thread is executing zfs_mount() while another thread forks and execs. If the fork occurs while the directory is open, the child process will inherit (but not necessarily close immediately) the open fd for the directory, preventing the mount. Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Approved by: Richard Lowe Author: Alex Reece Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:45:46 2018 (r331387) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:47:04 2018 (r331388) @@ -22,7 +22,7 @@ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright (c) 2014, 2015 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -187,9 +188,16 @@ dir_is_empty(const char *dirname) { DIR *dirp; struct dirent64 *dp; + int dirfd; - if ((dirp = opendir(dirname)) == NULL) + if ((dirfd = openat(AT_FDCWD, dirname, + O_RDONLY | O_NDELAY | O_LARGEFILE | O_CLOEXEC, 0)) < 0) { return (B_TRUE); + } + + if ((dirp = fdopendir(dirfd)) == NULL) { + return (B_TRUE); + } while ((dp = readdir64(dirp)) != NULL) { From owner-svn-src-all@freebsd.org Thu Mar 22 23:48:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B4F0F54914; Thu, 22 Mar 2018 23:48:08 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E46A372E27; Thu, 22 Mar 2018 23:48:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C72B718194; Thu, 22 Mar 2018 23:48:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNm7WG095317; Thu, 22 Mar 2018 23:48:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNm7C0095316; Thu, 22 Mar 2018 23:48:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222348.w2MNm7C0095316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331389 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:48:08 -0000 Author: mav Date: Thu Mar 22 23:48:07 2018 New Revision: 331389 URL: https://svnweb.freebsd.org/changeset/base/331389 Log: MFC r329661: MFV r316875: 7336 vfork and O_CLOEXEC causes zfs_mount EBUSY illumos/illumos-gate@873c4903a52d089cd8234b79d24f5a3fc3bccc82 https://github.com/illumos/illumos-gate/commit/873c4903a52d089cd8234b79d24f5a3fc3bccc82 https://www.illumos.org/issues/7336 We can run into a problem where we call into zfs_mount, which in turn calls is_dir_empty, which opens the directory to try and make sure it's empty. The issue with the current approach is that it holds the directory open while it traverses it with readdir, which, due to subtle interaction with the Java JVM, vfork, and exec can cause a tricky race condition resulting in zfs_mount failures. The approach to resolving the issue in this patch is to drop the usage of readdir altogether, and instead rely on the fact that ZFS stores the number of entries contained in a directory using the st_size field of the stat structure. Thus, if the directory in question is a ZFS directory, we can check to see if it's empty by calling stat() and inspecting the st_size field of structure returned. =============================================================================== The root cause appears to be an interesting race between vfork, exec, and zfs_mount's usage of O_CLOEXEC when calling openat. Here's what is going on: 1. We call zfs_mount, and this in turn calls openat to check if the directory is empty, which results in opening the directory we're trying to mount onto, and increment v_count. 2. As we're in the middle of reading the directory, vfork is called by the JVM and proceeds to exec the jspawnhelper utility. As a result of the vfork, we take an additional hold on the directory, which increments v_count a second time. The semantics of vfork mean the parent process will wait for the child process to exit or exec before the parent can continue; at this point the parent is in the middle of zfs_mount, reading the directory to determine if it's empty or not. 3. The child process exec-ing jspawnhelper gets to the relvm call within exec_args (which is called by exec_common). relvm is the function that releases the parent process, allowing the parent to proceed. The problem is, at this point of calling relvm, the child hasn't yet called close_exec which is responsible for closing the file descriptors inherited from the parent process Reviewed by: Matt Ahrens Reviewed by: Paul Dagnelie Reviewed by: Robert Mustacchi Approved by: Dan McDonald Author: Prakash Surya Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:47:04 2018 (r331388) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:48:07 2018 (r331389) @@ -78,6 +78,7 @@ #include #include #include +#include #include @@ -178,14 +179,33 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint } #ifdef illumos -/* - * Returns true if the specified directory is empty. If we can't open the - * directory at all, return true so that the mount can fail with a more - * informative error message. - */ static boolean_t -dir_is_empty(const char *dirname) +dir_is_empty_stat(const char *dirname) { + struct stat st; + + /* + * We only want to return false if the given path is a non empty + * directory, all other errors are handled elsewhere. + */ + if (stat(dirname, &st) < 0 || !S_ISDIR(st.st_mode)) { + return (B_TRUE); + } + + /* + * An empty directory will still have two entries in it, one + * entry for each of "." and "..". + */ + if (st.st_size > 2) { + return (B_FALSE); + } + + return (B_TRUE); +} + +static boolean_t +dir_is_empty_readdir(const char *dirname) +{ DIR *dirp; struct dirent64 *dp; int dirfd; @@ -211,6 +231,42 @@ dir_is_empty(const char *dirname) (void) closedir(dirp); return (B_TRUE); +} + +/* + * Returns true if the specified directory is empty. If we can't open the + * directory at all, return true so that the mount can fail with a more + * informative error message. + */ +static boolean_t +dir_is_empty(const char *dirname) +{ + struct statvfs64 st; + + /* + * If the statvfs call fails or the filesystem is not a ZFS + * filesystem, fall back to the slow path which uses readdir. + */ + if ((statvfs64(dirname, &st) != 0) || + (strcmp(st.f_basetype, "zfs") != 0)) { + return (dir_is_empty_readdir(dirname)); + } + + /* + * At this point, we know the provided path is on a ZFS + * filesystem, so we can use stat instead of readdir to + * determine if the directory is empty or not. We try to avoid + * using readdir because that requires opening "dirname"; this + * open file descriptor can potentially end up in a child + * process if there's a concurrent fork, thus preventing the + * zfs_mount() from otherwise succeeding (the open file + * descriptor inherited by the child process will cause the + * parent's mount to fail with EBUSY). The performance + * implications of replacing the open, read, and close with a + * single stat is nice; but is not the main motivation for the + * added complexity. + */ + return (dir_is_empty_stat(dirname)); } #endif From owner-svn-src-all@freebsd.org Thu Mar 22 23:49:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6FD7F54B0C; Thu, 22 Mar 2018 23:49:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5901172FB6; Thu, 22 Mar 2018 23:49:55 +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 36DFB18195; Thu, 22 Mar 2018 23:49:55 +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 w2MNnt1t095438; Thu, 22 Mar 2018 23:49:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNnsqH095436; Thu, 22 Mar 2018 23:49:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222349.w2MNnsqH095436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331390 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:49:55 -0000 Author: mav Date: Thu Mar 22 23:49:54 2018 New Revision: 331390 URL: https://svnweb.freebsd.org/changeset/base/331390 Log: MFC r329663: MFV r316876: 7542 zfs_unmount failed with EZFS_UNSHARENFSFAILED illumos/illumos-gate@09c9e6dc9b69d10b771bb87e01040ec320a0bfd3 https://github.com/illumos/illumos-gate/commit/09c9e6dc9b69d10b771bb87e01040ec320a0bfd3 https://www.illumos.org/issues/7542 libshare keeps a cached copy of the sharetab listing in memory, which can become out of date if shares are destroyed or created while leaving a libzfs handle open. This results in a spurious unmounting failure when an NFS share exists but isn't in the stale libshare cache. Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: Matt Amdur Approved by: Robert Mustacchi Author: Chris Williamson Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Mar 22 23:48:07 2018 (r331389) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Mar 22 23:49:54 2018 (r331390) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Martin Matuska . All rights reserved. */ @@ -72,7 +72,6 @@ struct libzfs_handle { int libzfs_printerr; int libzfs_storeerr; /* stuff error messages into buffer */ void *libzfs_sharehdl; /* libshare handle */ - uint_t libzfs_shareflags; boolean_t libzfs_mnttab_enable; avl_tree_t libzfs_mnttab_cache; int libzfs_pool_iter; @@ -81,8 +80,6 @@ struct libzfs_handle { char libzfs_chassis_id[256]; boolean_t libzfs_prop_debug; }; - -#define ZFSSHARE_MISS 0x01 /* Didn't find entry in cache */ struct zfs_handle { libzfs_handle_t *zfs_hdl; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:48:07 2018 (r331389) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:49:54 2018 (r331390) @@ -22,7 +22,7 @@ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. @@ -672,8 +672,6 @@ _zfs_init_libshare(void) int zfs_init_libshare(libzfs_handle_t *zhandle, int service) { - int ret = SA_OK; - #ifdef illumos /* * libshare is either not installed or we're in a branded zone. The @@ -684,31 +682,28 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic if (_sa_init == NULL) return (SA_OK); - if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { - /* - * We had a cache miss. Most likely it is a new ZFS - * dataset that was just created. We want to make sure - * so check timestamps to see if a different process - * has updated any of the configuration. If there was - * some non-ZFS change, we need to re-initialize the - * internal cache. - */ - zhandle->libzfs_shareflags &= ~ZFSSHARE_MISS; - if (_sa_needs_refresh != NULL && - _sa_needs_refresh(zhandle->libzfs_sharehdl)) { - zfs_uninit_libshare(zhandle); - zhandle->libzfs_sharehdl = _sa_init(service); - } + /* + * Attempt to refresh libshare. This is necessary if there was a cache + * miss for a new ZFS dataset that was just created, or if state of the + * sharetab file has changed since libshare was last initialized. We + * want to make sure so check timestamps to see if a different process + * has updated any of the configuration. If there was some non-ZFS + * change, we need to re-initialize the internal cache. + */ + if (_sa_needs_refresh != NULL && + _sa_needs_refresh(zhandle->libzfs_sharehdl)) { + zfs_uninit_libshare(zhandle); + zhandle->libzfs_sharehdl = _sa_init(service); } - if (ret == SA_OK && zhandle && zhandle->libzfs_sharehdl == NULL) + if (zhandle && zhandle->libzfs_sharehdl == NULL) zhandle->libzfs_sharehdl = _sa_init(service); - if (ret == SA_OK && zhandle->libzfs_sharehdl == NULL) - ret = SA_NO_MEMORY; + if (zhandle->libzfs_sharehdl == NULL) + return (SA_NO_MEMORY); #endif - return (ret); + return (SA_OK); } /* @@ -864,7 +859,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t * zfs_get_name(zhp)); return (-1); } - hdl->libzfs_shareflags |= ZFSSHARE_MISS; share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint); } From owner-svn-src-all@freebsd.org Thu Mar 22 23:50:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 688FEF54D80; Thu, 22 Mar 2018 23:50:44 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13892731CE; Thu, 22 Mar 2018 23:50:44 +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 03F92181A7; Thu, 22 Mar 2018 23:50:43 +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 w2MNohmZ096552; Thu, 22 Mar 2018 23:50:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNoh3r096551; Thu, 22 Mar 2018 23:50:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222350.w2MNoh3r096551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331391 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:50:44 -0000 Author: mav Date: Thu Mar 22 23:50:43 2018 New Revision: 331391 URL: https://svnweb.freebsd.org/changeset/base/331391 Log: MFC r329664: MFV r316893: 7604 if volblocksize property is the default, it displays as "-" rather than 8K illumos/illumos-gate@4d86c0eab246bdfddc2dd52410ba808433bd6266 https://github.com/illumos/illumos-gate/commit/4d86c0eab246bdfddc2dd52410ba808433bd6266 https://www.illumos.org/issues/7604 If a zvol has the default setting for the "volblocksize" property, it is 8KB. However, it is displayed as "-" (not present), rather than "8K". The problem was introduced by: commit 25228e830e86924a41243343b1de9daf2d7dd43a Author: Matthew Ahrens <mahrens@delphix.com> Date: Thu Nov 17 14:37:24 2016 -0800 7571 non-present readonly numeric ZFS props do not have default value which changed changed get_numeric_property() to indicate that readonly default properties are not present. However, zfs_prop_readonly() returns TRUE for both readonly and set-once properties (e.g. volblocksize). Amusingly, that commit essentially reverted: 6900484 default volblocksize is no longer being reported correctly from November 2009. However, that change was not correct either; the correct solution is to only do this check for "truly readonly" (i.e. not setonce) properties. $ zfs list -t volume -o name,volblocksize NAME VOLBLOCK domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ archive - domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ datafile - domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ external - rpool/dump 128K rpool/swap 4K rpool/swap1 =============================================================================== Reviewed by: Pavel Zakharov Reviewed by: Paul Dagnelie Reviewed by: John Kennedy Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Mar 22 23:49:54 2018 (r331390) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Mar 22 23:50:43 2018 (r331391) @@ -2161,9 +2161,12 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t pro /* * If we tried to use a default value for a * readonly property, it means that it was not - * present. + * present. Note this only applies to "truly" + * readonly properties, not set-once properties + * like volblocksize. */ if (zfs_prop_readonly(prop) && + !zfs_prop_setonce(prop) && *source != NULL && (*source)[0] == '\0') { *source = NULL; return (-1); From owner-svn-src-all@freebsd.org Thu Mar 22 23:51:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40F12F54E90; Thu, 22 Mar 2018 23:51:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0DD8733D6; Thu, 22 Mar 2018 23:51:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBE2D182F4; Thu, 22 Mar 2018 23:51:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNpdVH000518; Thu, 22 Mar 2018 23:51:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNpd7P000517; Thu, 22 Mar 2018 23:51:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222351.w2MNpd7P000517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331392 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:51:40 -0000 Author: mav Date: Thu Mar 22 23:51:39 2018 New Revision: 331392 URL: https://svnweb.freebsd.org/changeset/base/331392 Log: MFC r329665: MFV r316901: 7730 libzfs`add_config() leaks config nvl when reading spare/l2cache devices illumos/illumos-gate@105686550ee9cbf5d033166a8a2a5a763667d436 https://github.com/illumos/illumos-gate/commit/105686550ee9cbf5d033166a8a2a5a763667d436 https://www.illumos.org/issues/7730 antares:root:~# mdb /usr/sbin/zpool > ::sysbp _exit > ::run import pool: data id: 2093977168778024605 state: ONLINE action: The pool can be imported using its name or numeric identifier. config: data ONLINE c6t0d0 ONLINE c6t1d0 ONLINE cache c6t2d0 mdb: stop on entry to _exit mdb: target stopped at: 0xfee556ba: nop mdb: You've got symbols! Loading modules: [ ld.so.1 libumem.so.1 libc.so.1 libtopo.so.1 libavl.so.1 libnvpair.so.1 ] > ::findleaks -d BYTES LEAKED VMEM_SEG CALLER 4096 10 fda7b000 MMAP 8192 1 fea8d000 MMAP 8192 1 fe76d000 MMAP 8192 1 fe66e000 MMAP 4096 1 fe570000 MMAP 8192 1 fe470000 MMAP 4096 1 fe372000 MMAP 4096 1 fe273000 MMAP Reviewed by: Matthew Ahrens Reviewed by: Serapheim Dimitropoulos Approved by: Robert Mustacchi Author: Yuri Pankov Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Mar 22 23:50:43 2018 (r331391) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Mar 22 23:51:39 2018 (r331392) @@ -240,9 +240,12 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, cons free(ne); return (-1); } + ne->ne_guid = vdev_guid; ne->ne_next = pl->names; pl->names = ne; + + nvlist_free(config); return (0); } From owner-svn-src-all@freebsd.org Thu Mar 22 23:52:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DF15F5501B; Thu, 22 Mar 2018 23:52:38 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3E817373E; Thu, 22 Mar 2018 23:52:37 +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 AED1318364; Thu, 22 Mar 2018 23:52:37 +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 w2MNqbIX000610; Thu, 22 Mar 2018 23:52:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNqboK000607; Thu, 22 Mar 2018 23:52:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222352.w2MNqboK000607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331393 - in stable/11/cddl/contrib/opensolaris/lib: libzfs/common libzfs_core/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/cddl/contrib/opensolaris/lib: libzfs/common libzfs_core/common X-SVN-Commit-Revision: 331393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:52:38 -0000 Author: mav Date: Thu Mar 22 23:52:37 2018 New Revision: 331393 URL: https://svnweb.freebsd.org/changeset/base/331393 Log: MFC r329667: MFV r316902: 7745 print error if lzc_* is called before libzfs_core_init illumos/illumos-gate@7c13517fff71be473e47531ef4330160c042bedc https://github.com/illumos/illumos-gate/commit/7c13517fff71be473e47531ef4330160c042bedc https://www.illumos.org/issues/7745 The problem is that consumers of `libZFS_Core` that forget to call `libzfs_core_init()` before calling any other function of the library are having a hard time realizing their mistake. The library's internal file descriptor is declared as global static, which is ok, but it is not initialized explicitly; therefore, it defaults to 0, which is a valid file descriptor. If `libzfs_core_init()`, which explicitly initializes the correct fd, is skipped, the ioctl functions return errors that do not have anything to do with `libZFS_Core`, where the problem is actually located. Even though assertions for that existed within `libZFS_Core` for debug builds, they were never enabled because the `-DDEBUG` flag was missing from the compiler flags. This patch applies the following changes: 1. It adds `-DDEBUG` for debug builds of `libZFS_Core` and `libzfs`, to enable their assertions on debug builds. 2. It corrects an assertion within `libzfs`, where a function had been spelled incorrectly (`zpool_prop_unsupported()`) and nobody knew because the `-DDEBUG` flag was missing, and the preprocessor was taking that part of the code away. 3. The library's internal fd is initialized to `-1` and `VERIFY` assertions have been placed to check that the fd is not equal to `-1` before issuing any ioctl. It is important here to note, that the `VERIFY` assertions exist in both debug and non-debug builds. 4. In `libzfs_core_fini` we make sure to never increment the refcount of our fd below 0, and also reset the fd to `-1` when no one refers to it. The reason for this, is for the rare case that the consumer closes all references but then calls one of the library's functions without using `libzfs_core_init()` first, and in the mean time, a previous call to `open()` decided to reuse our previous fd. This scenario would have passed our assertion in Reviewed by: Pavel Zakharov Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Serapheim Dimitropoulos Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Mar 22 23:51:39 2018 (r331392) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Mar 22 23:52:37 2018 (r331393) @@ -273,6 +273,15 @@ cksummer(void *arg) ofp = fdopen(dda->inputfd, "r"); while (ssread(drr, sizeof (*drr), ofp) != 0) { + /* + * kernel filled in checksum, we are going to write same + * record, but need to regenerate checksum. + */ + if (drr->drr_type != DRR_BEGIN) { + bzero(&drr->drr_u.drr_checksum.drr_checksum, + sizeof (drr->drr_u.drr_checksum.drr_checksum)); + } + switch (drr->drr_type) { case DRR_BEGIN: { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Thu Mar 22 23:51:39 2018 (r331392) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Thu Mar 22 23:52:37 2018 (r331393) @@ -94,7 +94,7 @@ extern int zfs_ioctl_version; #endif -static int g_fd; +static int g_fd = -1; static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; static int g_refcount; @@ -120,9 +120,14 @@ libzfs_core_fini(void) { (void) pthread_mutex_lock(&g_lock); ASSERT3S(g_refcount, >, 0); - g_refcount--; - if (g_refcount == 0) + + if (g_refcount > 0) + g_refcount--; + + if (g_refcount == 0 && g_fd != -1) { (void) close(g_fd); + g_fd = -1; + } (void) pthread_mutex_unlock(&g_lock); } @@ -139,6 +144,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, size_t size; ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); @@ -411,6 +417,9 @@ lzc_exists(const char *dataset) */ zfs_cmd_t zc = { 0 }; + ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); + (void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name)); return (ioctl(g_fd, ZFS_IOC_OBJSET_STATS, &zc) == 0); } @@ -656,6 +665,7 @@ recv_impl(const char *snapname, nvlist_t *props, const int error; ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); /* zc_name is name of containing filesystem */ (void) strlcpy(zc.zc_name, snapname, sizeof (zc.zc_name)); From owner-svn-src-all@freebsd.org Thu Mar 22 23:53:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32B18F55121; Thu, 22 Mar 2018 23:53:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD626738AA; Thu, 22 Mar 2018 23:53:18 +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 D847418366; Thu, 22 Mar 2018 23:53:18 +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 w2MNrIIg000692; Thu, 22 Mar 2018 23:53:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNrIQC000691; Thu, 22 Mar 2018 23:53:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222353.w2MNrIQC000691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:53:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331394 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:53:19 -0000 Author: mav Date: Thu Mar 22 23:53:18 2018 New Revision: 331394 URL: https://svnweb.freebsd.org/changeset/base/331394 Log: MFC r329668: MFV r316918: 7990 libzfs: snapspec_cb() does not need to call zfs_strdup() illumos/illumos-gate@d8584ba6fb7a5e46da1725845b99ae5fab5a4baf https://github.com/illumos/illumos-gate/commit/d8584ba6fb7a5e46da1725845b99ae5fab5a4baf https://www.illumos.org/issues/7990 The snapspec_cb() callback function in libzfs does not need to call zfs_strdup(). Reviewed by: Yuri Pankov Reviewed by: Toomas Soome Approved by: Matthew Ahrens Author: Marcel Telka Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Thu Mar 22 23:52:37 2018 (r331393) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Thu Mar 22 23:53:18 2018 (r331394) @@ -317,26 +317,23 @@ static int snapspec_cb(zfs_handle_t *zhp, void *arg) { snapspec_arg_t *ssa = arg; - char *shortsnapname; + const char *shortsnapname; int err = 0; if (ssa->ssa_seenlast) return (0); - shortsnapname = zfs_strdup(zhp->zfs_hdl, - strchr(zfs_get_name(zhp), '@') + 1); + shortsnapname = strchr(zfs_get_name(zhp), '@') + 1; if (!ssa->ssa_seenfirst && strcmp(shortsnapname, ssa->ssa_first) == 0) ssa->ssa_seenfirst = B_TRUE; + if (strcmp(shortsnapname, ssa->ssa_last) == 0) + ssa->ssa_seenlast = B_TRUE; if (ssa->ssa_seenfirst) { err = ssa->ssa_func(zhp, ssa->ssa_arg); } else { zfs_close(zhp); } - - if (strcmp(shortsnapname, ssa->ssa_last) == 0) - ssa->ssa_seenlast = B_TRUE; - free(shortsnapname); return (err); } From owner-svn-src-all@freebsd.org Thu Mar 22 23:54:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF592F552B6; Thu, 22 Mar 2018 23:54:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77C1373AC7; Thu, 22 Mar 2018 23:54:15 +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 726D018369; Thu, 22 Mar 2018 23:54:15 +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 w2MNsF2o000911; Thu, 22 Mar 2018 23:54:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNsEcL000899; Thu, 22 Mar 2018 23:54:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222354.w2MNsEcL000899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331395 - in stable/11: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/usr.sbin/zfsd sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensol... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/usr.sbin/zfsd sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sy... X-SVN-Commit-Revision: 331395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:54:16 -0000 Author: mav Date: Thu Mar 22 23:54:14 2018 New Revision: 331395 URL: https://svnweb.freebsd.org/changeset/base/331395 Log: MFC r329681: MFV r318941: 7446 zpool create should support efi system partition illumos/illumos-gate@7855d95b30fd903e3918bad5a29b777e765db821 https://github.com/illumos/illumos-gate/commit/7855d95b30fd903e3918bad5a29b777e765db821 https://www.illumos.org/issues/7446 Since we support whole-disk configuration for boot pool, we also will need whole disk support with UEFI boot and for this, zpool create should create efi- system partition. I have borrowed the idea from oracle solaris, and introducing zpool create - B switch to provide an way to specify that boot partition should be created. However, there is still an question, how big should the system partition be. For time being, I have set default size 256MB (thats minimum size for FAT32 with 4k blocks). To support custom size, the set on creation "bootsize" property is created and so the custom size can be set as: zpool create B - o bootsize=34MB rpool c0t0d0 After pool is created, the "bootsize" property is read only. When -B switch is not used, the bootsize defaults to 0 and is shown in zpool get output with value ''. Older zfs/zpool implementations are ignoring this property. https://www.illumos.org/rb/r/219/ Reviewed by: Andrew Stormont Reviewed by: Yuri Pankov Approved by: Dan McDonald Author: Toomas Soome This commit makes no sense for FreeBSD, that is why I blocked the option, but it should be good to stay closer to upstream. Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/11/cddl/usr.sbin/zfsd/case_file.cc stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Mar 22 23:54:14 2018 (r331395) @@ -212,7 +212,8 @@ get_usage(zpool_help_t idx) case HELP_CLEAR: return (gettext("\tclear [-nF] [device]\n")); case HELP_CREATE: - return (gettext("\tcreate [-fnd] [-o property=value] ... \n" + return (gettext("\tcreate [-fnd] [-B] " + "[-o property=value] ... \n" "\t [-O file-system-property=value] ... \n" "\t [-m mountpoint] [-R root] ...\n")); case HELP_DESTROY: @@ -499,6 +500,8 @@ zpool_do_add(int argc, char **argv) int c; nvlist_t *nvroot; char *poolname; + zpool_boot_label_t boot_type; + uint64_t boot_size; int ret; zpool_handle_t *zhp; nvlist_t *config; @@ -547,9 +550,15 @@ zpool_do_add(int argc, char **argv) return (1); } + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + /* pass off to get_vdev_spec for processing */ + boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); nvroot = make_root_vdev(zhp, force, !force, B_FALSE, dryrun, - argc, argv); + boot_type, boot_size, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); @@ -774,10 +783,11 @@ errout: } /* - * zpool create [-fnd] [-o property=value] ... + * zpool create [-fnd] [-B] [-o property=value] ... * [-O file-system-property=value] ... * [-R root] [-m mountpoint] ... * + * -B Create boot partition. * -f Force creation, even if devices appear in use * -n Do not create the pool, but display the resulting layout if it * were to be created. @@ -794,12 +804,16 @@ errout: * we get the nvlist back from get_vdev_spec(), we either print out the contents * (if '-n' was specified), or pass it to libzfs to do the creation. */ + +#define SYSTEM256 (256 * 1024 * 1024) int zpool_do_create(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; boolean_t enable_all_pool_feat = B_TRUE; + zpool_boot_label_t boot_type = ZPOOL_NO_BOOT_LABEL; + uint64_t boot_size = 0; int c; nvlist_t *nvroot = NULL; char *poolname; @@ -811,7 +825,7 @@ zpool_do_create(int argc, char **argv) char *propval; /* check options */ - while ((c = getopt(argc, argv, ":fndR:m:o:O:")) != -1) { + while ((c = getopt(argc, argv, ":fndBR:m:o:O:")) != -1) { switch (c) { case 'f': force = B_TRUE; @@ -822,6 +836,22 @@ zpool_do_create(int argc, char **argv) case 'd': enable_all_pool_feat = B_FALSE; break; + case 'B': +#ifdef illumos + /* + * We should create the system partition. + * Also make sure the size is set. + */ + boot_type = ZPOOL_CREATE_BOOT_LABEL; + if (boot_size == 0) + boot_size = SYSTEM256; + break; +#else + (void) fprintf(stderr, + gettext("option '%c' is not supported\n"), + optopt); + goto badusage; +#endif case 'R': altroot = optarg; if (add_prop_list(zpool_prop_to_name( @@ -852,6 +882,20 @@ zpool_do_create(int argc, char **argv) goto errout; /* + * Get bootsize value for make_root_vdev(). + */ + if (zpool_name_to_prop(optarg) == ZPOOL_PROP_BOOTSIZE) { + if (zfs_nicestrtonum(g_zfs, propval, + &boot_size) < 0 || boot_size == 0) { + (void) fprintf(stderr, + gettext("bad boot partition size " + "'%s': %s\n"), propval, + libzfs_error_description(g_zfs)); + goto errout; + } + } + + /* * If the user is creating a pool that doesn't support * feature flags, don't enable any features. */ @@ -928,9 +972,43 @@ zpool_do_create(int argc, char **argv) goto errout; } + /* + * Make sure the bootsize is set when ZPOOL_CREATE_BOOT_LABEL is used, + * and not set otherwise. + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + const char *propname; + char *strptr, *buf = NULL; + int rv; + + propname = zpool_prop_to_name(ZPOOL_PROP_BOOTSIZE); + if (nvlist_lookup_string(props, propname, &strptr) != 0) { + (void) asprintf(&buf, "%" PRIu64, boot_size); + if (buf == NULL) { + (void) fprintf(stderr, + gettext("internal error: out of memory\n")); + goto errout; + } + rv = add_prop_list(propname, buf, &props, B_TRUE); + free(buf); + if (rv != 0) + goto errout; + } + } else { + const char *propname; + char *strptr; + + propname = zpool_prop_to_name(ZPOOL_PROP_BOOTSIZE); + if (nvlist_lookup_string(props, propname, &strptr) == 0) { + (void) fprintf(stderr, gettext("error: setting boot " + "partition size requires option '-B'\n")); + goto errout; + } + } + /* pass off to get_vdev_spec for bulk processing */ nvroot = make_root_vdev(NULL, force, !force, B_FALSE, dryrun, - argc - 1, argv + 1); + boot_type, boot_size, argc - 1, argv + 1); if (nvroot == NULL) goto errout; @@ -3209,6 +3287,8 @@ zpool_do_attach_or_replace(int argc, char **argv, int nvlist_t *nvroot; char *poolname, *old_disk, *new_disk; zpool_handle_t *zhp; + zpool_boot_label_t boot_type; + uint64_t boot_size; int ret; /* check options */ @@ -3273,8 +3353,14 @@ zpool_do_attach_or_replace(int argc, char **argv, int return (1); } + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + + boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); nvroot = make_root_vdev(zhp, force, B_FALSE, replacing, B_FALSE, - argc, argv); + boot_type, boot_size, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Mar 22 23:54:14 2018 (r331395) @@ -44,7 +44,8 @@ uint_t num_logs(nvlist_t *nv); */ nvlist_t *make_root_vdev(zpool_handle_t *zhp, int force, int check_rep, - boolean_t replacing, boolean_t dryrun, int argc, char **argv); + boolean_t replacing, boolean_t dryrun, zpool_boot_label_t boot_type, + uint64_t boot_size, int argc, char **argv); nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props, splitflags_t flags, int argc, char **argv); Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Thu Mar 22 23:54:14 2018 (r331395) @@ -935,14 +935,15 @@ check_replication(nvlist_t *config, nvlist_t *newroot) * Go through and find any whole disks in the vdev specification, labelling them * as appropriate. When constructing the vdev spec, we were unable to open this * device in order to provide a devid. Now that we have labelled the disk and - * know that slice 0 is valid, we can construct the devid now. + * know the pool slice is valid, we can construct the devid now. * * If the disk was already labeled with an EFI label, we will have gotten the * devid already (because we were able to open the whole disk). Otherwise, we * need to get the devid after we label the disk. */ static int -make_disks(zpool_handle_t *zhp, nvlist_t *nv) +make_disks(zpool_handle_t *zhp, nvlist_t *nv, zpool_boot_label_t boot_type, + uint64_t boot_size) { nvlist_t **child; uint_t c, children; @@ -951,6 +952,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) uint64_t wholedisk; int fd; int ret; + int slice; ddi_devid_t devid; char *minor = NULL, *devid_str = NULL; @@ -968,20 +970,36 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) * slice and stat()ing the device. */ verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); - if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, - &wholedisk) != 0 || !wholedisk) - return (0); diskname = strrchr(path, '/'); assert(diskname != NULL); diskname++; - if (zpool_label_disk(g_zfs, zhp, diskname) == -1) - return (-1); + if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, + &wholedisk) != 0 || !wholedisk) { + /* + * This is not whole disk, return error if + * boot partition creation was requested + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + (void) fprintf(stderr, + gettext("creating boot partition is only " + "supported on whole disk vdevs: %s\n"), + diskname); + return (-1); + } + return (0); + } + + ret = zpool_label_disk(g_zfs, zhp, diskname, boot_type, + boot_size, &slice); + if (ret == -1) + return (ret); + /* * Fill in the devid, now that we've labeled the disk. */ - (void) snprintf(buf, sizeof (buf), "%ss0", path); + (void) snprintf(buf, sizeof (buf), "%ss%d", path, slice); if ((fd = open(buf, O_RDONLY)) < 0) { (void) fprintf(stderr, gettext("cannot open '%s': %s\n"), @@ -1004,7 +1022,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) } /* - * Update the path to refer to the 's0' slice. The presence of + * Update the path to refer to the pool slice. The presence of * the 'whole_disk' field indicates to the CLI that we should * chop off the slice number when displaying the device in * future output. @@ -1016,21 +1034,36 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) return (0); } - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + /* illumos kernel does not support booting from multi-vdev pools. */ + if ((boot_type == ZPOOL_CREATE_BOOT_LABEL)) { + if ((strcmp(type, VDEV_TYPE_ROOT) == 0) && children > 1) { + (void) fprintf(stderr, gettext("boot pool " + "can not have more than one vdev\n")); + return (-1); + } + } + + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, &child, &children) == 0) - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, &child, &children) == 0) - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } return (0); } @@ -1429,6 +1462,9 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, { nvlist_t *newroot = NULL, **child; uint_t c, children; +#ifdef illumos + zpool_boot_label_t boot_type; +#endif if (argc > 0) { if ((newroot = construct_spec(argc, argv)) == NULL) { @@ -1438,7 +1474,13 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, } #ifdef illumos - if (!flags.dryrun && make_disks(zhp, newroot) != 0) { + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + + if (!flags.dryrun && + make_disks(zhp, newroot, boot_type, 0) != 0) { nvlist_free(newroot); return (NULL); } @@ -1483,7 +1525,8 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, */ nvlist_t * make_root_vdev(zpool_handle_t *zhp, int force, int check_rep, - boolean_t replacing, boolean_t dryrun, int argc, char **argv) + boolean_t replacing, boolean_t dryrun, zpool_boot_label_t boot_type, + uint64_t boot_size, int argc, char **argv) { nvlist_t *newroot; nvlist_t *poolconfig = NULL; @@ -1525,7 +1568,7 @@ make_root_vdev(zpool_handle_t *zhp, int force, int che /* * Run through the vdev specification and label any whole disks found. */ - if (!dryrun && make_disks(zhp, newroot) != 0) { + if (!dryrun && make_disks(zhp, newroot, boot_type, boot_size) != 0) { nvlist_free(newroot); return (NULL); } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Mar 22 23:54:14 2018 (r331395) @@ -135,6 +135,18 @@ typedef enum zfs_error { } zfs_error_t; /* + * UEFI boot support parameters. When creating whole disk boot pool, + * zpool create should allow to create EFI System partition for UEFI boot + * program. In case of BIOS, the EFI System partition is not used + * even if it does exist. + */ +typedef enum zpool_boot_label { + ZPOOL_NO_BOOT_LABEL = 0, + ZPOOL_CREATE_BOOT_LABEL, + ZPOOL_COPY_BOOT_LABEL +} zpool_boot_label_t; + +/* * The following data structures are all part * of the zfs_allow_t data structure which is * used for printing 'allow' permissions. @@ -266,7 +278,8 @@ extern nvlist_t *zpool_find_vdev(zpool_handle_t *, con boolean_t *, boolean_t *); extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); +extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *, + zpool_boot_label_t, uint64_t, int *); /* * Functions to manage pool properties @@ -349,6 +362,7 @@ extern nvlist_t *zpool_get_config(zpool_handle_t *, nv extern nvlist_t *zpool_get_features(zpool_handle_t *); extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *); extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **); +extern boolean_t zpool_is_bootable(zpool_handle_t *); /* * Import and export functions Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Mar 22 23:54:14 2018 (r331395) @@ -49,7 +49,7 @@ #include "zfs_comutil.h" #include "zfeature_common.h" -static int read_efi_label(nvlist_t *config, diskaddr_t *sb); +static int read_efi_label(nvlist_t *, diskaddr_t *, boolean_t *); static boolean_t zpool_vdev_is_interior(const char *name); #define BACKUP_SLICE "s2" @@ -316,6 +316,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, (void) zfs_nicenum(intval, buf, len); } break; + case ZPOOL_PROP_BOOTSIZE: case ZPOOL_PROP_EXPANDSZ: if (intval == 0) { (void) strlcpy(buf, "-", len); @@ -517,6 +518,16 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char } break; + case ZPOOL_PROP_BOOTSIZE: + if (!flags.create) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "property '%s' can only be set during pool " + "creation"), propname); + (void) zfs_error(hdl, EZFS_BADPROP, errbuf); + goto error; + } + break; + case ZPOOL_PROP_BOOTFS: if (flags.create || flags.import) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -1990,8 +2001,9 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo /* * Search for the requested value. Special cases: * - * - ZPOOL_CONFIG_PATH for whole disk entries. These end in - * "s0" or "s0/old". The "s0" part is hidden from the user, + * - ZPOOL_CONFIG_PATH for whole disk entries. To support + * UEFI boot, these end in "s0" or "s0/old" or "s1" or + * "s1/old". The "s0" or "s1" part is hidden from the user, * but included in the string, so this matches around it. * - looking for a top-level vdev name (i.e. ZPOOL_CONFIG_TYPE). * @@ -2022,14 +2034,16 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo /* * strings identical except trailing "s0" */ - if (strcmp(&val[vlen - 2], "s0") == 0 && + if ((strcmp(&val[vlen - 2], "s0") == 0 || + strcmp(&val[vlen - 2], "s1") == 0) && strncmp(srchval, val, slen) == 0) return (nv); /* * strings identical except trailing "s0/old" */ - if (strcmp(&val[vlen - 6], "s0/old") == 0 && + if ((strcmp(&val[vlen - 6], "s0/old") == 0 || + strcmp(&val[vlen - 6], "s1/old") == 0) && strcmp(&srchval[slen - 4], "/old") == 0 && strncmp(srchval, val, slen - 4) == 0) return (nv); @@ -3460,15 +3474,17 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t * char *tmp = zfs_strdup(hdl, path); /* - * If it starts with c#, and ends with "s0", chop - * the "s0" off, or if it ends with "s0/old", remove - * the "s0" from the middle. + * If it starts with c#, and ends with "s0" or "s1", + * chop the slice off, or if it ends with "s0/old" or + * "s1/old", remove the slice from the middle. */ if (CTD_CHECK(tmp)) { - if (strcmp(&tmp[pathlen - 2], "s0") == 0) { + if (strcmp(&tmp[pathlen - 2], "s0") == 0 || + strcmp(&tmp[pathlen - 2], "s1") == 0) { tmp[pathlen - 2] = '\0'; } else if (pathlen > 6 && - strcmp(&tmp[pathlen - 6], "s0/old") == 0) { + (strcmp(&tmp[pathlen - 6], "s0/old") == 0 || + strcmp(&tmp[pathlen - 6], "s1/old") == 0)) { (void) strcpy(&tmp[pathlen - 6], "/old"); } @@ -3873,15 +3889,18 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, * Read the EFI label from the config, if a label does not exist then * pass back the error to the caller. If the caller has passed a non-NULL * diskaddr argument then we set it to the starting address of the EFI - * partition. + * partition. If the caller has passed a non-NULL boolean argument, then + * we set it to indicate if the disk does have efi system partition. */ static int -read_efi_label(nvlist_t *config, diskaddr_t *sb) +read_efi_label(nvlist_t *config, diskaddr_t *sb, boolean_t *system) { char *path; int fd; char diskname[MAXPATHLEN]; + boolean_t boot = B_FALSE; int err = -1; + int slice; if (nvlist_lookup_string(config, ZPOOL_CONFIG_PATH, &path) != 0) return (err); @@ -3892,8 +3911,16 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb) struct dk_gpt *vtoc; if ((err = efi_alloc_and_read(fd, &vtoc)) >= 0) { - if (sb != NULL) - *sb = vtoc->efi_parts[0].p_start; + for (slice = 0; slice < vtoc->efi_nparts; slice++) { + if (vtoc->efi_parts[slice].p_tag == V_SYSTEM) + boot = B_TRUE; + if (vtoc->efi_parts[slice].p_tag == V_USR) + break; + } + if (sb != NULL && vtoc->efi_parts[slice].p_tag == V_USR) + *sb = vtoc->efi_parts[slice].p_start; + if (system != NULL) + *system = boot; efi_free(vtoc); } (void) close(fd); @@ -3920,7 +3947,7 @@ find_start_block(nvlist_t *config) &wholedisk) != 0 || !wholedisk) { return (MAXOFFSET_T); } - if (read_efi_label(config, &sb) < 0) + if (read_efi_label(config, &sb, NULL) < 0) sb = MAXOFFSET_T; return (sb); } @@ -3940,7 +3967,8 @@ find_start_block(nvlist_t *config) * stripped of any leading /dev path. */ int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name, + zpool_boot_label_t boot_type, uint64_t boot_size, int *slice) { #ifdef illumos char path[MAXPATHLEN]; @@ -3999,15 +4027,6 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t return (zfs_error(hdl, EZFS_NOCAP, errbuf)); } - slice_size = vtoc->efi_last_u_lba + 1; - slice_size -= EFI_MIN_RESV_SIZE; - if (start_block == MAXOFFSET_T) - start_block = NEW_START_BLOCK; - slice_size -= start_block; - - vtoc->efi_parts[0].p_start = start_block; - vtoc->efi_parts[0].p_size = slice_size; - /* * Why we use V_USR: V_BACKUP confuses users, and is considered * disposable by some EFI utilities (since EFI doesn't have a backup @@ -4016,12 +4035,103 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t * etc. were all pretty specific. V_USR is as close to reality as we * can get, in the absence of V_OTHER. */ - vtoc->efi_parts[0].p_tag = V_USR; - (void) strcpy(vtoc->efi_parts[0].p_name, "zfs"); + /* first fix the partition start block */ + if (start_block == MAXOFFSET_T) + start_block = NEW_START_BLOCK; - vtoc->efi_parts[8].p_start = slice_size + start_block; - vtoc->efi_parts[8].p_size = resv; - vtoc->efi_parts[8].p_tag = V_RESERVED; + /* + * EFI System partition is using slice 0. + * ZFS is on slice 1 and slice 8 is reserved. + * We assume the GPT partition table without system + * partition has zfs p_start == NEW_START_BLOCK. + * If start_block != NEW_START_BLOCK, it means we have + * system partition. Correct solution would be to query/cache vtoc + * from existing vdev member. + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + if (boot_size % vtoc->efi_lbasize != 0) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "boot partition size must be a multiple of %d"), + vtoc->efi_lbasize); + (void) close(fd); + efi_free(vtoc); + return (zfs_error(hdl, EZFS_LABELFAILED, errbuf)); + } + /* + * System partition size checks. + * Note the 1MB is quite arbitrary value, since we + * are creating dedicated pool, it should be enough + * to hold fat + efi bootloader. May need to be + * adjusted if the bootloader size will grow. + */ + if (boot_size < 1024 * 1024) { + char buf[64]; + zfs_nicenum(boot_size, buf, sizeof (buf)); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "Specified size %s for EFI System partition is too " + "small, the minimum size is 1MB."), buf); + (void) close(fd); + efi_free(vtoc); + return (zfs_error(hdl, EZFS_LABELFAILED, errbuf)); + } + /* 33MB is tested with mkfs -F pcfs */ + if (hdl->libzfs_printerr && + ((vtoc->efi_lbasize == 512 && + boot_size < 33 * 1024 * 1024) || + (vtoc->efi_lbasize == 4096 && + boot_size < 256 * 1024 * 1024))) { + char buf[64]; + zfs_nicenum(boot_size, buf, sizeof (buf)); + (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + "Warning: EFI System partition size %s is " + "not allowing to create FAT32 file\nsystem, which " + "may result in unbootable system.\n"), buf); + } + /* Adjust zfs partition start by size of system partition. */ + start_block += boot_size / vtoc->efi_lbasize; + } + + if (start_block == NEW_START_BLOCK) { + /* + * Use default layout. + * ZFS is on slice 0 and slice 8 is reserved. + */ + slice_size = vtoc->efi_last_u_lba + 1; + slice_size -= EFI_MIN_RESV_SIZE; + slice_size -= start_block; + if (slice != NULL) + *slice = 0; + + vtoc->efi_parts[0].p_start = start_block; + vtoc->efi_parts[0].p_size = slice_size; + + vtoc->efi_parts[0].p_tag = V_USR; + (void) strcpy(vtoc->efi_parts[0].p_name, "zfs"); + + vtoc->efi_parts[8].p_start = slice_size + start_block; + vtoc->efi_parts[8].p_size = resv; + vtoc->efi_parts[8].p_tag = V_RESERVED; + } else { + slice_size = start_block - NEW_START_BLOCK; + vtoc->efi_parts[0].p_start = NEW_START_BLOCK; + vtoc->efi_parts[0].p_size = slice_size; + vtoc->efi_parts[0].p_tag = V_SYSTEM; + (void) strcpy(vtoc->efi_parts[0].p_name, "loader"); + if (slice != NULL) + *slice = 1; + /* prepare slice 1 */ + slice_size = vtoc->efi_last_u_lba + 1 - slice_size; + slice_size -= resv; + slice_size -= NEW_START_BLOCK; + vtoc->efi_parts[1].p_start = start_block; + vtoc->efi_parts[1].p_size = slice_size; + vtoc->efi_parts[1].p_tag = V_USR; + (void) strcpy(vtoc->efi_parts[1].p_name, "zfs"); + + vtoc->efi_parts[8].p_start = slice_size + start_block; + vtoc->efi_parts[8].p_size = resv; + vtoc->efi_parts[8].p_tag = V_RESERVED; + } if (efi_write(fd, vtoc) != 0) { /* Modified: stable/11/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/case_file.cc Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/usr.sbin/zfsd/case_file.cc Thu Mar 22 23:54:14 2018 (r331395) @@ -239,6 +239,8 @@ CaseFile::ReEvaluate(const string &devPath, const stri { ZpoolList zpl(ZpoolList::ZpoolByGUID, &m_poolGUID); zpool_handle_t *pool(zpl.empty() ? NULL : zpl.front()); + zpool_boot_label_t boot_type; + uint64_t boot_size; if (pool == NULL || !RefreshVdevState()) { /* @@ -331,7 +333,13 @@ CaseFile::ReEvaluate(const string &devPath, const stri } /* Write a label on the newly inserted disk. */ - if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str()) != 0) { + if (zpool_is_bootable(pool)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + boot_size = zpool_get_prop_int(pool, ZPOOL_PROP_BOOTSIZE, NULL); + if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str(), + boot_type, boot_size, NULL) != 0) { syslog(LOG_ERR, "Replace vdev(%s/%s) by physical path (label): %s: %s\n", zpool_get_name(pool), VdevGUIDString().c_str(), Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu Mar 22 23:54:14 2018 (r331395) @@ -100,6 +100,10 @@ zpool_prop_init(void) PROP_READONLY, ZFS_TYPE_POOL, "<1.00x or higher if deduped>", "DEDUP"); + /* system partition size */ + zprop_register_number(ZPOOL_PROP_BOOTSIZE, "bootsize", 0, PROP_ONETIME, + ZFS_TYPE_POOL, "", "BOOTSIZE"); + /* default number properties */ zprop_register_number(ZPOOL_PROP_VERSION, "version", SPA_VERSION, PROP_DEFAULT, ZFS_TYPE_POOL, "", "VERSION"); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Mar 22 23:54:14 2018 (r331395) @@ -481,6 +481,7 @@ metaslab_class_expandable_space(metaslab_class_t *mc) spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER); for (int c = 0; c < rvd->vdev_children; c++) { + uint64_t tspace; vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; @@ -493,9 +494,13 @@ metaslab_class_expandable_space(metaslab_class_t *mc) * Calculate if we have enough space to add additional * metaslabs. We report the expandable space in terms * of the metaslab size since that's the unit of expansion. + * Adjust by efi system partition size. */ - space += P2ALIGN(tvd->vdev_max_asize - tvd->vdev_asize, - 1ULL << tvd->vdev_ms_shift); + tspace = tvd->vdev_max_asize - tvd->vdev_asize; + if (tspace > mc->mc_spa->spa_bootsize) { + tspace -= mc->mc_spa->spa_bootsize; + } + space += P2ALIGN(tspace, 1ULL << tvd->vdev_ms_shift); } spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); return (space); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:54:14 2018 (r331395) @@ -2818,6 +2818,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); + spa_prop_find(spa, ZPOOL_PROP_BOOTSIZE, &spa->spa_bootsize); spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, &spa->spa_dedup_ditto); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Mar 22 23:54:14 2018 (r331395) @@ -242,6 +242,7 @@ struct spa { int spa_mode; /* FREAD | FWRITE */ spa_log_state_t spa_log_state; /* log state */ uint64_t spa_autoexpand; /* lun expansion on/off */ + uint64_t spa_bootsize; /* efi system partition size */ ddt_t *spa_ddt[ZIO_CHECKSUM_FUNCTIONS]; /* in-core DDTs */ uint64_t spa_ddt_stat_object; /* DDT statistics */ uint64_t spa_dedup_ditto; /* dedup ditto threshold */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:54:14 2018 (r331395) @@ -2922,8 +2922,8 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) * since that determines how much space the pool can expand. */ if (vd->vdev_aux == NULL && tvd != NULL && vd->vdev_max_asize != 0) { - vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize, - 1ULL << tvd->vdev_ms_shift); + vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize - + spa->spa_bootsize, 1ULL << tvd->vdev_ms_shift); } vs->vs_configured_ashift = vd->vdev_top != NULL ? vd->vdev_top->vdev_ashift : vd->vdev_ashift; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:54:14 2018 (r331395) @@ -211,6 +211,7 @@ typedef enum { ZPOOL_PROP_FRAGMENTATION, ZPOOL_PROP_LEAKED, ZPOOL_PROP_MAXBLOCKSIZE, + ZPOOL_PROP_BOOTSIZE, ZPOOL_NUM_PROPS } zpool_prop_t; From owner-svn-src-all@freebsd.org Thu Mar 22 23:55:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35DC1F553FE; Thu, 22 Mar 2018 23:55:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE66973C32; Thu, 22 Mar 2018 23:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D94E01836A; Thu, 22 Mar 2018 23:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNt00J001027; Thu, 22 Mar 2018 23:55:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNt0MZ001026; Thu, 22 Mar 2018 23:55:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222355.w2MNt0MZ001026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331396 - stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent X-SVN-Commit-Revision: 331396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:55:01 -0000 Author: mav Date: Thu Mar 22 23:55:00 2018 New Revision: 331396 URL: https://svnweb.freebsd.org/changeset/base/331396 Log: MFC r329683: MFV r319736: 6396 remove SVM illumos/illumos-gate@5f10ef697f250374b7b917e10961c4e02d4e3112 https://github.com/illumos/illumos-gate/commit/5f10ef697f250374b7b917e10961c4e02d4e3112 https://www.illumos.org/issues/6396 LVM = SVM = Solaris Volume Manager dead code and not using with ZFS based platform. Reviewed by: Igor Kozhukhov Reviewed by: Toomas Soome Approved by: Hans Rosenfeld Author: Yuri Pankov Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:54:14 2018 (r331395) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:55:00 2018 (r331396) @@ -18,9 +18,10 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. */ #ifndef _SYS_SYSEVENT_EVENTDEFS_H @@ -59,67 +60,6 @@ extern "C" { * by Sun Cluster software. */ #define EC_CLUSTER "EC_Cluster" - -/* - * The following classes are exclusively reserved for use by the - * Solaris Volume Manager (SVM) - */ -#define EC_SVM_CONFIG "EC_SVM_Config" -#define EC_SVM_STATE "EC_SVM_State" - -/* - * EC_SVM_CONFIG subclass definitions - supporting attributes (name/value pairs) - * are found in sys/sysevent/svm.h - */ -#define ESC_SVM_CREATE "ESC_SVM_Create" -#define ESC_SVM_DELETE "ESC_SVM_Delete" -#define ESC_SVM_ADD "ESC_SVM_Add" -#define ESC_SVM_REMOVE "ESC_SVM_Remove" -#define ESC_SVM_REPLACE "ESC_SVM_Replace" -#define ESC_SVM_GROW "ESC_SVM_Grow" -#define ESC_SVM_RENAME_SRC "ESC_SVM_Rename_Src" -#define ESC_SVM_RENAME_DST "ESC_SVM_Rename_Dst" -#define ESC_SVM_MEDIATOR_ADD "ESC_SVM_Mediator_Add" -#define ESC_SVM_MEDIATOR_DELETE "ESC_SVM_Mediator_Delete" -#define ESC_SVM_HOST_ADD "ESC_SVM_Host_Add" -#define ESC_SVM_HOST_DELETE "ESC_SVM_Host_Delete" -#define ESC_SVM_DRIVE_ADD "ESC_SVM_Drive_Add" -#define ESC_SVM_DRIVE_DELETE "ESC_SVM_Drive_Delete" -#define ESC_SVM_DETACH "ESC_SVM_Detach" -#define ESC_SVM_DETACHING "ESC_SVM_Detaching" -#define ESC_SVM_ATTACH "ESC_SVM_Attach" -#define ESC_SVM_ATTACHING "ESC_SVM_Attaching" - -/* - * EC_SVM_STATE subclass definitions - supporting attributes (name/value pairs) - * are found in sys/sysevent/svm.h - */ -#define ESC_SVM_INIT_START "ESC_SVM_Init_Start" -#define ESC_SVM_INIT_FAILED "ESC_SVM_Init_Failed" -#define ESC_SVM_INIT_FATAL "ESC_SVM_Init_Fatal" -#define ESC_SVM_INIT_SUCCESS "ESC_SVM_Init_Success" -#define ESC_SVM_IOERR "ESC_SVM_Ioerr" -#define ESC_SVM_ERRED "ESC_SVM_Erred" -#define ESC_SVM_LASTERRED "ESC_SVM_Lasterred" -#define ESC_SVM_OK "ESC_SVM_Ok" -#define ESC_SVM_ENABLE "ESC_SVM_Enable" -#define ESC_SVM_RESYNC_START "ESC_SVM_Resync_Start" -#define ESC_SVM_RESYNC_FAILED "ESC_SVM_Resync_Failed" -#define ESC_SVM_RESYNC_SUCCESS "ESC_SVM_Resync_Success" -#define ESC_SVM_RESYNC_DONE "ESC_SVM_Resync_Done" -#define ESC_SVM_HOTSPARED "ESC_SVM_Hotspared" -#define ESC_SVM_HS_FREED "ESC_SVM_HS_Freed" -#define ESC_SVM_HS_CHANGED "ESC_SVM_HS_Changed" -#define ESC_SVM_TAKEOVER "ESC_SVM_Takeover" -#define ESC_SVM_RELEASE "ESC_SVM_Release" -#define ESC_SVM_OPEN_FAIL "ESC_SVM_Open_Fail" -#define ESC_SVM_OFFLINE "ESC_SVM_Offline" -#define ESC_SVM_ONLINE "ESC_SVM_Online" -#define ESC_SVM_CHANGE "ESC_SVM_Change" -#define ESC_SVM_EXCHANGE "ESC_SVM_Exchange" -#define ESC_SVM_REGEN_START "ESC_SVM_Regen_Start" -#define ESC_SVM_REGEN_DONE "ESC_SVM_Regen_Done" -#define ESC_SVM_REGEN_FAILED "ESC_SVM_Regen_Failed" /* * EC_DR subclass definitions - supporting attributes (name/value pairs) From owner-svn-src-all@freebsd.org Thu Mar 22 23:56:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ED4EF555EC; Thu, 22 Mar 2018 23:56:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D58FD73DC8; Thu, 22 Mar 2018 23:56:18 +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 D03181836B; Thu, 22 Mar 2018 23:56:18 +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 w2MNuIc9001133; Thu, 22 Mar 2018 23:56:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNuISt001125; Thu, 22 Mar 2018 23:56:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222356.w2MNuISt001125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331397 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs sys/sysevent X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs sys/sysevent X-SVN-Commit-Revision: 331397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:56:19 -0000 Author: mav Date: Thu Mar 22 23:56:17 2018 New Revision: 331397 URL: https://svnweb.freebsd.org/changeset/base/331397 Log: MFC r329690: MFV r319737: 6939 add sysevents to zfs core for commands illumos/illumos-gate@ce1577b04976f1d8bb5f235b6eaaab15b46a3068 https://github.com/illumos/illumos-gate/commit/ce1577b04976f1d8bb5f235b6eaaab15b46a3068 https://www.illumos.org/issues/6939 Originally created https://smartos.org/bugview/OS-4489 sysevents should be fired in the kernel from ZFS whenever a command is run that is logged in zpool history. Example output Terminal 1 root - gz sunos ~ # zfs create zones/foobar root - gz sunos ~ # zfs set quota=10g zones/foobar root - gz sunos ~ # zfs destroy zones/foobar Terminal 2 root - gz sunos ~ # sysevent EC_zfs nvlist version: 0 date = 2016-04-28T14:50:08.964Z vendor = SUNW publisher = zfs class = EC_zfs subclass = ESC_ZFS_history_event pid = 0 data = (embedded nvlist) nvlist version: 0 pool_name = zones pool_guid = 0x40c964e8f9a7a694 history_record = (embedded nvlist) nvlist version: 0 dsname = zones/foobar dsid = 0x1525 history internal str = internal_name = create history txg = 0x4c4ef3 Reviewed by: Patrick Mooney Reviewed by: Joshua M. Clulow Reviewed by: Josh Wilsdon Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Richard Elling Reviewed by: Alan Somers Reviewed by: Andrew Stormont Approved by: Matthew Ahrens Author: Dave Eddy Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Mar 22 23:56:17 2018 (r331397) @@ -22,6 +22,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Gary Mills * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -242,9 +243,10 @@ dsl_scan_setup_sync(void *arg, dmu_tx_t *tx) if (vdev_resilver_needed(spa->spa_root_vdev, &scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) { - spa_event_notify(spa, NULL, ESC_ZFS_RESILVER_START); + spa_event_notify(spa, NULL, NULL, + ESC_ZFS_RESILVER_START); } else { - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_START); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_START); } spa->spa_scrub_started = B_TRUE; @@ -353,7 +355,8 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu vdev_dtl_reassess(spa->spa_root_vdev, tx->tx_txg, complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE); if (complete) { - spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ? + spa_event_notify(spa, NULL, NULL, + scn->scn_phys.scn_min_txg ? ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH); } spa_errlog_rotate(spa); @@ -387,7 +390,7 @@ dsl_scan_cancel_sync(void *arg, dmu_tx_t *tx) dsl_scan_done(scn, B_FALSE, tx); dsl_scan_sync_state(scn, tx); - spa_event_notify(scn->scn_dp->dp_spa, NULL, ESC_ZFS_SCRUB_ABORT); + spa_event_notify(scn->scn_dp->dp_spa, NULL, NULL, ESC_ZFS_SCRUB_ABORT); } int @@ -442,7 +445,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) spa->spa_scan_pass_scrub_pause = gethrestime_sec(); scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx); - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_PAUSED); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_PAUSED); } else { ASSERT3U(*cmd, ==, POOL_SCRUB_NORMAL); if (dsl_scan_is_paused_scrub(scn)) { @@ -2015,7 +2018,7 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); if (err == 0) { - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_RESUME); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:56:17 2018 (r331397) @@ -27,6 +27,7 @@ * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -153,7 +154,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */ }; -static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, const char *name); +static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, + const char *name); static void spa_event_post(sysevent_t *ev); static void spa_sync_version(void *arg, dmu_tx_t *tx); static void spa_sync_props(void *arg, dmu_tx_t *tx); @@ -805,7 +807,7 @@ spa_change_guid(spa_t *spa) if (error == 0) { spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_REGUID); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_REGUID); } mutex_exit(&spa_namespace_lock); @@ -1679,7 +1681,7 @@ spa_check_removed(vdev_t *vd) if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd) && !vd->vdev_ishole) { zfs_post_autoreplace(vd->vdev_spa, vd); - spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_CHECK); + spa_event_notify(vd->vdev_spa, vd, NULL, ESC_ZFS_VDEV_CHECK); } } @@ -3920,7 +3922,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ txg_wait_synced(spa->spa_dsl_pool, txg); spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_CREATE); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE); spa_history_log_version(spa, "create"); @@ -4392,7 +4394,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_configfile_set(spa, props, B_FALSE); spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); mutex_exit(&spa_namespace_lock); return (0); @@ -4525,7 +4527,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_history_log_version(spa, "import"); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); mutex_exit(&spa_namespace_lock); @@ -4719,7 +4721,7 @@ spa_export_common(char *pool, int new_state, nvlist_t } } - spa_event_notify(spa, NULL, ESC_ZFS_POOL_DESTROY); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY); if (spa->spa_state != POOL_STATE_UNINITIALIZED) { spa_unload(spa); @@ -4874,7 +4876,7 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot) mutex_enter(&spa_namespace_lock); spa_config_update(spa, SPA_CONFIG_UPDATE_POOL); - spa_event_notify(spa, NULL, ESC_ZFS_VDEV_ADD); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_VDEV_ADD); mutex_exit(&spa_namespace_lock); return (0); @@ -5050,7 +5052,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *n if (newvd->vdev_isspare) { spa_spare_activate(newvd); - spa_event_notify(spa, newvd, ESC_ZFS_VDEV_SPARE); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_SPARE); } oldvdpath = spa_strdup(oldvd->vdev_path); @@ -5070,9 +5072,9 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *n dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg); if (spa->spa_bootfs) - spa_event_notify(spa, newvd, ESC_ZFS_BOOTFS_VDEV_ATTACH); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_BOOTFS_VDEV_ATTACH); - spa_event_notify(spa, newvd, ESC_ZFS_VDEV_ATTACH); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_ATTACH); /* * Commit the config @@ -5286,7 +5288,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pg vd->vdev_detached = B_TRUE; vdev_dirty(tvd, VDD_DTL, vd, txg); - spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE); /* hang on to the spa before we release the lock */ spa_open_ref(spa, FTAG); @@ -5802,7 +5804,8 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u if (vd == NULL || unspare) { if (vd == NULL) vd = spa_lookup_by_guid(spa, guid, B_TRUE); - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); + ev = spa_event_create(spa, vd, NULL, + ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_spares.sav_config, ZPOOL_CONFIG_SPARES, spares, nspares, nv); spa_load_spares(spa); @@ -5818,7 +5821,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u * Cache devices can always be removed. */ vd = spa_lookup_by_guid(spa, guid, B_TRUE); - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); + ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_l2cache.sav_config, ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv); spa_load_l2cache(spa); @@ -5859,7 +5862,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u /* * Clean up the vdev namespace. */ - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV); + ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_DEV); spa_vdev_remove_from_namespace(spa, vd); } else if (vd != NULL) { @@ -7331,7 +7334,7 @@ spa_has_active_shared_spare(spa_t *spa) } static sysevent_t * -spa_event_create(spa_t *spa, vdev_t *vd, const char *name) +spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name) { sysevent_t *ev = NULL; #ifdef _KERNEL @@ -7368,6 +7371,10 @@ spa_event_create(spa_t *spa, vdev_t *vd, const char *n } } + if (hist_nvl != NULL) { + fnvlist_merge((nvlist_t *)attr, hist_nvl); + } + if (sysevent_attach_attributes(ev, attr) != 0) goto done; attr = NULL; @@ -7394,12 +7401,12 @@ spa_event_post(sysevent_t *ev) /* * Post a sysevent corresponding to the given event. The 'name' must be one of * the event definitions in sys/sysevent/eventdefs.h. The payload will be - * filled in from the spa and (optionally) the vdev. This doesn't do anything - * in the userland libzpool, as we don't want consumers to misinterpret ztest - * or zdb as real changes. + * filled in from the spa and (optionally) the vdev and history nvl. This + * doesn't do anything in the userland libzpool, as we don't want consumers to + * misinterpret ztest or zdb as real changes. */ void -spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) +spa_event_notify(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name) { - spa_event_post(spa_event_create(spa, vd, name)); + spa_event_post(spa_event_create(spa, vd, hist_nvl, name)); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu Mar 22 23:56:17 2018 (r331397) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright 2017 Joyent, Inc. */ #include @@ -321,7 +322,7 @@ spa_config_sync(spa_t *target, boolean_t removing, boo spa_config_generation++; if (postsysevent) - spa_event_notify(target, NULL, ESC_ZFS_CONFIG_SYNC); + spa_event_notify(target, NULL, NULL, ESC_ZFS_CONFIG_SYNC); } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Thu Mar 22 23:56:17 2018 (r331397) @@ -23,6 +23,7 @@ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. */ #include @@ -191,6 +192,71 @@ spa_history_zone(void) } /* + * Post a history sysevent. + * + * The nvlist_t* passed into this function will be transformed into a new + * nvlist where: + * + * 1. Nested nvlists will be flattened to a single level + * 2. Keys will have their names normalized (to remove any problematic + * characters, such as whitespace) + * + * The nvlist_t passed into this function will duplicated and should be freed + * by caller. + * + */ +static void +spa_history_log_notify(spa_t *spa, nvlist_t *nvl) +{ + nvlist_t *hist_nvl = fnvlist_alloc(); + uint64_t uint64; + char *string; + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_CMD, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_CMD, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_ZONE, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_ZONE, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_HOST, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_HOST, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_DSNAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_DSNAME, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_STR, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_IOCTL, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_DSID, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_DSID, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TXG, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TXG, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TIME, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TIME, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_WHO, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_WHO, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_INT_EVENT, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_INT_EVENT, uint64); + + spa_event_notify(spa, NULL, hist_nvl, ESC_ZFS_HISTORY_EVENT); + + nvlist_free(hist_nvl); +} + +/* * Write out a history event. */ /*ARGSUSED*/ @@ -254,6 +320,22 @@ spa_history_log_sync(void *arg, dmu_tx_t *tx) fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME), fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR)); } + /* + * The history sysevent is posted only for internal history + * messages to show what has happened, not how it happened. For + * example, the following command: + * + * # zfs destroy -r tank/foo + * + * will result in one sysevent posted per dataset that is + * destroyed as a result of the command - which could be more + * than one event in total. By contrast, if the sysevent was + * posted as a result of the ZPOOL_HIST_CMD key being present + * it would result in only one sysevent being posted with the + * full command line arguments, requiring the consumer to know + * how to parse and understand zfs(1M) command invocations. + */ + spa_history_log_notify(spa, nvl); } else if (nvlist_exists(nvl, ZPOOL_HIST_IOCTL)) { zfs_dbgmsg("ioctl %s", fnvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:56:17 2018 (r331397) @@ -25,6 +25,7 @@ * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -898,7 +899,8 @@ extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t); /* asynchronous event notification */ -extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name); +extern void spa_event_notify(spa_t *spa, vdev_t *vdev, nvlist_t *hist_nvl, + const char *name); #ifdef ZFS_DEBUG #define dprintf_bp(bp, fmt, ...) do { \ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:56:17 2018 (r331397) @@ -25,6 +25,7 @@ * Copyright 2017 Nexenta Systems, Inc. * Copyright 2013 Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. */ #include @@ -2651,7 +2652,7 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, if (wasoffline || (oldstate < VDEV_STATE_DEGRADED && vd->vdev_state >= VDEV_STATE_DEGRADED)) - spa_event_notify(spa, vd, ESC_ZFS_VDEV_ONLINE); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_ONLINE); return (spa_vdev_state_exit(spa, vd, 0)); } @@ -2822,7 +2823,7 @@ vdev_clear(spa_t *spa, vdev_t *vd) if (vd->vdev_aux == NULL && !vdev_is_dead(vd)) spa_async_request(spa, SPA_ASYNC_RESILVER); - spa_event_notify(spa, vd, ESC_ZFS_VDEV_CLEAR); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_CLEAR); } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:56:17 2018 (r331397) @@ -23,9 +23,9 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -1019,11 +1019,45 @@ typedef enum { * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 + * + * ESC_ZFS_HISTORY_EVENT + * + * ZFS_EV_POOL_NAME DATA_TYPE_STRING + * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 + * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional) + * + * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the + * history log nvlist. The keynames will be free of any spaces or other + * characters that could be potentially unexpected to consumers of the + * sysevents. */ #define ZFS_EV_POOL_NAME "pool_name" #define ZFS_EV_POOL_GUID "pool_guid" #define ZFS_EV_VDEV_PATH "vdev_path" #define ZFS_EV_VDEV_GUID "vdev_guid" +#define ZFS_EV_HIST_TIME "history_time" +#define ZFS_EV_HIST_CMD "history_command" +#define ZFS_EV_HIST_WHO "history_who" +#define ZFS_EV_HIST_ZONE "history_zone" +#define ZFS_EV_HIST_HOST "history_hostname" +#define ZFS_EV_HIST_TXG "history_txg" +#define ZFS_EV_HIST_INT_EVENT "history_internal_event" +#define ZFS_EV_HIST_INT_STR "history_internal_str" +#define ZFS_EV_HIST_INT_NAME "history_internal_name" +#define ZFS_EV_HIST_IOCTL "history_ioctl" +#define ZFS_EV_HIST_DSNAME "history_dsname" +#define ZFS_EV_HIST_DSID "history_dsid" #ifdef __cplusplus } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:56:17 2018 (r331397) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2017 Joyent, Inc. */ #ifndef _SYS_SYSEVENT_EVENTDEFS_H @@ -208,6 +209,7 @@ extern "C" { #define ESC_ZFS_VDEV_SPARE "ESC_ZFS_vdev_spare" #define ESC_ZFS_BOOTFS_VDEV_ATTACH "ESC_ZFS_bootfs_vdev_attach" #define ESC_ZFS_POOL_REGUID "ESC_ZFS_pool_reguid" +#define ESC_ZFS_HISTORY_EVENT "ESC_ZFS_history_event" #define ESC_ZFS_VDEV_AUTOEXPAND "ESC_ZFS_vdev_autoexpand" /* From owner-svn-src-all@freebsd.org Thu Mar 22 23:56:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94168F556F1; Thu, 22 Mar 2018 23:56: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4775673F04; Thu, 22 Mar 2018 23:56: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 41C2E1836C; Thu, 22 Mar 2018 23:56: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 w2MNusMe001212; Thu, 22 Mar 2018 23:56:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNusQ2001211; Thu, 22 Mar 2018 23:56:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222356.w2MNusQ2001211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331398 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:56:54 -0000 Author: mav Date: Thu Mar 22 23:56:53 2018 New Revision: 331398 URL: https://svnweb.freebsd.org/changeset/base/331398 Log: MFC r329691: MFV r322231: 8430 dir_is_empty_readdir() doesn't properly handle error from fdopendir() illumos/illumos-gate@ba6e7e6505150388de6dc6a88741164118a421bf https://github.com/illumos/illumos-gate/commit/ba6e7e6505150388de6dc6a88741164118a421bf https://www.illumos.org/issues/8430 we should close dirfd if fdopendir() fails. Reviewed by: Serapheim Dimitropoulos Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: Yuri Pankov Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Sowrabha Gopal Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:56:17 2018 (r331397) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:56:53 2018 (r331398) @@ -216,6 +216,7 @@ dir_is_empty_readdir(const char *dirname) } if ((dirp = fdopendir(dirfd)) == NULL) { + (void) close(dirfd); return (B_TRUE); } From owner-svn-src-all@freebsd.org Thu Mar 22 23:58:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD946F55A4C; Thu, 22 Mar 2018 23:58:06 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67FCE740EF; Thu, 22 Mar 2018 23:58:06 +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 5F50218398; Thu, 22 Mar 2018 23:58:06 +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 w2MNw62r001321; Thu, 22 Mar 2018 23:58:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNw5kP001312; Thu, 22 Mar 2018 23:58:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222358.w2MNw5kP001312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:58:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331399 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 331399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:58:07 -0000 Author: mav Date: Thu Mar 22 23:58:05 2018 New Revision: 331399 URL: https://svnweb.freebsd.org/changeset/base/331399 Log: MFC r329694: MFV r324198: 8081 Compiler warnings in zdb illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://www.illumos.org/issues/8081 zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD, which uses -WError, the only way to build it is to disable all compiler warnings. This makes it much harder to detect newly introduced bugs. We should cleanup all the warnings. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Richard Lowe Author: Alan Somers Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:58:05 2018 (r331399) @@ -4458,8 +4458,9 @@ arc_kmem_reap_now(void) * This possible deadlock is avoided by always acquiring a hash lock * using mutex_tryenter() from arc_reclaim_thread(). */ +/* ARGSUSED */ static void -arc_reclaim_thread(void *dummy __unused) +arc_reclaim_thread(void *unused __unused) { hrtime_t growtime = 0; callb_cpr_t cpr; @@ -7596,8 +7597,9 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint * This thread feeds the L2ARC at regular intervals. This is the beating * heart of the L2ARC. */ +/* ARGSUSED */ static void -l2arc_feed_thread(void *dummy __unused) +l2arc_feed_thread(void *unused __unused) { callb_cpr_t cpr; l2arc_dev_t *dev; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Mar 22 23:58:05 2018 (r331399) @@ -505,8 +505,9 @@ dbuf_evict_one(void) * of the dbuf cache is at or below the maximum size. Once the dbuf is aged * out of the cache it is destroyed and becomes eligible for arc eviction. */ +/* ARGSUSED */ static void -dbuf_evict_thread(void *dummy __unused) +dbuf_evict_thread(void *unused __unused) { callb_cpr_t cpr; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:58:05 2018 (r331399) @@ -6180,7 +6180,7 @@ spa_async_autoexpand(spa_t *spa, vdev_t *vd) static void spa_async_thread(void *arg) { - spa_t *spa = arg; + spa_t *spa = (spa_t *)arg; int tasks; ASSERT(spa->spa_sync_on); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Thu Mar 22 23:58:05 2018 (r331399) @@ -41,7 +41,7 @@ extern "C" { * particular object, use FTAG (which is a string) for the holder_tag. * Otherwise, use the object that holds the reference. */ -#define FTAG ((char *)__func__) +#define FTAG ((char *)(uintptr_t)__func__) #ifdef ZFS_DEBUG typedef struct reference { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h Thu Mar 22 23:58:05 2018 (r331399) @@ -147,8 +147,8 @@ int sa_replace_all_by_template(sa_handle_t *, sa_bulk_ int sa_replace_all_by_template_locked(sa_handle_t *, sa_bulk_attr_t *, int, dmu_tx_t *); boolean_t sa_enabled(objset_t *); -void sa_cache_init(); -void sa_cache_fini(); +void sa_cache_init(void); +void sa_cache_fini(void); int sa_set_sa_object(objset_t *, uint64_t); int sa_hdrsize(void *); void sa_handle_lock(sa_handle_t *); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:58:05 2018 (r331399) @@ -890,7 +890,7 @@ extern void vdev_cache_stat_fini(void); /* Initialization and termination */ extern void spa_init(int flags); extern void spa_fini(void); -extern void spa_boot_init(); +extern void spa_boot_init(void); /* properties */ extern int spa_prop_set(spa_t *spa, nvlist_t *nvp); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Mar 22 23:58:05 2018 (r331399) @@ -389,7 +389,7 @@ typedef int zil_parse_blk_func_t(zilog_t *zilog, blkpt uint64_t txg); typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); -typedef int zil_replay_func_t(); +typedef int zil_replay_func_t(void *arg1, void *arg2, boolean_t byteswap); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, struct lwb *lwb, zio_t *zio); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Thu Mar 22 23:58:05 2018 (r331399) @@ -72,7 +72,7 @@ zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t m /* ARGSUSED */ static int -zfs_replay_error(zfsvfs_t *zfsvfs, lr_t *lr, boolean_t byteswap) +zfs_replay_error(void *arg1, void *arg2, boolean_t byteswap) { return (SET_ERROR(ENOTSUP)); } @@ -265,9 +265,10 @@ zfs_replay_swap_attrs(lr_attr_t *lrattr) * as option FUID information. */ static int -zfs_replay_create_acl(zfsvfs_t *zfsvfs, - lr_acl_create_t *lracl, boolean_t byteswap) +zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_create_t *lracl = arg2; char *name = NULL; /* location determined later */ lr_create_t *lr = (lr_create_t *)lracl; znode_t *dzp; @@ -414,8 +415,10 @@ bail: } static int -zfs_replay_create(zfsvfs_t *zfsvfs, lr_create_t *lr, boolean_t byteswap) +zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_create_t *lr = arg2; char *name = NULL; /* location determined later */ char *link; /* symlink content follows name */ znode_t *dzp; @@ -546,8 +549,10 @@ out: } static int -zfs_replay_remove(zfsvfs_t *zfsvfs, lr_remove_t *lr, boolean_t byteswap) +zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_remove_t *lr = arg2; char *name = (char *)(lr + 1); /* name follows lr_remove_t */ znode_t *dzp; struct componentname cn; @@ -597,8 +602,10 @@ fail: } static int -zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap) +zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_link_t *lr = arg2; char *name = (char *)(lr + 1); /* name follows lr_link_t */ znode_t *dzp, *zp; struct componentname cn; @@ -637,8 +644,10 @@ zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boole } static int -zfs_replay_rename(zfsvfs_t *zfsvfs, lr_rename_t *lr, boolean_t byteswap) +zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_rename_t *lr = arg2; char *sname = (char *)(lr + 1); /* sname and tname follow lr_rename_t */ char *tname = sname + strlen(sname) + 1; znode_t *sdzp, *tdzp; @@ -707,8 +716,10 @@ fail: } static int -zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap) +zfs_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_write_t *lr = arg2; char *data = (char *)(lr + 1); /* data follows lr_write_t */ znode_t *zp; int error; @@ -773,8 +784,10 @@ zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boo * the file is grown. */ static int -zfs_replay_write2(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap) +zfs_replay_write2(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_write_t *lr = arg2; znode_t *zp; int error; uint64_t end; @@ -818,9 +831,11 @@ top: } static int -zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap) +zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { #ifdef illumos + zfsvfs_t *zfsvfs = arg1; + lr_truncate_t *lr = arg2; znode_t *zp; flock64_t fl; int error; @@ -850,8 +865,10 @@ zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *l } static int -zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap) +zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_setattr_t *lr = arg2; znode_t *zp; xvattr_t xva; vattr_t *vap = &xva.xva_vattr; @@ -909,8 +926,10 @@ extern int zfs_setsecattr(vnode_t *vp, vsecattr_t *vse caller_context_t *ct); static int -zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap) +zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_v0_t *lr = arg2; ace_t *ace = (ace_t *)(lr + 1); /* ace array follows lr_acl_t */ vsecattr_t vsa; vnode_t *vp; @@ -957,8 +976,10 @@ zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, b * */ static int -zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap) +zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_t *lr = arg2; ace_t *ace = (ace_t *)(lr + 1); vsecattr_t vsa; znode_t *zp; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Mar 22 23:58:05 2018 (r331399) @@ -495,8 +495,10 @@ zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dm * implement DKIOCFREE/free-long-range. */ static int -zvol_replay_truncate(zvol_state_t *zv, lr_truncate_t *lr, boolean_t byteswap) +zvol_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { + zvol_state_t *zv = arg1; + lr_truncate_t *lr = arg2; uint64_t offset, length; if (byteswap) @@ -513,8 +515,10 @@ zvol_replay_truncate(zvol_state_t *zv, lr_truncate_t * * after a system failure */ static int -zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, boolean_t byteswap) +zvol_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + zvol_state_t *zv = arg1; + lr_write_t *lr = arg2; objset_t *os = zv->zv_objset; char *data = (char *)(lr + 1); /* data follows lr_write_t */ uint64_t offset, length; @@ -551,7 +555,7 @@ zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, bo /* ARGSUSED */ static int -zvol_replay_err(zvol_state_t *zv, lr_t *lr, boolean_t byteswap) +zvol_replay_err(void *arg1, void *arg2, boolean_t byteswap) { return (SET_ERROR(ENOTSUP)); } From owner-svn-src-all@freebsd.org Fri Mar 23 00:20:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D46DDF57870; Fri, 23 Mar 2018 00:20:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 805A774FC1; Fri, 23 Mar 2018 00:20:43 +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 7AD7A1870D; Fri, 23 Mar 2018 00:20:43 +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 w2N0Kho9013579; Fri, 23 Mar 2018 00:20:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N0Kgss012204; Fri, 23 Mar 2018 00:20:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230020.w2N0Kgss012204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 00:20:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r331400 - in vendor-sys/illumos/dist/uts/common: . fs/zfs fs/zfs/sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common: . fs/zfs fs/zfs/sys X-SVN-Commit-Revision: 331400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 00:20:44 -0000 Author: mav Date: Fri Mar 23 00:20:42 2018 New Revision: 331400 URL: https://svnweb.freebsd.org/changeset/base/331400 Log: 8484 Implement aggregate sum and use for arc counters In pursuit of improving performance on multi-core systems, we should implements fanned out counters and use them to improve the performance of some of the arc statistics. These stats are updated extremely frequently, and can consume a significant amount of CPU time. Reviewed by: Pavel Zakharov Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Paul Dagnelie Added: vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h (contents, props changed) Modified: vendor-sys/illumos/dist/uts/common/Makefile.files vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Modified: vendor-sys/illumos/dist/uts/common/Makefile.files ============================================================================== --- vendor-sys/illumos/dist/uts/common/Makefile.files Thu Mar 22 23:58:05 2018 (r331399) +++ vendor-sys/illumos/dist/uts/common/Makefile.files Fri Mar 23 00:20:42 2018 (r331400) @@ -1339,12 +1339,14 @@ LUA_OBJS += \ ZFS_COMMON_OBJS += \ abd.o \ + aggsum.o \ arc.o \ blkptr.o \ bplist.o \ bpobj.o \ bptree.o \ bqueue.o \ + cityhash.o \ dbuf.o \ ddt.o \ ddt_zap.o \ Added: vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash Fri Mar 23 00:20:42 2018 (r331400) @@ -0,0 +1,19 @@ +Copyright (c) 2011 Google, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. Added: vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip Fri Mar 23 00:20:42 2018 (r331400) @@ -0,0 +1 @@ +CITYHASH CHECKSUM FUNCTIONALITY IN ZFS Added: vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c Fri Mar 23 00:20:42 2018 (r331400) @@ -0,0 +1,232 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#include +#include + +/* + * Aggregate-sum counters are a form of fanned-out counter, used when atomic + * instructions on a single field cause enough CPU cache line contention to + * slow system performance. Due to their increased overhead and the expense + * involved with precisely reading from them, they should only be used in cases + * where the write rate (increment/decrement) is much higher than the read rate + * (get value). + * + * Aggregate sum counters are comprised of two basic parts, the core and the + * buckets. The core counter contains a lock for the entire counter, as well + * as the current upper and lower bounds on the value of the counter. The + * aggsum_bucket structure contains a per-bucket lock to protect the contents of + * the bucket, the current amount that this bucket has changed from the global + * counter (called the delta), and the amount of increment and decrement we have + * "borrowed" from the core counter. + * + * The basic operation of an aggsum is simple. Threads that wish to modify the + * counter will modify one bucket's counter (determined by their current CPU, to + * help minimize lock and cache contention). If the bucket already has + * sufficient capacity borrowed from the core structure to handle their request, + * they simply modify the delta and return. If the bucket does not, we clear + * the bucket's current state (to prevent the borrowed amounts from getting too + * large), and borrow more from the core counter. Borrowing is done by adding to + * the upper bound (or subtracting from the lower bound) of the core counter, + * and setting the borrow value for the bucket to the amount added (or + * subtracted). Clearing the bucket is the opposite; we add the current delta + * to both the lower and upper bounds of the core counter, subtract the borrowed + * incremental from the upper bound, and add the borrowed decrement from the + * lower bound. Note that only borrowing and clearing require access to the + * core counter; since all other operations access CPU-local resources, + * performance can be much higher than a traditional counter. + * + * Threads that wish to read from the counter have a slightly more challenging + * task. It is fast to determine the upper and lower bounds of the aggum; this + * does not require grabbing any locks. This suffices for cases where an + * approximation of the aggsum's value is acceptable. However, if one needs to + * know whether some specific value is above or below the current value in the + * aggsum, they invoke aggsum_compare(). This function operates by repeatedly + * comparing the target value to the upper and lower bounds of the aggsum, and + * then clearing a bucket. This proceeds until the target is outside of the + * upper and lower bounds and we return a response, or the last bucket has been + * cleared and we know that the target is equal to the aggsum's value. Finally, + * the most expensive operation is determining the precise value of the aggsum. + * To do this, we clear every bucket and then return the upper bound (which must + * be equal to the lower bound). What makes aggsum_compare() and aggsum_value() + * expensive is clearing buckets. This involves grabbing the global lock + * (serializing against themselves and borrow operations), grabbing a bucket's + * lock (preventing threads on those CPUs from modifying their delta), and + * zeroing out the borrowed value (forcing that thread to borrow on its next + * request, which will also be expensive). This is what makes aggsums well + * suited for write-many read-rarely operations. + */ + +/* + * We will borrow aggsum_borrow_multiplier times the current request, so we will + * have to get the as_lock approximately every aggsum_borrow_multiplier calls to + * aggsum_delta(). + */ +static uint_t aggsum_borrow_multiplier = 10; + +void +aggsum_init(aggsum_t *as, uint64_t value) +{ + bzero(as, sizeof (*as)); + as->as_lower_bound = as->as_upper_bound = value; + mutex_init(&as->as_lock, NULL, MUTEX_DEFAULT, NULL); + as->as_numbuckets = boot_ncpus; + as->as_buckets = kmem_zalloc(boot_ncpus * sizeof (aggsum_bucket_t), + KM_SLEEP); + for (int i = 0; i < as->as_numbuckets; i++) { + mutex_init(&as->as_buckets[i].asc_lock, + NULL, MUTEX_DEFAULT, NULL); + } +} + +void +aggsum_fini(aggsum_t *as) +{ + for (int i = 0; i < as->as_numbuckets; i++) + mutex_destroy(&as->as_buckets[i].asc_lock); + mutex_destroy(&as->as_lock); +} + +int64_t +aggsum_lower_bound(aggsum_t *as) +{ + return (as->as_lower_bound); +} + +int64_t +aggsum_upper_bound(aggsum_t *as) +{ + return (as->as_upper_bound); +} + +static void +aggsum_flush_bucket(aggsum_t *as, struct aggsum_bucket *asb) +{ + ASSERT(MUTEX_HELD(&as->as_lock)); + ASSERT(MUTEX_HELD(&asb->asc_lock)); + + /* + * We use atomic instructions for this because we read the upper and + * lower bounds without the lock, so we need stores to be atomic. + */ + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, asb->asc_delta); + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, asb->asc_delta); + asb->asc_delta = 0; + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, + -asb->asc_borrowed); + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, + asb->asc_borrowed); + asb->asc_borrowed = 0; +} + +uint64_t +aggsum_value(aggsum_t *as) +{ + int64_t rv; + + mutex_enter(&as->as_lock); + if (as->as_lower_bound == as->as_upper_bound) { + rv = as->as_lower_bound; + for (int i = 0; i < as->as_numbuckets; i++) { + ASSERT0(as->as_buckets[i].asc_delta); + ASSERT0(as->as_buckets[i].asc_borrowed); + } + mutex_exit(&as->as_lock); + return (rv); + } + for (int i = 0; i < as->as_numbuckets; i++) { + struct aggsum_bucket *asb = &as->as_buckets[i]; + mutex_enter(&asb->asc_lock); + aggsum_flush_bucket(as, asb); + mutex_exit(&asb->asc_lock); + } + VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound); + rv = as->as_lower_bound; + mutex_exit(&as->as_lock); + + return (rv); +} + +static void +aggsum_borrow(aggsum_t *as, int64_t delta, struct aggsum_bucket *asb) +{ + int64_t abs_delta = (delta < 0 ? -delta : delta); + mutex_enter(&as->as_lock); + mutex_enter(&asb->asc_lock); + + aggsum_flush_bucket(as, asb); + + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, abs_delta); + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, -abs_delta); + asb->asc_borrowed = abs_delta; + + mutex_exit(&asb->asc_lock); + mutex_exit(&as->as_lock); +} + +void +aggsum_add(aggsum_t *as, int64_t delta) +{ + struct aggsum_bucket *asb = + &as->as_buckets[CPU_SEQID % as->as_numbuckets]; + + for (;;) { + mutex_enter(&asb->asc_lock); + if (asb->asc_delta + delta <= (int64_t)asb->asc_borrowed && + asb->asc_delta + delta >= -(int64_t)asb->asc_borrowed) { + asb->asc_delta += delta; + mutex_exit(&asb->asc_lock); + return; + } + mutex_exit(&asb->asc_lock); + aggsum_borrow(as, delta * aggsum_borrow_multiplier, asb); + } +} + +/* + * Compare the aggsum value to target efficiently. Returns -1 if the value + * represented by the aggsum is less than target, 1 if it's greater, and 0 if + * they are equal. + */ +int +aggsum_compare(aggsum_t *as, uint64_t target) +{ + if (as->as_upper_bound < target) + return (-1); + if (as->as_lower_bound > target) + return (1); + mutex_enter(&as->as_lock); + for (int i = 0; i < as->as_numbuckets; i++) { + struct aggsum_bucket *asb = &as->as_buckets[i]; + mutex_enter(&asb->asc_lock); + aggsum_flush_bucket(as, asb); + mutex_exit(&asb->asc_lock); + if (as->as_upper_bound < target) { + mutex_exit(&as->as_lock); + return (-1); + } + if (as->as_lower_bound > target) { + mutex_exit(&as->as_lock); + return (1); + } + } + VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound); + ASSERT3U(as->as_lower_bound, ==, target); + mutex_exit(&as->as_lock); + return (0); +} Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Thu Mar 22 23:58:05 2018 (r331399) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Fri Mar 23 00:20:42 2018 (r331400) @@ -275,6 +275,8 @@ #include #include #include +#include +#include #ifndef _KERNEL /* set with ZFS_DEBUG=watch, to enable watchpoints on frozen buffers */ @@ -465,6 +467,7 @@ typedef struct arc_stats { kstat_named_t arcstat_c; kstat_named_t arcstat_c_min; kstat_named_t arcstat_c_max; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_size; /* * Number of compressed bytes stored in the arc_buf_hdr_t's b_pabd. @@ -493,12 +496,14 @@ typedef struct arc_stats { * (allocated via arc_buf_hdr_t_full and arc_buf_hdr_t_l2only * caches), and arc_buf_t structures (allocated via arc_buf_t * cache). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_hdr_size; /* * Number of bytes consumed by ARC buffers of type equal to * ARC_BUFC_DATA. This is generally consumed by buffers backing * on disk user data (e.g. plain file contents). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_data_size; /* @@ -506,6 +511,7 @@ typedef struct arc_stats { * ARC_BUFC_METADATA. This is generally consumed by buffers * backing on disk data that is used for internal ZFS * structures (e.g. ZAP, dnode, indirect blocks, etc). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_metadata_size; /* @@ -514,6 +520,7 @@ typedef struct arc_stats { * buffers (allocated directly via zio_buf_* functions), * dmu_buf_impl_t structures (allocated via dmu_buf_impl_t * cache), and dnode_t structures (allocated via dnode_t cache). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_other_size; /* @@ -521,6 +528,7 @@ typedef struct arc_stats { * arc_anon state. This includes *all* buffers in the arc_anon * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_size; /* @@ -528,6 +536,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_DATA, * residing in the arc_anon state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_evictable_data; /* @@ -535,6 +544,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_METADATA, * residing in the arc_anon state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_evictable_metadata; /* @@ -542,6 +552,7 @@ typedef struct arc_stats { * arc_mru state. This includes *all* buffers in the arc_mru * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_size; /* @@ -549,6 +560,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_DATA, * residing in the arc_mru state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_evictable_data; /* @@ -556,6 +568,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_METADATA, * residing in the arc_mru state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_evictable_metadata; /* @@ -566,18 +579,21 @@ typedef struct arc_stats { * don't actually have ARC buffers linked off of these headers. * Thus, *if* the headers had associated ARC buffers, these * buffers *would have* consumed this number of bytes. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_size; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_DATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_evictable_data; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_evictable_metadata; /* @@ -585,36 +601,42 @@ typedef struct arc_stats { * arc_mfu state. This includes *all* buffers in the arc_mfu * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_size; /* * Number of bytes consumed by ARC buffers that are eligible for * eviction, of type ARC_BUFC_DATA, and reside in the arc_mfu * state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_evictable_data; /* * Number of bytes consumed by ARC buffers that are eligible for * eviction, of type ARC_BUFC_METADATA, and reside in the * arc_mfu state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_evictable_metadata; /* * Total number of bytes that *would have been* consumed by ARC * buffers in the arc_mfu_ghost state. See the comment above * arcstat_mru_ghost_size for more details. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_size; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_DATA, and linked off the arc_mfu_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_evictable_data; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_evictable_metadata; kstat_named_t arcstat_l2_hits; @@ -636,8 +658,10 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_lsize; kstat_named_t arcstat_l2_psize; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_l2_hdr_size; kstat_named_t arcstat_memory_throttle_count; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_meta_used; kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; @@ -784,14 +808,12 @@ static arc_state_t *arc_l2c_only; * the possibility of inconsistency by having shadow copies of the variables, * while still allowing the code to be readable. */ -#define arc_size ARCSTAT(arcstat_size) /* actual total arc size */ #define arc_p ARCSTAT(arcstat_p) /* target size of MRU */ #define arc_c ARCSTAT(arcstat_c) /* target size of cache */ #define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */ #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ #define arc_meta_limit ARCSTAT(arcstat_meta_limit) /* max size for metadata */ #define arc_meta_min ARCSTAT(arcstat_meta_min) /* min size for metadata */ -#define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */ #define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ /* compressed size of entire arc */ @@ -801,6 +823,22 @@ static arc_state_t *arc_l2c_only; /* number of bytes in the arc from arc_buf_t's */ #define arc_overhead_size ARCSTAT(arcstat_overhead_size) +/* + * There are also some ARC variables that we want to export, but that are + * updated so often that having the canonical representation be the statistic + * variable causes a performance bottleneck. We want to use aggsum_t's for these + * instead, but still be able to export the kstat in the same way as before. + * The solution is to always use the aggsum version, except in the kstat update + * callback. + */ +aggsum_t arc_size; +aggsum_t arc_meta_used; +aggsum_t astat_data_size; +aggsum_t astat_metadata_size; +aggsum_t astat_hdr_size; +aggsum_t astat_other_size; +aggsum_t astat_l2_hdr_size; + static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; @@ -1118,21 +1156,15 @@ static inline void arc_hdr_clear_flags(arc_buf_hdr_t * static boolean_t l2arc_write_eligible(uint64_t, arc_buf_hdr_t *); static void l2arc_read_done(zio_t *); + +/* + * We use Cityhash for this. It's fast, and has good hash properties without + * requiring any large static buffers. + */ static uint64_t buf_hash(uint64_t spa, const dva_t *dva, uint64_t birth) { - uint8_t *vdva = (uint8_t *)dva; - uint64_t crc = -1ULL; - int i; - - ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); - - for (i = 0; i < sizeof (dva_t); i++) - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ vdva[i]) & 0xFF]; - - crc ^= (spa>>8) ^ birth; - - return (crc); + return (cityhash4(spa, dva->dva_word[0], dva->dva_word[1], birth)); } #define HDR_EMPTY(hdr) \ @@ -2322,26 +2354,26 @@ arc_space_consume(uint64_t space, arc_space_type_t typ switch (type) { case ARC_SPACE_DATA: - ARCSTAT_INCR(arcstat_data_size, space); + aggsum_add(&astat_data_size, space); break; case ARC_SPACE_META: - ARCSTAT_INCR(arcstat_metadata_size, space); + aggsum_add(&astat_metadata_size, space); break; case ARC_SPACE_OTHER: - ARCSTAT_INCR(arcstat_other_size, space); + aggsum_add(&astat_other_size, space); break; case ARC_SPACE_HDRS: - ARCSTAT_INCR(arcstat_hdr_size, space); + aggsum_add(&astat_hdr_size, space); break; case ARC_SPACE_L2HDRS: - ARCSTAT_INCR(arcstat_l2_hdr_size, space); + aggsum_add(&astat_l2_hdr_size, space); break; } if (type != ARC_SPACE_DATA) - ARCSTAT_INCR(arcstat_meta_used, space); + aggsum_add(&arc_meta_used, space); - atomic_add_64(&arc_size, space); + aggsum_add(&arc_size, space); } void @@ -2351,31 +2383,36 @@ arc_space_return(uint64_t space, arc_space_type_t type switch (type) { case ARC_SPACE_DATA: - ARCSTAT_INCR(arcstat_data_size, -space); + aggsum_add(&astat_data_size, -space); break; case ARC_SPACE_META: - ARCSTAT_INCR(arcstat_metadata_size, -space); + aggsum_add(&astat_metadata_size, -space); break; case ARC_SPACE_OTHER: - ARCSTAT_INCR(arcstat_other_size, -space); + aggsum_add(&astat_other_size, -space); break; case ARC_SPACE_HDRS: - ARCSTAT_INCR(arcstat_hdr_size, -space); + aggsum_add(&astat_hdr_size, -space); break; case ARC_SPACE_L2HDRS: - ARCSTAT_INCR(arcstat_l2_hdr_size, -space); + aggsum_add(&astat_l2_hdr_size, -space); break; } if (type != ARC_SPACE_DATA) { - ASSERT(arc_meta_used >= space); - if (arc_meta_max < arc_meta_used) - arc_meta_max = arc_meta_used; - ARCSTAT_INCR(arcstat_meta_used, -space); + ASSERT(aggsum_compare(&arc_meta_used, space) >= 0); + /* + * We use the upper bound here rather than the precise value + * because the arc_meta_max value doesn't need to be + * precise. It's only consumed by humans via arcstats. + */ + if (arc_meta_max < aggsum_upper_bound(&arc_meta_used)) + arc_meta_max = aggsum_upper_bound(&arc_meta_used); + aggsum_add(&arc_meta_used, -space); } - ASSERT(arc_size >= space); - atomic_add_64(&arc_size, -space); + ASSERT(aggsum_compare(&arc_size, space) >= 0); + aggsum_add(&arc_size, -space); } /* @@ -3573,7 +3610,7 @@ arc_adjust_impl(arc_state_t *state, uint64_t spa, int6 * capped by the arc_meta_limit tunable. */ static uint64_t -arc_adjust_meta(void) +arc_adjust_meta(uint64_t meta_used) { uint64_t total_evicted = 0; int64_t target; @@ -3585,7 +3622,7 @@ arc_adjust_meta(void) * we're over the meta limit more than we're over arc_p, we * evict some from the MRU here, and some from the MFU below. */ - target = MIN((int64_t)(arc_meta_used - arc_meta_limit), + target = MIN((int64_t)(meta_used - arc_meta_limit), (int64_t)(refcount_count(&arc_anon->arcs_size) + refcount_count(&arc_mru->arcs_size) - arc_p)); @@ -3596,8 +3633,9 @@ arc_adjust_meta(void) * below the meta limit, but not so much as to drop us below the * space allotted to the MFU (which is defined as arc_c - arc_p). */ - target = MIN((int64_t)(arc_meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_mfu->arcs_size) - (arc_c - arc_p))); + target = MIN((int64_t)(meta_used - arc_meta_limit), + (int64_t)(refcount_count(&arc_mfu->arcs_size) - + (arc_c - arc_p))); total_evicted += arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); @@ -3688,12 +3726,14 @@ arc_adjust(void) uint64_t total_evicted = 0; uint64_t bytes; int64_t target; + uint64_t asize = aggsum_value(&arc_size); + uint64_t ameta = aggsum_value(&arc_meta_used); /* * If we're over arc_meta_limit, we want to correct that before * potentially evicting data buffers below. */ - total_evicted += arc_adjust_meta(); + total_evicted += arc_adjust_meta(ameta); /* * Adjust MRU size @@ -3705,9 +3745,9 @@ arc_adjust(void) * the MRU is over arc_p, we'll evict enough to get back to * arc_p here, and then evict more from the MFU below. */ - target = MIN((int64_t)(arc_size - arc_c), + target = MIN((int64_t)(asize - arc_c), (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) + arc_meta_used - arc_p)); + refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); /* * If we're below arc_meta_min, always prefer to evict data. @@ -3718,7 +3758,7 @@ arc_adjust(void) * type, spill over into the next type. */ if (arc_adjust_type(arc_mru) == ARC_BUFC_METADATA && - arc_meta_used > arc_meta_min) { + ameta > arc_meta_min) { bytes = arc_adjust_impl(arc_mru, 0, target, ARC_BUFC_METADATA); total_evicted += bytes; @@ -3751,10 +3791,10 @@ arc_adjust(void) * size back to arc_p, if we're still above the target cache * size, we evict the rest from the MFU. */ - target = arc_size - arc_c; + target = asize - arc_c; if (arc_adjust_type(arc_mfu) == ARC_BUFC_METADATA && - arc_meta_used > arc_meta_min) { + ameta > arc_meta_min) { bytes = arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); total_evicted += bytes; @@ -3855,6 +3895,7 @@ arc_flush(spa_t *spa, boolean_t retry) void arc_shrink(int64_t to_free) { + uint64_t asize = aggsum_value(&arc_size); if (arc_c > arc_c_min) { if (arc_c > arc_c_min + to_free) @@ -3863,15 +3904,15 @@ arc_shrink(int64_t to_free) arc_c = arc_c_min; atomic_add_64(&arc_p, -(arc_p >> arc_shrink_shift)); - if (arc_c > arc_size) - arc_c = MAX(arc_size, arc_c_min); + if (asize < arc_c) + arc_c = MAX(asize, arc_c_min); if (arc_p > arc_c) arc_p = (arc_c >> 1); ASSERT(arc_c >= arc_c_min); ASSERT((int64_t)arc_p >= 0); } - if (arc_size > arc_c) + if (asize > arc_c) (void) arc_adjust(); } @@ -4035,7 +4076,7 @@ arc_kmem_reap_now(void) extern kmem_cache_t *abd_chunk_cache; #ifdef _KERNEL - if (arc_meta_used >= arc_meta_limit) { + if (aggsum_compare(&arc_meta_used, arc_meta_limit) >= 0) { /* * We are exceeding our meta-data cache limit. * Purge some DNLC entries to release holds on meta-data. @@ -4194,7 +4235,7 @@ arc_reclaim_thread(void *unused) * be helpful and could potentially cause us to enter an * infinite loop. */ - if (arc_size <= arc_c || evicted == 0) { + if (aggsum_compare(&arc_size, arc_c) <= 0|| evicted == 0) { /* * We're either no longer overflowing, or we * can't evict anything more, so we should wake @@ -4276,7 +4317,8 @@ arc_adapt(int bytes, arc_state_t *state) * If we're within (2 * maxblocksize) bytes of the target * cache size, increment the target cache size */ - if (arc_size > arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) { + if (aggsum_compare(&arc_size, arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) > + 0) { atomic_add_64(&arc_c, (int64_t)bytes); if (arc_c > arc_c_max) arc_c = arc_c_max; @@ -4299,7 +4341,16 @@ arc_is_overflowing(void) uint64_t overflow = MAX(SPA_MAXBLOCKSIZE, arc_c >> zfs_arc_overflow_shift); - return (arc_size >= arc_c + overflow); + /* + * We just compare the lower bound here for performance reasons. Our + * primary goals are to make sure that the arc never grows without + * bound, and that it can reach its maximum size. This check + * accomplishes both goals. The maximum amount we could run over by is + * 2 * aggsum_borrow_multiplier * NUM_CPUS * the average size of a block + * in the ARC. In practice, that's in the tens of MB, which is low + * enough to be safe. + */ + return (aggsum_lower_bound(&arc_size) >= arc_c + overflow); } static abd_t * @@ -4414,7 +4465,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v * If we are growing the cache, and we are adding anonymous * data, and we have outgrown arc_p, update arc_p */ - if (arc_size < arc_c && hdr->b_l1hdr.b_state == arc_anon && + if (aggsum_compare(&arc_size, arc_c) < 0 && + hdr->b_l1hdr.b_state == arc_anon && (refcount_count(&arc_anon->arcs_size) + refcount_count(&arc_mru->arcs_size) > arc_p)) arc_p = MIN(arc_c, arc_p + size); @@ -5850,6 +5902,15 @@ arc_kstat_update(kstat_t *ksp, int rw) &as->arcstat_mfu_ghost_size, &as->arcstat_mfu_ghost_evictable_data, &as->arcstat_mfu_ghost_evictable_metadata); + + ARCSTAT(arcstat_size) = aggsum_value(&arc_size); + ARCSTAT(arcstat_meta_used) = aggsum_value(&arc_meta_used); + ARCSTAT(arcstat_data_size) = aggsum_value(&astat_data_size); + ARCSTAT(arcstat_metadata_size) = + aggsum_value(&astat_metadata_size); + ARCSTAT(arcstat_hdr_size) = aggsum_value(&astat_hdr_size); + ARCSTAT(arcstat_other_size) = aggsum_value(&astat_other_size); + ARCSTAT(arcstat_l2_hdr_size) = aggsum_value(&astat_l2_hdr_size); } return (0); @@ -5960,6 +6021,14 @@ arc_state_init(void) refcount_create(&arc_mfu->arcs_size); refcount_create(&arc_mfu_ghost->arcs_size); refcount_create(&arc_l2c_only->arcs_size); + + aggsum_init(&arc_meta_used, 0); + aggsum_init(&arc_size, 0); + aggsum_init(&astat_data_size, 0); + aggsum_init(&astat_metadata_size, 0); + aggsum_init(&astat_hdr_size, 0); + aggsum_init(&astat_other_size, 0); + aggsum_init(&astat_l2_hdr_size, 0); } static void @@ -6052,7 +6121,6 @@ arc_init(void) arc_c = arc_c_max; arc_p = (arc_c >> 1); - arc_size = 0; /* limit meta-data to 1/4 of the arc capacity */ arc_meta_limit = arc_c_max / 4; Added: vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c Fri Mar 23 00:20:42 2018 (r331400) @@ -0,0 +1,63 @@ +// Copyright (c) 2011 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#include + +#define HASH_K1 0xb492b66fbe98f273ULL +#define HASH_K2 0x9ae16a3b2f90404fULL + +/* + * Bitwise right rotate. Normally this will compile to a single + * instruction. + */ +static inline uint64_t +rotate(uint64_t val, int shift) +{ + // Avoid shifting by 64: doing so yields an undefined result. + return (shift == 0 ? val : (val >> shift) | (val << (64 - shift))); +} + +static inline uint64_t +cityhash_helper(uint64_t u, uint64_t v, uint64_t mul) +{ + uint64_t a = (u ^ v) * mul; + a ^= (a >> 47); + uint64_t b = (v ^ a) * mul; + b ^= (b >> 47); + b *= mul; + return (b); +} + +uint64_t +cityhash4(uint64_t w1, uint64_t w2, uint64_t w3, uint64_t w4) +{ + uint64_t mul = HASH_K2 + 64; + uint64_t a = w1 * HASH_K1; + uint64_t b = w2; + uint64_t c = w4 * mul; + uint64_t d = w3 * HASH_K2; + return (cityhash_helper(rotate(a + b, 43) + rotate(c, 30) + d, + a + rotate(b + HASH_K2, 18) + c, mul)); + +} Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Thu Mar 22 23:58:05 2018 (r331399) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Fri Mar 23 00:20:42 2018 (r331400) @@ -48,6 +48,7 @@ #include #include #include +#include uint_t zfs_dbuf_evict_key; @@ -167,23 +168,14 @@ static dbuf_hash_table_t dbuf_hash_table; static uint64_t dbuf_hash_count; +/* + * We use Cityhash for this. It's fast, and has good hash properties without + * requiring any large static buffers. + */ static uint64_t dbuf_hash(void *os, uint64_t obj, uint8_t lvl, uint64_t blkid) { - uintptr_t osv = (uintptr_t)os; - uint64_t crc = -1ULL; - - ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (lvl)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (osv >> 6)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 0)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 8)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (blkid >> 0)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (blkid >> 8)) & 0xFF]; - - crc ^= (osv>>14) ^ (obj>>16) ^ (blkid>>16); - - return (crc); + return (cityhash4((uintptr_t)os, obj, (uint64_t)lvl, blkid)); } #define DBUF_EQUAL(dbuf, os, obj, level, blkid) \ Added: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 00:20:42 2018 (r331400) @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#ifndef _SYS_AGGSUM_H +#define _SYS_AGGSUM_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define CACHE_LINE_SIZE 64 + +typedef struct aggsum_bucket { + kmutex_t asc_lock; + int64_t asc_delta; + uint64_t asc_borrowed; + uint64_t asc_pad[4]; /* pad out to cache line (64 bytes) */ +} aggsum_bucket_t __aligned(CACHE_LINE_SIZE); + +/* + * Fan out over FANOUT cpus. + */ +typedef struct aggsum { + kmutex_t as_lock; + int64_t as_lower_bound; + int64_t as_upper_bound; + uint64_t as_numbuckets; + aggsum_bucket_t *as_buckets; +} aggsum_t; + +void aggsum_init(aggsum_t *, uint64_t); +void aggsum_fini(aggsum_t *); +int64_t aggsum_lower_bound(aggsum_t *); +int64_t aggsum_upper_bound(aggsum_t *); +int aggsum_compare(aggsum_t *, uint64_t); +uint64_t aggsum_value(aggsum_t *); +void aggsum_add(aggsum_t *, int64_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_AGGSUM_H */ Added: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h Fri Mar 23 00:20:42 2018 (r331400) @@ -0,0 +1,41 @@ +// Copyright (c) 2011 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#ifndef _SYS_CITYHASH_H +#define _SYS_CITYHASH_H *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Mar 23 00:40:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20DFBF59230; Fri, 23 Mar 2018 00:40:09 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA28B75B4C; Fri, 23 Mar 2018 00:40:08 +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 C0F9C18A60; Fri, 23 Mar 2018 00:40:08 +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 w2N0e8h5021388; Fri, 23 Mar 2018 00:40:08 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N0e8Fs021387; Fri, 23 Mar 2018 00:40:08 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201803230040.w2N0e8Fs021387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Mar 2018 00:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331401 - 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: 331401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 00:40:09 -0000 Author: jhibbits Date: Fri Mar 23 00:40:08 2018 New Revision: 331401 URL: https://svnweb.freebsd.org/changeset/base/331401 Log: Debug interrupts aren't instruction traps The EXC_DEBUG type is akin to the MPC74xx "Instruction Breakpoint" trap. Don't treat it as a trap instruction. Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Fri Mar 23 00:20:42 2018 (r331400) +++ head/sys/powerpc/powerpc/trap.c Fri Mar 23 00:40:08 2018 (r331401) @@ -189,7 +189,7 @@ frame_is_trap_inst(struct trapframe *frame) #ifdef AIM return (frame->exc == EXC_PGM && frame->srr1 & EXC_PGM_TRAP); #else - return (frame->exc == EXC_DEBUG || frame->cpu.booke.esr & ESR_PTR); + return ((frame->cpu.booke.esr & ESR_PTR) != 0); #endif } @@ -895,6 +895,7 @@ db_trap_glue(struct trapframe *frame) && (frame->exc == EXC_TRC || frame->exc == EXC_RUNMODETRC || frame_is_trap_inst(frame) || frame->exc == EXC_BPT + || frame->exc == EXC_DEBUG || frame->exc == EXC_DSI)) { int type = frame->exc; From owner-svn-src-all@freebsd.org Fri Mar 23 00:53:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22626F5A26F for ; Fri, 23 Mar 2018 00:53:03 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl0-x236.google.com (mail-pl0-x236.google.com [IPv6:2607:f8b0:400e:c01::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C52D76527 for ; Fri, 23 Mar 2018 00:53:02 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl0-x236.google.com with SMTP id w12-v6so6439307plp.4 for ; Thu, 22 Mar 2018 17:53:02 -0700 (PDT) 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=iRQGdrNV/na0Zp0a6w61Q363ZuwXUbsJlSdDxFv6twk=; b=jpeh9dNeN6kbONsjmYUdyjQS0WvibXFX+8AGZElX61w1djVrCvKXwB1NAKkTZPPVI+ HWDTF1P6Zg78hUliSVpvS9/3KJF3shN8X8vK4WaV6lq8t15PFB2hDND8RckSaRYJLHK+ qYgw7kGI5UVfic4zBsVwFyfn42Fwj1m/SABJtpNLlXfEaaChWO1GPFyCOR0QcvVAAPLo OuslWeGoAKAAuCeNOJZtTs5nmepsMGjpBbOVayV3fpfutg5R51JR3FaBmwcoGtPRQ5vH Yy6dZBCka2xZHc4GhGz42aHyW/oSpK5MCk7aa8GY9AKMNA1wwVpp7skUYIvh3QsHv7S/ c/8w== 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=iRQGdrNV/na0Zp0a6w61Q363ZuwXUbsJlSdDxFv6twk=; b=krpb7t0w2BBIGNKPP4qh+1dzXg5ctVGRe5nXVWdXQFPFdTDTtYIBf7EDUOuv1xLIFG pVpKqmhWPE+byqRJ/SvgxvVph8lNorE0PAIFaFVGjRFw46EF9w7HJoo0IY/CTJGiBgli yZgi3sNwUSzBRY1FEIvQkpOj2JTyUB4clje/MQnqp7Zc6TXhhbdFN6jyY+FePCU00WgT aEy+AHWboTrVOeEsjaSaB8LX7sr9Ewxq8E1GmN1Uv2OyLvGLT1Aoow+feGaSejO6czaF EnINaghNGRp6857jpC8aRfcU7928dRgU+kxnerbPxBajCpYA96HZlHLJJL6p0EIplhuA 1HGA== X-Gm-Message-State: AElRT7GqyCvHNdvA9qKDDE8FtkUoyIx1ItI/ijaohLmOvcPq8T13bNQS VJcuIJMjlybXARWIm1cEY3DM1w== X-Google-Smtp-Source: AG47ELta3MbOF/gVgUhBEcGwrur63u2YuDL9UXbawXXiiDEZNJUIdTTijj9tTnM+2xeokBxev36zRw== X-Received: by 2002:a17:902:c6:: with SMTP id a64-v6mr21952838pla.408.1521766381446; Thu, 22 Mar 2018 17:53:01 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id 13sm16526293pfm.10.2018.03.22.17.52.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 17:53:00 -0700 (PDT) Date: Thu, 22 Mar 2018 14:52:01 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Justin Hibbits cc: Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message-ID: References: <201803221921.w2MJLBi7058560@repo.freebsd.org> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 00:53:03 -0000 Thank you, working on it. I had done a make universe before getting review feedback. Jeff On Thu, 22 Mar 2018, Justin Hibbits wrote: > This broke gcc builds. > > On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >> Author: jeff >> Date: Thu Mar 22 19:21:11 2018 >> New Revision: 331369 >> URL: https://svnweb.freebsd.org/changeset/base/331369 >> >> Log: >> Lock reservations with a dedicated lock in each reservation. Protect the >> vmd_free_count with atomics. >> >> This allows us to allocate and free from reservations without the free lock >> except where a superpage is allocated from the physical layer, which is >> roughly 1/512 of the operations on amd64. >> >> Use the counter api to eliminate cache conention on counters. >> >> Reviewed by: markj >> Tested by: pho >> Sponsored by: Netflix, Dell/EMC Isilon >> Differential Revision: https://reviews.freebsd.org/D14707 >> >> Modified: >> head/sys/vm/vm_page.c >> head/sys/vm/vm_pagequeue.h >> head/sys/vm/vm_reserv.c >> head/sys/vm/vm_reserv.h >> >> Modified: head/sys/vm/vm_page.c >> ============================================================================== >> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) >> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) >> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >> static void vm_page_alloc_check(vm_page_t m); >> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); >> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >> -static void vm_page_free_phys(struct vm_domain *vmd, 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); >> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi >> * for the request class and false otherwise. >> */ >> int >> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >> { >> + u_int limit, old, new; >> >> - vm_domain_free_assert_locked(vmd); >> req = req & VM_ALLOC_CLASS_MASK; >> >> /* >> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req, in >> */ >> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >> req = VM_ALLOC_SYSTEM; >> + if (req == VM_ALLOC_INTERRUPT) >> + limit = 0; >> + else if (req == VM_ALLOC_SYSTEM) >> + limit = vmd->vmd_interrupt_free_min; >> + else >> + limit = vmd->vmd_free_reserved; >> >> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >> - (req == VM_ALLOC_SYSTEM && >> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || >> - (req == VM_ALLOC_INTERRUPT && >> - vmd->vmd_free_count >= npages)) >> - return (1); >> + /* >> + * Attempt to reserve the pages. Fail if we're below the limit. >> + */ >> + limit += npages; >> + old = vmd->vmd_free_count; >> + do { >> + if (old < limit) >> + return (0); >> + new = old - npages; >> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0); >> >> - return (0); >> + /* Wake the page daemon if we've crossed the threshold. */ >> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >> + pagedaemon_wakeup(vmd->vmd_domain); >> + >> + /* Only update bitsets on transitions. */ >> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >> + vm_domain_set(vmd); >> + >> + return (1); >> } >> >> vm_page_t >> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind >> again: >> m = NULL; >> #if VM_NRESERVLEVEL > 0 >> + /* >> + * Can we allocate the page from a reservation? >> + */ >> if (vm_object_reserv(object) && >> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >> - != NULL) { >> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || >> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { >> domain = vm_phys_domain(m); >> vmd = VM_DOMAIN(domain); >> goto found; >> } >> #endif >> vmd = VM_DOMAIN(domain); >> - vm_domain_free_lock(vmd); >> - if (vm_domain_available(vmd, req, 1)) { >> + if (vm_domain_allocate(vmd, req, 1)) { >> /* >> - * Can we allocate the page from a reservation? >> + * If not, allocate it from the free page queues. >> */ >> + vm_domain_free_lock(vmd); >> + m = vm_phys_alloc_pages(domain, object != NULL ? >> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >> + vm_domain_free_unlock(vmd); >> + if (m == NULL) { >> + vm_domain_freecnt_inc(vmd, 1); >> #if VM_NRESERVLEVEL > 0 >> - if (!vm_object_reserv(object) || >> - (m = vm_reserv_alloc_page(object, pindex, >> - domain, mpred)) == NULL) >> + if (vm_reserv_reclaim_inactive(domain)) >> + goto again; >> #endif >> - { >> - /* >> - * If not, allocate it from the free page queues. >> - */ >> - m = vm_phys_alloc_pages(domain, object != NULL ? >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >> -#if VM_NRESERVLEVEL > 0 >> - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { >> - m = vm_phys_alloc_pages(domain, >> - object != NULL ? >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, >> - 0); >> - } >> -#endif >> } >> } >> - if (m != NULL) >> - vm_domain_freecnt_dec(vmd, 1); >> - vm_domain_free_unlock(vmd); >> if (m == NULL) { >> /* >> * Not allocatable, give up. >> @@ -1775,9 +1783,7 @@ again: >> */ >> KASSERT(m != NULL, ("missing page")); >> >> -#if VM_NRESERVLEVEL > 0 >> found: >> -#endif > > 'found' is now declared, but unused on powerpc64. > > - Justin > From owner-svn-src-all@freebsd.org Fri Mar 23 00:59:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B485F5A87F; Fri, 23 Mar 2018 00:59:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6577B767F7; Fri, 23 Mar 2018 00:59:10 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zB2uefcv3U5pnzB2wem7L4; Thu, 22 Mar 2018 18:59:08 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=1IRbpGNzCyaoQT8CEAwA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B3DD91248; Thu, 22 Mar 2018 17:59:04 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N0x2Kg077301; Thu, 22 Mar 2018 17:59:02 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N0x2fw077291; Thu, 22 Mar 2018 17:59:02 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230059.w2N0x2fw077291@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 14:52:01 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 17:59:02 -0700 X-CMAE-Envelope: MS4wfF13DQe+MfdEAy6Ew3KCgDcUJSJrsoiZnPVcft2wGRv+qq6Y6TGEI94fTvuGEL2uVCV66bklvOEj4nQ214YLBNgIb2NbdicC1DiFt8ZfuTm6LzRCq+zs 8mdqPkGFBGZ6pnE4t4R31XR2YMbKTJYmvrsHdNrX3NZWYUjEuAd9wapZ/LhGLYSy8qdbghFsaHYtwnvKRklripuH5lcff4BjZK2fpgxopRxKMdeuuTgUiZa/ LcjePc4SKmO32Td3Mz5MhRIk9ILhxRRU1SFZC1LsvgFtNnakyWZFcmmbImz2C6wAbw0UgBLVwjkqIRv6j9V8RBR5J0/cIwopqbNdDec36CBDcLZ0q8kzlbr7 zlpAsQwc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 00:59:11 -0000 It broke i386 too. Index: sys/vm/vm_reserv.c =================================================================== --- sys/vm/vm_reserv.c (revision 331399) +++ sys/vm/vm_reserv.c (working copy) @@ -45,8 +45,6 @@ #include #include -#include -#include #include #include #include @@ -55,6 +53,8 @@ #include #include #include +#include +#include #include #include This is because sys/i386/include/machine.h uses critical_enter() and critical_exit() which are defined in sys/systm.h. It built nicely on my amd64's though. ~cy In message , Jeff Roberson writes: > Thank you, working on it. I had done a make universe before getting > review feedback. > > Jeff > > On Thu, 22 Mar 2018, Justin Hibbits wrote: > > > This broke gcc builds. > > > > On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > >> Author: jeff > >> Date: Thu Mar 22 19:21:11 2018 > >> New Revision: 331369 > >> URL: https://svnweb.freebsd.org/changeset/base/331369 > >> > >> Log: > >> Lock reservations with a dedicated lock in each reservation. Protect th > e > >> vmd_free_count with atomics. > >> > >> This allows us to allocate and free from reservations without the free l > ock > >> except where a superpage is allocated from the physical layer, which is > >> roughly 1/512 of the operations on amd64. > >> > >> Use the counter api to eliminate cache conention on counters. > >> > >> Reviewed by: markj > >> Tested by: pho > >> Sponsored by: Netflix, Dell/EMC Isilon > >> Differential Revision: https://reviews.freebsd.org/D14707 > >> > >> Modified: > >> head/sys/vm/vm_page.c > >> head/sys/vm/vm_pagequeue.h > >> head/sys/vm/vm_reserv.c > >> head/sys/vm/vm_reserv.h > >> > >> Modified: head/sys/vm/vm_page.c > >> ========================================================================== > ==== > >> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) > >> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) > >> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >> static void vm_page_alloc_check(vm_page_t m); > >> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits > ); > >> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >> -static void vm_page_free_phys(struct vm_domain *vmd, 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); > >> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_ > t pi > >> * for the request class and false otherwise. > >> */ > >> int > >> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >> { > >> + u_int limit, old, new; > >> > >> - vm_domain_free_assert_locked(vmd); > >> req = req & VM_ALLOC_CLASS_MASK; > >> > >> /* > >> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req > , in > >> */ > >> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >> req = VM_ALLOC_SYSTEM; > >> + if (req == VM_ALLOC_INTERRUPT) > >> + limit = 0; > >> + else if (req == VM_ALLOC_SYSTEM) > >> + limit = vmd->vmd_interrupt_free_min; > >> + else > >> + limit = vmd->vmd_free_reserved; > >> > >> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >> - (req == VM_ALLOC_SYSTEM && > >> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) | > | > >> - (req == VM_ALLOC_INTERRUPT && > >> - vmd->vmd_free_count >= npages)) > >> - return (1); > >> + /* > >> + * Attempt to reserve the pages. Fail if we're below the limit. > >> + */ > >> + limit += npages; > >> + old = vmd->vmd_free_count; > >> + do { > >> + if (old < limit) > >> + return (0); > >> + new = old - npages; > >> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0) > ; > >> > >> - return (0); > >> + /* Wake the page daemon if we've crossed the threshold. */ > >> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >> + pagedaemon_wakeup(vmd->vmd_domain); > >> + > >> + /* Only update bitsets on transitions. */ > >> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > >> + vm_domain_set(vmd); > >> + > >> + return (1); > >> } > >> > >> vm_page_t > >> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_ > pind > >> again: > >> m = NULL; > >> #if VM_NRESERVLEVEL > 0 > >> + /* > >> + * Can we allocate the page from a reservation? > >> + */ > >> if (vm_object_reserv(object) && > >> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >> - != NULL) { > >> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != > NULL || > >> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) > != NULL)) { > >> domain = vm_phys_domain(m); > >> vmd = VM_DOMAIN(domain); > >> goto found; > >> } > >> #endif > >> vmd = VM_DOMAIN(domain); > >> - vm_domain_free_lock(vmd); > >> - if (vm_domain_available(vmd, req, 1)) { > >> + if (vm_domain_allocate(vmd, req, 1)) { > >> /* > >> - * Can we allocate the page from a reservation? > >> + * If not, allocate it from the free page queues. > >> */ > >> + vm_domain_free_lock(vmd); > >> + m = vm_phys_alloc_pages(domain, object != NULL ? > >> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >> + vm_domain_free_unlock(vmd); > >> + if (m == NULL) { > >> + vm_domain_freecnt_inc(vmd, 1); > >> #if VM_NRESERVLEVEL > 0 > >> - if (!vm_object_reserv(object) || > >> - (m = vm_reserv_alloc_page(object, pindex, > >> - domain, mpred)) == NULL) > >> + if (vm_reserv_reclaim_inactive(domain)) > >> + goto again; > >> #endif > >> - { > >> - /* > >> - * If not, allocate it from the free page queues. > >> - */ > >> - m = vm_phys_alloc_pages(domain, object != NULL ? > >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >> -#if VM_NRESERVLEVEL > 0 > >> - if (m == NULL && vm_reserv_reclaim_inactive(domain > )) { > >> - m = vm_phys_alloc_pages(domain, > >> - object != NULL ? > >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRE > CT, > >> - 0); > >> - } > >> -#endif > >> } > >> } > >> - if (m != NULL) > >> - vm_domain_freecnt_dec(vmd, 1); > >> - vm_domain_free_unlock(vmd); > >> if (m == NULL) { > >> /* > >> * Not allocatable, give up. > >> @@ -1775,9 +1783,7 @@ again: > >> */ > >> KASSERT(m != NULL, ("missing page")); > >> > >> -#if VM_NRESERVLEVEL > 0 > >> found: > >> -#endif > > > > 'found' is now declared, but unused on powerpc64. > > > > - Justin > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Fri Mar 23 01:20:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8A2AF5C2D4 for ; Fri, 23 Mar 2018 01:20:26 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl0-x234.google.com (mail-pl0-x234.google.com [IPv6:2607:f8b0:400e:c01::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 350027754D for ; Fri, 23 Mar 2018 01:20:26 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl0-x234.google.com with SMTP id 9-v6so6478034ple.11 for ; Thu, 22 Mar 2018 18:20:26 -0700 (PDT) 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=jCdVj0tIOFf3syaz8NMfukM7vCrMSGuhP8lRkIZMtXs=; b=Y7f6fagq2EVNony+xkLczUj2YoNXB2jrY7mouIYu6xfDnJfuxN4SBZ2V4ofIg4wWVh ToEhaT+RnfmvpOrXgVYJQozsBWlHCLmDRC60LOGXFMfU03fnTaLSxetILsRqamLAgZhS 7JGwtMcVz3Vl55/Qj6HkMd/ljnUqO4jQEv/C0Msgqikomyr+YIKU/eDzuNSdF60nymuP 1bAcb6g+rPnCVqCjgB2P1kuZAbnJRFa9bCfcUS+yBWswpsYpWQwqrVFYPyrmOdguUL+E KeF8XJ+qBhUpy2O8Jq89SusK+JlXJ8/53chtJw74UwIykG27NYL4rnCEJFW+1na8qphK I/vQ== 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=jCdVj0tIOFf3syaz8NMfukM7vCrMSGuhP8lRkIZMtXs=; b=iR7xW7sIeEeIsqRPuUQLAzTPTzDRaxmeABxAv+sEGSNfLukv8MAnE3ELpFhkA1eoql ZnDStDx4UcjDvlnvAtWH184AQNs8bYbbqxTAnbDU7TAAeN+4MMoqpzPRqZDB3isgUGTx mLPw4653Vp6VUX11kF3B6y3vTE4R7yPbu4Vs3EdyjM/JYZu7tpT4S77YB+SD9WcEZpiS zcwmZnpzFGdAqE2ThUjQVi47wN0SPLNu/gt8zTDiN9AJfMBrH4Icv6ydgvjBA1h/DmLc fvWEXQpwteSJnhY5MiY784QGxFCzaiVFqQCK5Nr63YOWUwoAZfzUPdnofDXHFZTgY/zf NExA== X-Gm-Message-State: AElRT7FKheU11g7faOURjQ88RbQICiBHHrBZzfVUzHos2wocZNS+A8vD f12qfAQuS8gGpPsc2Rdkw9ETyg== X-Google-Smtp-Source: AG47ELu35D99abYM/iIgHzoGKLi1AyKWlcm6zxMMfxXUHXAagukQrNb/26KzZpHv1qHJP0FoW9VTVw== X-Received: by 2002:a17:902:6ac1:: with SMTP id i1-v6mr24103735plt.152.1521768025080; Thu, 22 Mar 2018 18:20:25 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id 5sm16213207pfh.133.2018.03.22.18.20.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 18:20:24 -0700 (PDT) Date: Thu, 22 Mar 2018 15:19:25 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Cy Schubert cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: <201803230059.w2N0x2fw077291@slippy.cwsent.com> Message-ID: References: <201803230059.w2N0x2fw077291@slippy.cwsent.com> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:20:27 -0000 On Thu, 22 Mar 2018, Cy Schubert wrote: > It broke i386 too. I just did TARGET_ARCH=i386 make buildworld TARGET_ARCH=i386 make buildkernel This worked for me? Jeff > > Index: sys/vm/vm_reserv.c > =================================================================== > --- sys/vm/vm_reserv.c (revision 331399) > +++ sys/vm/vm_reserv.c (working copy) > @@ -45,8 +45,6 @@ > > #include > #include > -#include > -#include > #include > #include > #include > @@ -55,6 +53,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > This is because sys/i386/include/machine.h uses critical_enter() and > critical_exit() which are defined in sys/systm.h. > > It built nicely on my amd64's though. > > ~cy > > In message , Jeff Roberson > writes: >> Thank you, working on it. I had done a make universe before getting >> review feedback. >> >> Jeff >> >> On Thu, 22 Mar 2018, Justin Hibbits wrote: >> >>> This broke gcc builds. >>> >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >>>> Author: jeff >>>> Date: Thu Mar 22 19:21:11 2018 >>>> New Revision: 331369 >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 >>>> >>>> Log: >>>> Lock reservations with a dedicated lock in each reservation. Protect th >> e >>>> vmd_free_count with atomics. >>>> >>>> This allows us to allocate and free from reservations without the free l >> ock >>>> except where a superpage is allocated from the physical layer, which is >>>> roughly 1/512 of the operations on amd64. >>>> >>>> Use the counter api to eliminate cache conention on counters. >>>> >>>> Reviewed by: markj >>>> Tested by: pho >>>> Sponsored by: Netflix, Dell/EMC Isilon >>>> Differential Revision: https://reviews.freebsd.org/D14707 >>>> >>>> Modified: >>>> head/sys/vm/vm_page.c >>>> head/sys/vm/vm_pagequeue.h >>>> head/sys/vm/vm_reserv.c >>>> head/sys/vm/vm_reserv.h >>>> >>>> Modified: head/sys/vm/vm_page.c >>>> ========================================================================== >> ==== >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >>>> static void vm_page_alloc_check(vm_page_t m); >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits >> ); >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >>>> -static void vm_page_free_phys(struct vm_domain *vmd, 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); >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_ >> t pi >>>> * for the request class and false otherwise. >>>> */ >>>> int >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >>>> { >>>> + u_int limit, old, new; >>>> >>>> - vm_domain_free_assert_locked(vmd); >>>> req = req & VM_ALLOC_CLASS_MASK; >>>> >>>> /* >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req >> , in >>>> */ >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >>>> req = VM_ALLOC_SYSTEM; >>>> + if (req == VM_ALLOC_INTERRUPT) >>>> + limit = 0; >>>> + else if (req == VM_ALLOC_SYSTEM) >>>> + limit = vmd->vmd_interrupt_free_min; >>>> + else >>>> + limit = vmd->vmd_free_reserved; >>>> >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >>>> - (req == VM_ALLOC_SYSTEM && >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) | >> | >>>> - (req == VM_ALLOC_INTERRUPT && >>>> - vmd->vmd_free_count >= npages)) >>>> - return (1); >>>> + /* >>>> + * Attempt to reserve the pages. Fail if we're below the limit. >>>> + */ >>>> + limit += npages; >>>> + old = vmd->vmd_free_count; >>>> + do { >>>> + if (old < limit) >>>> + return (0); >>>> + new = old - npages; >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0) >> ; >>>> >>>> - return (0); >>>> + /* Wake the page daemon if we've crossed the threshold. */ >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >>>> + pagedaemon_wakeup(vmd->vmd_domain); >>>> + >>>> + /* Only update bitsets on transitions. */ >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >>>> + vm_domain_set(vmd); >>>> + >>>> + return (1); >>>> } >>>> >>>> vm_page_t >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_ >> pind >>>> again: >>>> m = NULL; >>>> #if VM_NRESERVLEVEL > 0 >>>> + /* >>>> + * Can we allocate the page from a reservation? >>>> + */ >>>> if (vm_object_reserv(object) && >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >>>> - != NULL) { >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != >> NULL || >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) >> != NULL)) { >>>> domain = vm_phys_domain(m); >>>> vmd = VM_DOMAIN(domain); >>>> goto found; >>>> } >>>> #endif >>>> vmd = VM_DOMAIN(domain); >>>> - vm_domain_free_lock(vmd); >>>> - if (vm_domain_available(vmd, req, 1)) { >>>> + if (vm_domain_allocate(vmd, req, 1)) { >>>> /* >>>> - * Can we allocate the page from a reservation? >>>> + * If not, allocate it from the free page queues. >>>> */ >>>> + vm_domain_free_lock(vmd); >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> + vm_domain_free_unlock(vmd); >>>> + if (m == NULL) { >>>> + vm_domain_freecnt_inc(vmd, 1); >>>> #if VM_NRESERVLEVEL > 0 >>>> - if (!vm_object_reserv(object) || >>>> - (m = vm_reserv_alloc_page(object, pindex, >>>> - domain, mpred)) == NULL) >>>> + if (vm_reserv_reclaim_inactive(domain)) >>>> + goto again; >>>> #endif >>>> - { >>>> - /* >>>> - * If not, allocate it from the free page queues. >>>> - */ >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> -#if VM_NRESERVLEVEL > 0 >>>> - if (m == NULL && vm_reserv_reclaim_inactive(domain >> )) { >>>> - m = vm_phys_alloc_pages(domain, >>>> - object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRE >> CT, >>>> - 0); >>>> - } >>>> -#endif >>>> } >>>> } >>>> - if (m != NULL) >>>> - vm_domain_freecnt_dec(vmd, 1); >>>> - vm_domain_free_unlock(vmd); >>>> if (m == NULL) { >>>> /* >>>> * Not allocatable, give up. >>>> @@ -1775,9 +1783,7 @@ again: >>>> */ >>>> KASSERT(m != NULL, ("missing page")); >>>> >>>> -#if VM_NRESERVLEVEL > 0 >>>> found: >>>> -#endif >>> >>> 'found' is now declared, but unused on powerpc64. >>> >>> - Justin >>> >> > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > From owner-svn-src-all@freebsd.org Fri Mar 23 01:37:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC0A9F5D907; Fri, 23 Mar 2018 01:37:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1EDC780BA; Fri, 23 Mar 2018 01:37:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CA9A194E0; Fri, 23 Mar 2018 01:37:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N1bWnS050989; Fri, 23 Mar 2018 01:37:32 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N1bW84050982; Fri, 23 Mar 2018 01:37:32 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201803230137.w2N1bW84050982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 23 Mar 2018 01:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331402 - in stable/11/sys/arm: conf versatile X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/arm: conf versatile X-SVN-Commit-Revision: 331402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:37:33 -0000 Author: gonzo Date: Fri Mar 23 01:37:31 2018 New Revision: 331402 URL: https://svnweb.freebsd.org/changeset/base/331402 Log: MFC r316370-r316371 r316370: [versatilepb] Convert VERSATILEPB kernel to INTRNG and switch to upstream DTB Scope of this change is somewhat larger than just converting to INTRNG. The reason for this is that INTRNG support required switching from custom to upstream DTS because custom DTS didn't have interrup routing information. This switch caused rewrite of PCI and CLCD drivers and adding SCM module. List of changes in this commit: - Enable INTRNG and switch to versatile-pb.dts - Add SCM driver that controls various peripheral devices like LCD or PCI controller. Previously registers required for power-up and configuring peripherals were part of their respective nodes. Upstream DTS has dedicated node for SCM - Convert PL190 driver to INTRNG - Convert Versatile SIC (secondary interrupt controller) to INTRNG - Refactor CLCD driver to use SCM API to power up and configuration - Refactor PCI driver to use SCM API to enable controller - Refactor PCI driver to use interrupt map provided in DTS for interrupt routing. As a result it fixes broken IRQ routing and it's no longer required to run QEMU with "-global versatile_pci.broken-irq-mapping=1" command-line arguments r316371: [versatilepb] Fix keyboard driver after switching to upstream DTS FreeBSD's DTS contained only one PL050 node and driver considered it to be PS/2 keyboard. In reality PL050 is a PS/2 port that pushes bytes to/from the periphers connected to it. New DTS contains two nodes and QEMU emulates keyboard connected to port #0 and mouse connected to port #1. Since there is no way to say what's connected to port by checking DTS we hardcode this knowledge in the driver: it assumes keyboard on port #0 and ignores port #1 altogether. Also QEMU defaults emulated keyboard to scan code set 2 while driver used to work with scan code set 1 so when initializing driver make sure keyboard is switched to scan code set 1 Added: stable/11/sys/arm/versatile/versatile_scm.c - copied unchanged from r316371, head/sys/arm/versatile/versatile_scm.c stable/11/sys/arm/versatile/versatile_scm.h - copied unchanged from r316371, head/sys/arm/versatile/versatile_scm.h Modified: stable/11/sys/arm/conf/VERSATILEPB stable/11/sys/arm/versatile/files.versatile stable/11/sys/arm/versatile/pl050.c stable/11/sys/arm/versatile/versatile_clcd.c stable/11/sys/arm/versatile/versatile_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/VERSATILEPB ============================================================================== --- stable/11/sys/arm/conf/VERSATILEPB Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/conf/VERSATILEPB Fri Mar 23 01:37:31 2018 (r331402) @@ -68,7 +68,9 @@ makeoptions SC_DFLT_FONT=cp437 device md device random # Entropy device +options INTRNG + # Flattened Device Tree options FDT # Configure using FDT/DTB data options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=versatilepb.dts +makeoptions FDT_DTS_FILE=versatile-pb.dts Modified: stable/11/sys/arm/versatile/files.versatile ============================================================================== --- stable/11/sys/arm/versatile/files.versatile Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/files.versatile Fri Mar 23 01:37:31 2018 (r331402) @@ -6,6 +6,7 @@ arm/versatile/versatile_machdep.c standard arm/versatile/versatile_clcd.c optional sc arm/versatile/versatile_common.c standard arm/versatile/versatile_pci.c optional pci +arm/versatile/versatile_scm.c standard arm/versatile/versatile_sic.c standard arm/versatile/versatile_timer.c standard Modified: stable/11/sys/arm/versatile/pl050.c ============================================================================== --- stable/11/sys/arm/versatile/pl050.c Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/pl050.c Fri Mar 23 01:37:31 2018 (r331402) @@ -109,7 +109,10 @@ __FBSDID("$FreeBSD$"); #define KMI_DRIVER_NAME "kmi" #define KMI_NFKEY (sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ +#define SET_SCANCODE_SET 0xf0 + struct kmi_softc { + device_t sc_dev; keyboard_t sc_kbd; keymap_t sc_keymap; accentmap_t sc_accmap; @@ -145,6 +148,8 @@ static int kmi_ioctl(keyboard_t *, u_long, caddr_t); static int kmi_enable(keyboard_t *); static int kmi_disable(keyboard_t *); +static int kmi_attached = 0; + /* early keyboard probe, not supported */ static int kmi_configure(int flags) @@ -483,7 +488,6 @@ kmi_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) } } - /* clear the internal state of the keyboard */ static void kmi_clear_state(keyboard_t *kbd) @@ -613,6 +617,17 @@ pl050_kmi_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); + /* + * PL050 is plain PS2 port that pushes bytes to/from computer + * VersatilePB has two such ports and QEMU simulates keyboard + * connected to port #0 and mouse connected to port #1. This + * information can't be obtained from device tree so we just + * hardcode this knowledge here. We attach keyboard driver to + * port #0 and ignore port #1 + */ + if (kmi_attached) + return (ENXIO); + if (ofw_bus_is_compatible(dev, "arm,pl050")) { device_set_desc(dev, "PL050 Keyboard/Mouse Interface"); return (BUS_PROBE_DEFAULT); @@ -628,7 +643,9 @@ pl050_kmi_attach(device_t dev) keyboard_t *kbd; int rid; int i; + uint32_t ack; + sc->sc_dev = dev; kbd = &sc->sc_kbd; rid = 0; @@ -657,6 +674,16 @@ pl050_kmi_attach(device_t dev) /* TODO: clock & divisor */ + pl050_kmi_write_4(sc, KMICR, KMICR_EN); + + pl050_kmi_write_4(sc, KMIDATA, SET_SCANCODE_SET); + /* read out ACK */ + ack = pl050_kmi_read_4(sc, KMIDATA); + /* Set Scan Code set 1 (XT) */ + pl050_kmi_write_4(sc, KMIDATA, 1); + /* read out ACK */ + ack = pl050_kmi_read_4(sc, KMIDATA); + pl050_kmi_write_4(sc, KMICR, KMICR_EN | KMICR_RXINTREN); kbd_init_struct(kbd, KMI_DRIVER_NAME, KB_OTHER, @@ -692,6 +719,7 @@ pl050_kmi_attach(device_t dev) if (bootverbose) { genkbd_diag(kbd, bootverbose); } + kmi_attached = 1; return (0); detach: Modified: stable/11/sys/arm/versatile/versatile_clcd.c ============================================================================== --- stable/11/sys/arm/versatile/versatile_clcd.c Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/versatile_clcd.c Fri Mar 23 01:37:31 2018 (r331402) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012-2017 Oleksandr Tymoshenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,22 +52,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #define PL110_VENDOR_ARM926PXP 1 -#define MEM_SYS 0 -#define MEM_CLCD 1 -#define MEM_REGIONS 2 - -#define SYS_CLCD 0x00 -#define SYS_CLCD_CLCDID_SHIFT 0x08 -#define SYS_CLCD_CLCDID_MASK 0x1f -#define SYS_CLCD_PWR3V5VSWITCH (1 << 4) -#define SYS_CLCD_VDDPOSSWITCH (1 << 3) -#define SYS_CLCD_NLCDIOON (1 << 2) -#define SYS_CLCD_LCD_MODE_MASK 0x03 - #define CLCD_MODE_RGB888 0x0 #define CLCD_MODE_RGB555 0x01 #define CLCD_MODE_RBG565 0x02 @@ -122,18 +112,13 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, args...) #endif -#define versatile_clcdc_sys_read_4(sc, reg) \ - bus_read_4((sc)->mem_res[MEM_SYS], (reg)) -#define versatile_clcdc_sys_write_4(sc, reg, val) \ - bus_write_4((sc)->mem_res[MEM_SYS], (reg), (val)) - #define versatile_clcdc_read_4(sc, reg) \ - bus_read_4((sc)->mem_res[MEM_CLCD], (reg)) + bus_read_4((sc)->mem_res, (reg)) #define versatile_clcdc_write_4(sc, reg, val) \ - bus_write_4((sc)->mem_res[MEM_CLCD], (reg), (val)) + bus_write_4((sc)->mem_res, (reg), (val)) struct versatile_clcdc_softc { - struct resource* mem_res[MEM_REGIONS]; + struct resource* mem_res; struct mtx mtx; @@ -208,12 +193,6 @@ static u_char mouse_pointer[16] = { static struct video_adapter_softc va_softc; -static struct resource_spec versatile_clcdc_mem_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { SYS_RES_MEMORY, 1, RF_ACTIVE }, - { -1, 0, 0 } -}; - static int versatilefb_configure(int); static void versatilefb_update_margins(video_adapter_t *adp); @@ -249,21 +228,25 @@ versatile_clcdc_attach(device_t dev) { struct versatile_clcdc_softc *sc = device_get_softc(dev); struct video_adapter_softc *va_sc = &va_softc; - int err; + int err, rid; uint32_t reg; int clcdid; int dma_size; /* Request memory resources */ - err = bus_alloc_resources(dev, versatile_clcdc_mem_spec, - sc->mem_res); - if (err) { - device_printf(dev, "Error: could not allocate memory resources\n"); + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "could not allocate memory resources\n"); return (ENXIO); } - reg = versatile_clcdc_sys_read_4(sc, SYS_CLCD); - clcdid = (reg >> SYS_CLCD_CLCDID_SHIFT) & SYS_CLCD_CLCDID_MASK; + err = versatile_scm_reg_read_4(SCM_CLCD, ®); + if (err) { + device_printf(dev, "failed to read SCM register\n"); + goto fail; + } + clcdid = (reg >> SCM_CLCD_CLCDID_SHIFT) & SCM_CLCD_CLCDID_MASK; switch (clcdid) { case 31: device_printf(dev, "QEMU VGA 640x480\n"); @@ -275,17 +258,17 @@ versatile_clcdc_attach(device_t dev) goto fail; } - reg &= ~SYS_CLCD_LCD_MODE_MASK; + reg &= ~SCM_CLCD_LCD_MODE_MASK; reg |= CLCD_MODE_RGB565; sc->mode = CLCD_MODE_RGB565; - versatile_clcdc_sys_write_4(sc, SYS_CLCD, reg); - dma_size = sc->width*sc->height*2; - - /* + versatile_scm_reg_write_4(SCM_CLCD, reg); + dma_size = sc->width*sc->height*2; + + /* * Power on LCD */ - reg |= SYS_CLCD_PWR3V5VSWITCH | SYS_CLCD_NLCDIOON; - versatile_clcdc_sys_write_4(sc, SYS_CLCD, reg); + reg |= SCM_CLCD_PWR3V5VSWITCH | SCM_CLCD_NLCDIOON; + versatile_scm_reg_write_4(SCM_CLCD, reg); /* * XXX: hardcoded timing for VGA. For other modes/panels @@ -657,7 +640,6 @@ versatilefb_init(int unit, video_adapter_t *adp, int f sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2; sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2; - adp->va_window = (vm_offset_t) versatilefb_static_window; adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */; Modified: stable/11/sys/arm/versatile/versatile_pci.c ============================================================================== --- stable/11/sys/arm/versatile/versatile_pci.c Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/versatile_pci.c Fri Mar 23 01:37:31 2018 (r331402) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012-2017 Oleksandr Tymoshenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,18 +55,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include + #include #include -#define MEM_SYS 0 -#define MEM_CORE 1 -#define MEM_BASE 2 -#define MEM_CONF_BASE 3 -#define MEM_REGIONS 4 +#define MEM_CORE 0 +#define MEM_BASE 1 +#define MEM_CONF_BASE 2 +#define MEM_REGIONS 3 -#define SYS_PCICTL 0x00 - #define PCI_CORE_IMAP0 0x00 #define PCI_CORE_IMAP1 0x04 #define PCI_CORE_IMAP2 0x08 @@ -95,12 +95,6 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, args...) #endif - -#define versatile_pci_sys_read_4(reg) \ - bus_read_4(sc->mem_res[MEM_SYS], (reg)) -#define versatile_pci_sys_write_4(reg, val) \ - bus_write_4(sc->mem_res[MEM_SYS], (reg), (val)) - #define versatile_pci_core_read_4(reg) \ bus_read_4(sc->mem_res[MEM_CORE], (reg)) #define versatile_pci_core_write_4(reg, val) \ @@ -134,13 +128,13 @@ struct versatile_pci_softc { struct rman mem_rman; struct mtx mtx; + struct ofw_bus_iinfo pci_iinfo; }; static struct resource_spec versatile_pci_mem_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_MEMORY, 1, RF_ACTIVE }, { SYS_RES_MEMORY, 2, RF_ACTIVE }, - { SYS_RES_MEMORY, 3, RF_ACTIVE }, { -1, 0, 0 } }; @@ -151,7 +145,7 @@ versatile_pci_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "versatile,pci")) { + if (ofw_bus_is_compatible(dev, "arm,versatile-pci")) { device_set_desc(dev, "Versatile PCI controller"); return (BUS_PROBE_DEFAULT); } @@ -167,7 +161,10 @@ versatile_pci_attach(device_t dev) int slot; uint32_t vendordev_id, class_id; uint32_t val; + phandle_t node; + node = ofw_bus_get_node(dev); + /* Request memory resources */ err = bus_alloc_resources(dev, versatile_pci_mem_spec, sc->mem_res); @@ -191,7 +188,7 @@ versatile_pci_attach(device_t dev) versatile_pci_core_write_4(PCI_CORE_SMAP1, (PCI_NPREFETCH_WINDOW >> 28)); versatile_pci_core_write_4(PCI_CORE_SMAP2, (PCI_NPREFETCH_WINDOW >> 28)); - versatile_pci_sys_write_4(SYS_PCICTL, 1); + versatile_scm_reg_write_4(SCM_PCICTL, 1); for (slot = 0; slot <= PCI_SLOTMAX; slot++) { vendordev_id = versatile_pci_read_4((slot << 11) + PCIR_DEVVENDOR); @@ -268,6 +265,8 @@ versatile_pci_attach(device_t dev) versatile_pci_conf_write_4((slot << 11) + PCIR_COMMAND, val); } + ofw_bus_setup_iinfo(node, &sc->pci_iinfo, sizeof(cell_t)); + device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); } @@ -321,7 +320,7 @@ versatile_pci_alloc_resource(device_t bus, device_t ch rm = &sc->io_rman; break; case SYS_RES_IRQ: - rm = &sc->irq_rman; + rm = NULL; break; case SYS_RES_MEMORY: rm = &sc->mem_rman; @@ -330,8 +329,11 @@ versatile_pci_alloc_resource(device_t bus, device_t ch return (NULL); } - rv = rman_reserve_resource(rm, start, end, count, flags, child); + if (rm == NULL) + return (BUS_ALLOC_RESOURCE(device_get_parent(bus), + child, type, rid, start, end, count, flags)); + rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == NULL) return (NULL); @@ -392,8 +394,6 @@ versatile_pci_teardown_intr(device_t dev, device_t chi return BUS_TEARDOWN_INTR(device_get_parent(dev), dev, ires, cookie); } - - static int versatile_pci_maxslots(device_t dev) { @@ -402,10 +402,33 @@ versatile_pci_maxslots(device_t dev) } static int -versatile_pci_route_interrupt(device_t pcib, device_t device, int pin) +versatile_pci_route_interrupt(device_t bus, device_t dev, int pin) { + struct versatile_pci_softc *sc; + struct ofw_pci_register reg; + uint32_t pintr, mintr[4]; + phandle_t iparent; + int intrcells; - return (27 + ((pci_get_slot(device) + pin - 1) & 3)); + sc = device_get_softc(bus); + pintr = pin; + + bzero(®, sizeof(reg)); + reg.phys_hi = (pci_get_bus(dev) << OFW_PCI_PHYS_HI_BUSSHIFT) | + (pci_get_slot(dev) << OFW_PCI_PHYS_HI_DEVICESHIFT) | + (pci_get_function(dev) << OFW_PCI_PHYS_HI_FUNCTIONSHIFT); + + intrcells = ofw_bus_lookup_imap(ofw_bus_get_node(dev), + &sc->pci_iinfo, ®, sizeof(reg), &pintr, sizeof(pintr), + mintr, sizeof(mintr), &iparent); + if (intrcells) { + pintr = ofw_bus_map_intr(dev, iparent, intrcells, mintr); + return (pintr); + } + + device_printf(bus, "could not route pin %d for device %d.%d\n", + pin, pci_get_slot(dev), pci_get_function(dev)); + return (PCI_INVALID_IRQ); } static uint32_t Copied: stable/11/sys/arm/versatile/versatile_scm.c (from r316371, head/sys/arm/versatile/versatile_scm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/versatile/versatile_scm.c Fri Mar 23 01:37:31 2018 (r331402, copy of r316371, head/sys/arm/versatile/versatile_scm.c) @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Ben Gray. + * 4. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``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 BEN GRAY 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. + */ + +/* + * SCM - System Control Module + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "versatile_scm.h" + +struct versatile_scm_softc { + device_t sc_dev; + struct resource * sc_mem_res; +}; + +static struct versatile_scm_softc *versatile_scm_sc; + +#define versatile_scm_read_4(sc, reg) \ + bus_read_4((sc)->sc_mem_res, (reg)) +#define versatile_scm_write_4(sc, reg, val) \ + bus_write_4((sc)->sc_mem_res, (reg), (val)) + +static int +versatile_scm_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "syscon")) + return (ENXIO); + + if (versatile_scm_sc) { + return (EEXIST); + } + + device_set_desc(dev, "Versatile Control Module"); + return (BUS_PROBE_DEFAULT); +} + +static int +versatile_scm_attach(device_t dev) +{ + struct versatile_scm_softc *sc; + int rid; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + + if (sc->sc_mem_res == NULL) { + device_printf(dev, "could not allocate memory resources\n"); + return (ENXIO); + } + + versatile_scm_sc = sc; + + return (0); +} + +int +versatile_scm_reg_read_4(uint32_t reg, uint32_t *val) +{ + if (!versatile_scm_sc) + return (ENXIO); + + *val = versatile_scm_read_4(versatile_scm_sc, reg); + return (0); +} + +int +versatile_scm_reg_write_4(uint32_t reg, uint32_t val) +{ + if (!versatile_scm_sc) + return (ENXIO); + + versatile_scm_write_4(versatile_scm_sc, reg, val); + return (0); +} + +static device_method_t versatile_scm_methods[] = { + DEVMETHOD(device_probe, versatile_scm_probe), + DEVMETHOD(device_attach, versatile_scm_attach), + + DEVMETHOD_END +}; + +static driver_t versatile_scm_driver = { + "scm", + versatile_scm_methods, + sizeof(struct versatile_scm_softc), +}; + +static devclass_t versatile_scm_devclass; + +EARLY_DRIVER_MODULE(versatile_scm, simplebus, versatile_scm_driver, versatile_scm_devclass, 0, 0, + BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); Copied: stable/11/sys/arm/versatile/versatile_scm.h (from r316371, head/sys/arm/versatile/versatile_scm.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/versatile/versatile_scm.h Fri Mar 23 01:37:31 2018 (r331402, copy of r316371, head/sys/arm/versatile/versatile_scm.h) @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Ben Gray. + * 4. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``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 BEN GRAY 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 _VERSATILE_SCM_H_ +#define _VERSATILE_SCM_H_ + +#define SCM_PCICTL 0x44 +#define SCM_CLCD 0x50 +#define SCM_CLCD_CLCDID_SHIFT 0x08 +#define SCM_CLCD_CLCDID_MASK 0x1f +#define SCM_CLCD_PWR3V5VSWITCH (1 << 4) +#define SCM_CLCD_VDDPOSSWITCH (1 << 3) +#define SCM_CLCD_NLCDIOON (1 << 2) +#define SCM_CLCD_LCD_MODE_MASK 0x03 + +int versatile_scm_reg_read_4(uint32_t reg, uint32_t *val); +int versatile_scm_reg_write_4(uint32_t reg, uint32_t val); + +#endif /* _VERSATILE_SCM_H_ */ From owner-svn-src-all@freebsd.org Fri Mar 23 01:43:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60DFAF5E06C; Fri, 23 Mar 2018 01:43:28 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05EC4785B3; Fri, 23 Mar 2018 01:43:28 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFF8A19686; Fri, 23 Mar 2018 01:43:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N1hRMX055870; Fri, 23 Mar 2018 01:43:27 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N1hRGQ055869; Fri, 23 Mar 2018 01:43:27 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201803230143.w2N1hRGQ055869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 23 Mar 2018 01:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331403 - stable/11/sys/gnu/dts/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/gnu/dts/arm X-SVN-Commit-Revision: 331403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:43:28 -0000 Author: gonzo Date: Fri Mar 23 01:43:27 2018 New Revision: 331403 URL: https://svnweb.freebsd.org/changeset/base/331403 Log: Fix VERSATILEPB boot after r331402 r331402 MFCed switch from custom DTS to upstream one. stable/11 version still has main bus compatibility as "arm,amba-bus" while in Linux and HEAD it has been changed to "simple-bus". simplebus(4) supports only the latter so VERSATILEPB boot was broken by r331402. To fix this make manual change to stable/11 version of versatile-ab.dts Modified: stable/11/sys/gnu/dts/arm/versatile-ab.dts Modified: stable/11/sys/gnu/dts/arm/versatile-ab.dts ============================================================================== --- stable/11/sys/gnu/dts/arm/versatile-ab.dts Fri Mar 23 01:37:31 2018 (r331402) +++ stable/11/sys/gnu/dts/arm/versatile-ab.dts Fri Mar 23 01:43:27 2018 (r331403) @@ -148,7 +148,7 @@ }; amba { - compatible = "arm,amba-bus"; + compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; From owner-svn-src-all@freebsd.org Fri Mar 23 01:43:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 579C6F5E0B3 for ; Fri, 23 Mar 2018 01:43:42 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pg0-x22b.google.com (mail-pg0-x22b.google.com [IPv6:2607:f8b0:400e:c05::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC46B7869E for ; Fri, 23 Mar 2018 01:43:41 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pg0-x22b.google.com with SMTP id i9so4001767pgq.10 for ; Thu, 22 Mar 2018 18:43:41 -0700 (PDT) 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=8BEgLg/bQWM2TNW0NJqT8/Ie9n+0a9+Aoi+T/CrzEZk=; b=WzZWpYl3rrhsO9CDbpAGKLed6mDWyZuvYhFip3Jo2HYo8bypoeECYSttKsY6JT5Lcs V3DcikVcRWLlx4RocgBry/o03pLnKzxxUrqz7A5Ptm0zJ/uJNO+dTH5tpwmCHJ/k3JH+ akzEdmpLoe7eJsxHZ8pc8/1TznPvkhKapl1kH+ZqiCcuQTW/jVOMteo1BENusexpAw6a ujS1SjTt59IXq3M4rcJRubknymU0d9Y2Gt3ZRvRnMI9MDLDhf7USyQV7VIsoTL5v33aL ar6/CewrzrSfG7lPPGBlQkLr/orDJRPcX92XIL58M16g2YRHQhJs1UMitvokIDrwdn2R hsvw== 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=8BEgLg/bQWM2TNW0NJqT8/Ie9n+0a9+Aoi+T/CrzEZk=; b=EDEYjf7mf5OmWlEhl0UbNfY6MyGHquzFBVrOuDdV1iaPuIOZucwLBR0VGXVTjgXIFP jK8x/7yLmSANGEsGtnZXTn/qdd8NoTQH/fJ6TT+Ktul4aD12p0XqX60ZX28J65/fTMAo ssI+1NF5IgZbzRutMz3QOddsZ99ayTaLoXkYV1zUJFm+sjZAlBtO8A3msVT0nBnLif8v hzRI6v2fz9GC+wZ0tjD4jqVsemNpH3c6amNkmLhyxwl9gz1k/D8vNKYbAkwBJU0W5oZF yb15UV3NE35OdW0nwgVXxz7tQ/+q8Cjxc/bZIz274fcnedou/b88f8HCgIGXi7iCYozw NPtg== X-Gm-Message-State: AElRT7FgKNvPXcY/jtjoWCepTNuVtCoZwKX6F8ZGvCPqeDy2M5PEEHBN McrRC4jBNUvFGkWccXhPjcP3ag== X-Google-Smtp-Source: AG47ELuc/pyoAn7A3pfd5DcuI4caB+tTJOKQoj/JkqkuctSk0QzbVYUonlKgZY933DO41ndjG01ZJw== X-Received: by 10.99.65.6 with SMTP id o6mr10841562pga.57.1521769420752; Thu, 22 Mar 2018 18:43:40 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id 26sm15235343pfn.68.2018.03.22.18.43.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 18:43:39 -0700 (PDT) Date: Thu, 22 Mar 2018 15:42:41 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Cy Schubert cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: <201803230059.w2N0x2fw077291@slippy.cwsent.com> Message-ID: References: <201803230059.w2N0x2fw077291@slippy.cwsent.com> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:43:42 -0000 On Thu, 22 Mar 2018, Cy Schubert wrote: > It broke i386 too. I believe I'm not able to reproduce this because it is a result of changes in kernel config. I can not reproduce it so I can't verify the fix. Since you can, would you mind committing? I see no problem with the diff below. Thanks, Jeff > > Index: sys/vm/vm_reserv.c > =================================================================== > --- sys/vm/vm_reserv.c (revision 331399) > +++ sys/vm/vm_reserv.c (working copy) > @@ -45,8 +45,6 @@ > > #include > #include > -#include > -#include > #include > #include > #include > @@ -55,6 +53,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > This is because sys/i386/include/machine.h uses critical_enter() and > critical_exit() which are defined in sys/systm.h. > > It built nicely on my amd64's though. > > ~cy > > In message , Jeff Roberson > writes: >> Thank you, working on it. I had done a make universe before getting >> review feedback. >> >> Jeff >> >> On Thu, 22 Mar 2018, Justin Hibbits wrote: >> >>> This broke gcc builds. >>> >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >>>> Author: jeff >>>> Date: Thu Mar 22 19:21:11 2018 >>>> New Revision: 331369 >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 >>>> >>>> Log: >>>> Lock reservations with a dedicated lock in each reservation. Protect th >> e >>>> vmd_free_count with atomics. >>>> >>>> This allows us to allocate and free from reservations without the free l >> ock >>>> except where a superpage is allocated from the physical layer, which is >>>> roughly 1/512 of the operations on amd64. >>>> >>>> Use the counter api to eliminate cache conention on counters. >>>> >>>> Reviewed by: markj >>>> Tested by: pho >>>> Sponsored by: Netflix, Dell/EMC Isilon >>>> Differential Revision: https://reviews.freebsd.org/D14707 >>>> >>>> Modified: >>>> head/sys/vm/vm_page.c >>>> head/sys/vm/vm_pagequeue.h >>>> head/sys/vm/vm_reserv.c >>>> head/sys/vm/vm_reserv.h >>>> >>>> Modified: head/sys/vm/vm_page.c >>>> ========================================================================== >> ==== >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >>>> static void vm_page_alloc_check(vm_page_t m); >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits >> ); >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >>>> -static void vm_page_free_phys(struct vm_domain *vmd, 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); >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_ >> t pi >>>> * for the request class and false otherwise. >>>> */ >>>> int >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >>>> { >>>> + u_int limit, old, new; >>>> >>>> - vm_domain_free_assert_locked(vmd); >>>> req = req & VM_ALLOC_CLASS_MASK; >>>> >>>> /* >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req >> , in >>>> */ >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >>>> req = VM_ALLOC_SYSTEM; >>>> + if (req == VM_ALLOC_INTERRUPT) >>>> + limit = 0; >>>> + else if (req == VM_ALLOC_SYSTEM) >>>> + limit = vmd->vmd_interrupt_free_min; >>>> + else >>>> + limit = vmd->vmd_free_reserved; >>>> >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >>>> - (req == VM_ALLOC_SYSTEM && >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) | >> | >>>> - (req == VM_ALLOC_INTERRUPT && >>>> - vmd->vmd_free_count >= npages)) >>>> - return (1); >>>> + /* >>>> + * Attempt to reserve the pages. Fail if we're below the limit. >>>> + */ >>>> + limit += npages; >>>> + old = vmd->vmd_free_count; >>>> + do { >>>> + if (old < limit) >>>> + return (0); >>>> + new = old - npages; >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0) >> ; >>>> >>>> - return (0); >>>> + /* Wake the page daemon if we've crossed the threshold. */ >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >>>> + pagedaemon_wakeup(vmd->vmd_domain); >>>> + >>>> + /* Only update bitsets on transitions. */ >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >>>> + vm_domain_set(vmd); >>>> + >>>> + return (1); >>>> } >>>> >>>> vm_page_t >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_ >> pind >>>> again: >>>> m = NULL; >>>> #if VM_NRESERVLEVEL > 0 >>>> + /* >>>> + * Can we allocate the page from a reservation? >>>> + */ >>>> if (vm_object_reserv(object) && >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >>>> - != NULL) { >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != >> NULL || >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) >> != NULL)) { >>>> domain = vm_phys_domain(m); >>>> vmd = VM_DOMAIN(domain); >>>> goto found; >>>> } >>>> #endif >>>> vmd = VM_DOMAIN(domain); >>>> - vm_domain_free_lock(vmd); >>>> - if (vm_domain_available(vmd, req, 1)) { >>>> + if (vm_domain_allocate(vmd, req, 1)) { >>>> /* >>>> - * Can we allocate the page from a reservation? >>>> + * If not, allocate it from the free page queues. >>>> */ >>>> + vm_domain_free_lock(vmd); >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> + vm_domain_free_unlock(vmd); >>>> + if (m == NULL) { >>>> + vm_domain_freecnt_inc(vmd, 1); >>>> #if VM_NRESERVLEVEL > 0 >>>> - if (!vm_object_reserv(object) || >>>> - (m = vm_reserv_alloc_page(object, pindex, >>>> - domain, mpred)) == NULL) >>>> + if (vm_reserv_reclaim_inactive(domain)) >>>> + goto again; >>>> #endif >>>> - { >>>> - /* >>>> - * If not, allocate it from the free page queues. >>>> - */ >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> -#if VM_NRESERVLEVEL > 0 >>>> - if (m == NULL && vm_reserv_reclaim_inactive(domain >> )) { >>>> - m = vm_phys_alloc_pages(domain, >>>> - object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRE >> CT, >>>> - 0); >>>> - } >>>> -#endif >>>> } >>>> } >>>> - if (m != NULL) >>>> - vm_domain_freecnt_dec(vmd, 1); >>>> - vm_domain_free_unlock(vmd); >>>> if (m == NULL) { >>>> /* >>>> * Not allocatable, give up. >>>> @@ -1775,9 +1783,7 @@ again: >>>> */ >>>> KASSERT(m != NULL, ("missing page")); >>>> >>>> -#if VM_NRESERVLEVEL > 0 >>>> found: >>>> -#endif >>> >>> 'found' is now declared, but unused on powerpc64. >>> >>> - Justin >>> >> > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > From owner-svn-src-all@freebsd.org Fri Mar 23 01:50:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B06EBF5E861; Fri, 23 Mar 2018 01:50:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 07B5578AD9; Fri, 23 Mar 2018 01:50:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zBqzefvitU5pnzBr0emDd4; Thu, 22 Mar 2018 19:50:51 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=yqQTKvdX5MLKBJhURkEA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 1B25A12D6; Thu, 22 Mar 2018 18:50:49 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N1om2X036182; Thu, 22 Mar 2018 18:50:48 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N1omDY036179; Thu, 22 Mar 2018 18:50:48 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230150.w2N1omDY036179@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 15:19:25 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 18:50:47 -0700 X-CMAE-Envelope: MS4wfED8Sp1RAp/lyPhXbOJ4vvEhjsHHu+56ExKc0uUSoDNIr3HC3joo8Sqqwrlqpx65/lIr/znJgQZc2NAGHyGmmFxsa4hhIYYQMd+cQKXsOo5h9k8pO0TR mWZhnJQjHQu05NAIfI5T7pTmpUJewzfgenX0otBicHH9L5mIT1ZCvfqklG8qRQtvotm0m+ZAaHD0RDQoGFNrc++MBLi+TIqEQczvRUiro0EUxc64beDUJTyU B9KEFPkATb7/UXGuHf31PLmMlSP9J0+rVQARbinrJImFoaeAaB8M/jPkgv+umw6VpWDxFCRv0SynH5dTpTL2wyC9wmU9QTM8t6chlIcfZKpAWAn4hs45Y6fw UZmSH7YS X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:50:58 -0000 In message , Jeff Roberson writes: > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > It broke i386 too. > > I just did > TARGET_ARCH=i386 make buildworld > TARGET_ARCH=i386 make buildkernel > > This worked for me? > > Jeff hmmm. make TARGET=i386 TARGET_ARCH=i386 buildkernel --- vm_reserv.o --- In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: In file included from /opt/src/svn-current/sys/sys/counter.h:37: ./machine/counter.h:174:3: error: implicit declaration of function 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat ion] critical_enter(); ^ ./machine/counter.h:174:3: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] ./machine/counter.h:176:3: error: implicit declaration of function 'critical_exit' is invalid in C99 [-Werror,-Wimplicit-function-declarati on] critical_exit(); ^ ./machine/counter.h:176:3: note: did you mean 'critical_enter'? ./machine/counter.h:174:3: note: 'critical_enter' declared here critical_enter(); ^ ./machine/counter.h:176:3: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] critical_exit(); ^ In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: /opt/src/svn-current/sys/sys/systm.h:217:6: error: conflicting types for 'critical_enter' void critical_enter(void); ^ ./machine/counter.h:174:3: note: previous implicit declaration is here critical_enter(); ^ In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: /opt/src/svn-current/sys/sys/systm.h:218:6: error: conflicting types for 'critical_exit' void critical_exit(void); ^ ./machine/counter.h:176:3: note: previous implicit declaration is here critical_exit(); ^ 6 errors generated. *** [vm_reserv.o] Error code 1 make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK --- modules-all --- A failure has been detected in another branch of the parallel make make[3]: stopped in /opt/src/svn-current/sys/modules *** [modules-all] Error code 2 make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK 2 errors make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK *** [buildkernel] Error code 2 make[1]: stopped in /opt/src/svn-current 1 error make[1]: stopped in /opt/src/svn-current *** [buildkernel] Error code 2 make: stopped in /opt/src/svn-current 1 error make: stopped in /opt/src/svn-current ~cy > > > > > Index: sys/vm/vm_reserv.c > > =================================================================== > > --- sys/vm/vm_reserv.c (revision 331399) > > +++ sys/vm/vm_reserv.c (working copy) > > @@ -45,8 +45,6 @@ > > > > #include > > #include > > -#include > > -#include > > #include > > #include > > #include > > @@ -55,6 +53,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > > > This is because sys/i386/include/machine.h uses critical_enter() and > > critical_exit() which are defined in sys/systm.h. > > > > It built nicely on my amd64's though. > > > > ~cy > > > > In message , Jeff Roberson > > writes: > >> Thank you, working on it. I had done a make universe before getting > >> review feedback. > >> > >> Jeff > >> > >> On Thu, 22 Mar 2018, Justin Hibbits wrote: > >> > >>> This broke gcc builds. > >>> > >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > >>>> Author: jeff > >>>> Date: Thu Mar 22 19:21:11 2018 > >>>> New Revision: 331369 > >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 > >>>> > >>>> Log: > >>>> Lock reservations with a dedicated lock in each reservation. Protect > th > >> e > >>>> vmd_free_count with atomics. > >>>> > >>>> This allows us to allocate and free from reservations without the free > l > >> ock > >>>> except where a superpage is allocated from the physical layer, which i > s > >>>> roughly 1/512 of the operations on amd64. > >>>> > >>>> Use the counter api to eliminate cache conention on counters. > >>>> > >>>> Reviewed by: markj > >>>> Tested by: pho > >>>> Sponsored by: Netflix, Dell/EMC Isilon > >>>> Differential Revision: https://reviews.freebsd.org/D14707 > >>>> > >>>> Modified: > >>>> head/sys/vm/vm_page.c > >>>> head/sys/vm/vm_pagequeue.h > >>>> head/sys/vm/vm_reserv.c > >>>> head/sys/vm/vm_reserv.h > >>>> > >>>> Modified: head/sys/vm/vm_page.c > >>>> ======================================================================== > == > >> ==== > >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368 > ) > >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369 > ) > >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >>>> static void vm_page_alloc_check(vm_page_t m); > >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebi > ts > >> ); > >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >>>> -static void vm_page_free_phys(struct vm_domain *vmd, 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); > >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pinde > x_ > >> t pi > >>>> * for the request class and false otherwise. > >>>> */ > >>>> int > >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >>>> { > >>>> + u_int limit, old, new; > >>>> > >>>> - vm_domain_free_assert_locked(vmd); > >>>> req = req & VM_ALLOC_CLASS_MASK; > >>>> > >>>> /* > >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int r > eq > >> , in > >>>> */ > >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >>>> req = VM_ALLOC_SYSTEM; > >>>> + if (req == VM_ALLOC_INTERRUPT) > >>>> + limit = 0; > >>>> + else if (req == VM_ALLOC_SYSTEM) > >>>> + limit = vmd->vmd_interrupt_free_min; > >>>> + else > >>>> + limit = vmd->vmd_free_reserved; > >>>> > >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >>>> - (req == VM_ALLOC_SYSTEM && > >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) > | > >> | > >>>> - (req == VM_ALLOC_INTERRUPT && > >>>> - vmd->vmd_free_count >= npages)) > >>>> - return (1); > >>>> + /* > >>>> + * Attempt to reserve the pages. Fail if we're below the limit. > >>>> + */ > >>>> + limit += npages; > >>>> + old = vmd->vmd_free_count; > >>>> + do { > >>>> + if (old < limit) > >>>> + return (0); > >>>> + new = old - npages; > >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == > 0) > >> ; > >>>> > >>>> - return (0); > >>>> + /* Wake the page daemon if we've crossed the threshold. */ > >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >>>> + pagedaemon_wakeup(vmd->vmd_domain); > >>>> + > >>>> + /* Only update bitsets on transitions. */ > >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > >>>> + vm_domain_set(vmd); > >>>> + > >>>> + return (1); > >>>> } > >>>> > >>>> vm_page_t > >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, v > m_ > >> pind > >>>> again: > >>>> m = NULL; > >>>> #if VM_NRESERVLEVEL > 0 > >>>> + /* > >>>> + * Can we allocate the page from a reservation? > >>>> + */ > >>>> if (vm_object_reserv(object) && > >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >>>> - != NULL) { > >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) > != > >> NULL || > >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred > )) > >> != NULL)) { > >>>> domain = vm_phys_domain(m); > >>>> vmd = VM_DOMAIN(domain); > >>>> goto found; > >>>> } > >>>> #endif > >>>> vmd = VM_DOMAIN(domain); > >>>> - vm_domain_free_lock(vmd); > >>>> - if (vm_domain_available(vmd, req, 1)) { > >>>> + if (vm_domain_allocate(vmd, req, 1)) { > >>>> /* > >>>> - * Can we allocate the page from a reservation? > >>>> + * If not, allocate it from the free page queues. > >>>> */ > >>>> + vm_domain_free_lock(vmd); > >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >>>> + vm_domain_free_unlock(vmd); > >>>> + if (m == NULL) { > >>>> + vm_domain_freecnt_inc(vmd, 1); > >>>> #if VM_NRESERVLEVEL > 0 > >>>> - if (!vm_object_reserv(object) || > >>>> - (m = vm_reserv_alloc_page(object, pindex, > >>>> - domain, mpred)) == NULL) > >>>> + if (vm_reserv_reclaim_inactive(domain)) > >>>> + goto again; > >>>> #endif > >>>> - { > >>>> - /* > >>>> - * If not, allocate it from the free page queues > . > >>>> - */ > >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0) > ; > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> - if (m == NULL && vm_reserv_reclaim_inactive(doma > in > >> )) { > >>>> - m = vm_phys_alloc_pages(domain, > >>>> - object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DI > RE > >> CT, > >>>> - 0); > >>>> - } > >>>> -#endif > >>>> } > >>>> } > >>>> - if (m != NULL) > >>>> - vm_domain_freecnt_dec(vmd, 1); > >>>> - vm_domain_free_unlock(vmd); > >>>> if (m == NULL) { > >>>> /* > >>>> * Not allocatable, give up. > >>>> @@ -1775,9 +1783,7 @@ again: > >>>> */ > >>>> KASSERT(m != NULL, ("missing page")); > >>>> > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> found: > >>>> -#endif > >>> > >>> 'found' is now declared, but unused on powerpc64. > >>> > >>> - Justin > >>> > >> > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Fri Mar 23 01:54:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2090CF5ECB1 for ; Fri, 23 Mar 2018 01:54:52 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl0-x22c.google.com (mail-pl0-x22c.google.com [IPv6:2607:f8b0:400e:c01::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93A8078DC6 for ; Fri, 23 Mar 2018 01:54:51 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl0-x22c.google.com with SMTP id u11-v6so6550034plq.1 for ; Thu, 22 Mar 2018 18:54:51 -0700 (PDT) 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=MVU0zafikC46w4TBpJGlh8R5GnA9t0lQUm9f9KFpLlU=; b=L4Xd6JazxwhQXktjhRnFew4npiTIy9VtK7xhrcGbygneHEgDJOiQR1L3fQpO9afVXc woapbD54UfNVAA29hPFjGdkm5U5am/vhBiqrycukTKYdteOhC8keuOgKbHGwcDGDDoFW 8exYuzlF6vvtPekrE/+fPdVr5KCW+sWOOMkNIFreU4VRhSTZgOVEHcBd6BetTZQpfHrx aGbbwXayQBg+xUfC81LpsBprUpGQtt2CiQ4+iB23Utpy7+nCs+Id3ydLRRUQZ++BePTl 2XNa7PNv/0VpWumLutNNW3FbjZR2C+s3a+fHEN72I7m+gzoqRIdMOD1qvkaB54HNRFkr jqjw== 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=MVU0zafikC46w4TBpJGlh8R5GnA9t0lQUm9f9KFpLlU=; b=YCYhNNz6JyBPLKtqEy2U5lafAuzPWVhlYihv2AWMQgcZyMbGBgvVckRAzRKpMKa4lz 1bUAeGM+8H3vigP02eBzHevQksS9K7mntUSdtettf6Zd4/ExuT4CfcBHGfcCAeiOv5k/ 31TBTCLp2TLynBvr8Xsy/CcV6o4fbusAlpH66qjUNK6WB6hCrO6bl/dOgYReXY50Y6H+ PnNkHCMQUB4uwRJoF4KtjNw/xzHDmVO5CZUm4BiihdBKv7u8aw0OvE80FWvaeRtbnuef IReqfPPUx4acJDvgKGQyk+otLy++iiBudmUdj2KITEvo50wSKzVbxiV89kRFGlI4IMgX HSMw== X-Gm-Message-State: AElRT7HfzOgl44TNulKD3FS1dbAtiDVm8cHLaswlK8xmZnsHyV+YQt95 catyrOOZ2DJroCUYEYEiMC7/Rw== X-Google-Smtp-Source: AG47ELs4Q9rnFsYq/uhxzdgW2Y/BAOOSZKZznIQGo7lFntn6yFX9q3C0Duk7UK2AZq7bv+DXvGC67w== X-Received: by 2002:a17:902:28c4:: with SMTP id f62-v6mr6916138plb.19.1521770090551; Thu, 22 Mar 2018 18:54:50 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id n187sm4218926pfn.8.2018.03.22.18.54.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 18:54:49 -0700 (PDT) Date: Thu, 22 Mar 2018 15:53:51 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Cy Schubert cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: <201803230150.w2N1omDY036179@slippy.cwsent.com> Message-ID: References: <201803230150.w2N1omDY036179@slippy.cwsent.com> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:54:52 -0000 On Thu, 22 Mar 2018, Cy Schubert wrote: > In message , Jeff Roberson > writes: >> On Thu, 22 Mar 2018, Cy Schubert wrote: >> >>> It broke i386 too. >> >> I just did >> TARGET_ARCH=i386 make buildworld >> TARGET_ARCH=i386 make buildkernel >> >> This worked for me? >> >> Jeff > > hmmm. > > make TARGET=i386 TARGET_ARCH=i386 buildkernel Do you have changes to GENERIC? Thanks, Jeff > > --- vm_reserv.o --- > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: > In file included from /opt/src/svn-current/sys/sys/counter.h:37: > ./machine/counter.h:174:3: error: implicit declaration of function > 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat > ion] > critical_enter(); > ^ > ./machine/counter.h:174:3: error: this function declaration is not a > prototype [-Werror,-Wstrict-prototypes] > ./machine/counter.h:176:3: error: implicit declaration of function > 'critical_exit' is invalid in C99 [-Werror,-Wimplicit-function-declarati > on] > critical_exit(); > ^ > ./machine/counter.h:176:3: note: did you mean 'critical_enter'? > ./machine/counter.h:174:3: note: 'critical_enter' declared here > critical_enter(); > ^ > ./machine/counter.h:176:3: error: this function declaration is not a > prototype [-Werror,-Wstrict-prototypes] > critical_exit(); > ^ > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > /opt/src/svn-current/sys/sys/systm.h:217:6: error: conflicting types > for 'critical_enter' > void critical_enter(void); > ^ > ./machine/counter.h:174:3: note: previous implicit declaration is here > critical_enter(); > ^ > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > /opt/src/svn-current/sys/sys/systm.h:218:6: error: conflicting types > for 'critical_exit' > void critical_exit(void); > ^ > ./machine/counter.h:176:3: note: previous implicit declaration is here > critical_exit(); > ^ > 6 errors generated. > *** [vm_reserv.o] Error code 1 > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > --- modules-all --- > A failure has been detected in another branch of the parallel make > > make[3]: stopped in /opt/src/svn-current/sys/modules > *** [modules-all] Error code 2 > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > 2 errors > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > *** [buildkernel] Error code 2 > > make[1]: stopped in /opt/src/svn-current > 1 error > > make[1]: stopped in /opt/src/svn-current > *** [buildkernel] Error code 2 > > make: stopped in /opt/src/svn-current > 1 error > > make: stopped in /opt/src/svn-current > > ~cy > >> >>> >>> Index: sys/vm/vm_reserv.c >>> =================================================================== >>> --- sys/vm/vm_reserv.c (revision 331399) >>> +++ sys/vm/vm_reserv.c (working copy) >>> @@ -45,8 +45,6 @@ >>> >>> #include >>> #include >>> -#include >>> -#include >>> #include >>> #include >>> #include >>> @@ -55,6 +53,8 @@ >>> #include >>> #include >>> #include >>> +#include >>> +#include >>> #include >>> #include >>> >>> This is because sys/i386/include/machine.h uses critical_enter() and >>> critical_exit() which are defined in sys/systm.h. >>> >>> It built nicely on my amd64's though. >>> >>> ~cy >>> >>> In message , Jeff Roberson >>> writes: >>>> Thank you, working on it. I had done a make universe before getting >>>> review feedback. >>>> >>>> Jeff >>>> >>>> On Thu, 22 Mar 2018, Justin Hibbits wrote: >>>> >>>>> This broke gcc builds. >>>>> >>>>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >>>>>> Author: jeff >>>>>> Date: Thu Mar 22 19:21:11 2018 >>>>>> New Revision: 331369 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/331369 >>>>>> >>>>>> Log: >>>>>> Lock reservations with a dedicated lock in each reservation. Protect >> th >>>> e >>>>>> vmd_free_count with atomics. >>>>>> >>>>>> This allows us to allocate and free from reservations without the free >> l >>>> ock >>>>>> except where a superpage is allocated from the physical layer, which i >> s >>>>>> roughly 1/512 of the operations on amd64. >>>>>> >>>>>> Use the counter api to eliminate cache conention on counters. >>>>>> >>>>>> Reviewed by: markj >>>>>> Tested by: pho >>>>>> Sponsored by: Netflix, Dell/EMC Isilon >>>>>> Differential Revision: https://reviews.freebsd.org/D14707 >>>>>> >>>>>> Modified: >>>>>> head/sys/vm/vm_page.c >>>>>> head/sys/vm/vm_pagequeue.h >>>>>> head/sys/vm/vm_reserv.c >>>>>> head/sys/vm/vm_reserv.h >>>>>> >>>>>> Modified: head/sys/vm/vm_page.c >>>>>> ======================================================================== >> == >>>> ==== >>>>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368 >> ) >>>>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369 >> ) >>>>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >>>>>> static void vm_page_alloc_check(vm_page_t m); >>>>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebi >> ts >>>> ); >>>>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >>>>>> -static void vm_page_free_phys(struct vm_domain *vmd, 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); >>>>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pinde >> x_ >>>> t pi >>>>>> * for the request class and false otherwise. >>>>>> */ >>>>>> int >>>>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >>>>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >>>>>> { >>>>>> + u_int limit, old, new; >>>>>> >>>>>> - vm_domain_free_assert_locked(vmd); >>>>>> req = req & VM_ALLOC_CLASS_MASK; >>>>>> >>>>>> /* >>>>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int r >> eq >>>> , in >>>>>> */ >>>>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >>>>>> req = VM_ALLOC_SYSTEM; >>>>>> + if (req == VM_ALLOC_INTERRUPT) >>>>>> + limit = 0; >>>>>> + else if (req == VM_ALLOC_SYSTEM) >>>>>> + limit = vmd->vmd_interrupt_free_min; >>>>>> + else >>>>>> + limit = vmd->vmd_free_reserved; >>>>>> >>>>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >>>>>> - (req == VM_ALLOC_SYSTEM && >>>>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) >> | >>>> | >>>>>> - (req == VM_ALLOC_INTERRUPT && >>>>>> - vmd->vmd_free_count >= npages)) >>>>>> - return (1); >>>>>> + /* >>>>>> + * Attempt to reserve the pages. Fail if we're below the limit. >>>>>> + */ >>>>>> + limit += npages; >>>>>> + old = vmd->vmd_free_count; >>>>>> + do { >>>>>> + if (old < limit) >>>>>> + return (0); >>>>>> + new = old - npages; >>>>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == >> 0) >>>> ; >>>>>> >>>>>> - return (0); >>>>>> + /* Wake the page daemon if we've crossed the threshold. */ >>>>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >>>>>> + pagedaemon_wakeup(vmd->vmd_domain); >>>>>> + >>>>>> + /* Only update bitsets on transitions. */ >>>>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >>>>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >>>>>> + vm_domain_set(vmd); >>>>>> + >>>>>> + return (1); >>>>>> } >>>>>> >>>>>> vm_page_t >>>>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, v >> m_ >>>> pind >>>>>> again: >>>>>> m = NULL; >>>>>> #if VM_NRESERVLEVEL > 0 >>>>>> + /* >>>>>> + * Can we allocate the page from a reservation? >>>>>> + */ >>>>>> if (vm_object_reserv(object) && >>>>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >>>>>> - != NULL) { >>>>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) >> != >>>> NULL || >>>>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred >> )) >>>> != NULL)) { >>>>>> domain = vm_phys_domain(m); >>>>>> vmd = VM_DOMAIN(domain); >>>>>> goto found; >>>>>> } >>>>>> #endif >>>>>> vmd = VM_DOMAIN(domain); >>>>>> - vm_domain_free_lock(vmd); >>>>>> - if (vm_domain_available(vmd, req, 1)) { >>>>>> + if (vm_domain_allocate(vmd, req, 1)) { >>>>>> /* >>>>>> - * Can we allocate the page from a reservation? >>>>>> + * If not, allocate it from the free page queues. >>>>>> */ >>>>>> + vm_domain_free_lock(vmd); >>>>>> + m = vm_phys_alloc_pages(domain, object != NULL ? >>>>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>>>> + vm_domain_free_unlock(vmd); >>>>>> + if (m == NULL) { >>>>>> + vm_domain_freecnt_inc(vmd, 1); >>>>>> #if VM_NRESERVLEVEL > 0 >>>>>> - if (!vm_object_reserv(object) || >>>>>> - (m = vm_reserv_alloc_page(object, pindex, >>>>>> - domain, mpred)) == NULL) >>>>>> + if (vm_reserv_reclaim_inactive(domain)) >>>>>> + goto again; >>>>>> #endif >>>>>> - { >>>>>> - /* >>>>>> - * If not, allocate it from the free page queues >> . >>>>>> - */ >>>>>> - m = vm_phys_alloc_pages(domain, object != NULL ? >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0) >> ; >>>>>> -#if VM_NRESERVLEVEL > 0 >>>>>> - if (m == NULL && vm_reserv_reclaim_inactive(doma >> in >>>> )) { >>>>>> - m = vm_phys_alloc_pages(domain, >>>>>> - object != NULL ? >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DI >> RE >>>> CT, >>>>>> - 0); >>>>>> - } >>>>>> -#endif >>>>>> } >>>>>> } >>>>>> - if (m != NULL) >>>>>> - vm_domain_freecnt_dec(vmd, 1); >>>>>> - vm_domain_free_unlock(vmd); >>>>>> if (m == NULL) { >>>>>> /* >>>>>> * Not allocatable, give up. >>>>>> @@ -1775,9 +1783,7 @@ again: >>>>>> */ >>>>>> KASSERT(m != NULL, ("missing page")); >>>>>> >>>>>> -#if VM_NRESERVLEVEL > 0 >>>>>> found: >>>>>> -#endif >>>>> >>>>> 'found' is now declared, but unused on powerpc64. >>>>> >>>>> - Justin >>>>> >>>> >>> >>> -- >>> Cheers, >>> Cy Schubert >>> FreeBSD UNIX: Web: http://www.FreeBSD.org >>> >>> The need of the many outweighs the greed of the few. >>> >>> > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > From owner-svn-src-all@freebsd.org Fri Mar 23 02:15:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABC6DF60375; Fri, 23 Mar 2018 02:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 596B8797F3; Fri, 23 Mar 2018 02:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FE6119B47; Fri, 23 Mar 2018 02:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2F7bP070734; Fri, 23 Mar 2018 02:15:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2F6wL070720; Fri, 23 Mar 2018 02:15:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230215.w2N2F6wL070720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331404 - in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/u... X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/... X-SVN-Commit-Revision: 331404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:15:08 -0000 Author: mav Date: Fri Mar 23 02:15:05 2018 New Revision: 331404 URL: https://svnweb.freebsd.org/changeset/base/331404 Log: MFV r331400: 8484 Implement aggregate sum and use for arc counters In pursuit of improving performance on multi-core systems, we should implements fanned out counters and use them to improve the performance of some of the arc statistics. These stats are updated extremely frequently, and can consume a significant amount of CPU time. Reviewed by: Pavel Zakharov Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Paul Dagnelie Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h - copied, changed from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/conf/files Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Mar 23 01:43:27 2018 (r331403) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Mar 23 02:15:05 2018 (r331404) @@ -559,6 +559,7 @@ extern void delay(clock_t ticks); } while (0); #define max_ncpus 64 +#define boot_ncpus (sysconf(_SC_NPROCESSORS_ONLN)) #define minclsyspri 60 #define maxclsyspri 99 Modified: head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Fri Mar 23 02:15:05 2018 (r331404) @@ -63,12 +63,14 @@ LUA_OBJS += \ ZFS_COMMON_OBJS += \ abd.o \ + aggsum.o \ arc.o \ bplist.o \ blkptr.o \ bpobj.o \ bptree.o \ bqueue.o \ + cityhash.o \ dbuf.o \ ddt.o \ ddt_zap.o \ Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash) @@ -0,0 +1,19 @@ +Copyright (c) 2011 Google, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip) @@ -0,0 +1 @@ +CITYHASH CHECKSUM FUNCTIONALITY IN ZFS Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c) @@ -0,0 +1,232 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#include +#include + +/* + * Aggregate-sum counters are a form of fanned-out counter, used when atomic + * instructions on a single field cause enough CPU cache line contention to + * slow system performance. Due to their increased overhead and the expense + * involved with precisely reading from them, they should only be used in cases + * where the write rate (increment/decrement) is much higher than the read rate + * (get value). + * + * Aggregate sum counters are comprised of two basic parts, the core and the + * buckets. The core counter contains a lock for the entire counter, as well + * as the current upper and lower bounds on the value of the counter. The + * aggsum_bucket structure contains a per-bucket lock to protect the contents of + * the bucket, the current amount that this bucket has changed from the global + * counter (called the delta), and the amount of increment and decrement we have + * "borrowed" from the core counter. + * + * The basic operation of an aggsum is simple. Threads that wish to modify the + * counter will modify one bucket's counter (determined by their current CPU, to + * help minimize lock and cache contention). If the bucket already has + * sufficient capacity borrowed from the core structure to handle their request, + * they simply modify the delta and return. If the bucket does not, we clear + * the bucket's current state (to prevent the borrowed amounts from getting too + * large), and borrow more from the core counter. Borrowing is done by adding to + * the upper bound (or subtracting from the lower bound) of the core counter, + * and setting the borrow value for the bucket to the amount added (or + * subtracted). Clearing the bucket is the opposite; we add the current delta + * to both the lower and upper bounds of the core counter, subtract the borrowed + * incremental from the upper bound, and add the borrowed decrement from the + * lower bound. Note that only borrowing and clearing require access to the + * core counter; since all other operations access CPU-local resources, + * performance can be much higher than a traditional counter. + * + * Threads that wish to read from the counter have a slightly more challenging + * task. It is fast to determine the upper and lower bounds of the aggum; this + * does not require grabbing any locks. This suffices for cases where an + * approximation of the aggsum's value is acceptable. However, if one needs to + * know whether some specific value is above or below the current value in the + * aggsum, they invoke aggsum_compare(). This function operates by repeatedly + * comparing the target value to the upper and lower bounds of the aggsum, and + * then clearing a bucket. This proceeds until the target is outside of the + * upper and lower bounds and we return a response, or the last bucket has been + * cleared and we know that the target is equal to the aggsum's value. Finally, + * the most expensive operation is determining the precise value of the aggsum. + * To do this, we clear every bucket and then return the upper bound (which must + * be equal to the lower bound). What makes aggsum_compare() and aggsum_value() + * expensive is clearing buckets. This involves grabbing the global lock + * (serializing against themselves and borrow operations), grabbing a bucket's + * lock (preventing threads on those CPUs from modifying their delta), and + * zeroing out the borrowed value (forcing that thread to borrow on its next + * request, which will also be expensive). This is what makes aggsums well + * suited for write-many read-rarely operations. + */ + +/* + * We will borrow aggsum_borrow_multiplier times the current request, so we will + * have to get the as_lock approximately every aggsum_borrow_multiplier calls to + * aggsum_delta(). + */ +static uint_t aggsum_borrow_multiplier = 10; + +void +aggsum_init(aggsum_t *as, uint64_t value) +{ + bzero(as, sizeof (*as)); + as->as_lower_bound = as->as_upper_bound = value; + mutex_init(&as->as_lock, NULL, MUTEX_DEFAULT, NULL); + as->as_numbuckets = boot_ncpus; + as->as_buckets = kmem_zalloc(boot_ncpus * sizeof (aggsum_bucket_t), + KM_SLEEP); + for (int i = 0; i < as->as_numbuckets; i++) { + mutex_init(&as->as_buckets[i].asc_lock, + NULL, MUTEX_DEFAULT, NULL); + } +} + +void +aggsum_fini(aggsum_t *as) +{ + for (int i = 0; i < as->as_numbuckets; i++) + mutex_destroy(&as->as_buckets[i].asc_lock); + mutex_destroy(&as->as_lock); +} + +int64_t +aggsum_lower_bound(aggsum_t *as) +{ + return (as->as_lower_bound); +} + +int64_t +aggsum_upper_bound(aggsum_t *as) +{ + return (as->as_upper_bound); +} + +static void +aggsum_flush_bucket(aggsum_t *as, struct aggsum_bucket *asb) +{ + ASSERT(MUTEX_HELD(&as->as_lock)); + ASSERT(MUTEX_HELD(&asb->asc_lock)); + + /* + * We use atomic instructions for this because we read the upper and + * lower bounds without the lock, so we need stores to be atomic. + */ + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, asb->asc_delta); + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, asb->asc_delta); + asb->asc_delta = 0; + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, + -asb->asc_borrowed); + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, + asb->asc_borrowed); + asb->asc_borrowed = 0; +} + +uint64_t +aggsum_value(aggsum_t *as) +{ + int64_t rv; + + mutex_enter(&as->as_lock); + if (as->as_lower_bound == as->as_upper_bound) { + rv = as->as_lower_bound; + for (int i = 0; i < as->as_numbuckets; i++) { + ASSERT0(as->as_buckets[i].asc_delta); + ASSERT0(as->as_buckets[i].asc_borrowed); + } + mutex_exit(&as->as_lock); + return (rv); + } + for (int i = 0; i < as->as_numbuckets; i++) { + struct aggsum_bucket *asb = &as->as_buckets[i]; + mutex_enter(&asb->asc_lock); + aggsum_flush_bucket(as, asb); + mutex_exit(&asb->asc_lock); + } + VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound); + rv = as->as_lower_bound; + mutex_exit(&as->as_lock); + + return (rv); +} + +static void +aggsum_borrow(aggsum_t *as, int64_t delta, struct aggsum_bucket *asb) +{ + int64_t abs_delta = (delta < 0 ? -delta : delta); + mutex_enter(&as->as_lock); + mutex_enter(&asb->asc_lock); + + aggsum_flush_bucket(as, asb); + + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, abs_delta); + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, -abs_delta); + asb->asc_borrowed = abs_delta; + + mutex_exit(&asb->asc_lock); + mutex_exit(&as->as_lock); +} + +void +aggsum_add(aggsum_t *as, int64_t delta) +{ + struct aggsum_bucket *asb = + &as->as_buckets[CPU_SEQID % as->as_numbuckets]; + + for (;;) { + mutex_enter(&asb->asc_lock); + if (asb->asc_delta + delta <= (int64_t)asb->asc_borrowed && + asb->asc_delta + delta >= -(int64_t)asb->asc_borrowed) { + asb->asc_delta += delta; + mutex_exit(&asb->asc_lock); + return; + } + mutex_exit(&asb->asc_lock); + aggsum_borrow(as, delta * aggsum_borrow_multiplier, asb); + } +} + +/* + * Compare the aggsum value to target efficiently. Returns -1 if the value + * represented by the aggsum is less than target, 1 if it's greater, and 0 if + * they are equal. + */ +int +aggsum_compare(aggsum_t *as, uint64_t target) +{ + if (as->as_upper_bound < target) + return (-1); + if (as->as_lower_bound > target) + return (1); + mutex_enter(&as->as_lock); + for (int i = 0; i < as->as_numbuckets; i++) { + struct aggsum_bucket *asb = &as->as_buckets[i]; + mutex_enter(&asb->asc_lock); + aggsum_flush_bucket(as, asb); + mutex_exit(&asb->asc_lock); + if (as->as_upper_bound < target) { + mutex_exit(&as->as_lock); + return (-1); + } + if (as->as_lower_bound > target) { + mutex_exit(&as->as_lock); + return (1); + } + } + VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound); + ASSERT3U(as->as_lower_bound, ==, target); + mutex_exit(&as->as_lock); + return (0); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Mar 23 02:15:05 2018 (r331404) @@ -275,6 +275,8 @@ #include #include #include +#include +#include #include @@ -561,6 +563,7 @@ typedef struct arc_stats { kstat_named_t arcstat_c; kstat_named_t arcstat_c_min; kstat_named_t arcstat_c_max; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_size; /* * Number of compressed bytes stored in the arc_buf_hdr_t's b_pabd. @@ -589,12 +592,14 @@ typedef struct arc_stats { * (allocated via arc_buf_hdr_t_full and arc_buf_hdr_t_l2only * caches), and arc_buf_t structures (allocated via arc_buf_t * cache). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_hdr_size; /* * Number of bytes consumed by ARC buffers of type equal to * ARC_BUFC_DATA. This is generally consumed by buffers backing * on disk user data (e.g. plain file contents). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_data_size; /* @@ -602,6 +607,7 @@ typedef struct arc_stats { * ARC_BUFC_METADATA. This is generally consumed by buffers * backing on disk data that is used for internal ZFS * structures (e.g. ZAP, dnode, indirect blocks, etc). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_metadata_size; /* @@ -610,6 +616,7 @@ typedef struct arc_stats { * buffers (allocated directly via zio_buf_* functions), * dmu_buf_impl_t structures (allocated via dmu_buf_impl_t * cache), and dnode_t structures (allocated via dnode_t cache). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_other_size; /* @@ -617,6 +624,7 @@ typedef struct arc_stats { * arc_anon state. This includes *all* buffers in the arc_anon * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_size; /* @@ -624,6 +632,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_DATA, * residing in the arc_anon state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_evictable_data; /* @@ -631,6 +640,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_METADATA, * residing in the arc_anon state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_evictable_metadata; /* @@ -638,6 +648,7 @@ typedef struct arc_stats { * arc_mru state. This includes *all* buffers in the arc_mru * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_size; /* @@ -645,6 +656,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_DATA, * residing in the arc_mru state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_evictable_data; /* @@ -652,6 +664,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_METADATA, * residing in the arc_mru state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_evictable_metadata; /* @@ -662,18 +675,21 @@ typedef struct arc_stats { * don't actually have ARC buffers linked off of these headers. * Thus, *if* the headers had associated ARC buffers, these * buffers *would have* consumed this number of bytes. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_size; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_DATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_evictable_data; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_evictable_metadata; /* @@ -681,36 +697,42 @@ typedef struct arc_stats { * arc_mfu state. This includes *all* buffers in the arc_mfu * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_size; /* * Number of bytes consumed by ARC buffers that are eligible for * eviction, of type ARC_BUFC_DATA, and reside in the arc_mfu * state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_evictable_data; /* * Number of bytes consumed by ARC buffers that are eligible for * eviction, of type ARC_BUFC_METADATA, and reside in the * arc_mfu state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_evictable_metadata; /* * Total number of bytes that *would have been* consumed by ARC * buffers in the arc_mfu_ghost state. See the comment above * arcstat_mru_ghost_size for more details. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_size; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_DATA, and linked off the arc_mfu_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_evictable_data; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_evictable_metadata; kstat_named_t arcstat_l2_hits; @@ -732,6 +754,7 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_lsize; kstat_named_t arcstat_l2_psize; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_l2_hdr_size; kstat_named_t arcstat_l2_write_trylock_fail; kstat_named_t arcstat_l2_write_passed_headroom; @@ -746,6 +769,7 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_write_buffer_list_iter; kstat_named_t arcstat_l2_write_buffer_list_null_iter; kstat_named_t arcstat_memory_throttle_count; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_meta_used; kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; @@ -905,14 +929,12 @@ static arc_state_t *arc_l2c_only; * the possibility of inconsistency by having shadow copies of the variables, * while still allowing the code to be readable. */ -#define arc_size ARCSTAT(arcstat_size) /* actual total arc size */ #define arc_p ARCSTAT(arcstat_p) /* target size of MRU */ #define arc_c ARCSTAT(arcstat_c) /* target size of cache */ #define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */ #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ #define arc_meta_limit ARCSTAT(arcstat_meta_limit) /* max size for metadata */ #define arc_meta_min ARCSTAT(arcstat_meta_min) /* min size for metadata */ -#define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */ #define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ /* compressed size of entire arc */ @@ -922,6 +944,22 @@ static arc_state_t *arc_l2c_only; /* number of bytes in the arc from arc_buf_t's */ #define arc_overhead_size ARCSTAT(arcstat_overhead_size) +/* + * There are also some ARC variables that we want to export, but that are + * updated so often that having the canonical representation be the statistic + * variable causes a performance bottleneck. We want to use aggsum_t's for these + * instead, but still be able to export the kstat in the same way as before. + * The solution is to always use the aggsum version, except in the kstat update + * callback. + */ +aggsum_t arc_size; +aggsum_t arc_meta_used; +aggsum_t astat_data_size; +aggsum_t astat_metadata_size; +aggsum_t astat_hdr_size; +aggsum_t astat_other_size; +aggsum_t astat_l2_hdr_size; + static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; @@ -1433,21 +1471,14 @@ l2arc_trim(const arc_buf_hdr_t *hdr) } } +/* + * We use Cityhash for this. It's fast, and has good hash properties without + * requiring any large static buffers. + */ static uint64_t buf_hash(uint64_t spa, const dva_t *dva, uint64_t birth) { - uint8_t *vdva = (uint8_t *)dva; - uint64_t crc = -1ULL; - int i; - - ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); - - for (i = 0; i < sizeof (dva_t); i++) - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ vdva[i]) & 0xFF]; - - crc ^= (spa>>8) ^ birth; - - return (crc); + return (cityhash4(spa, dva->dva_word[0], dva->dva_word[1], birth)); } #define HDR_EMPTY(hdr) \ @@ -2643,26 +2674,26 @@ arc_space_consume(uint64_t space, arc_space_type_t typ switch (type) { case ARC_SPACE_DATA: - ARCSTAT_INCR(arcstat_data_size, space); + aggsum_add(&astat_data_size, space); break; case ARC_SPACE_META: - ARCSTAT_INCR(arcstat_metadata_size, space); + aggsum_add(&astat_metadata_size, space); break; case ARC_SPACE_OTHER: - ARCSTAT_INCR(arcstat_other_size, space); + aggsum_add(&astat_other_size, space); break; case ARC_SPACE_HDRS: - ARCSTAT_INCR(arcstat_hdr_size, space); + aggsum_add(&astat_hdr_size, space); break; case ARC_SPACE_L2HDRS: - ARCSTAT_INCR(arcstat_l2_hdr_size, space); + aggsum_add(&astat_l2_hdr_size, space); break; } if (type != ARC_SPACE_DATA) - ARCSTAT_INCR(arcstat_meta_used, space); + aggsum_add(&arc_meta_used, space); - atomic_add_64(&arc_size, space); + aggsum_add(&arc_size, space); } void @@ -2672,31 +2703,36 @@ arc_space_return(uint64_t space, arc_space_type_t type switch (type) { case ARC_SPACE_DATA: - ARCSTAT_INCR(arcstat_data_size, -space); + aggsum_add(&astat_data_size, -space); break; case ARC_SPACE_META: - ARCSTAT_INCR(arcstat_metadata_size, -space); + aggsum_add(&astat_metadata_size, -space); break; case ARC_SPACE_OTHER: - ARCSTAT_INCR(arcstat_other_size, -space); + aggsum_add(&astat_other_size, -space); break; case ARC_SPACE_HDRS: - ARCSTAT_INCR(arcstat_hdr_size, -space); + aggsum_add(&astat_hdr_size, -space); break; case ARC_SPACE_L2HDRS: - ARCSTAT_INCR(arcstat_l2_hdr_size, -space); + aggsum_add(&astat_l2_hdr_size, -space); break; } if (type != ARC_SPACE_DATA) { - ASSERT(arc_meta_used >= space); - if (arc_meta_max < arc_meta_used) - arc_meta_max = arc_meta_used; - ARCSTAT_INCR(arcstat_meta_used, -space); + ASSERT(aggsum_compare(&arc_meta_used, space) >= 0); + /* + * We use the upper bound here rather than the precise value + * because the arc_meta_max value doesn't need to be + * precise. It's only consumed by humans via arcstats. + */ + if (arc_meta_max < aggsum_upper_bound(&arc_meta_used)) + arc_meta_max = aggsum_upper_bound(&arc_meta_used); + aggsum_add(&arc_meta_used, -space); } - ASSERT(arc_size >= space); - atomic_add_64(&arc_size, -space); + ASSERT(aggsum_compare(&arc_size, space) >= 0); + aggsum_add(&arc_size, -space); } /* @@ -3898,7 +3934,7 @@ arc_adjust_impl(arc_state_t *state, uint64_t spa, int6 * capped by the arc_meta_limit tunable. */ static uint64_t -arc_adjust_meta(void) +arc_adjust_meta(uint64_t meta_used) { uint64_t total_evicted = 0; int64_t target; @@ -3910,7 +3946,7 @@ arc_adjust_meta(void) * we're over the meta limit more than we're over arc_p, we * evict some from the MRU here, and some from the MFU below. */ - target = MIN((int64_t)(arc_meta_used - arc_meta_limit), + target = MIN((int64_t)(meta_used - arc_meta_limit), (int64_t)(refcount_count(&arc_anon->arcs_size) + refcount_count(&arc_mru->arcs_size) - arc_p)); @@ -3921,8 +3957,9 @@ arc_adjust_meta(void) * below the meta limit, but not so much as to drop us below the * space allotted to the MFU (which is defined as arc_c - arc_p). */ - target = MIN((int64_t)(arc_meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_mfu->arcs_size) - (arc_c - arc_p))); + target = MIN((int64_t)(meta_used - arc_meta_limit), + (int64_t)(refcount_count(&arc_mfu->arcs_size) - + (arc_c - arc_p))); total_evicted += arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); @@ -4013,12 +4050,14 @@ arc_adjust(void) uint64_t total_evicted = 0; uint64_t bytes; int64_t target; + uint64_t asize = aggsum_value(&arc_size); + uint64_t ameta = aggsum_value(&arc_meta_used); /* * If we're over arc_meta_limit, we want to correct that before * potentially evicting data buffers below. */ - total_evicted += arc_adjust_meta(); + total_evicted += arc_adjust_meta(ameta); /* * Adjust MRU size @@ -4030,9 +4069,9 @@ arc_adjust(void) * the MRU is over arc_p, we'll evict enough to get back to * arc_p here, and then evict more from the MFU below. */ - target = MIN((int64_t)(arc_size - arc_c), + target = MIN((int64_t)(asize - arc_c), (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) + arc_meta_used - arc_p)); + refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); /* * If we're below arc_meta_min, always prefer to evict data. @@ -4043,7 +4082,7 @@ arc_adjust(void) * type, spill over into the next type. */ if (arc_adjust_type(arc_mru) == ARC_BUFC_METADATA && - arc_meta_used > arc_meta_min) { + ameta > arc_meta_min) { bytes = arc_adjust_impl(arc_mru, 0, target, ARC_BUFC_METADATA); total_evicted += bytes; @@ -4076,10 +4115,10 @@ arc_adjust(void) * size back to arc_p, if we're still above the target cache * size, we evict the rest from the MFU. */ - target = arc_size - arc_c; + target = asize - arc_c; if (arc_adjust_type(arc_mfu) == ARC_BUFC_METADATA && - arc_meta_used > arc_meta_min) { + ameta > arc_meta_min) { bytes = arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); total_evicted += bytes; @@ -4180,6 +4219,7 @@ arc_flush(spa_t *spa, boolean_t retry) void arc_shrink(int64_t to_free) { + uint64_t asize = aggsum_value(&arc_size); if (arc_c > arc_c_min) { DTRACE_PROBE4(arc__shrink, uint64_t, arc_c, uint64_t, arc_c_min, uint64_t, arc_p, uint64_t, to_free); @@ -4189,8 +4229,8 @@ arc_shrink(int64_t to_free) arc_c = arc_c_min; atomic_add_64(&arc_p, -(arc_p >> arc_shrink_shift)); - if (arc_c > arc_size) - arc_c = MAX(arc_size, arc_c_min); + if (asize < arc_c) + arc_c = MAX(asize, arc_c_min); if (arc_p > arc_c) arc_p = (arc_c >> 1); @@ -4201,8 +4241,8 @@ arc_shrink(int64_t to_free) ASSERT((int64_t)arc_p >= 0); } - if (arc_size > arc_c) { - DTRACE_PROBE2(arc__shrink_adjust, uint64_t, arc_size, + if (asize > arc_c) { + DTRACE_PROBE2(arc__shrink_adjust, uint64_t, asize, uint64_t, arc_c); (void) arc_adjust(); } @@ -4383,7 +4423,7 @@ arc_kmem_reap_now(void) DTRACE_PROBE(arc__kmem_reap_start); #ifdef _KERNEL - if (arc_meta_used >= arc_meta_limit) { + if (aggsum_compare(&arc_meta_used, arc_meta_limit) >= 0) { /* * We are exceeding our meta-data cache limit. * Purge some DNLC entries to release holds on meta-data. @@ -4547,7 +4587,7 @@ arc_reclaim_thread(void *unused __unused) * be helpful and could potentially cause us to enter an * infinite loop. */ - if (arc_size <= arc_c || evicted == 0) { + if (aggsum_compare(&arc_size, arc_c) <= 0|| evicted == 0) { /* * We're either no longer overflowing, or we * can't evict anything more, so we should wake @@ -4680,7 +4720,8 @@ arc_adapt(int bytes, arc_state_t *state) * If we're within (2 * maxblocksize) bytes of the target * cache size, increment the target cache size */ - if (arc_size > arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) { + if (aggsum_compare(&arc_size, arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) > + 0) { DTRACE_PROBE1(arc__inc_adapt, int, bytes); atomic_add_64(&arc_c, (int64_t)bytes); if (arc_c > arc_c_max) @@ -4704,7 +4745,16 @@ arc_is_overflowing(void) uint64_t overflow = MAX(SPA_MAXBLOCKSIZE, arc_c >> zfs_arc_overflow_shift); - return (arc_size >= arc_c + overflow); + /* + * We just compare the lower bound here for performance reasons. Our + * primary goals are to make sure that the arc never grows without + * bound, and that it can reach its maximum size. This check + * accomplishes both goals. The maximum amount we could run over by is + * 2 * aggsum_borrow_multiplier * NUM_CPUS * the average size of a block + * in the ARC. In practice, that's in the tens of MB, which is low + * enough to be safe. + */ + return (aggsum_lower_bound(&arc_size) >= arc_c + overflow); } static abd_t * @@ -4819,7 +4869,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v * If we are growing the cache, and we are adding anonymous * data, and we have outgrown arc_p, update arc_p */ - if (arc_size < arc_c && hdr->b_l1hdr.b_state == arc_anon && + if (aggsum_compare(&arc_size, arc_c) < 0 && + hdr->b_l1hdr.b_state == arc_anon && (refcount_count(&arc_anon->arcs_size) + refcount_count(&arc_mru->arcs_size) > arc_p)) arc_p = MIN(arc_c, arc_p + size); @@ -6273,6 +6324,15 @@ arc_kstat_update(kstat_t *ksp, int rw) &as->arcstat_mfu_ghost_size, &as->arcstat_mfu_ghost_evictable_data, &as->arcstat_mfu_ghost_evictable_metadata); + + ARCSTAT(arcstat_size) = aggsum_value(&arc_size); + ARCSTAT(arcstat_meta_used) = aggsum_value(&arc_meta_used); + ARCSTAT(arcstat_data_size) = aggsum_value(&astat_data_size); + ARCSTAT(arcstat_metadata_size) = + aggsum_value(&astat_metadata_size); + ARCSTAT(arcstat_hdr_size) = aggsum_value(&astat_hdr_size); + ARCSTAT(arcstat_other_size) = aggsum_value(&astat_other_size); + ARCSTAT(arcstat_l2_hdr_size) = aggsum_value(&astat_l2_hdr_size); } return (0); @@ -6405,6 +6465,14 @@ arc_state_init(void) refcount_create(&arc_mfu->arcs_size); refcount_create(&arc_mfu_ghost->arcs_size); refcount_create(&arc_l2c_only->arcs_size); + + aggsum_init(&arc_meta_used, 0); + aggsum_init(&arc_size, 0); + aggsum_init(&astat_data_size, 0); + aggsum_init(&astat_metadata_size, 0); + aggsum_init(&astat_hdr_size, 0); + aggsum_init(&astat_other_size, 0); + aggsum_init(&astat_l2_hdr_size, 0); } static void @@ -6509,7 +6577,6 @@ arc_init(void) arc_c = arc_c_max; arc_p = (arc_c >> 1); - arc_size = 0; /* limit meta-data to 1/4 of the arc capacity */ arc_meta_limit = arc_c_max / 4; Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c) @@ -0,0 +1,63 @@ +// Copyright (c) 2011 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#include + +#define HASH_K1 0xb492b66fbe98f273ULL +#define HASH_K2 0x9ae16a3b2f90404fULL + +/* + * Bitwise right rotate. Normally this will compile to a single + * instruction. + */ +static inline uint64_t +rotate(uint64_t val, int shift) +{ + // Avoid shifting by 64: doing so yields an undefined result. + return (shift == 0 ? val : (val >> shift) | (val << (64 - shift))); +} + +static inline uint64_t +cityhash_helper(uint64_t u, uint64_t v, uint64_t mul) +{ + uint64_t a = (u ^ v) * mul; + a ^= (a >> 47); + uint64_t b = (v ^ a) * mul; + b ^= (b >> 47); + b *= mul; + return (b); +} + +uint64_t +cityhash4(uint64_t w1, uint64_t w2, uint64_t w3, uint64_t w4) +{ + uint64_t mul = HASH_K2 + 64; + uint64_t a = w1 * HASH_K1; + uint64_t b = w2; + uint64_t c = w4 * mul; + uint64_t d = w3 * HASH_K2; + return (cityhash_helper(rotate(a + b, 43) + rotate(c, 30) + d, + a + rotate(b + HASH_K2, 18) + c, mul)); + +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Mar 23 02:15:05 2018 (r331404) @@ -48,6 +48,7 @@ #include #include #include +#include uint_t zfs_dbuf_evict_key; @@ -177,23 +178,14 @@ static dbuf_hash_table_t dbuf_hash_table; static uint64_t dbuf_hash_count; +/* + * We use Cityhash for this. It's fast, and has good hash properties without + * requiring any large static buffers. + */ static uint64_t dbuf_hash(void *os, uint64_t obj, uint8_t lvl, uint64_t blkid) { - uintptr_t osv = (uintptr_t)os; - uint64_t crc = -1ULL; - - ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (lvl)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (osv >> 6)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 0)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 8)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (blkid >> 0)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (blkid >> 8)) & 0xFF]; - - crc ^= (osv>>14) ^ (obj>>16) ^ (blkid>>16); - - return (crc); + return (cityhash4((uintptr_t)os, obj, (uint64_t)lvl, blkid)); } #define DBUF_EQUAL(dbuf, os, obj, level, blkid) \ Copied and modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h) ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 00:20:42 2018 (r331400, copy source) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 02:15:05 2018 (r331404) @@ -25,8 +25,6 @@ extern "C" { #endif -#define CACHE_LINE_SIZE 64 - typedef struct aggsum_bucket { kmutex_t asc_lock; int64_t asc_delta; Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h) @@ -0,0 +1,41 @@ +// Copyright (c) 2011 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#ifndef _SYS_CITYHASH_H +#define _SYS_CITYHASH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +uint64_t cityhash4(uint64_t, uint64_t, uint64_t, uint64_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_CITYHASH_H */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Fri Mar 23 02:15:05 2018 (r331404) @@ -114,6 +114,8 @@ extern "C" { #include #include +#define boot_ncpus (mp_ncpus) + #define CPU_SEQID (curcpu) #define tsd_create(keyp, destructor) do { \ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/conf/files Fri Mar 23 02:15:05 2018 (r331404) @@ -162,12 +162,14 @@ cddl/contrib/opensolaris/common/zfs/zpool_prop.c opt cddl/contrib/opensolaris/common/zfs/zprop_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/vnode.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c optional zfs compile-with "${ZFS_C}" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Mar 23 02:22:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFC66F60DAF; Fri, 23 Mar 2018 02:22:16 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9559979DD3; Fri, 23 Mar 2018 02:22:16 +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 904EC19CC1; Fri, 23 Mar 2018 02:22:16 +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 w2N2MG1Q075492; Fri, 23 Mar 2018 02:22:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2MGW3075491; Fri, 23 Mar 2018 02:22:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230222.w2N2MGW3075491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r331405 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 331405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:22:17 -0000 Author: mav Date: Fri Mar 23 02:22:16 2018 New Revision: 331405 URL: https://svnweb.freebsd.org/changeset/base/331405 Log: 9084 spa_*_ashift must ignore spare devices illumos/illumos-gate@b037f3dbd69cef4a7ffd576ad33e07bfaf0b1e84 Reviewed by: Prashanth Sreenivasa Reviewed by: George Wilson Approved by: Dan McDonald Author: Prakash Surya Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Fri Mar 23 02:15:05 2018 (r331404) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Fri Mar 23 02:22:16 2018 (r331405) @@ -1478,14 +1478,6 @@ vdev_open(vdev_t *vd) return (error); } - if (vd->vdev_top == vd && vd->vdev_ashift != 0 && - !vd->vdev_isl2cache && !vd->vdev_islog) { - if (vd->vdev_ashift > spa->spa_max_ashift) - spa->spa_max_ashift = vd->vdev_ashift; - if (vd->vdev_ashift < spa->spa_min_ashift) - spa->spa_min_ashift = vd->vdev_ashift; - } - /* * Track the min and max ashift values for normal data devices. */ From owner-svn-src-all@freebsd.org Fri Mar 23 02:24:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3B31F61033; Fri, 23 Mar 2018 02:24:52 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C53B79FCC; Fri, 23 Mar 2018 02:24:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FF9A19CD6; Fri, 23 Mar 2018 02:24:52 +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 w2N2Oqu7075630; Fri, 23 Mar 2018 02:24:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2OqR3075629; Fri, 23 Mar 2018 02:24:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230224.w2N2OqR3075629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331406 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:24:53 -0000 Author: mav Date: Fri Mar 23 02:24:52 2018 New Revision: 331406 URL: https://svnweb.freebsd.org/changeset/base/331406 Log: MFV r331405: 9084 spa_*_ashift must ignore spare devices illumos/illumos-gate@b037f3dbd69cef4a7ffd576ad33e07bfaf0b1e84 Reviewed by: Prashanth Sreenivasa Reviewed by: George Wilson Approved by: Dan McDonald Author: Prakash Surya Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 02:22:16 2018 (r331405) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 02:24:52 2018 (r331406) @@ -1589,14 +1589,6 @@ vdev_open(vdev_t *vd) return (error); } - if (vd->vdev_top == vd && vd->vdev_ashift != 0 && - !vd->vdev_isl2cache && !vd->vdev_islog) { - if (vd->vdev_ashift > spa->spa_max_ashift) - spa->spa_max_ashift = vd->vdev_ashift; - if (vd->vdev_ashift < spa->spa_min_ashift) - spa->spa_min_ashift = vd->vdev_ashift; - } - /* * Track the min and max ashift values for normal data devices. */ From owner-svn-src-all@freebsd.org Fri Mar 23 02:28:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB2DCF61460; Fri, 23 Mar 2018 02:28:38 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7031A7A204; Fri, 23 Mar 2018 02:28:38 +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 6B42319CD9; Fri, 23 Mar 2018 02:28:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2ScHx075819; Fri, 23 Mar 2018 02:28:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2ScaL075817; Fri, 23 Mar 2018 02:28:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230228.w2N2ScaL075817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r331407 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zfs vendor/illumos/dist/cmd/zpool X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zfs vendor/illumos/dist/cmd/zpool X-SVN-Commit-Revision: 331407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:28:38 -0000 Author: mav Date: Fri Mar 23 02:28:37 2018 New Revision: 331407 URL: https://svnweb.freebsd.org/changeset/base/331407 Log: 9213 zfs: sytem typo illumos/illumos-gate@edc8ef7d921c96b23969898aeb766cb24960bda7 Reviewed by: C Fraire Reviewed by: Andy Fiddaman Approved by: Joshua M. Clulow Author: Toomas Soome Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zpool/zpool_main.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Fri Mar 23 02:24:52 2018 (r331406) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Fri Mar 23 02:28:37 2018 (r331407) @@ -2188,7 +2188,7 @@ zfs_do_upgrade(int argc, char **argv) if (cb.cb_numfailed != 0) ret = 1; } else { - /* List old-version filesytems */ + /* List old-version filesystems */ boolean_t found; (void) printf(gettext("This system is currently running " "ZFS filesystem version %llu.\n\n"), ZPL_VERSION); Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Fri Mar 23 02:24:52 2018 (r331406) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Fri Mar 23 02:28:37 2018 (r331407) @@ -1826,7 +1826,7 @@ show_import(nvlist_t *config) case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("status: The pool uses the following " - "feature(s) not supported on this sytem:\n")); + "feature(s) not supported on this system:\n")); zpool_print_unsup_feat(config); break; From owner-svn-src-all@freebsd.org Fri Mar 23 02:28:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59C27F6145D; Fri, 23 Mar 2018 02:28:38 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07E777A203; Fri, 23 Mar 2018 02:28:38 +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 02F0F19CD8; Fri, 23 Mar 2018 02:28:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2Sb2n075812; Fri, 23 Mar 2018 02:28:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2SbN1075811; Fri, 23 Mar 2018 02:28:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230228.w2N2SbN1075811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r331407 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zfs vendor/illumos/dist/cmd/zpool X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zfs vendor/illumos/dist/cmd/zpool X-SVN-Commit-Revision: 331407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:28:38 -0000 Author: mav Date: Fri Mar 23 02:28:37 2018 New Revision: 331407 URL: https://svnweb.freebsd.org/changeset/base/331407 Log: 9213 zfs: sytem typo illumos/illumos-gate@edc8ef7d921c96b23969898aeb766cb24960bda7 Reviewed by: C Fraire Reviewed by: Andy Fiddaman Approved by: Joshua M. Clulow Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zpool/zpool_main.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Fri Mar 23 02:24:52 2018 (r331406) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Fri Mar 23 02:28:37 2018 (r331407) @@ -2371,7 +2371,7 @@ slow: /* * Determine whether Access should be granted/denied. * - * The least priv subsytem is always consulted as a basic privilege + * The least priv subsystem is always consulted as a basic privilege * can define any form of access. */ int From owner-svn-src-all@freebsd.org Fri Mar 23 02:30:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFE5BF617A8; Fri, 23 Mar 2018 02:30:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CBA17A4CC; Fri, 23 Mar 2018 02:30:30 +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 5956C19CDD; Fri, 23 Mar 2018 02:30:30 +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 w2N2UUwv075976; Fri, 23 Mar 2018 02:30:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2UTsL075973; Fri, 23 Mar 2018 02:30:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230230.w2N2UTsL075973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331408 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:30:31 -0000 Author: mav Date: Fri Mar 23 02:30:29 2018 New Revision: 331408 URL: https://svnweb.freebsd.org/changeset/base/331408 Log: MFV r331407: 9213 zfs: sytem typo illumos/illumos-gate@edc8ef7d921c96b23969898aeb766cb24960bda7 Reviewed by: C Fraire Reviewed by: Andy Fiddaman Approved by: Joshua M. Clulow Author: Toomas Soome Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Mar 23 02:28:37 2018 (r331407) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Mar 23 02:30:29 2018 (r331408) @@ -2215,7 +2215,7 @@ zfs_do_upgrade(int argc, char **argv) if (cb.cb_numfailed != 0) ret = 1; } else { - /* List old-version filesytems */ + /* List old-version filesystems */ boolean_t found; (void) printf(gettext("This system is currently running " "ZFS filesystem version %llu.\n\n"), ZPL_VERSION); Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Mar 23 02:28:37 2018 (r331407) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Mar 23 02:30:29 2018 (r331408) @@ -1852,7 +1852,7 @@ show_import(nvlist_t *config) case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("status: The pool uses the following " - "feature(s) not supported on this sytem:\n")); + "feature(s) not supported on this system:\n")); zpool_print_unsup_feat(config); break; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Mar 23 02:28:37 2018 (r331407) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Mar 23 02:30:29 2018 (r331408) @@ -2369,7 +2369,7 @@ slow: /* * Determine whether Access should be granted/denied. * - * The least priv subsytem is always consulted as a basic privilege + * The least priv subsystem is always consulted as a basic privilege * can define any form of access. */ int From owner-svn-src-all@freebsd.org Fri Mar 23 02:33:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86708F61D4C; Fri, 23 Mar 2018 02:33:31 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39A557A95B; Fri, 23 Mar 2018 02:33:31 +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 349D719E68; Fri, 23 Mar 2018 02:33:31 +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 w2N2XVu8080701; Fri, 23 Mar 2018 02:33:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2XVV0080700; Fri, 23 Mar 2018 02:33:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230233.w2N2XVV0080700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331409 - stable/11/sys/dev/drm X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/drm X-SVN-Commit-Revision: 331409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:33:31 -0000 Author: emaste Date: Fri Mar 23 02:33:30 2018 New Revision: 331409 URL: https://svnweb.freebsd.org/changeset/base/331409 Log: MFC r331339: Correct signedness bug in drm_modeset_ctl drm_modeset_ctl() takes a signed in from userland, does a boundscheck, and then uses it to index into a structure and write to it. The boundscheck only checks upper bound, and never checks for nagative values. If the int coming from userland is negative [after conversion] it will bypass the boundscheck, perform a negative index into an array and write to it, causing memory corruption. Note that this is in the "old" drm driver; this issue does not exist in drm2. Reported by: Ilja Van Sprundel Reviewed by: cem Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/dev/drm/drm_irq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/drm/drm_irq.c ============================================================================== --- stable/11/sys/dev/drm/drm_irq.c Fri Mar 23 02:30:29 2018 (r331408) +++ stable/11/sys/dev/drm/drm_irq.c Fri Mar 23 02:33:30 2018 (r331409) @@ -351,7 +351,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data goto out; crtc = modeset->crtc; - if (crtc >= dev->num_crtcs) { + if (crtc < 0 || crtc >= dev->num_crtcs) { ret = EINVAL; goto out; } From owner-svn-src-all@freebsd.org Fri Mar 23 02:34:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12724F61F49; Fri, 23 Mar 2018 02:34:46 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BAAD47AAEF; Fri, 23 Mar 2018 02:34:45 +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 B577E19E69; Fri, 23 Mar 2018 02:34:45 +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 w2N2Yj7U080797; Fri, 23 Mar 2018 02:34:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2Yj8T080796; Fri, 23 Mar 2018 02:34:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230234.w2N2Yj8T080796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331410 - stable/10/sys/dev/drm X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/drm X-SVN-Commit-Revision: 331410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:34:46 -0000 Author: emaste Date: Fri Mar 23 02:34:45 2018 New Revision: 331410 URL: https://svnweb.freebsd.org/changeset/base/331410 Log: MFC r331339: Correct signedness bug in drm_modeset_ctl drm_modeset_ctl() takes a signed in from userland, does a boundscheck, and then uses it to index into a structure and write to it. The boundscheck only checks upper bound, and never checks for nagative values. If the int coming from userland is negative [after conversion] it will bypass the boundscheck, perform a negative index into an array and write to it, causing memory corruption. Note that this is in the "old" drm driver; this issue does not exist in drm2. Reported by: Ilja Van Sprundel Reviewed by: cem Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/drm/drm_irq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm/drm_irq.c ============================================================================== --- stable/10/sys/dev/drm/drm_irq.c Fri Mar 23 02:33:30 2018 (r331409) +++ stable/10/sys/dev/drm/drm_irq.c Fri Mar 23 02:34:45 2018 (r331410) @@ -357,7 +357,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data goto out; crtc = modeset->crtc; - if (crtc >= dev->num_crtcs) { + if (crtc < 0 || crtc >= dev->num_crtcs) { ret = EINVAL; goto out; } From owner-svn-src-all@freebsd.org Fri Mar 23 02:34:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAE7BF61FBE; Fri, 23 Mar 2018 02:34:54 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1355D7ABD7; Fri, 23 Mar 2018 02:34:53 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zCXUeB38KYxCTzCXWe5miT; Thu, 22 Mar 2018 20:34:46 -0600 X-Authority-Analysis: v=2.3 cv=cav8UELM c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=4Q51EqK4VeBSQbaRQZ8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B12AD133F; Thu, 22 Mar 2018 19:34:44 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N2Yh4j004874; Thu, 22 Mar 2018 19:34:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N2YhAL004871; Thu, 22 Mar 2018 19:34:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230234.w2N2YhAL004871@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 15:42:41 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 19:34:43 -0700 X-CMAE-Envelope: MS4wfB0ZMIE4LlEeSBoC2L7tm9oJvc+5ze027nK1LXx2/KaDHkOQ28jwWpiuLJY9J06DQwjRm5wH2Rn8eby6k/J89RWcd5LrFCj0ClYhkCXMaW3IT/+Ti3GH NbmA8hrp+sF/sUhqflFxp+4Na6aIfwVBaaYlcAc/VCVSEhe/JKI/YDeOS7Q1Csv1p5Xtksm4EVXWUv0j7BSqOjwRIYkemK1Z0+GFngyAL/7I7TjjnFobJeNb rf/bLbsT7M9QFigP2g6c49h351VgfSxPb8cvZmq+zHnAlUVLXgfGQpLGbuxRXQktwhXzvNvhQVSgCqdM9k31m07HqsOpGpDrfjY+P0MIKxJkk9UQ02LG6Ftw iBzQklnH X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:34:55 -0000 In message , Jeff Roberson writes: > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > It broke i386 too. > > I believe I'm not able to reproduce this because it is a result of changes > in kernel config. I can not reproduce it so I can't verify the fix. > Since you can, would you mind committing? I see no problem with the diff > below. I don't mind. > > Thanks, > Jeff > > > > > Index: sys/vm/vm_reserv.c > > =================================================================== > > --- sys/vm/vm_reserv.c (revision 331399) > > +++ sys/vm/vm_reserv.c (working copy) > > @@ -45,8 +45,6 @@ > > > > #include > > #include > > -#include > > -#include > > #include > > #include > > #include > > @@ -55,6 +53,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > > > This is because sys/i386/include/machine.h uses critical_enter() and > > critical_exit() which are defined in sys/systm.h. > > > > It built nicely on my amd64's though. > > > > ~cy > > > > In message , Jeff Roberson > > writes: > >> Thank you, working on it. I had done a make universe before getting > >> review feedback. > >> > >> Jeff > >> > >> On Thu, 22 Mar 2018, Justin Hibbits wrote: > >> > >>> This broke gcc builds. > >>> > >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > >>>> Author: jeff > >>>> Date: Thu Mar 22 19:21:11 2018 > >>>> New Revision: 331369 > >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 > >>>> > >>>> Log: > >>>> Lock reservations with a dedicated lock in each reservation. Protect > th > >> e > >>>> vmd_free_count with atomics. > >>>> > >>>> This allows us to allocate and free from reservations without the free > l > >> ock > >>>> except where a superpage is allocated from the physical layer, which i > s > >>>> roughly 1/512 of the operations on amd64. > >>>> > >>>> Use the counter api to eliminate cache conention on counters. > >>>> > >>>> Reviewed by: markj > >>>> Tested by: pho > >>>> Sponsored by: Netflix, Dell/EMC Isilon > >>>> Differential Revision: https://reviews.freebsd.org/D14707 > >>>> > >>>> Modified: > >>>> head/sys/vm/vm_page.c > >>>> head/sys/vm/vm_pagequeue.h > >>>> head/sys/vm/vm_reserv.c > >>>> head/sys/vm/vm_reserv.h > >>>> > >>>> Modified: head/sys/vm/vm_page.c > >>>> ======================================================================== > == > >> ==== > >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368 > ) > >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369 > ) > >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >>>> static void vm_page_alloc_check(vm_page_t m); > >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebi > ts > >> ); > >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >>>> -static void vm_page_free_phys(struct vm_domain *vmd, 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); > >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pinde > x_ > >> t pi > >>>> * for the request class and false otherwise. > >>>> */ > >>>> int > >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >>>> { > >>>> + u_int limit, old, new; > >>>> > >>>> - vm_domain_free_assert_locked(vmd); > >>>> req = req & VM_ALLOC_CLASS_MASK; > >>>> > >>>> /* > >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int r > eq > >> , in > >>>> */ > >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >>>> req = VM_ALLOC_SYSTEM; > >>>> + if (req == VM_ALLOC_INTERRUPT) > >>>> + limit = 0; > >>>> + else if (req == VM_ALLOC_SYSTEM) > >>>> + limit = vmd->vmd_interrupt_free_min; > >>>> + else > >>>> + limit = vmd->vmd_free_reserved; > >>>> > >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >>>> - (req == VM_ALLOC_SYSTEM && > >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) > | > >> | > >>>> - (req == VM_ALLOC_INTERRUPT && > >>>> - vmd->vmd_free_count >= npages)) > >>>> - return (1); > >>>> + /* > >>>> + * Attempt to reserve the pages. Fail if we're below the limit. > >>>> + */ > >>>> + limit += npages; > >>>> + old = vmd->vmd_free_count; > >>>> + do { > >>>> + if (old < limit) > >>>> + return (0); > >>>> + new = old - npages; > >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == > 0) > >> ; > >>>> > >>>> - return (0); > >>>> + /* Wake the page daemon if we've crossed the threshold. */ > >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >>>> + pagedaemon_wakeup(vmd->vmd_domain); > >>>> + > >>>> + /* Only update bitsets on transitions. */ > >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > >>>> + vm_domain_set(vmd); > >>>> + > >>>> + return (1); > >>>> } > >>>> > >>>> vm_page_t > >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, v > m_ > >> pind > >>>> again: > >>>> m = NULL; > >>>> #if VM_NRESERVLEVEL > 0 > >>>> + /* > >>>> + * Can we allocate the page from a reservation? > >>>> + */ > >>>> if (vm_object_reserv(object) && > >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >>>> - != NULL) { > >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) > != > >> NULL || > >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred > )) > >> != NULL)) { > >>>> domain = vm_phys_domain(m); > >>>> vmd = VM_DOMAIN(domain); > >>>> goto found; > >>>> } > >>>> #endif > >>>> vmd = VM_DOMAIN(domain); > >>>> - vm_domain_free_lock(vmd); > >>>> - if (vm_domain_available(vmd, req, 1)) { > >>>> + if (vm_domain_allocate(vmd, req, 1)) { > >>>> /* > >>>> - * Can we allocate the page from a reservation? > >>>> + * If not, allocate it from the free page queues. > >>>> */ > >>>> + vm_domain_free_lock(vmd); > >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >>>> + vm_domain_free_unlock(vmd); > >>>> + if (m == NULL) { > >>>> + vm_domain_freecnt_inc(vmd, 1); > >>>> #if VM_NRESERVLEVEL > 0 > >>>> - if (!vm_object_reserv(object) || > >>>> - (m = vm_reserv_alloc_page(object, pindex, > >>>> - domain, mpred)) == NULL) > >>>> + if (vm_reserv_reclaim_inactive(domain)) > >>>> + goto again; > >>>> #endif > >>>> - { > >>>> - /* > >>>> - * If not, allocate it from the free page queues > . > >>>> - */ > >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0) > ; > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> - if (m == NULL && vm_reserv_reclaim_inactive(doma > in > >> )) { > >>>> - m = vm_phys_alloc_pages(domain, > >>>> - object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DI > RE > >> CT, > >>>> - 0); > >>>> - } > >>>> -#endif > >>>> } > >>>> } > >>>> - if (m != NULL) > >>>> - vm_domain_freecnt_dec(vmd, 1); > >>>> - vm_domain_free_unlock(vmd); > >>>> if (m == NULL) { > >>>> /* > >>>> * Not allocatable, give up. > >>>> @@ -1775,9 +1783,7 @@ again: > >>>> */ > >>>> KASSERT(m != NULL, ("missing page")); > >>>> > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> found: > >>>> -#endif > >>> > >>> 'found' is now declared, but unused on powerpc64. > >>> > >>> - Justin > >>> > >> > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Fri Mar 23 02:36:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F5ADF622FC; Fri, 23 Mar 2018 02:36:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x234.google.com (mail-qt0-x234.google.com [IPv6:2607:f8b0:400d:c0d::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0216B7ADF6; Fri, 23 Mar 2018 02:36:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x234.google.com with SMTP id q11so11182651qtl.9; Thu, 22 Mar 2018 19:36:42 -0700 (PDT) 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=BvixQ4uByB/yZ8W/K8iK6nHz/H5dPuXCD8nkN4rLwjg=; b=KFHYVWgLd9fkUr4WH6qAlDCLTp8uuw6iD7torv52vBO9U07zbhriCEDYom+oUaTKYb w6/azmBY2bC7yAhQz2iHy/24hgxAO5ZS8SMhSZpu5y7sIJ3yCrclC8r6WVLdgPtQ7uRe HNI6mKLqKHzwLhAhj5ZdcsuBw4c4sJ7V0GPMWeeqDwBj3DoTHdumfZfriZWwDCLpkMYP hQjN4SFFjC2BEfjVTc/ePcd7GlbRcszxRJo+MLma+gJCv6HZBIUEGDk2GLyR6lRxemzs +1YCu0oTmTWvqC/yN42jxy44VqiEMRdDjJFRHY9370U9UmgesbAYOLen9alZnLBku/4Z 6EIA== 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=BvixQ4uByB/yZ8W/K8iK6nHz/H5dPuXCD8nkN4rLwjg=; b=nsODck0nYx4y7F8h7dcXTyiWZl25P/PvnoerL29rqIHdIt56ZS3qozJRV5Exxl6q2F ncXFQJoRdtdi+VexxM8B+KS1BkEloz1lurxxnyP9C71Qo1FBS3dQJXre9l+2qCGNgUw1 UgoiZxlTF2D1/n237vrp66A56ye4Yj+tmVaymVXT5kkpk4ree2P33iBrGUyH6DKfjDDr F5hRAlj/eLKaZY37PnP6QPpUMwIlmxcYN4sH3eiZVTb9MuBUYTpYjtZobKHsFPfGSy/v ImRE0HaVzX2KnVApDQe9+ds0oI3pvApm1ukjz935iglF5v/QaKipbJ91W+xJ/+VNqkqN 50tw== X-Gm-Message-State: AElRT7EQHGmarimDnucw6rc0LvX00VZRQADIE3LJVr8wueFymyNMVFO8 lOVxTy7HMHbm2cf9BNR3MIfBjAU8CD5aMMxbiUWuJg== X-Google-Smtp-Source: AG47ELuDdDGNle14rfWYPlbls+teCyMcVg49KaBjKaqZhYpqlgr94d8Z6DT/rHARcLneyvk261ypEo2dKT5VjB1VPCk= X-Received: by 10.237.62.243 with SMTP id o48mr37520818qtf.3.1521772602095; Thu, 22 Mar 2018 19:36:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.36.52 with HTTP; Thu, 22 Mar 2018 19:36:41 -0700 (PDT) In-Reply-To: <201803230215.w2N2F6wL070720@repo.freebsd.org> References: <201803230215.w2N2F6wL070720@repo.freebsd.org> From: Mateusz Guzik Date: Fri, 23 Mar 2018 03:36:41 +0100 Message-ID: Subject: Re: svn commit: r331404 - in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/u... To: Alexander Motin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:36:43 -0000 On Fri, Mar 23, 2018 at 3:15 AM, Alexander Motin wrote: > Author: mav > Date: Fri Mar 23 02:15:05 2018 > New Revision: 331404 > URL: https://svnweb.freebsd.org/changeset/base/331404 > > Log: > MFV r331400: 8484 Implement aggregate sum and use for arc counters > > In pursuit of improving performance on multi-core systems, we should > implements fanned out counters and use them to improve the performance of > some of the arc statistics. These stats are updated extremely frequently, > and can consume a significant amount of CPU time. > > > > Due to seriously fat locks this struct: typedef struct aggsum_bucket { kmutex_t asc_lock; int64_t asc_delta; uint64_t asc_borrowed; uint64_t asc_pad[4]; /* pad out to cache line (64 bytes) */ } aggsum_bucket_t __aligned(CACHE_LINE_SIZE); ends up using *two* cache lines. Without asc_pad the size is 48 bytes. asc_pad adds 4 * 8 = 32 which pushes it to the next line for no good reason. That said, I suggest #ifndefing it the field. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Fri Mar 23 02:37:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39A8FF623DC; Fri, 23 Mar 2018 02:37:09 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC2E57AF64; Fri, 23 Mar 2018 02:37:08 +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 D2AD919E6A; Fri, 23 Mar 2018 02:37:08 +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 w2N2b8pr080938; Fri, 23 Mar 2018 02:37:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2b8wn080937; Fri, 23 Mar 2018 02:37:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230237.w2N2b8wn080937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331411 - stable/11/sys/dev/drm X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/drm X-SVN-Commit-Revision: 331411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:37:09 -0000 Author: emaste Date: Fri Mar 23 02:37:08 2018 New Revision: 331411 URL: https://svnweb.freebsd.org/changeset/base/331411 Log: MFC r331333: Fix kernel memory disclosure in drm_infobufs drm_infobufs() has a structure on the stack, fills it out and copies it to userland. There are 2 elements in the struct that are not filled out and left uninitialized. This will leak uninitialized kernel stack data to userland. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel Security: Kernel memory disclosure (798) Modified: stable/11/sys/dev/drm/drm_bufs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/drm/drm_bufs.c ============================================================================== --- stable/11/sys/dev/drm/drm_bufs.c Fri Mar 23 02:34:45 2018 (r331410) +++ stable/11/sys/dev/drm/drm_bufs.c Fri Mar 23 02:37:08 2018 (r331411) @@ -935,6 +935,7 @@ int drm_infobufs(struct drm_device *dev, void *data, s if (dma->bufs[i].buf_count) { struct drm_buf_desc from; + memset(&from, 0, sizeof(from)); from.count = dma->bufs[i].buf_count; from.size = dma->bufs[i].buf_size; from.low_mark = dma->bufs[i].freelist.low_mark; From owner-svn-src-all@freebsd.org Fri Mar 23 02:38:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D100F62618; Fri, 23 Mar 2018 02:38:32 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EEDB7B12E; Fri, 23 Mar 2018 02:38: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 19A9919E6B; Fri, 23 Mar 2018 02:38: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 w2N2cVxV081042; Fri, 23 Mar 2018 02:38:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2cV8e081041; Fri, 23 Mar 2018 02:38:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230238.w2N2cV8e081041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331412 - stable/10/sys/dev/drm X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/drm X-SVN-Commit-Revision: 331412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:38:32 -0000 Author: emaste Date: Fri Mar 23 02:38:31 2018 New Revision: 331412 URL: https://svnweb.freebsd.org/changeset/base/331412 Log: MFC r331333: Fix kernel memory disclosure in drm_infobufs drm_infobufs() has a structure on the stack, fills it out and copies it to userland. There are 2 elements in the struct that are not filled out and left uninitialized. This will leak uninitialized kernel stack data to userland. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel Security: Kernel memory disclosure (798) Modified: stable/10/sys/dev/drm/drm_bufs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm/drm_bufs.c ============================================================================== --- stable/10/sys/dev/drm/drm_bufs.c Fri Mar 23 02:37:08 2018 (r331411) +++ stable/10/sys/dev/drm/drm_bufs.c Fri Mar 23 02:38:31 2018 (r331412) @@ -935,6 +935,7 @@ int drm_infobufs(struct drm_device *dev, void *data, s if (dma->bufs[i].buf_count) { struct drm_buf_desc from; + memset(&from, 0, sizeof(from)); from.count = dma->bufs[i].buf_count; from.size = dma->bufs[i].buf_size; from.low_mark = dma->bufs[i].freelist.low_mark; From owner-svn-src-all@freebsd.org Fri Mar 23 02:40:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAAF8F6290D; Fri, 23 Mar 2018 02:40:40 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 170477B32C; Fri, 23 Mar 2018 02:40:39 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zCdAegDbuU5pnzCdBemKPO; Thu, 22 Mar 2018 20:40:38 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=PkHr_DOy3S1xoynW2OsA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0E35D1369; Thu, 22 Mar 2018 19:40:36 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N2eZJY005405; Thu, 22 Mar 2018 19:40:35 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N2eZDb005402; Thu, 22 Mar 2018 19:40:35 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230240.w2N2eZDb005402@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 15:53:51 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 19:40:35 -0700 X-CMAE-Envelope: MS4wfHhV48vLNYhjVGlMO5/+uD96XunXltx11wdK3LDHTOh2H2b67yKcchO1v+/XBO2fhlJ4lKj6IQ6TbuuuUef1Z2z6wqVqrd5I7qPxMY8D+Ix48vs7X4jm 1b3ltrUXY8ez8evdE/x+SsnBWAI2TotGvewyzsRxuy4vyewzsAe9IgeMqd6InIU81cbARXmywQbV3y3a4S7Snu9gmLTRfOXHayh5yyPl5QaRr6tv1VzFjwBn oxhNhcXUrWMSXvlbvcKrffy5D+OEAV8lmu18vHgbgaBJvLMu0dUEZitm56hH6oM/ZY5iM2Z6d5dqnBIVSzmb88a5TRlu2Skr925lmseXVDqE6kDAfWkZ+itS AVsAiQiO X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:40:41 -0000 In message , Jeff Roberson writes: > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > In message , Jeff Roberson > > writes: > >> On Thu, 22 Mar 2018, Cy Schubert wrote: > >> > >>> It broke i386 too. > >> > >> I just did > >> TARGET_ARCH=i386 make buildworld > >> TARGET_ARCH=i386 make buildkernel > >> > >> This worked for me? > >> > >> Jeff > > > > hmmm. > > > > make TARGET=i386 TARGET_ARCH=i386 buildkernel > > Do you have changes to GENERIC? Not to GENERIC but I used a different kernel by default that removes most drivers (as I load them dynamically -- single kernel different modules on each machine). Ahh but this particular i386 kernel I was building does not include INVARIANTS. sys/i386/include/counter.h at line 35 has: #ifdef INVARIANTS #include #endif sys/proc.h includes sys/systm.h. i386 without INVARIANTS will fail to build. With INVARIANTS i386 does build. I'll commit the fix. ~cy > > Thanks, > Jeff > > > > --- vm_reserv.o --- > > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: > > In file included from /opt/src/svn-current/sys/sys/counter.h:37: > > ./machine/counter.h:174:3: error: implicit declaration of function > > 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat > > ion] > > critical_enter(); > > ^ > > ./machine/counter.h:174:3: error: this function declaration is not a > > prototype [-Werror,-Wstrict-prototypes] > > ./machine/counter.h:176:3: error: implicit declaration of function > > 'critical_exit' is invalid in C99 [-Werror,-Wimplicit-function-declarati > > on] > > critical_exit(); > > ^ > > ./machine/counter.h:176:3: note: did you mean 'critical_enter'? > > ./machine/counter.h:174:3: note: 'critical_enter' declared here > > critical_enter(); > > ^ > > ./machine/counter.h:176:3: error: this function declaration is not a > > prototype [-Werror,-Wstrict-prototypes] > > critical_exit(); > > ^ > > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > > /opt/src/svn-current/sys/sys/systm.h:217:6: error: conflicting types > > for 'critical_enter' > > void critical_enter(void); > > ^ > > ./machine/counter.h:174:3: note: previous implicit declaration is here > > critical_enter(); > > ^ > > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > > /opt/src/svn-current/sys/sys/systm.h:218:6: error: conflicting types > > for 'critical_exit' > > void critical_exit(void); > > ^ > > ./machine/counter.h:176:3: note: previous implicit declaration is here > > critical_exit(); > > ^ > > 6 errors generated. > > *** [vm_reserv.o] Error code 1 > > > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > > --- modules-all --- > > A failure has been detected in another branch of the parallel make > > > > make[3]: stopped in /opt/src/svn-current/sys/modules > > *** [modules-all] Error code 2 > > > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > > 2 errors > > > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > > *** [buildkernel] Error code 2 > > > > make[1]: stopped in /opt/src/svn-current > > 1 error > > > > make[1]: stopped in /opt/src/svn-current > > *** [buildkernel] Error code 2 > > > > make: stopped in /opt/src/svn-current > > 1 error > > > > make: stopped in /opt/src/svn-current > > > > ~cy > > > >> > >>> > >>> Index: sys/vm/vm_reserv.c > >>> =================================================================== > >>> --- sys/vm/vm_reserv.c (revision 331399) > >>> +++ sys/vm/vm_reserv.c (working copy) > >>> @@ -45,8 +45,6 @@ > >>> > >>> #include > >>> #include > >>> -#include > >>> -#include > >>> #include > >>> #include > >>> #include > >>> @@ -55,6 +53,8 @@ > >>> #include > >>> #include > >>> #include > >>> +#include > >>> +#include > >>> #include > >>> #include > >>> > >>> This is because sys/i386/include/machine.h uses critical_enter() and > >>> critical_exit() which are defined in sys/systm.h. > >>> > >>> It built nicely on my amd64's though. > >>> > >>> ~cy > >>> > >>> In message , Jeff Roberson > >>> writes: > >>>> Thank you, working on it. I had done a make universe before getting > >>>> review feedback. > >>>> > >>>> Jeff > >>>> > >>>> On Thu, 22 Mar 2018, Justin Hibbits wrote: > >>>> > >>>>> This broke gcc builds. > >>>>> > >>>>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote > : > >>>>>> Author: jeff > >>>>>> Date: Thu Mar 22 19:21:11 2018 > >>>>>> New Revision: 331369 > >>>>>> URL: https://svnweb.freebsd.org/changeset/base/331369 > >>>>>> > >>>>>> Log: > >>>>>> Lock reservations with a dedicated lock in each reservation. Protec > t > >> th > >>>> e > >>>>>> vmd_free_count with atomics. > >>>>>> > >>>>>> This allows us to allocate and free from reservations without the fr > ee > >> l > >>>> ock > >>>>>> except where a superpage is allocated from the physical layer, which > i > >> s > >>>>>> roughly 1/512 of the operations on amd64. > >>>>>> > >>>>>> Use the counter api to eliminate cache conention on counters. > >>>>>> > >>>>>> Reviewed by: markj > >>>>>> Tested by: pho > >>>>>> Sponsored by: Netflix, Dell/EMC Isilon > >>>>>> Differential Revision: https://reviews.freebsd.org/D14707 > >>>>>> > >>>>>> Modified: > >>>>>> head/sys/vm/vm_page.c > >>>>>> head/sys/vm/vm_pagequeue.h > >>>>>> head/sys/vm/vm_reserv.c > >>>>>> head/sys/vm/vm_reserv.h > >>>>>> > >>>>>> Modified: head/sys/vm/vm_page.c > >>>>>> ====================================================================== > == > >> == > >>>> ==== > >>>>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r3313 > 68 > >> ) > >>>>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r3313 > 69 > >> ) > >>>>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >>>>>> static void vm_page_alloc_check(vm_page_t m); > >>>>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t page > bi > >> ts > >>>> ); > >>>>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >>>>>> -static void vm_page_free_phys(struct vm_domain *vmd, 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); > >>>>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pin > de > >> x_ > >>>> t pi > >>>>>> * for the request class and false otherwise. > >>>>>> */ > >>>>>> int > >>>>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >>>>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >>>>>> { > >>>>>> + u_int limit, old, new; > >>>>>> > >>>>>> - vm_domain_free_assert_locked(vmd); > >>>>>> req = req & VM_ALLOC_CLASS_MASK; > >>>>>> > >>>>>> /* > >>>>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int > r > >> eq > >>>> , in > >>>>>> */ > >>>>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >>>>>> req = VM_ALLOC_SYSTEM; > >>>>>> + if (req == VM_ALLOC_INTERRUPT) > >>>>>> + limit = 0; > >>>>>> + else if (req == VM_ALLOC_SYSTEM) > >>>>>> + limit = vmd->vmd_interrupt_free_min; > >>>>>> + else > >>>>>> + limit = vmd->vmd_free_reserved; > >>>>>> > >>>>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >>>>>> - (req == VM_ALLOC_SYSTEM && > >>>>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_mi > n) > >> | > >>>> | > >>>>>> - (req == VM_ALLOC_INTERRUPT && > >>>>>> - vmd->vmd_free_count >= npages)) > >>>>>> - return (1); > >>>>>> + /* > >>>>>> + * Attempt to reserve the pages. Fail if we're below the limi > t. > >>>>>> + */ > >>>>>> + limit += npages; > >>>>>> + old = vmd->vmd_free_count; > >>>>>> + do { > >>>>>> + if (old < limit) > >>>>>> + return (0); > >>>>>> + new = old - npages; > >>>>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) = > = > >> 0) > >>>> ; > >>>>>> > >>>>>> - return (0); > >>>>>> + /* Wake the page daemon if we've crossed the threshold. */ > >>>>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >>>>>> + pagedaemon_wakeup(vmd->vmd_domain); > >>>>>> + > >>>>>> + /* Only update bitsets on transitions. */ > >>>>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >>>>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe > )) > >>>>>> + vm_domain_set(vmd); > >>>>>> + > >>>>>> + return (1); > >>>>>> } > >>>>>> > >>>>>> vm_page_t > >>>>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, > v > >> m_ > >>>> pind > >>>>>> again: > >>>>>> m = NULL; > >>>>>> #if VM_NRESERVLEVEL > 0 > >>>>>> + /* > >>>>>> + * Can we allocate the page from a reservation? > >>>>>> + */ > >>>>>> if (vm_object_reserv(object) && > >>>>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >>>>>> - != NULL) { > >>>>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred) > ) > >> != > >>>> NULL || > >>>>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpr > ed > >> )) > >>>> != NULL)) { > >>>>>> domain = vm_phys_domain(m); > >>>>>> vmd = VM_DOMAIN(domain); > >>>>>> goto found; > >>>>>> } > >>>>>> #endif > >>>>>> vmd = VM_DOMAIN(domain); > >>>>>> - vm_domain_free_lock(vmd); > >>>>>> - if (vm_domain_available(vmd, req, 1)) { > >>>>>> + if (vm_domain_allocate(vmd, req, 1)) { > >>>>>> /* > >>>>>> - * Can we allocate the page from a reservation? > >>>>>> + * If not, allocate it from the free page queues. > >>>>>> */ > >>>>>> + vm_domain_free_lock(vmd); > >>>>>> + m = vm_phys_alloc_pages(domain, object != NULL ? > >>>>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >>>>>> + vm_domain_free_unlock(vmd); > >>>>>> + if (m == NULL) { > >>>>>> + vm_domain_freecnt_inc(vmd, 1); > >>>>>> #if VM_NRESERVLEVEL > 0 > >>>>>> - if (!vm_object_reserv(object) || > >>>>>> - (m = vm_reserv_alloc_page(object, pindex, > >>>>>> - domain, mpred)) == NULL) > >>>>>> + if (vm_reserv_reclaim_inactive(domain)) > >>>>>> + goto again; > >>>>>> #endif > >>>>>> - { > >>>>>> - /* > >>>>>> - * If not, allocate it from the free page queu > es > >> . > >>>>>> - */ > >>>>>> - m = vm_phys_alloc_pages(domain, object != NULL > ? > >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, > 0) > >> ; > >>>>>> -#if VM_NRESERVLEVEL > 0 > >>>>>> - if (m == NULL && vm_reserv_reclaim_inactive(do > ma > >> in > >>>> )) { > >>>>>> - m = vm_phys_alloc_pages(domain, > >>>>>> - object != NULL ? > >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_ > DI > >> RE > >>>> CT, > >>>>>> - 0); > >>>>>> - } > >>>>>> -#endif > >>>>>> } > >>>>>> } > >>>>>> - if (m != NULL) > >>>>>> - vm_domain_freecnt_dec(vmd, 1); > >>>>>> - vm_domain_free_unlock(vmd); > >>>>>> if (m == NULL) { > >>>>>> /* > >>>>>> * Not allocatable, give up. > >>>>>> @@ -1775,9 +1783,7 @@ again: > >>>>>> */ > >>>>>> KASSERT(m != NULL, ("missing page")); > >>>>>> > >>>>>> -#if VM_NRESERVLEVEL > 0 > >>>>>> found: > >>>>>> -#endif > >>>>> > >>>>> 'found' is now declared, but unused on powerpc64. > >>>>> > >>>>> - Justin > >>>>> > >>>> > >>> > >>> -- > >>> Cheers, > >>> Cy Schubert > >>> FreeBSD UNIX: Web: http://www.FreeBSD.org > >>> > >>> The need of the many outweighs the greed of the few. > >>> > >>> > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Fri Mar 23 02:45:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8AE4F62F93; Fri, 23 Mar 2018 02:45:09 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E3B27B81D; Fri, 23 Mar 2018 02:45:09 +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 659EC1A010; Fri, 23 Mar 2018 02:45:09 +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 w2N2j9g2085681; Fri, 23 Mar 2018 02:45:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2j9lt085680; Fri, 23 Mar 2018 02:45:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803230245.w2N2j9lt085680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 02:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331413 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 331413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:45:09 -0000 Author: kevans Date: Fri Mar 23 02:45:09 2018 New Revision: 331413 URL: https://svnweb.freebsd.org/changeset/base/331413 Log: efidev: Drop a quick note in about efi_cfgtbl/efi_runtime There's no real annotation for it, so it's not immediately obvious to the unfamiliar that these pointers are to locations in the EFI runtime map unlike the system table pointer immediately above them. Modified: head/sys/dev/efidev/efirt.c Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Fri Mar 23 02:38:31 2018 (r331412) +++ head/sys/dev/efidev/efirt.c Fri Mar 23 02:45:09 2018 (r331413) @@ -57,6 +57,11 @@ __FBSDID("$FreeBSD$"); #include static struct efi_systbl *efi_systbl; +/* + * The following pointers point to tables in the EFI runtime service data pages. + * Care should be taken to make sure that we've properly entered the EFI runtime + * environment (efi_enter()) before dereferencing them. + */ static struct efi_cfgtbl *efi_cfgtbl; static struct efi_rt *efi_runtime; From owner-svn-src-all@freebsd.org Fri Mar 23 02:50:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E87CF636D1; Fri, 23 Mar 2018 02:50:39 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 304E87BB78; Fri, 23 Mar 2018 02:50:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 275591A01B; Fri, 23 Mar 2018 02:50:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2odeu085925; Fri, 23 Mar 2018 02:50:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2odbi085924; Fri, 23 Mar 2018 02:50:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230250.w2N2odbi085924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331414 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 331414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:50:39 -0000 Author: mav Date: Fri Mar 23 02:50:38 2018 New Revision: 331414 URL: https://svnweb.freebsd.org/changeset/base/331414 Log: Reduce struct aggsum_bucket padding to fit into one cache line. Reported by: mjg Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 02:45:09 2018 (r331413) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 02:50:38 2018 (r331414) @@ -29,7 +29,7 @@ typedef struct aggsum_bucket { kmutex_t asc_lock; int64_t asc_delta; uint64_t asc_borrowed; - uint64_t asc_pad[4]; /* pad out to cache line (64 bytes) */ + uint64_t asc_pad[2]; /* pad out to cache line (64 bytes) */ } aggsum_bucket_t __aligned(CACHE_LINE_SIZE); /* From owner-svn-src-all@freebsd.org Fri Mar 23 03:22:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1420F65BC1; Fri, 23 Mar 2018 03:22:30 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E1EC7D1A5; Fri, 23 Mar 2018 03:22:30 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 691D01A6F0; Fri, 23 Mar 2018 03:22:30 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N3MUxS006653; Fri, 23 Mar 2018 03:22:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N3MUbV006652; Fri, 23 Mar 2018 03:22:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201803230322.w2N3MUbV006652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 23 Mar 2018 03:22:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331415 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 03:22:30 -0000 Author: cy Date: Fri Mar 23 03:22:30 2018 New Revision: 331415 URL: https://svnweb.freebsd.org/changeset/base/331415 Log: Fix build on i386 without INVARIANTS following r331369. --- vm_reserv.o --- In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: In file included from /opt/src/svn-current/sys/sys/counter.h:37: ./machine/counter.h:174:3: error: implicit declaration of function 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat ion] critical_enter(); Reviewed by: jeff@ Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Fri Mar 23 02:50:38 2018 (r331414) +++ head/sys/vm/vm_reserv.c Fri Mar 23 03:22:30 2018 (r331415) @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include #include @@ -55,6 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include From owner-svn-src-all@freebsd.org Fri Mar 23 03:48:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B81FDF67791; Fri, 23 Mar 2018 03:48:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 665787DE5A; Fri, 23 Mar 2018 03:48:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 615CB1AA29; Fri, 23 Mar 2018 03:48:46 +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 w2N3mk56017083; Fri, 23 Mar 2018 03:48:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N3mka2017081; Fri, 23 Mar 2018 03:48:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803230348.w2N3mka2017081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 03:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331416 - in head/stand: efi/libefi i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: efi/libefi i386/libi386 X-SVN-Commit-Revision: 331416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 03:48:46 -0000 Author: kevans Date: Fri Mar 23 03:48:45 2018 New Revision: 331416 URL: https://svnweb.freebsd.org/changeset/base/331416 Log: Loader consoles: Implement SGR 22, reset intensity MFC after: 3 days Modified: head/stand/efi/libefi/efi_console.c head/stand/i386/libi386/vidconsole.c Modified: head/stand/efi/libefi/efi_console.c ============================================================================== --- head/stand/efi/libefi/efi_console.c Fri Mar 23 03:22:30 2018 (r331415) +++ head/stand/efi/libefi/efi_console.c Fri Mar 23 03:48:45 2018 (r331416) @@ -383,6 +383,9 @@ efi_term_emu(int c) fg_c = bg_c; bg_c = t; break; + case 22: /* normal intensity */ + fg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; Modified: head/stand/i386/libi386/vidconsole.c ============================================================================== --- head/stand/i386/libi386/vidconsole.c Fri Mar 23 03:22:30 2018 (r331415) +++ head/stand/i386/libi386/vidconsole.c Fri Mar 23 03:48:45 2018 (r331416) @@ -449,6 +449,9 @@ vidc_term_emu(int c) fg_c = bg_c; bg_c = t; break; + case 22: /* normal intensity */ + fg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; From owner-svn-src-all@freebsd.org Fri Mar 23 04:31:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3403BF6A7E4; Fri, 23 Mar 2018 04:31:20 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D71D67F5E1; Fri, 23 Mar 2018 04:31: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 D1BFD1B0C0; Fri, 23 Mar 2018 04:31: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 w2N4VJ86039717; Fri, 23 Mar 2018 04:31:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N4VJV4039715; Fri, 23 Mar 2018 04:31:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803230431.w2N4VJV4039715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 23 Mar 2018 04:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331417 - head/tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tools/tools/crypto X-SVN-Commit-Revision: 331417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 04:31:20 -0000 Author: cem Date: Fri Mar 23 04:31:19 2018 New Revision: 331417 URL: https://svnweb.freebsd.org/changeset/base/331417 Log: Bring in JHB's cryptocheck tool It can be used to validate basic algorithm correctness on a variety of inputs, by comarison to openssl. While here, add some sanity to the crypto/Makefile. The tool may not be perfect, but getting it in tree where collaboration can happen is a nice first step. The pace of development outside of svn seems to have slowed down mid-2017. Obtained from: github bsdjhb/freebsd:cryptocheck Sponsored by: Dell EMC Isilon Added: head/tools/tools/crypto/cryptocheck.c (contents, props changed) Modified: head/tools/tools/crypto/Makefile Modified: head/tools/tools/crypto/Makefile ============================================================================== --- head/tools/tools/crypto/Makefile Fri Mar 23 03:48:45 2018 (r331416) +++ head/tools/tools/crypto/Makefile Fri Mar 23 04:31:19 2018 (r331417) @@ -1,5 +1,6 @@ # $FreeBSD$ # +# Copyright (c) 2018 Conrad Meyer # Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting # All rights reserved. # @@ -25,40 +26,23 @@ # SUCH DAMAGE. # -ALL= cryptotest cryptokeytest cryptostats \ +PROGS= cryptocheck cryptotest cryptokeytest cryptostats \ ubsecstats hifnstats ipsecstats safestats -BINDIR= /usr/local/bin +MAN= +BINDIR?= /usr/local/bin -all: ${ALL} +# cryptocheck: test symmetric crypto functions +LIBADD.cryptocheck+= crypto ssl util -# program to test asymmetric crypto functions -cryptokeytest: cryptokeytest.c - ${CC} -o cryptokeytest cryptokeytest.c -lcrypto +# cryptokeytest: test asymmetric crypto functions +LIBADD.cryptokeytest+= crypto -# program to dump statistics kept by the core crypto code -cryptostats: cryptostats.c - ${CC} -o cryptostats cryptostats.c +# cryptostats: dump statistics kept by the core crypto code +# ubsecstats: print statistics kept by the Broadcom driver +# hifnstats: print statistics kept by the HIFN driver +# safestats: statistics kept by the SafeNet driver +# ipsecstats: print statistics kept by fast ipsec -# program to print statistics kept by the Broadcom driver -ubsecstats: ubsecstats.c - ${CC} -o ubsecstats ubsecstats.c +CLEANFILES+= core a.out -# program to print statistics kept by the HIFN driver -hifnstats: hifnstats.c - ${CC} -o hifnstats hifnstats.c - -# program to print statistics kept by the SafeNet driver -safestats: safestats.c - ${CC} -o safestats safestats.c - -# program to print statistics kept by fast ipsec -ipsecstats: ipsecstats.c - ${CC} -o ipsecstats ipsecstats.c - -clean: - rm -f ${ALL} core a.out - -install: ${ALL} - for i in ${ALL}; do \ - install $$i ${DESTDIR}${BINDIR}; \ - done +.include Added: head/tools/tools/crypto/cryptocheck.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/crypto/cryptocheck.c Fri Mar 23 04:31:19 2018 (r331417) @@ -0,0 +1,1168 @@ +/*- + * Copyright (c) 2017 John Baldwin, + * Copyright (c) 2004 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO WARRANTY + * 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 NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +/* + * A different tool for checking hardware crypto support. Whereas + * cryptotest is focused on simple performance numbers, this tool is + * focused on correctness. For each crypto operation, it performs the + * operation once in software via OpenSSL and a second time via + * OpenCrypto and compares the results. + * + * cryptocheck [-vz] [-A aad length] [-a algorithm] [-d dev] [size ...] + * + * Options: + * -v Verbose. + * -z Run all algorithms on a variety of buffer sizes. + * + * Supported algorithms: + * all Run all tests + * hmac Run all hmac tests + * blkcipher Run all block cipher tests + * authenc Run all authenticated encryption tests + * aead Run all authenticated encryption with associated data + * tests + * + * HMACs: + * sha1 sha1 hmac + * sha256 256-bit sha2 hmac + * sha384 384-bit sha2 hmac + * sha512 512-bit sha2 hmac + * + * Block Ciphers: + * aes-cbc 128-bit aes cbc + * aes-cbc192 192-bit aes cbc + * aes-cbc256 256-bit aes cbc + * aes-ctr 128-bit aes ctr + * aes-ctr192 192-bit aes ctr + * aes-ctr256 256-bit aes ctr + * aes-xts 128-bit aes xts + * aes-xts256 256-bit aes xts + * + * Authenticated Encryption: + * + + * + * Authenticated Encryption with Associated Data: + * aes-gcm 128-bit aes gcm + * aes-gcm192 192-bit aes gcm + * aes-gcm256 256-bit aes gcm + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +/* XXX: Temporary hack */ +#ifndef COP_F_CIPHER_FIRST +#define COP_F_CIPHER_FIRST 0x0001 /* Cipher before MAC. */ +#endif + +struct alg { + const char *name; + int cipher; + int mac; + enum { T_HMAC, T_BLKCIPHER, T_AUTHENC, T_GCM } type; + const EVP_CIPHER *(*evp_cipher)(void); + const EVP_MD *(*evp_md)(void); +} algs[] = { + { .name = "sha1", .mac = CRYPTO_SHA1_HMAC, .type = T_HMAC, + .evp_md = EVP_sha1 }, + { .name = "sha256", .mac = CRYPTO_SHA2_256_HMAC, .type = T_HMAC, + .evp_md = EVP_sha256 }, + { .name = "sha384", .mac = CRYPTO_SHA2_384_HMAC, .type = T_HMAC, + .evp_md = EVP_sha384 }, + { .name = "sha512", .mac = CRYPTO_SHA2_512_HMAC, .type = T_HMAC, + .evp_md = EVP_sha512 }, + { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_128_cbc }, + { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_192_cbc }, + { .name = "aes-cbc256", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_256_cbc }, + { .name = "aes-ctr", .cipher = CRYPTO_AES_ICM, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_128_ctr }, + { .name = "aes-ctr192", .cipher = CRYPTO_AES_ICM, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_192_ctr }, + { .name = "aes-ctr256", .cipher = CRYPTO_AES_ICM, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_256_ctr }, + { .name = "aes-xts", .cipher = CRYPTO_AES_XTS, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_128_xts }, + { .name = "aes-xts256", .cipher = CRYPTO_AES_XTS, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_256_xts }, + { .name = "aes-gcm", .cipher = CRYPTO_AES_NIST_GCM_16, + .mac = CRYPTO_AES_128_NIST_GMAC, .type = T_GCM, + .evp_cipher = EVP_aes_128_gcm }, + { .name = "aes-gcm192", .cipher = CRYPTO_AES_NIST_GCM_16, + .mac = CRYPTO_AES_192_NIST_GMAC, .type = T_GCM, + .evp_cipher = EVP_aes_192_gcm }, + { .name = "aes-gcm256", .cipher = CRYPTO_AES_NIST_GCM_16, + .mac = CRYPTO_AES_256_NIST_GMAC, .type = T_GCM, + .evp_cipher = EVP_aes_256_gcm }, +}; + +static bool verbose; +static int crid; +static size_t aad_len; + +static void +usage(void) +{ + fprintf(stderr, + "usage: cryptocheck [-z] [-a algorithm] [-d dev] [size ...]\n"); + exit(1); +} + +static struct alg * +find_alg(const char *name) +{ + u_int i; + + for (i = 0; i < nitems(algs); i++) + if (strcasecmp(algs[i].name, name) == 0) + return (&algs[i]); + return (NULL); +} + +static struct alg * +build_authenc(struct alg *cipher, struct alg *hmac) +{ + static struct alg authenc; + char *name; + + assert(cipher->type == T_BLKCIPHER); + assert(hmac->type == T_HMAC); + memset(&authenc, 0, sizeof(authenc)); + asprintf(&name, "%s+%s", cipher->name, hmac->name); + authenc.name = name; + authenc.cipher = cipher->cipher; + authenc.mac = hmac->mac; + authenc.type = T_AUTHENC; + authenc.evp_cipher = cipher->evp_cipher; + authenc.evp_md = hmac->evp_md; + return (&authenc); +} + +static struct alg * +build_authenc_name(const char *name) +{ + struct alg *cipher, *hmac; + const char *hmac_name; + char *cp, *cipher_name; + + cp = strchr(name, '+'); + cipher_name = strndup(name, cp - name); + hmac_name = cp + 1; + cipher = find_alg(cipher_name); + free(cipher_name); + if (cipher == NULL) + errx(1, "Invalid cipher %s", cipher_name); + hmac = find_alg(hmac_name); + if (hmac == NULL) + errx(1, "Invalid hash %s", hmac_name); + return (build_authenc(cipher, hmac)); +} + +static int +devcrypto(void) +{ + static int fd = -1; + + if (fd < 0) { + fd = open("/dev/crypto", O_RDWR | O_CLOEXEC, 0); + if (fd < 0) + err(1, "/dev/crypto"); + } + return (fd); +} + +static int +crlookup(const char *devname) +{ + struct crypt_find_op find; + + if (strncmp(devname, "soft", 4) == 0) + return CRYPTO_FLAG_SOFTWARE; + + find.crid = -1; + strlcpy(find.name, devname, sizeof(find.name)); + if (ioctl(devcrypto(), CIOCFINDDEV, &find) == -1) + err(1, "ioctl(CIOCFINDDEV)"); + return (find.crid); +} + +const char * +crfind(int crid) +{ + static struct crypt_find_op find; + + if (crid == CRYPTO_FLAG_SOFTWARE) + return ("soft"); + else if (crid == CRYPTO_FLAG_HARDWARE) + return ("unknown"); + + bzero(&find, sizeof(find)); + find.crid = crid; + if (ioctl(devcrypto(), CRIOFINDDEV, &find) == -1) + err(1, "ioctl(CIOCFINDDEV): crid %d", crid); + return (find.name); +} + +static int +crget(void) +{ + int fd; + + if (ioctl(devcrypto(), CRIOGET, &fd) == -1) + err(1, "ioctl(CRIOGET)"); + if (fcntl(fd, F_SETFD, 1) == -1) + err(1, "fcntl(F_SETFD) (crget)"); + return fd; +} + +static char +rdigit(void) +{ + const char a[] = { + 0x10,0x54,0x11,0x48,0x45,0x12,0x4f,0x13,0x49,0x53,0x14,0x41, + 0x15,0x16,0x4e,0x55,0x54,0x17,0x18,0x4a,0x4f,0x42,0x19,0x01 + }; + return 0x20+a[random()%nitems(a)]; +} + +static char * +alloc_buffer(size_t len) +{ + char *buf; + size_t i; + + buf = malloc(len); + for (i = 0; i < len; i++) + buf[i] = rdigit(); + return (buf); +} + +static char * +generate_iv(size_t len, struct alg *alg) +{ + char *iv; + + iv = alloc_buffer(len); + switch (alg->cipher) { + case CRYPTO_AES_ICM: + /* Clear the low 32 bits of the IV to hold the counter. */ + iv[len - 4] = 0; + iv[len - 3] = 0; + iv[len - 2] = 0; + iv[len - 1] = 0; + break; + case CRYPTO_AES_XTS: + /* + * Clear the low 64-bits to only store a 64-bit block + * number. + */ + iv[len - 8] = 0; + iv[len - 7] = 0; + iv[len - 6] = 0; + iv[len - 5] = 0; + iv[len - 4] = 0; + iv[len - 3] = 0; + iv[len - 2] = 0; + iv[len - 1] = 0; + break; + } + return (iv); +} + +static bool +ocf_hmac(struct alg *alg, const char *buffer, size_t size, const char *key, + size_t key_len, char *digest, int *cridp) +{ + struct session2_op sop; + struct crypt_op cop; + int fd; + + memset(&sop, 0, sizeof(sop)); + memset(&cop, 0, sizeof(cop)); + sop.crid = crid; + sop.mackeylen = key_len; + sop.mackey = (char *)key; + sop.mac = alg->mac; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s HMAC not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + cop.ses = sop.ses; + cop.op = 0; + cop.len = size; + cop.src = (char *)buffer; + cop.dst = NULL; + cop.mac = digest; + cop.iv = NULL; + + if (ioctl(fd, CIOCCRYPT, &cop) < 0) { + warn("cryptodev %s (%zu) HMAC failed for device %s", alg->name, + size, crfind(crid)); + close(fd); + return (false); + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +static void +run_hmac_test(struct alg *alg, size_t size) +{ + const EVP_MD *md; + char *key, *buffer; + u_int key_len, digest_len; + int crid; + char control_digest[EVP_MAX_MD_SIZE], test_digest[EVP_MAX_MD_SIZE]; + + memset(control_digest, 0x3c, sizeof(control_digest)); + memset(test_digest, 0x3c, sizeof(test_digest)); + + md = alg->evp_md(); + key_len = EVP_MD_size(md); + assert(EVP_MD_size(md) <= sizeof(control_digest)); + + key = alloc_buffer(key_len); + buffer = alloc_buffer(size); + + /* OpenSSL HMAC. */ + digest_len = sizeof(control_digest); + if (HMAC(md, key, key_len, (u_char *)buffer, size, + (u_char *)control_digest, &digest_len) == NULL) + errx(1, "OpenSSL %s (%zu) HMAC failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + + /* cryptodev HMAC. */ + if (!ocf_hmac(alg, buffer, size, key, key_len, test_digest, &crid)) + goto out; + if (memcmp(control_digest, test_digest, sizeof(control_digest)) != 0) { + if (memcmp(control_digest, test_digest, EVP_MD_size(md)) == 0) + printf("%s (%zu) mismatch in trailer:\n", + alg->name, size); + else + printf("%s (%zu) mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(control_digest, sizeof(control_digest), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_digest, sizeof(test_digest), NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(buffer); + free(key); +} + +static void +openssl_cipher(struct alg *alg, const EVP_CIPHER *cipher, const char *key, + const char *iv, const char *input, char *output, size_t size, int enc) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) + errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_CipherInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)iv, enc) != 1) + errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (EVP_CipherUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) + errx(1, "OpenSSL %s (%zu) cipher update failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total = outl; + if (EVP_CipherFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) + errx(1, "OpenSSL %s (%zu) cipher final failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total += outl; + if (total != size) + errx(1, "OpenSSL %s (%zu) cipher size mismatch: %d", alg->name, + size, total); + EVP_CIPHER_CTX_free(ctx); +} + +static bool +ocf_cipher(struct alg *alg, const char *key, size_t key_len, + const char *iv, const char *input, char *output, size_t size, int enc, + int *cridp) +{ + struct session2_op sop; + struct crypt_op cop; + int fd; + + memset(&sop, 0, sizeof(sop)); + memset(&cop, 0, sizeof(cop)); + sop.crid = crid; + sop.keylen = key_len; + sop.key = (char *)key; + sop.cipher = alg->cipher; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s block cipher not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + cop.ses = sop.ses; + cop.op = enc ? COP_ENCRYPT : COP_DECRYPT; + cop.len = size; + cop.src = (char *)input; + cop.dst = output; + cop.mac = NULL; + cop.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPT, &cop) < 0) { + warn("cryptodev %s (%zu) block cipher failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +static void +run_blkcipher_test(struct alg *alg, size_t size) +{ + const EVP_CIPHER *cipher; + char *buffer, *cleartext, *ciphertext; + char *iv, *key; + u_int iv_len, key_len; + int crid; + + cipher = alg->evp_cipher(); + if (size % EVP_CIPHER_block_size(cipher) != 0) { + if (verbose) + printf( + "%s (%zu): invalid buffer size (block size %d)\n", + alg->name, size, EVP_CIPHER_block_size(cipher)); + return; + } + + key_len = EVP_CIPHER_key_length(cipher); + iv_len = EVP_CIPHER_iv_length(cipher); + + key = alloc_buffer(key_len); + iv = generate_iv(iv_len, alg); + cleartext = alloc_buffer(size); + buffer = malloc(size); + ciphertext = malloc(size); + + /* OpenSSL cipher. */ + openssl_cipher(alg, cipher, key, iv, cleartext, ciphertext, size, 1); + if (size > 0 && memcmp(cleartext, ciphertext, size) == 0) + errx(1, "OpenSSL %s (%zu): cipher text unchanged", alg->name, + size); + openssl_cipher(alg, cipher, key, iv, ciphertext, buffer, size, 0); + if (memcmp(cleartext, buffer, size) != 0) { + printf("OpenSSL %s (%zu): cipher mismatch:", alg->name, size); + printf("original:\n"); + hexdump(cleartext, size, NULL, 0); + printf("decrypted:\n"); + hexdump(buffer, size, NULL, 0); + exit(1); + } + + /* OCF encrypt. */ + if (!ocf_cipher(alg, key, key_len, iv, cleartext, buffer, size, 1, + &crid)) + goto out; + if (memcmp(ciphertext, buffer, size) != 0) { + printf("%s (%zu) encryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(ciphertext, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer, size, NULL, 0); + goto out; + } + + /* OCF decrypt. */ + if (!ocf_cipher(alg, key, key_len, iv, ciphertext, buffer, size, 0, + &crid)) + goto out; + if (memcmp(cleartext, buffer, size) != 0) { + printf("%s (%zu) decryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(cleartext, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer, size, NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(ciphertext); + free(buffer); + free(cleartext); + free(iv); + free(key); +} + +static bool +ocf_authenc(struct alg *alg, const char *cipher_key, size_t cipher_key_len, + const char *iv, size_t iv_len, const char *auth_key, size_t auth_key_len, + const char *aad, size_t aad_len, const char *input, char *output, + size_t size, char *digest, int enc, int *cridp) +{ + struct session2_op sop; + int fd; + + memset(&sop, 0, sizeof(sop)); + sop.crid = crid; + sop.keylen = cipher_key_len; + sop.key = (char *)cipher_key; + sop.cipher = alg->cipher; + sop.mackeylen = auth_key_len; + sop.mackey = (char *)auth_key; + sop.mac = alg->mac; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s AUTHENC not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + if (aad_len != 0) { + struct crypt_aead caead; + + memset(&caead, 0, sizeof(caead)); + caead.ses = sop.ses; + caead.op = enc ? COP_ENCRYPT : COP_DECRYPT; + caead.flags = enc ? COP_F_CIPHER_FIRST : 0; + caead.len = size; + caead.aadlen = aad_len; + caead.ivlen = iv_len; + caead.src = (char *)input; + caead.dst = output; + caead.aad = (char *)aad; + caead.tag = digest; + caead.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPTAEAD, &caead) < 0) { + warn("cryptodev %s (%zu) failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + } else { + struct crypt_op cop; + + memset(&cop, 0, sizeof(cop)); + cop.ses = sop.ses; + cop.op = enc ? COP_ENCRYPT : COP_DECRYPT; + cop.flags = enc ? COP_F_CIPHER_FIRST : 0; + cop.len = size; + cop.src = (char *)input; + cop.dst = output; + cop.mac = digest; + cop.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPT, &cop) < 0) { + warn("cryptodev %s (%zu) AUTHENC failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +static void +run_authenc_test(struct alg *alg, size_t size) +{ + const EVP_CIPHER *cipher; + const EVP_MD *md; + char *aad, *buffer, *cleartext, *ciphertext; + char *iv, *auth_key, *cipher_key; + u_int iv_len, auth_key_len, cipher_key_len, digest_len; + int crid; + char control_digest[EVP_MAX_MD_SIZE], test_digest[EVP_MAX_MD_SIZE]; + + cipher = alg->evp_cipher(); + if (size % EVP_CIPHER_block_size(cipher) != 0) { + if (verbose) + printf( + "%s (%zu): invalid buffer size (block size %d)\n", + alg->name, size, EVP_CIPHER_block_size(cipher)); + return; + } + + memset(control_digest, 0x3c, sizeof(control_digest)); + memset(test_digest, 0x3c, sizeof(test_digest)); + + md = alg->evp_md(); + + cipher_key_len = EVP_CIPHER_key_length(cipher); + iv_len = EVP_CIPHER_iv_length(cipher); + auth_key_len = EVP_MD_size(md); + + cipher_key = alloc_buffer(cipher_key_len); + iv = generate_iv(iv_len, alg); + auth_key = alloc_buffer(auth_key_len); + cleartext = alloc_buffer(aad_len + size); + buffer = malloc(aad_len + size); + ciphertext = malloc(aad_len + size); + + /* OpenSSL encrypt + HMAC. */ + if (aad_len != 0) + memcpy(ciphertext, cleartext, aad_len); + openssl_cipher(alg, cipher, cipher_key, iv, cleartext + aad_len, + ciphertext + aad_len, size, 1); + if (size > 0 && memcmp(cleartext + aad_len, ciphertext + aad_len, + size) == 0) + errx(1, "OpenSSL %s (%zu): cipher text unchanged", alg->name, + size); + digest_len = sizeof(control_digest); + if (HMAC(md, auth_key, auth_key_len, (u_char *)ciphertext, + aad_len + size, (u_char *)control_digest, &digest_len) == NULL) + errx(1, "OpenSSL %s (%zu) HMAC failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + + /* OCF encrypt + HMAC. */ + if (!ocf_authenc(alg, cipher_key, cipher_key_len, iv, iv_len, auth_key, + auth_key_len, aad_len != 0 ? cleartext : NULL, aad_len, + cleartext + aad_len, buffer + aad_len, size, test_digest, 1, &crid)) + goto out; + if (memcmp(ciphertext + aad_len, buffer + aad_len, size) != 0) { + printf("%s (%zu) encryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(ciphertext + aad_len, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer + aad_len, size, NULL, 0); + goto out; + } + if (memcmp(control_digest, test_digest, sizeof(control_digest)) != 0) { + if (memcmp(control_digest, test_digest, EVP_MD_size(md)) == 0) + printf("%s (%zu) enc hash mismatch in trailer:\n", + alg->name, size); + else + printf("%s (%zu) enc hash mismatch:\n", alg->name, + size); + printf("control:\n"); + hexdump(control_digest, sizeof(control_digest), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_digest, sizeof(test_digest), NULL, 0); + goto out; + } + + /* OCF HMAC + decrypt. */ + memset(test_digest, 0x3c, sizeof(test_digest)); + if (!ocf_authenc(alg, cipher_key, cipher_key_len, iv, iv_len, auth_key, + auth_key_len, aad_len != 0 ? ciphertext : NULL, aad_len, + ciphertext + aad_len, buffer + aad_len, size, test_digest, 0, + &crid)) + goto out; + if (memcmp(control_digest, test_digest, sizeof(control_digest)) != 0) { + if (memcmp(control_digest, test_digest, EVP_MD_size(md)) == 0) + printf("%s (%zu) dec hash mismatch in trailer:\n", + alg->name, size); + else + printf("%s (%zu) dec hash mismatch:\n", alg->name, + size); + printf("control:\n"); + hexdump(control_digest, sizeof(control_digest), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_digest, sizeof(test_digest), NULL, 0); + goto out; + } + if (memcmp(cleartext + aad_len, buffer + aad_len, size) != 0) { + printf("%s (%zu) decryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(cleartext, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer, size, NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(ciphertext); + free(buffer); + free(cleartext); + free(auth_key); + free(iv); + free(cipher_key); +} + +static void +openssl_gcm_encrypt(struct alg *alg, const EVP_CIPHER *cipher, const char *key, + const char *iv, const char *aad, size_t aad_len, const char *input, + char *output, size_t size, char *tag) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) + errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_EncryptInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)iv) != 1) + errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (aad != NULL) { + if (EVP_EncryptUpdate(ctx, NULL, &outl, (const u_char *)aad, + aad_len) != 1) + errx(1, "OpenSSL %s (%zu) aad update failed: %s", + alg->name, size, + ERR_error_string(ERR_get_error(), NULL)); + } + if (EVP_EncryptUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) + errx(1, "OpenSSL %s (%zu) encrypt update failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total = outl; + if (EVP_EncryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) + errx(1, "OpenSSL %s (%zu) encrypt final failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total += outl; + if (total != size) + errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, + size, total); + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, AES_GMAC_HASH_LEN, + tag) != 1) + errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); +} + +static bool +ocf_gcm(struct alg *alg, const char *key, size_t key_len, const char *iv, + size_t iv_len, const char *aad, size_t aad_len, const char *input, + char *output, size_t size, char *tag, int enc, int *cridp) +{ + struct session2_op sop; + struct crypt_aead caead; + int fd; + + memset(&sop, 0, sizeof(sop)); + memset(&caead, 0, sizeof(caead)); + sop.crid = crid; + sop.keylen = key_len; + sop.key = (char *)key; + sop.cipher = alg->cipher; + sop.mackeylen = key_len; + sop.mackey = (char *)key; + sop.mac = alg->mac; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + caead.ses = sop.ses; + caead.op = enc ? COP_ENCRYPT : COP_DECRYPT; + caead.len = size; + caead.aadlen = aad_len; + caead.ivlen = iv_len; + caead.src = (char *)input; + caead.dst = output; + caead.aad = (char *)aad; + caead.tag = tag; + caead.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPTAEAD, &caead) < 0) { + warn("cryptodev %s (%zu) failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +#ifdef notused +static bool +openssl_gcm_decrypt(struct alg *alg, const EVP_CIPHER *cipher, const char *key, + const char *iv, const char *aad, size_t aad_len, const char *input, + char *output, size_t size, char *tag) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + bool valid; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) + errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_DecryptInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)iv) != 1) + errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (aad != NULL) { + if (EVP_DecryptUpdate(ctx, NULL, &outl, (const u_char *)aad, + aad_len) != 1) + errx(1, "OpenSSL %s (%zu) aad update failed: %s", + alg->name, size, + ERR_error_string(ERR_get_error(), NULL)); + } + if (EVP_DecryptUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) + errx(1, "OpenSSL %s (%zu) decrypt update failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total = outl; + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, AES_GMAC_HASH_LEN, + tag) != 1) + errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + valid = (EVP_DecryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1); + total += outl; + if (total != size) + errx(1, "OpenSSL %s (%zu) decrypt size mismatch: %d", alg->name, + size, total); + EVP_CIPHER_CTX_free(ctx); + return (valid); +} +#endif + +static void +run_gcm_test(struct alg *alg, size_t size) +{ + const EVP_CIPHER *cipher; + char *aad, *buffer, *cleartext, *ciphertext; + char *iv, *key; + u_int iv_len, key_len; + int crid; + char control_tag[AES_GMAC_HASH_LEN], test_tag[AES_GMAC_HASH_LEN]; + + cipher = alg->evp_cipher(); + if (size % EVP_CIPHER_block_size(cipher) != 0) { + if (verbose) + printf( + "%s (%zu): invalid buffer size (block size %d)\n", + alg->name, size, EVP_CIPHER_block_size(cipher)); + return; + } + + memset(control_tag, 0x3c, sizeof(control_tag)); + memset(test_tag, 0x3c, sizeof(test_tag)); + + key_len = EVP_CIPHER_key_length(cipher); + iv_len = EVP_CIPHER_iv_length(cipher); + + key = alloc_buffer(key_len); + iv = generate_iv(iv_len, alg); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Mar 23 04:38:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4659BF6B07C; Fri, 23 Mar 2018 04:38:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 7244A7F9D7; Fri, 23 Mar 2018 04:38:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 29B68D4AB33; Fri, 23 Mar 2018 15:38:09 +1100 (AEDT) Date: Fri, 23 Mar 2018 15:38:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message-ID: <20180323150709.H968@besplex.bde.org> References: <201803230059.w2N0x2fw077291@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=SJCHQCfh3hcGHLzz5TgA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 04:38:14 -0000 On Thu, 22 Mar 2018, Jeff Roberson wrote: > On Thu, 22 Mar 2018, Cy Schubert wrote: > >> It broke i386 too. > > I just did > TARGET_ARCH=i386 make buildworld > TARGET_ARCH=i386 make buildkernel > > This worked for me? >> >> Index: sys/vm/vm_reserv.c >> =================================================================== >> --- sys/vm/vm_reserv.c (revision 331399) >> +++ sys/vm/vm_reserv.c (working copy) >> @@ -45,8 +45,6 @@ >> >> #include >> #include >> -#include >> -#include >> #include >> #include >> #include >> @@ -55,6 +53,8 @@ >> #include >> #include >> #include >> +#include >> +#include >> #include >> #include >> >> This is because sys/i386/include/machine.h uses critical_enter() and >> critical_exit() which are defined in sys/systm.h. Wrong fix. I see you committed this. Now there are more bugs to fix. is a prerequisite for all kernel headers except , since it defines and declares things like KASSERT() and critical_enter() which might be used in other headers (except sys/param.h and its standard pollution). Sometimes sys/systm.h is included as undocumented namespace pollution in headers that are accidentally included before the (other) ones that use KASSERT(), etc. The headers that have this bug have it to work around bugs in .c files like the one above. It is more usual to have this bug by not including sys/systm.h at all than to have it by including it in a wrong order. Sorting it alphabetically almost always gives a wrong order. It must be included after sys/param.h and that must be included first. It is a related bug to include only sys/types.h and not sys/param.h. This requires chumminess with the current implementation and all future implementations. sys/param.h provides certain undocumented but standard namespace pollution which might vary with the implementation, as necessary to satisfy some of the pollution requirements of all current and future implementations of other headers. (The pollution should be monotonically decreasing but it was only that for a few years about 20 years ago when I worked on fixing it.) .c files that include sys/types.h instead of sys/param.h have do some subset of the includes in sys/param.h. Since nothing is documented and the subset might depend on the arch and user options, it is hard to know the minimal subset. .c files that include sys/types.h tend to have lots of other #include bugs like not including sys/systm.h. Again it is hard to know the minimal replacement for sys/systm.h and its undocumented but standard pollution. It is a style bug to include both sys/types.h and sys/param.h. style(9) even explicitly forbids including both. It is a larger style bug to include the standard pollution in sys/systm.h direction. This includes especially and . These should be considered as being implemented in sys/systm.h, with the headers for them only and implementation detail. Similarly for . >> It built nicely on my amd64's though. amd64 apparently has more namespace pollution which breaks detection of the bug. But I couldn't find where it is. sys/systm.h isn't included nested in any amd64 or x86 headers. Apparently some amd64 option gives it. Bruce From owner-svn-src-all@freebsd.org Fri Mar 23 05:37:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CDC8F6EB74; Fri, 23 Mar 2018 05:37: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FF37817C2; Fri, 23 Mar 2018 05:37: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 369D51BBA1; Fri, 23 Mar 2018 05:37: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 w2N5bI9W071282; Fri, 23 Mar 2018 05:37:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N5bI6h071280; Fri, 23 Mar 2018 05:37:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803230537.w2N5bI6h071280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 23 Mar 2018 05:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331418 - head/tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tools/tools/crypto X-SVN-Commit-Revision: 331418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 05:37:19 -0000 Author: cem Date: Fri Mar 23 05:37:18 2018 New Revision: 331418 URL: https://svnweb.freebsd.org/changeset/base/331418 Log: cryptocheck: Add support for Blake2{B,S} hashes Since they are not yet present in the version of openssl in base, this will require installing the ports openssl. Sponsored by: Dell EMC Isilon Modified: head/tools/tools/crypto/Makefile head/tools/tools/crypto/cryptocheck.c Modified: head/tools/tools/crypto/Makefile ============================================================================== --- head/tools/tools/crypto/Makefile Fri Mar 23 04:31:19 2018 (r331417) +++ head/tools/tools/crypto/Makefile Fri Mar 23 05:37:18 2018 (r331418) @@ -32,7 +32,10 @@ MAN= BINDIR?= /usr/local/bin # cryptocheck: test symmetric crypto functions -LIBADD.cryptocheck+= crypto ssl util +# Use openssl from ports for Blake2 algorithms +CFLAGS.cryptocheck.c+= $$(pkg-config --cflags openssl) +LDFLAGS.cryptocheck+= $$(pkg-config --libs openssl) +LIBADD.cryptocheck+= util # cryptokeytest: test asymmetric crypto functions LIBADD.cryptokeytest+= crypto Modified: head/tools/tools/crypto/cryptocheck.c ============================================================================== --- head/tools/tools/crypto/cryptocheck.c Fri Mar 23 04:31:19 2018 (r331417) +++ head/tools/tools/crypto/cryptocheck.c Fri Mar 23 05:37:18 2018 (r331418) @@ -59,6 +59,8 @@ * sha256 256-bit sha2 hmac * sha384 384-bit sha2 hmac * sha512 512-bit sha2 hmac + * blake2b Blake2-B + * blake2s Blake2-S * * Block Ciphers: * aes-cbc 128-bit aes cbc @@ -115,6 +117,10 @@ struct alg { .evp_md = EVP_sha384 }, { .name = "sha512", .mac = CRYPTO_SHA2_512_HMAC, .type = T_HMAC, .evp_md = EVP_sha512 }, + { .name = "blake2b", .mac = CRYPTO_BLAKE2B, .type = T_HMAC, + .evp_md = EVP_blake2b512 }, + { .name = "blake2s", .mac = CRYPTO_BLAKE2S, .type = T_HMAC, + .evp_md = EVP_blake2s256 }, { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, .evp_cipher = EVP_aes_128_cbc }, { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, From owner-svn-src-all@freebsd.org Fri Mar 23 06:15:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4FACF4A49E; Fri, 23 Mar 2018 06:15:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1793E8292E; Fri, 23 Mar 2018 06:15:35 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zFz9ehJb4U5pnzFzAemn2j; Fri, 23 Mar 2018 00:15:34 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=JzwRw_2MAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=KOz5PoXyROM3pLaX7PQA:9 a=CjuIK1q_8ugA:10 a=_bBvcJC8wCc67rcU61zu:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 5682298; Thu, 22 Mar 2018 23:15:31 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N6FUOW040644; Thu, 22 Mar 2018 23:15:30 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N6FTMJ040628; Thu, 22 Mar 2018 23:15:29 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230615.w2N6FTMJ040628@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Bruce Evans cc: Jeff Roberson , Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Bruce Evans of "Fri, 23 Mar 2018 15:38:08 +1100." <20180323150709.H968@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 23:15:29 -0700 X-CMAE-Envelope: MS4wfJs+r7omdWf+Otrml2Q8nLd1Np0GcJ6obUh1atf5U4xHOZ4O1fxijDwi5YJHtTtHfKdaT1R1dg7YwTOCpGLVw49kjLRNw3uI3p37w7QVWi/j1qWszdHN x/MqikPHVA19WLRXfMi/pFY3nVkq/z00F7oc6WS2VjALHYIv20+3MEkxBIuljnooc8+8wsu+GetHnDHbLsTSdJo88o9DfMV7RfyvbvoCxKXZ9F6uDKZZGs98 6pEyS5hGyDEa+/JxKhDRhiqK+qEgrINjoujrzoVplowq0z1kgQ5J5VZmKkmtsLKKVLa8JdkfyDu4SkeOkS1r62LShygpDPDpKFlGui0871ffBmKM4i3mDaU7 d8S21n7oBg4IezwbxLQatJxwoG2v1w== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 06:15:37 -0000 In message <20180323150709.H968@besplex.bde.org>, Bruce Evans writes: > On Thu, 22 Mar 2018, Jeff Roberson wrote: > > > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > >> It broke i386 too. > > > > I just did > > TARGET_ARCH=i386 make buildworld > > TARGET_ARCH=i386 make buildkernel > > > > This worked for me? > >> > >> Index: sys/vm/vm_reserv.c > >> =================================================================== > >> --- sys/vm/vm_reserv.c (revision 331399) > >> +++ sys/vm/vm_reserv.c (working copy) > >> @@ -45,8 +45,6 @@ > >> > >> #include > >> #include > >> -#include > >> -#include > >> #include > >> #include > >> #include > >> @@ -55,6 +53,8 @@ > >> #include > >> #include > >> #include > >> +#include > >> +#include > >> #include > >> #include > >> > >> This is because sys/i386/include/machine.h uses critical_enter() and > >> critical_exit() which are defined in sys/systm.h. > > Wrong fix. I see you committed this. Now there are more bugs to fix. > > is a prerequisite for all kernel headers except > , since it defines and declares things like KASSERT() and > critical_enter() which might be used in other headers (except > sys/param.h and its standard pollution). Sometimes sys/systm.h is > included as undocumented namespace pollution in headers that are > accidentally included before the (other) ones that use KASSERT(), etc. > The headers that have this bug have it to work around bugs in .c files > like the one above. It is more usual to have this bug by not including > sys/systm.h at all than to have it by including it in a wrong order. > Sorting it alphabetically almost always gives a wrong order. It must > be included after sys/param.h and that must be included first. Agreed on alphabetic sorting. > > It is a related bug to include only sys/types.h and not sys/param.h. > This requires chumminess with the current implementation and all > future implementations. sys/param.h provides certain undocumented > but standard namespace pollution which might vary with the implementation, > as necessary to satisfy some of the pollution requirements of all current > and future implementations of other headers. (The pollution should be > monotonically decreasing but it was only that for a few years about 20 > years ago when I worked on fixing it.) .c files that include sys/types.h > instead of sys/param.h have do some subset of the includes in sys/param.h. > Since nothing is documented and the subset might depend on the arch and > user options, it is hard to know the minimal subset. That's not the case here. sys/types.h is not included in this file but point taken. > > .c files that include sys/types.h tend to have lots of other #include > bugs like not including sys/systm.h. Again it is hard to know the > minimal replacement for sys/systm.h and its undocumented but standard > pollution. It is a style bug to include both sys/types.h and sys/param.h. > style(9) even explicitly forbids including both. It is a larger style > bug to include the standard pollution in sys/systm.h direction. This > includes especially and . These > should be considered as being implemented in sys/systm.h, with the > headers for them only and implementation detail. Similarly > for . > > >> It built nicely on my amd64's though. > > amd64 apparently has more namespace pollution which breaks detection > of the bug. But I couldn't find where it is. sys/systm.h isn't included > nested in any amd64 or x86 headers. Apparently some amd64 option gives > it. The reason is amd64 doesn't use critical_enter() and critical_exit() because counter_enter() and counter_exit() are NOPs. The reason they are NOPs in amd64 and not in i386 is not all i386 processors support cmpxchg8b. It is only then that the critical_*() functions are called. > > Bruce I can create a phabricator revision to clean this instance up and move sys/systm.h just after sys/param.h. I'm just about to head out of town so I'll create it after I get back, after April 4. Thank you for your input Bruce. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Fri Mar 23 07:37:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4CA6F4F3C2; Fri, 23 Mar 2018 07:37:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF8484D6A; Fri, 23 Mar 2018 07:37:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x22b.google.com with SMTP id t6so1758436wmt.5; Fri, 23 Mar 2018 00:37:33 -0700 (PDT) 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=qPb5JPEHcIzfrjTldtGEyZlKTx8KOyU/v9hGdwJYogc=; b=OjLCiPKINHHDl3ncRFBGtsliRXe2HLKFW8iyoTgYgLnP/1pVbLS5jOSvlchKrkDfrQ DjCyDs/w7gk7d49ZQZJRkLD9QFfgnGJTGqHAKFh8kNjeSmJc49c5P19XEhH3uZUEpqLm FO8Evs1PXWZ3zrpWqL/eZZ4RE4GmpDfFZS72fiJE8E3GuhnCXlfnmV8+bENhFFlBUl5R 7dJhccVlh0yIpyELCU8WIm0Ztk9zI8vbwMWqWRf9qEm23DTdDXwMYRrhnMvWyATNC6Qh ix2ExNakAN3H5wFalHZzsQrCmeXiskIePFZ9zIqzTWizOcogqAkeM4RaiG6tGf7kWV2c XuQA== 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=qPb5JPEHcIzfrjTldtGEyZlKTx8KOyU/v9hGdwJYogc=; b=eqv+gJToSr9u+7vj2R+IBSJLwY4/J3rJaXvatfJ4FWrPJARSwcStY+dcRA0xt+1t8Y yP3WjF+a2H6ZNsPyYUmGQzdsywvdfSiMGkDS7wvEmTknMu0jTHtX/7bNGGd9iM2LnmXi erFlqR6pgJH4qoNG4Gwhsc4kPXv+aKSWD/sD+w/W2lWpgndQElI2WT0iauip4yv8dnkV DAPqaLfKWrQMBuhm8RxNbL1qM4PxiFyKT7rJ11jaDEdsqkJ9hi0EVXCrLPo0xN2LiueR iBjpWT1mUn4F4eDbBXmfVK0XufG60fKoUiPudrTXJMaXNKM/c/lgWSKv17Tt+3dZC7HP yS3w== X-Gm-Message-State: AElRT7HjtMkVMFhYHagKb5BW4OwyFjNv/ob2YgD5F4Fe9bnGt40ADPpz EBBTNTHE28ANiBkRfMlqc1NM6ghL56KUlAcxFvV16w== X-Google-Smtp-Source: AG47ELvJenWRuA3xX9d3+Zr/Y+Yz7dmzUct5JCElbbtrs7EsNtVUFALSGDKiC6Rve0PA/OJkxCbTU3ckCjYReknmLTo= X-Received: by 10.28.105.19 with SMTP id e19mr8007897wmc.3.1521790649624; Fri, 23 Mar 2018 00:37:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.4.12 with HTTP; Fri, 23 Mar 2018 00:37:28 -0700 (PDT) In-Reply-To: <201802071859.w17IxtxX060804@repo.freebsd.org> References: <201802071859.w17IxtxX060804@repo.freebsd.org> From: Adrian Chadd Date: Fri, 23 Mar 2018 00:37:28 -0700 Message-ID: Subject: Re: svn commit: r328988 - in head/sys: conf modules/ipfw netinet netpfil/ipfw To: "Andrey V. Elsukov" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 07:37:34 -0000 Hi! It looks like this broke on mips32. I posted in -net on this. In addition i can't even build the concurrencykit regression suite from github. It just plainly fails to build, so I can't even attempt to cross compile it for mips to test things. Did you test this on any platform besides 64 bit intel? Thanks! -adrian On 7 February 2018 at 10:59, Andrey V. Elsukov wrote: > Author: ae > Date: Wed Feb 7 18:59:54 2018 > New Revision: 328988 > URL: https://svnweb.freebsd.org/changeset/base/328988 > > Log: > Rework ipfw dynamic states implementation to be lockless on fast path. > > o added struct ipfw_dyn_info that keeps all needed for ipfw_chk and > for dynamic states implementation information; > o added DYN_LOOKUP_NEEDED() macro that can be used to determine the > need of new lookup of dynamic states; > o ipfw_dyn_rule now becomes obsolete. Currently it used to pass > information from kernel to userland only. > o IPv4 and IPv6 states now described by different structures > dyn_ipv4_state and dyn_ipv6_state; > o IPv6 scope zones support is added; > o ipfw(4) now depends from Concurrency Kit; > o states are linked with "entry" field using CK_SLIST. This allows > lockless lookup and protected by mutex modifications. > o the "expired" SLIST field is used for states expiring. > o struct dyn_data is used to keep generic information for both IPv4 > and IPv6; > o struct dyn_parent is used to keep O_LIMIT_PARENT information; > o IPv4 and IPv6 states are stored in different hash tables; > o O_LIMIT_PARENT states now are kept separately from O_LIMIT and > O_KEEP_STATE states; > o per-cpu dyn_hp pointers are used to implement hazard pointers and they > prevent freeing states that are locklessly used by lookup threads; > o mutexes to protect modification of lists in hash tables now kept in > separate arrays. 65535 limit to maximum number of hash buckets now > removed. > o Separate lookup and install functions added for IPv4 and IPv6 states > and for parent states. > o By default now is used Jenkinks hash function. > > Obtained from: Yandex LLC > MFC after: 42 days > Sponsored by: Yandex LLC > Differential Revision: https://reviews.freebsd.org/D12685 > > Modified: > head/sys/conf/files > head/sys/modules/ipfw/Makefile > head/sys/netinet/ip_fw.h > head/sys/netpfil/ipfw/ip_fw2.c > head/sys/netpfil/ipfw/ip_fw_dynamic.c > head/sys/netpfil/ipfw/ip_fw_private.h > head/sys/netpfil/ipfw/ip_fw_sockopt.c > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/conf/files Wed Feb 7 18:59:54 2018 (r328988) > @@ -4374,7 +4374,8 @@ netpfil/ipfw/ip_dn_io.c optional inet dummynet > netpfil/ipfw/ip_dn_glue.c optional inet dummynet > netpfil/ipfw/ip_fw2.c optional inet ipfirewall > netpfil/ipfw/ip_fw_bpf.c optional inet ipfirewall > -netpfil/ipfw/ip_fw_dynamic.c optional inet ipfirewall > +netpfil/ipfw/ip_fw_dynamic.c optional inet ipfirewall \ > + compile-with "${NORMAL_C} -I$S/contrib/ck/include" > netpfil/ipfw/ip_fw_eaction.c optional inet ipfirewall > netpfil/ipfw/ip_fw_log.c optional inet ipfirewall > netpfil/ipfw/ip_fw_pfil.c optional inet ipfirewall > > Modified: head/sys/modules/ipfw/Makefile > ============================================================================== > --- head/sys/modules/ipfw/Makefile Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/modules/ipfw/Makefile Wed Feb 7 18:59:54 2018 (r328988) > @@ -9,7 +9,7 @@ SRCS+= ip_fw_sockopt.c ip_fw_table.c ip_fw_table_algo. > SRCS+= ip_fw_table_value.c > SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h > > -CFLAGS+= -DIPFIREWALL > +CFLAGS+= -DIPFIREWALL -I${SRCTOP}/sys/contrib/ck/include > # > #If you want it verbose > #CFLAGS+= -DIPFIREWALL_VERBOSE > > Modified: head/sys/netinet/ip_fw.h > ============================================================================== > --- head/sys/netinet/ip_fw.h Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/netinet/ip_fw.h Wed Feb 7 18:59:54 2018 (r328988) > @@ -671,7 +671,7 @@ struct ipfw_flow_id { > uint32_t src_ip; > uint16_t dst_port; > uint16_t src_port; > - uint8_t fib; > + uint8_t fib; /* XXX: must be uint16_t */ > uint8_t proto; > uint8_t _flags; /* protocol-specific flags */ > uint8_t addr_type; /* 4=ip4, 6=ip6, 1=ether ? */ > @@ -682,6 +682,7 @@ struct ipfw_flow_id { > }; > #endif > > +#define IS_IP4_FLOW_ID(id) ((id)->addr_type == 4) > #define IS_IP6_FLOW_ID(id) ((id)->addr_type == 6) > > /* > > Modified: head/sys/netpfil/ipfw/ip_fw2.c > ============================================================================== > --- head/sys/netpfil/ipfw/ip_fw2.c Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/netpfil/ipfw/ip_fw2.c Wed Feb 7 18:59:54 2018 (r328988) > @@ -1387,8 +1387,7 @@ ipfw_chk(struct ip_fw_args *args) > * MATCH_NONE when checked and not matched (q = NULL), > * MATCH_FORWARD or MATCH_REVERSE otherwise (q != NULL) > */ > - int dyn_dir = MATCH_UNKNOWN; > - uint16_t dyn_name = 0; > + struct ipfw_dyn_info dyn_info; > struct ip_fw *q = NULL; > struct ip_fw_chain *chain = &V_layer3_chain; > > @@ -1420,6 +1419,7 @@ ipfw_chk(struct ip_fw_args *args) > proto = args->f_id.proto = 0; /* mark f_id invalid */ > /* XXX 0 is a valid proto: IP/IPv6 Hop-by-Hop Option */ > > + DYN_INFO_INIT(&dyn_info); > /* > * PULLUP_TO(len, p, T) makes sure that len + sizeof(T) is contiguous, > * then it sets p to point at the offset "len" in the mbuf. WARNING: the > @@ -2605,7 +2605,8 @@ do { \ > case O_LIMIT: > case O_KEEP_STATE: > if (ipfw_dyn_install_state(chain, f, > - (ipfw_insn_limit *)cmd, args, tablearg)) { > + (ipfw_insn_limit *)cmd, args, ulp, > + pktlen, &dyn_info, tablearg)) { > /* error or limit violation */ > retval = IP_FW_DENY; > l = 0; /* exit inner loop */ > @@ -2619,34 +2620,15 @@ do { \ > /* > * dynamic rules are checked at the first > * keep-state or check-state occurrence, > - * with the result being stored in dyn_dir > - * and dyn_name. > + * with the result being stored in dyn_info. > * The compiler introduces a PROBE_STATE > * instruction for us when we have a > * KEEP_STATE (because PROBE_STATE needs > * to be run first). > - * > - * (dyn_dir == MATCH_UNKNOWN) means this is > - * first lookup for such f_id. Do lookup. > - * > - * (dyn_dir != MATCH_UNKNOWN && > - * dyn_name != 0 && dyn_name != cmd->arg1) > - * means previous lookup didn't find dynamic > - * rule for specific state name and current > - * lookup will search rule with another state > - * name. Redo lookup. > - * > - * (dyn_dir != MATCH_UNKNOWN && dyn_name == 0) > - * means previous lookup was for `any' name > - * and it didn't find rule. No need to do > - * lookup again. > */ > - if ((dyn_dir == MATCH_UNKNOWN || > - (dyn_name != 0 && > - dyn_name != cmd->arg1)) && > - (q = ipfw_dyn_lookup_state(&args->f_id, > - ulp, pktlen, &dyn_dir, > - (dyn_name = cmd->arg1))) != NULL) { > + if (DYN_LOOKUP_NEEDED(&dyn_info, cmd) && > + (q = ipfw_dyn_lookup_state(args, ulp, > + pktlen, cmd, &dyn_info)) != NULL) { > /* > * Found dynamic entry, jump to the > * 'action' part of the parent rule > @@ -2654,13 +2636,7 @@ do { \ > * cmdlen. > */ > f = q; > - /* XXX we would like to have f_pos > - * readily accessible in the dynamic > - * rule, instead of having to > - * lookup q->rule. > - */ > - f_pos = ipfw_find_rule(chain, > - f->rulenum, f->id); > + f_pos = dyn_info.f_pos; > cmd = ACTION_PTR(f); > l = f->cmd_len - f->act_ofs; > cmdlen = 0; > @@ -2877,7 +2853,8 @@ do { \ > case O_FORWARD_IP: > if (args->eh) /* not valid on layer2 pkts */ > break; > - if (q != f || dyn_dir == MATCH_FORWARD) { > + if (q != f || > + dyn_info.direction == MATCH_FORWARD) { > struct sockaddr_in *sa; > > sa = &(((ipfw_insn_sa *)cmd)->sa); > @@ -2937,7 +2914,8 @@ do { \ > case O_FORWARD_IP6: > if (args->eh) /* not valid on layer2 pkts */ > break; > - if (q != f || dyn_dir == MATCH_FORWARD) { > + if (q != f || > + dyn_info.direction == MATCH_FORWARD) { > struct sockaddr_in6 *sin6; > > sin6 = &(((ipfw_insn_sa6 *)cmd)->sa); > @@ -3089,7 +3067,7 @@ do { \ > * @args content, and it may be > * used for new state lookup later. > */ > - dyn_dir = MATCH_UNKNOWN; > + DYN_INFO_INIT(&dyn_info); > } > break; > > > Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c > ============================================================================== > --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Wed Feb 7 18:59:54 2018 (r328988) > @@ -1,6 +1,8 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > + * Copyright (c) 2017-2018 Yandex LLC > + * Copyright (c) 2017-2018 Andrey V. Elsukov > * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa > * > * Redistribution and use in source and binary forms, with or without > @@ -28,32 +30,27 @@ > #include > __FBSDID("$FreeBSD$"); > > -#define DEB(x) > -#define DDB(x) x > - > -/* > - * Dynamic rule support for ipfw > - */ > - > -#include "opt_ipfw.h" > #include "opt_inet.h" > +#include "opt_inet6.h" > +#include "opt_ipfw.h" > #ifndef INET > #error IPFIREWALL requires INET. > #endif /* INET */ > -#include "opt_inet6.h" > > #include > #include > -#include > +#include > #include > #include > -#include > #include > +#include > +#include > #include > +#include > #include > #include > #include > -#include /* for ETHERTYPE_IP */ > +#include > #include > #include > #include > @@ -61,8 +58,9 @@ __FBSDID("$FreeBSD$"); > > #include > #include > -#include /* ip_defttl */ > +#include > #include > +#include > #include > #include > > @@ -70,6 +68,7 @@ __FBSDID("$FreeBSD$"); > #ifdef INET6 > #include > #include > +#include > #endif > > #include > @@ -79,86 +78,261 @@ __FBSDID("$FreeBSD$"); > #ifdef MAC > #include > #endif > +#include > > /* > - * Description of dynamic rules. > + * Description of dynamic states. > * > - * Dynamic rules are stored in lists accessed through a hash table > - * (ipfw_dyn_v) whose size is curr_dyn_buckets. This value can > - * be modified through the sysctl variable dyn_buckets which is > - * updated when the table becomes empty. > + * Dynamic states are stored in lists accessed through a hash tables > + * whose size is curr_dyn_buckets. This value can be modified through > + * the sysctl variable dyn_buckets. > * > - * XXX currently there is only one list, ipfw_dyn. > + * Currently there are four tables: dyn_ipv4, dyn_ipv6, dyn_ipv4_parent, > + * and dyn_ipv6_parent. > * > - * When a packet is received, its address fields are first masked > - * with the mask defined for the rule, then hashed, then matched > - * against the entries in the corresponding list. > - * Dynamic rules can be used for different purposes: > + * When a packet is received, its address fields hashed, then matched > + * against the entries in the corresponding list by addr_type. > + * Dynamic states can be used for different purposes: > * + stateful rules; > * + enforcing limits on the number of sessions; > * + in-kernel NAT (not implemented yet) > * > - * The lifetime of dynamic rules is regulated by dyn_*_lifetime, > + * The lifetime of dynamic states is regulated by dyn_*_lifetime, > * measured in seconds and depending on the flags. > * > - * The total number of dynamic rules is equal to UMA zone items count. > - * The max number of dynamic rules is dyn_max. When we reach > + * The total number of dynamic states is equal to UMA zone items count. > + * The max number of dynamic states is dyn_max. When we reach > * the maximum number of rules we do not create anymore. This is > * done to avoid consuming too much memory, but also too much > * time when searching on each packet (ideally, we should try instead > * to put a limit on the length of the list on each bucket...). > * > - * Each dynamic rule holds a pointer to the parent ipfw rule so > - * we know what action to perform. Dynamic rules are removed when > - * the parent rule is deleted. This can be changed by dyn_keep_states > - * sysctl. > + * Each state holds a pointer to the parent ipfw rule so we know what > + * action to perform. Dynamic rules are removed when the parent rule is > + * deleted. > * > * There are some limitations with dynamic rules -- we do not > * obey the 'randomized match', and we do not do multiple > * passes through the firewall. XXX check the latter!!! > */ > > -struct ipfw_dyn_bucket { > - struct mtx mtx; /* Bucket protecting lock */ > - ipfw_dyn_rule *head; /* Pointer to first rule */ > +/* By default use jenkins hash function */ > +#define IPFIREWALL_JENKINSHASH > + > +#define DYN_COUNTER_INC(d, dir, pktlen) do { \ > + (d)->pcnt_ ## dir++; \ > + (d)->bcnt_ ## dir += pktlen; \ > + } while (0) > + > +struct dyn_data { > + void *parent; /* pointer to parent rule */ > + uint32_t chain_id; /* cached ruleset id */ > + uint32_t f_pos; /* cached rule index */ > + > + uint32_t hashval; /* hash value used for hash resize */ > + uint16_t fibnum; /* fib used to send keepalives */ > + uint8_t _pad[3]; > + uint8_t set; /* parent rule set number */ > + uint16_t rulenum; /* parent rule number */ > + uint32_t ruleid; /* parent rule id */ > + > + uint32_t state; /* TCP session state and flags */ > + uint32_t ack_fwd; /* most recent ACKs in forward */ > + uint32_t ack_rev; /* and reverse direction (used */ > + /* to generate keepalives) */ > + uint32_t sync; /* synchronization time */ > + uint32_t expire; /* expire time */ > + > + uint64_t pcnt_fwd; /* bytes counter in forward */ > + uint64_t bcnt_fwd; /* packets counter in forward */ > + uint64_t pcnt_rev; /* bytes counter in reverse */ > + uint64_t bcnt_rev; /* packets counter in reverse */ > }; > > +#define DPARENT_COUNT_DEC(p) do { \ > + MPASS(p->count > 0); \ > + ck_pr_dec_32(&(p)->count); \ > +} while (0) > +#define DPARENT_COUNT_INC(p) ck_pr_inc_32(&(p)->count) > +#define DPARENT_COUNT(p) ck_pr_load_32(&(p)->count) > +struct dyn_parent { > + void *parent; /* pointer to parent rule */ > + uint32_t count; /* number of linked states */ > + uint8_t _pad; > + uint8_t set; /* parent rule set number */ > + uint16_t rulenum; /* parent rule number */ > + uint32_t ruleid; /* parent rule id */ > + uint32_t hashval; /* hash value used for hash resize */ > + uint32_t expire; /* expire time */ > +}; > + > +struct dyn_ipv4_state { > + uint8_t type; /* State type */ > + uint8_t proto; /* UL Protocol */ > + uint16_t kidx; /* named object index */ > + uint16_t sport, dport; /* ULP source and destination ports */ > + in_addr_t src, dst; /* IPv4 source and destination */ > + > + union { > + struct dyn_data *data; > + struct dyn_parent *limit; > + }; > + CK_SLIST_ENTRY(dyn_ipv4_state) entry; > + SLIST_ENTRY(dyn_ipv4_state) expired; > +}; > +CK_SLIST_HEAD(dyn_ipv4ck_slist, dyn_ipv4_state); > +static VNET_DEFINE(struct dyn_ipv4ck_slist *, dyn_ipv4); > +static VNET_DEFINE(struct dyn_ipv4ck_slist *, dyn_ipv4_parent); > + > +SLIST_HEAD(dyn_ipv4_slist, dyn_ipv4_state); > +static VNET_DEFINE(struct dyn_ipv4_slist, dyn_expired_ipv4); > +#define V_dyn_ipv4 VNET(dyn_ipv4) > +#define V_dyn_ipv4_parent VNET(dyn_ipv4_parent) > +#define V_dyn_expired_ipv4 VNET(dyn_expired_ipv4) > + > +#ifdef INET6 > +struct dyn_ipv6_state { > + uint8_t type; /* State type */ > + uint8_t proto; /* UL Protocol */ > + uint16_t kidx; /* named object index */ > + uint16_t sport, dport; /* ULP source and destination ports */ > + struct in6_addr src, dst; /* IPv6 source and destination */ > + uint32_t zoneid; /* IPv6 scope zone id */ > + union { > + struct dyn_data *data; > + struct dyn_parent *limit; > + }; > + CK_SLIST_ENTRY(dyn_ipv6_state) entry; > + SLIST_ENTRY(dyn_ipv6_state) expired; > +}; > +CK_SLIST_HEAD(dyn_ipv6ck_slist, dyn_ipv6_state); > +static VNET_DEFINE(struct dyn_ipv6ck_slist *, dyn_ipv6); > +static VNET_DEFINE(struct dyn_ipv6ck_slist *, dyn_ipv6_parent); > + > +SLIST_HEAD(dyn_ipv6_slist, dyn_ipv6_state); > +static VNET_DEFINE(struct dyn_ipv6_slist, dyn_expired_ipv6); > +#define V_dyn_ipv6 VNET(dyn_ipv6) > +#define V_dyn_ipv6_parent VNET(dyn_ipv6_parent) > +#define V_dyn_expired_ipv6 VNET(dyn_expired_ipv6) > +#endif /* INET6 */ > + > /* > - * Static variables followed by global ones > + * Per-CPU pointer indicates that specified state is currently in use > + * and must not be reclaimed by expiration callout. > */ > -static VNET_DEFINE(struct ipfw_dyn_bucket *, ipfw_dyn_v); > -static VNET_DEFINE(u_int32_t, dyn_buckets_max); > -static VNET_DEFINE(u_int32_t, curr_dyn_buckets); > -static VNET_DEFINE(struct callout, ipfw_timeout); > -#define V_ipfw_dyn_v VNET(ipfw_dyn_v) > -#define V_dyn_buckets_max VNET(dyn_buckets_max) > -#define V_curr_dyn_buckets VNET(curr_dyn_buckets) > -#define V_ipfw_timeout VNET(ipfw_timeout) > +static void **dyn_hp_cache; > +static DPCPU_DEFINE(void *, dyn_hp); > +#define DYNSTATE_GET(cpu) ck_pr_load_ptr(DPCPU_ID_PTR((cpu), dyn_hp)) > +#define DYNSTATE_PROTECT(v) ck_pr_store_ptr(DPCPU_PTR(dyn_hp), (v)) > +#define DYNSTATE_RELEASE() DYNSTATE_PROTECT(NULL) > +#define DYNSTATE_CRITICAL_ENTER() critical_enter() > +#define DYNSTATE_CRITICAL_EXIT() do { \ > + DYNSTATE_RELEASE(); \ > + critical_exit(); \ > +} while (0); > > -static VNET_DEFINE(uma_zone_t, ipfw_dyn_rule_zone); > -#define V_ipfw_dyn_rule_zone VNET(ipfw_dyn_rule_zone) > +/* > + * We keep two version numbers, one is updated when new entry added to > + * the list. Second is updated when an entry deleted from the list. > + * Versions are updated under bucket lock. > + * > + * Bucket "add" version number is used to know, that in the time between > + * state lookup (i.e. ipfw_dyn_lookup_state()) and the followed state > + * creation (i.e. ipfw_dyn_install_state()) another concurrent thread did > + * not install some state in this bucket. Using this info we can avoid > + * additional state lookup, because we are sure that we will not install > + * the state twice. > + * > + * Also doing the tracking of bucket "del" version during lookup we can > + * be sure, that state entry was not unlinked and freed in time between > + * we read the state pointer and protect it with hazard pointer. > + * > + * An entry unlinked from CK list keeps unchanged until it is freed. > + * Unlinked entries are linked into expired lists using "expired" field. > + */ > > -#define IPFW_BUCK_LOCK_INIT(b) \ > - mtx_init(&(b)->mtx, "IPFW dynamic bucket", NULL, MTX_DEF) > -#define IPFW_BUCK_LOCK_DESTROY(b) \ > - mtx_destroy(&(b)->mtx) > -#define IPFW_BUCK_LOCK(i) mtx_lock(&V_ipfw_dyn_v[(i)].mtx) > -#define IPFW_BUCK_UNLOCK(i) mtx_unlock(&V_ipfw_dyn_v[(i)].mtx) > -#define IPFW_BUCK_ASSERT(i) mtx_assert(&V_ipfw_dyn_v[(i)].mtx, MA_OWNED) > +/* > + * dyn_expire_lock is used to protect access to dyn_expired_xxx lists. > + * dyn_bucket_lock is used to get write access to lists in specific bucket. > + * Currently one dyn_bucket_lock is used for all ipv4, ipv4_parent, ipv6, > + * and ipv6_parent lists. > + */ > +static VNET_DEFINE(struct mtx, dyn_expire_lock); > +static VNET_DEFINE(struct mtx *, dyn_bucket_lock); > +#define V_dyn_expire_lock VNET(dyn_expire_lock) > +#define V_dyn_bucket_lock VNET(dyn_bucket_lock) > > +/* > + * Bucket's add/delete generation versions. > + */ > +static VNET_DEFINE(uint32_t *, dyn_ipv4_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv4_del); > +static VNET_DEFINE(uint32_t *, dyn_ipv4_parent_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv4_parent_del); > +#define V_dyn_ipv4_add VNET(dyn_ipv4_add) > +#define V_dyn_ipv4_del VNET(dyn_ipv4_del) > +#define V_dyn_ipv4_parent_add VNET(dyn_ipv4_parent_add) > +#define V_dyn_ipv4_parent_del VNET(dyn_ipv4_parent_del) > > -static VNET_DEFINE(int, dyn_keep_states); > -#define V_dyn_keep_states VNET(dyn_keep_states) > +#ifdef INET6 > +static VNET_DEFINE(uint32_t *, dyn_ipv6_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv6_del); > +static VNET_DEFINE(uint32_t *, dyn_ipv6_parent_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv6_parent_del); > +#define V_dyn_ipv6_add VNET(dyn_ipv6_add) > +#define V_dyn_ipv6_del VNET(dyn_ipv6_del) > +#define V_dyn_ipv6_parent_add VNET(dyn_ipv6_parent_add) > +#define V_dyn_ipv6_parent_del VNET(dyn_ipv6_parent_del) > +#endif /* INET6 */ > > +#define DYN_BUCKET(h, b) ((h) & (b - 1)) > +#define DYN_BUCKET_VERSION(b, v) ck_pr_load_32(&V_dyn_ ## v[(b)]) > +#define DYN_BUCKET_VERSION_BUMP(b, v) ck_pr_inc_32(&V_dyn_ ## v[(b)]) > + > +#define DYN_BUCKET_LOCK_INIT(lock, b) \ > + mtx_init(&lock[(b)], "IPFW dynamic bucket", NULL, MTX_DEF) > +#define DYN_BUCKET_LOCK_DESTROY(lock, b) mtx_destroy(&lock[(b)]) > +#define DYN_BUCKET_LOCK(b) mtx_lock(&V_dyn_bucket_lock[(b)]) > +#define DYN_BUCKET_UNLOCK(b) mtx_unlock(&V_dyn_bucket_lock[(b)]) > +#define DYN_BUCKET_ASSERT(b) mtx_assert(&V_dyn_bucket_lock[(b)], MA_OWNED) > + > +#define DYN_EXPIRED_LOCK_INIT() \ > + mtx_init(&V_dyn_expire_lock, "IPFW expired states list", NULL, MTX_DEF) > +#define DYN_EXPIRED_LOCK_DESTROY() mtx_destroy(&V_dyn_expire_lock) > +#define DYN_EXPIRED_LOCK() mtx_lock(&V_dyn_expire_lock) > +#define DYN_EXPIRED_UNLOCK() mtx_unlock(&V_dyn_expire_lock) > + > +static VNET_DEFINE(uint32_t, dyn_buckets_max); > +static VNET_DEFINE(uint32_t, curr_dyn_buckets); > +static VNET_DEFINE(struct callout, dyn_timeout); > +#define V_dyn_buckets_max VNET(dyn_buckets_max) > +#define V_curr_dyn_buckets VNET(curr_dyn_buckets) > +#define V_dyn_timeout VNET(dyn_timeout) > + > +/* Maximum length of states chain in a bucket */ > +static VNET_DEFINE(uint32_t, curr_max_length); > +#define V_curr_max_length VNET(curr_max_length) > + > +static VNET_DEFINE(uma_zone_t, dyn_data_zone); > +static VNET_DEFINE(uma_zone_t, dyn_parent_zone); > +static VNET_DEFINE(uma_zone_t, dyn_ipv4_zone); > +#ifdef INET6 > +static VNET_DEFINE(uma_zone_t, dyn_ipv6_zone); > +#define V_dyn_ipv6_zone VNET(dyn_ipv6_zone) > +#endif /* INET6 */ > +#define V_dyn_data_zone VNET(dyn_data_zone) > +#define V_dyn_parent_zone VNET(dyn_parent_zone) > +#define V_dyn_ipv4_zone VNET(dyn_ipv4_zone) > + > /* > * Timeouts for various events in handing dynamic rules. > */ > -static VNET_DEFINE(u_int32_t, dyn_ack_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_syn_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_fin_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_rst_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_udp_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_short_lifetime); > +static VNET_DEFINE(uint32_t, dyn_ack_lifetime); > +static VNET_DEFINE(uint32_t, dyn_syn_lifetime); > +static VNET_DEFINE(uint32_t, dyn_fin_lifetime); > +static VNET_DEFINE(uint32_t, dyn_rst_lifetime); > +static VNET_DEFINE(uint32_t, dyn_udp_lifetime); > +static VNET_DEFINE(uint32_t, dyn_short_lifetime); > > #define V_dyn_ack_lifetime VNET(dyn_ack_lifetime) > #define V_dyn_syn_lifetime VNET(dyn_syn_lifetime) > @@ -174,10 +348,10 @@ static VNET_DEFINE(u_int32_t, dyn_short_lifetime); > * dyn_rst_lifetime and dyn_fin_lifetime should be strictly lower > * than dyn_keepalive_period. > */ > - > -static VNET_DEFINE(u_int32_t, dyn_keepalive_interval); > -static VNET_DEFINE(u_int32_t, dyn_keepalive_period); > -static VNET_DEFINE(u_int32_t, dyn_keepalive); > +#define DYN_KEEPALIVE_MAXQ 512 > +static VNET_DEFINE(uint32_t, dyn_keepalive_interval); > +static VNET_DEFINE(uint32_t, dyn_keepalive_period); > +static VNET_DEFINE(uint32_t, dyn_keepalive); > static VNET_DEFINE(time_t, dyn_keepalive_last); > > #define V_dyn_keepalive_interval VNET(dyn_keepalive_interval) > @@ -185,113 +359,208 @@ static VNET_DEFINE(time_t, dyn_keepalive_last); > #define V_dyn_keepalive VNET(dyn_keepalive) > #define V_dyn_keepalive_last VNET(dyn_keepalive_last) > > -static VNET_DEFINE(u_int32_t, dyn_max); /* max # of dynamic rules */ > - > -#define DYN_COUNT uma_zone_get_cur(V_ipfw_dyn_rule_zone) > +static VNET_DEFINE(uint32_t, dyn_max); /* max # of dynamic states */ > +static VNET_DEFINE(uint32_t, dyn_count); /* number of states */ > +static VNET_DEFINE(uint32_t, dyn_parent_max); /* max # of parent states */ > +static VNET_DEFINE(uint32_t, dyn_parent_count); /* number of parent states */ > #define V_dyn_max VNET(dyn_max) > +#define V_dyn_count VNET(dyn_count) > +#define V_dyn_parent_max VNET(dyn_parent_max) > +#define V_dyn_parent_count VNET(dyn_parent_count) > > -/* for userspace, we emulate the uma_zone_counter with ipfw_dyn_count */ > -static int ipfw_dyn_count; /* number of objects */ > +#define DYN_COUNT_DEC(name) do { \ > + MPASS((V_ ## name) > 0); \ > + ck_pr_dec_32(&(V_ ## name)); \ > +} while (0) > +#define DYN_COUNT_INC(name) ck_pr_inc_32(&(V_ ## name)) > +#define DYN_COUNT(name) ck_pr_load_32(&(V_ ## name)) > > -#ifdef USERSPACE /* emulation of UMA object counters for userspace */ > -#define uma_zone_get_cur(x) ipfw_dyn_count > -#endif /* USERSPACE */ > +static time_t last_log; /* Log ratelimiting */ > > -static int last_log; /* Log ratelimiting */ > +/* > + * Get/set maximum number of dynamic states in given VNET instance. > + */ > +static int > +sysctl_dyn_max(SYSCTL_HANDLER_ARGS) > +{ > + uint32_t nstates; > + int error; > > -static void ipfw_dyn_tick(void *vnetx); > -static void check_dyn_rules(struct ip_fw_chain *, ipfw_range_tlv *, int, int); > -#ifdef SYSCTL_NODE > + nstates = V_dyn_max; > + error = sysctl_handle_32(oidp, &nstates, 0, req); > + /* Read operation or some error */ > + if ((error != 0) || (req->newptr == NULL)) > + return (error); > > -static int sysctl_ipfw_dyn_count(SYSCTL_HANDLER_ARGS); > -static int sysctl_ipfw_dyn_max(SYSCTL_HANDLER_ARGS); > + V_dyn_max = nstates; > + uma_zone_set_max(V_dyn_data_zone, V_dyn_max); > + return (0); > +} > > -SYSBEGIN(f2) > +static int > +sysctl_dyn_parent_max(SYSCTL_HANDLER_ARGS) > +{ > + uint32_t nstates; > + int error; > > + nstates = V_dyn_parent_max; > + error = sysctl_handle_32(oidp, &nstates, 0, req); > + /* Read operation or some error */ > + if ((error != 0) || (req->newptr == NULL)) > + return (error); > + > + V_dyn_parent_max = nstates; > + uma_zone_set_max(V_dyn_parent_zone, V_dyn_parent_max); > + return (0); > +} > + > +static int > +sysctl_dyn_buckets(SYSCTL_HANDLER_ARGS) > +{ > + uint32_t nbuckets; > + int error; > + > + nbuckets = V_dyn_buckets_max; > + error = sysctl_handle_32(oidp, &nbuckets, 0, req); > + /* Read operation or some error */ > + if ((error != 0) || (req->newptr == NULL)) > + return (error); > + > + if (nbuckets > 256) > + V_dyn_buckets_max = 1 << fls(nbuckets - 1); > + else > + return (EINVAL); > + return (0); > +} > + > SYSCTL_DECL(_net_inet_ip_fw); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_buckets, > - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_buckets_max), 0, > - "Max number of dyn. buckets"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, curr_dyn_buckets, > + > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_count, > + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(dyn_count), 0, > + "Current number of dynamic states."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_parent_count, > + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(dyn_parent_count), 0, > + "Current number of parent states. "); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, curr_dyn_buckets, > CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(curr_dyn_buckets), 0, > - "Current Number of dyn. buckets"); > -SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_count, > - CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RD, 0, 0, sysctl_ipfw_dyn_count, "IU", > - "Number of dyn. rules"); > + "Current number of buckets for states hash table."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, curr_max_length, > + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(curr_max_length), 0, > + "Current maximum length of states chains in hash buckets."); > +SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_buckets, > + CTLFLAG_VNET | CTLTYPE_U32 | CTLFLAG_RW, 0, 0, sysctl_dyn_buckets, > + "IU", "Max number of buckets for dynamic states hash table."); > SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_max, > - CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, 0, 0, sysctl_ipfw_dyn_max, "IU", > - "Max number of dyn. rules"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_ack_lifetime, > + CTLFLAG_VNET | CTLTYPE_U32 | CTLFLAG_RW, 0, 0, sysctl_dyn_max, > + "IU", "Max number of dynamic states."); > +SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_parent_max, > + CTLFLAG_VNET | CTLTYPE_U32 | CTLFLAG_RW, 0, 0, sysctl_dyn_parent_max, > + "IU", "Max number of parent dynamic states."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_ack_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_ack_lifetime), 0, > - "Lifetime of dyn. rules for acks"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_syn_lifetime, > + "Lifetime of dynamic states for TCP ACK."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_syn_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_syn_lifetime), 0, > - "Lifetime of dyn. rules for syn"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_fin_lifetime, > + "Lifetime of dynamic states for TCP SYN."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_fin_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_fin_lifetime), 0, > - "Lifetime of dyn. rules for fin"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_rst_lifetime, > + "Lifetime of dynamic states for TCP FIN."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_rst_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_rst_lifetime), 0, > - "Lifetime of dyn. rules for rst"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_udp_lifetime, > + "Lifetime of dynamic states for TCP RST."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_udp_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_udp_lifetime), 0, > - "Lifetime of dyn. rules for UDP"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_short_lifetime, > + "Lifetime of dynamic states for UDP."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_short_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_short_lifetime), 0, > - "Lifetime of dyn. rules for other situations"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_keepalive, > + "Lifetime of dynamic states for other situations."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_keepalive, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_keepalive), 0, > - "Enable keepalives for dyn. rules"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_keep_states, > - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_keep_states), 0, > - "Do not flush dynamic states on rule deletion"); > + "Enable keepalives for dynamic states."); > > -SYSEND > +#ifdef IPFIREWALL_DYNDEBUG > +#define DYN_DEBUG(fmt, ...) do { \ > + printf("%s: " fmt "\n", __func__, __VA_ARGS__); \ > +} while (0) > +#else > +#define DYN_DEBUG(fmt, ...) > +#endif /* !IPFIREWALL_DYNDEBUG */ > > -#endif /* SYSCTL_NODE */ > - > - > #ifdef INET6 > -static __inline int > -hash_packet6(const struct ipfw_flow_id *id) > -{ > - u_int32_t i; > - i = (id->dst_ip6.__u6_addr.__u6_addr32[2]) ^ > - (id->dst_ip6.__u6_addr.__u6_addr32[3]) ^ > - (id->src_ip6.__u6_addr.__u6_addr32[2]) ^ > - (id->src_ip6.__u6_addr.__u6_addr32[3]); > - return ntohl(i); > -} > -#endif > +/* Functions to work with IPv6 states */ > +static struct dyn_ipv6_state *dyn_lookup_ipv6_state( > + const struct ipfw_flow_id *, uint32_t, const void *, > + struct ipfw_dyn_info *, int); > +static int dyn_lookup_ipv6_state_locked(const struct ipfw_flow_id *, > + uint32_t, const void *, int, const void *, uint32_t, uint16_t, uint32_t, > + uint16_t); > +static struct dyn_ipv6_state *dyn_alloc_ipv6_state( > + const struct ipfw_flow_id *, uint32_t, uint16_t, uint8_t); > +static int dyn_add_ipv6_state(void *, uint32_t, uint16_t, uint8_t, > + const struct ipfw_flow_id *, uint32_t, const void *, int, uint32_t, > + struct ipfw_dyn_info *, uint16_t, uint16_t, uint8_t); > +static void dyn_export_ipv6_state(const struct dyn_ipv6_state *, > + ipfw_dyn_rule *); > > -/* > - * IMPORTANT: the hash function for dynamic rules must be commutative > - * in source and destination (ip,port), because rules are bidirectional > - * and we want to find both in the same bucket. > - */ > -static __inline int > -hash_packet(const struct ipfw_flow_id *id, int buckets) > -{ > - u_int32_t i; > +static uint32_t dyn_getscopeid(const struct ip_fw_args *); > +static void dyn_make_keepalive_ipv6(struct mbuf *, const struct in6_addr *, > + const struct in6_addr *, uint32_t, uint32_t, uint32_t, uint16_t, > + uint16_t); > +static void dyn_enqueue_keepalive_ipv6(struct mbufq *, > + const struct dyn_ipv6_state *); > +static void dyn_send_keepalive_ipv6(struct ip_fw_chain *); > > -#ifdef INET6 > - if (IS_IP6_FLOW_ID(id)) > - i = hash_packet6(id); > - else > +static struct dyn_ipv6_state *dyn_lookup_ipv6_parent( > + const struct ipfw_flow_id *, uint32_t, const void *, uint32_t, uint16_t, > + uint32_t); > +static struct dyn_ipv6_state *dyn_lookup_ipv6_parent_locked( > + const struct ipfw_flow_id *, uint32_t, const void *, uint32_t, uint16_t, > + uint32_t); > +static struct dyn_ipv6_state *dyn_add_ipv6_parent(void *, uint32_t, uint16_t, > + uint8_t, const struct ipfw_flow_id *, uint32_t, uint32_t, uint32_t, > + uint16_t); > #endif /* INET6 */ > - i = (id->dst_ip) ^ (id->src_ip); > - i ^= (id->dst_port) ^ (id->src_port); > - return (i & (buckets - 1)); > -} > > -#if 0 > -#define DYN_DEBUG(fmt, ...) do { \ > - printf("%s: " fmt "\n", __func__, __VA_ARGS__); \ > -} while (0) > -#else > -#define DYN_DEBUG(fmt, ...) > -#endif > +/* Functions to work with limit states */ > +static void *dyn_get_parent_state(const struct ipfw_flow_id *, uint32_t, > + struct ip_fw *, uint32_t, uint32_t, uint16_t); > +static struct dyn_ipv4_state *dyn_lookup_ipv4_parent( > + const struct ipfw_flow_id *, const void *, uint32_t, uint16_t, uint32_t); > +static struct dyn_ipv4_state *dyn_lookup_ipv4_parent_locked( > + const struct ipfw_flow_id *, const void *, uint32_t, uint16_t, uint32_t); > +static struct dyn_parent *dyn_alloc_parent(void *, uint32_t, uint16_t, > + uint8_t, uint32_t); > +static struct dyn_ipv4_state *dyn_add_ipv4_parent(void *, uint32_t, uint16_t, > + uint8_t, const struct ipfw_flow_id *, uint32_t, uint32_t, uint16_t); > > +static void dyn_tick(void *); > +static void dyn_expire_states(struct ip_fw_chain *, ipfw_range_tlv *); > +static void dyn_free_states(struct ip_fw_chain *); > +static void dyn_export_parent(const struct dyn_parent *, uint16_t, > + ipfw_dyn_rule *); > +static void dyn_export_data(const struct dyn_data *, uint16_t, uint8_t, > + ipfw_dyn_rule *); > +static uint32_t dyn_update_tcp_state(struct dyn_data *, > + const struct ipfw_flow_id *, const struct tcphdr *, int); > +static void dyn_update_proto_state(struct dyn_data *, > + const struct ipfw_flow_id *, const void *, int, int); > + > +/* Functions to work with IPv4 states */ > +struct dyn_ipv4_state *dyn_lookup_ipv4_state(const struct ipfw_flow_id *, > + const void *, struct ipfw_dyn_info *, int); > +static int dyn_lookup_ipv4_state_locked(const struct ipfw_flow_id *, > + const void *, int, const void *, uint32_t, uint16_t, uint32_t, uint16_t); > +static struct dyn_ipv4_state *dyn_alloc_ipv4_state( > + const struct ipfw_flow_id *, uint16_t, uint8_t); > +static int dyn_add_ipv4_state(void *, uint32_t, uint16_t, uint8_t, > + const struct ipfw_flow_id *, const void *, int, uint32_t, > + struct ipfw_dyn_info *, uint16_t, uint16_t, uint8_t); > +static void dyn_export_ipv4_state(const struct dyn_ipv4_state *, > + ipfw_dyn_rule *); > + > +/* > + * Named states support. > + */ > static char *default_state_name = "default"; > struct dyn_state_obj { > struct named_object no; > @@ -438,7 +707,6 @@ dyn_destroy(struct ip_fw_chain *ch, struct named_objec > KASSERT(no->refcnt == 1, > ("Destroying object '%s' (type %u, idx %u) with refcnt %u", > no->name, no->etlv, no->kidx, no->refcnt)); > - > DYN_DEBUG("kidx %d", no->kidx); > obj = SRV_OBJECT(ch, no->kidx); > SRV_OBJECT(ch, no->kidx) = NULL; > @@ -474,7 +742,137 @@ static struct opcode_obj_rewrite dyn_opcodes[] = { > dyn_create, dyn_destroy > }, > }; > -/** > + > +/* > + * IMPORTANT: the hash function for dynamic rules must be commutative > + * in source and destination (ip,port), because rules are bidirectional > + * and we want to find both in the same bucket. > + */ > +#ifndef IPFIREWALL_JENKINSHASH > +static __inline uint32_t > +hash_packet(const struct ipfw_flow_id *id) > +{ > + uint32_t i; > + > +#ifdef INET6 > + if (IS_IP6_FLOW_ID(id)) > + i = ntohl((id->dst_ip6.__u6_addr.__u6_addr32[2]) ^ > + (id->dst_ip6.__u6_addr.__u6_addr32[3]) ^ > + (id->src_ip6.__u6_addr.__u6_addr32[2]) ^ > + (id->src_ip6.__u6_addr.__u6_addr32[3])); > + else > +#endif /* INET6 */ > + i = (id->dst_ip) ^ (id->src_ip); > + i ^= (id->dst_port) ^ (id->src_port); > + return (i); > +} > + > +static __inline uint32_t > +hash_parent(const struct ipfw_flow_id *id, const void *rule) > +{ > + > + return (hash_packet(id) ^ ((uintptr_t)rule)); > +} > + > +#else /* IPFIREWALL_JENKINSHASH */ > + > +static VNET_DEFINE(uint32_t, dyn_hashseed); > +#define V_dyn_hashseed VNET(dyn_hashseed) > + > +static __inline int > +addrcmp4(const struct ipfw_flow_id *id) > +{ > + > + if (id->src_ip < id->dst_ip) > + return (0); > + if (id->src_ip > id->dst_ip) > + return (1); > + if (id->src_port <= id->dst_port) > + return (0); > + return (1); > +} > + > +#ifdef INET6 > +static __inline int > +addrcmp6(const struct ipfw_flow_id *id) > +{ > + int ret; > + > + ret = memcmp(&id->src_ip6, &id->dst_ip6, sizeof(struct in6_addr)); > + if (ret < 0) > + return (0); > + if (ret > 0) > + return (1); > + if (id->src_port <= id->dst_port) > + return (0); > + return (1); > +} > + > +static __inline uint32_t > +hash_packet6(const struct ipfw_flow_id *id) > +{ > + struct tuple6 { > + struct in6_addr addr[2]; > + uint16_t port[2]; > + } t6; > + > + if (addrcmp6(id) == 0) { > + t6.addr[0] = id->src_ip6; > + t6.addr[1] = id->dst_ip6; > + t6.port[0] = id->src_port; > + t6.port[1] = id->dst_port; > + } else { > + t6.addr[0] = id->dst_ip6; > + t6.addr[1] = id->src_ip6; > + t6.port[0] = id->dst_port; > + t6.port[1] = id->src_port; > + } > + return (jenkins_hash32((const uint32_t *)&t6, > + sizeof(t6) / sizeof(uint32_t), V_dyn_hashseed)); > +} > +#endif > + > +static __inline uint32_t > +hash_packet(const struct ipfw_flow_id *id) > +{ > + struct tuple4 { > + in_addr_t addr[2]; > + uint16_t port[2]; > + } t4; > + > + if (IS_IP4_FLOW_ID(id)) { > + /* All fields are in host byte order */ > + if (addrcmp4(id) == 0) { > + t4.addr[0] = id->src_ip; > + t4.addr[1] = id->dst_ip; > + t4.port[0] = id->src_port; > + t4.port[1] = id->dst_port; > + } else { > + t4.addr[0] = id->dst_ip; > + t4.addr[1] = id->src_ip; > + t4.port[0] = id->dst_port; > + t4.port[1] = id->src_port; > + } > + return (jenkins_hash32((const uint32_t *)&t4, > + sizeof(t4) / sizeof(uint32_t), V_dyn_hashseed)); > + } else > +#ifdef INET6 > + if (IS_IP6_FLOW_ID(id)) > + return (hash_packet6(id)); > +#endif > + return (0); > +} > + > +static __inline uint32_t > +hash_parent(const struct ipfw_flow_id *id, const void *rule) > +{ > + > + return (jenkins_hash32((const uint32_t *)&rule, > + sizeof(rule) / sizeof(uint32_t), hash_packet(id))); > +} > +#endif /* IPFIREWALL_JENKINSHASH */ > + > +/* > * Print customizable flow id description via log(9) facility. > */ > static void > @@ -502,903 +900,1809 @@ print_dyn_rule_flags(const struct ipfw_flow_id *id, in > } > log(log_flags, "ipfw: %s type %d %s %d -> %s %d, %d %s\n", > prefix, dyn_type, src, id->src_port, dst, > - id->dst_port, DYN_COUNT, postfix); > + id->dst_port, V_dyn_count, postfix); > } > > #define print_dyn_rule(id, dtype, prefix, postfix) \ > print_dyn_rule_flags(id, dtype, LOG_DEBUG, prefix, postfix) > > -#define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) > -#define TIME_LE(a,b) ((int)((a)-(b)) < 0) > +#define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) > +#define TIME_LE(a,b) ((int)((a)-(b)) < 0) > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-all@freebsd.org Fri Mar 23 08:55:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8823F554F0; Fri, 23 Mar 2018 08:55:36 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (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 5388587F50; Fri, 23 Mar 2018 08:55:36 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:26712) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ezIU3-0011Zc-jt (Exim 4.89_2) (return-path ); Fri, 23 Mar 2018 08:55:35 +0000 Date: Fri, 23 Mar 2018 08:46:36 +0000 From: Ruslan Bukin To: Alan Somers Cc: Conrad Meyer , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr... Message-ID: <20180323084636.GA18215@bsdpad.com> References: <201803140300.w2E30HmE024745@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 08:55:37 -0000 On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote: > On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]cem@freebsd.org> wrote: > > Author: cem > Date: Wed Mar 14 03:00:17 2018 > New Revision: 330894 > URL: [2]https://svnweb.freebsd.org/changeset/base/330894 > > Log: >   Update to Zstandard 1.3.3 > >   Includes patch to conditionalize use of __builtin_clz(ll) on > __has_builtin(). >   The issue is tracked upstream at > [3]https://github.com/facebook/zstd/pull/884 . >   Otherwise, these are vanilla Zstandard 1.3.3 files. > >   Note that the 1.3.4 release should be due out soon. > >   Sponsored by: Dell EMC Isilon > > I think this broke the build on RISC-V.  Could you please take a look? > > [4]https://ci.freebsd.org/job/FreeBSD-head-riscv64-build/7028/console > I can confirm it breaks RISC-V Ruslan From owner-svn-src-all@freebsd.org Fri Mar 23 09:40:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8840EF59014; Fri, 23 Mar 2018 09:40:42 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36FD669A04; Fri, 23 Mar 2018 09:40:42 +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 31BDB1E355; Fri, 23 Mar 2018 09:40:42 +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 w2N9efnL090261; Fri, 23 Mar 2018 09:40:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N9efoA090258; Fri, 23 Mar 2018 09:40:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803230940.w2N9efoA090258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 09:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331419 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 331419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 09:40:42 -0000 Author: hselasky Date: Fri Mar 23 09:40:41 2018 New Revision: 331419 URL: https://svnweb.freebsd.org/changeset/base/331419 Log: Allow the libusb20_dev_get_port_path() function to be called when the USB device is closed. This fixes a compatibility issue with upstream libusb. Found by: romain@ MFC after: 1 week Modified: head/lib/libusb/libusb20.c head/lib/libusb/libusb20_int.h head/lib/libusb/libusb20_ugen20.c Modified: head/lib/libusb/libusb20.c ============================================================================== --- head/lib/libusb/libusb20.c Fri Mar 23 05:37:18 2018 (r331418) +++ head/lib/libusb/libusb20.c Fri Mar 23 09:40:41 2018 (r331419) @@ -77,7 +77,6 @@ dummy_callback(struct libusb20_transfer *xfer) #define dummy_check_connected (void *)dummy_int #define dummy_set_power_mode (void *)dummy_int #define dummy_get_power_mode (void *)dummy_int -#define dummy_get_port_path (void *)dummy_int #define dummy_get_power_usage (void *)dummy_int #define dummy_kernel_driver_active (void *)dummy_int #define dummy_detach_kernel_driver (void *)dummy_int @@ -745,7 +744,26 @@ libusb20_dev_get_power_mode(struct libusb20_device *pd int libusb20_dev_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize) { - return (pdev->methods->get_port_path(pdev, buf, bufsize)); + + if (pdev->port_level == 0) { + /* + * Fallback for backends without port path: + */ + if (bufsize < 2) + return (LIBUSB20_ERROR_OVERFLOW); + buf[0] = pdev->parent_address; + buf[1] = pdev->parent_port; + return (2); + } + + /* check if client buffer is too small */ + if (pdev->port_level > bufsize) + return (LIBUSB20_ERROR_OVERFLOW); + + /* copy port number information */ + memcpy(buf, pdev->port_path, pdev->port_level); + + return (pdev->port_level); /* success */ } uint16_t Modified: head/lib/libusb/libusb20_int.h ============================================================================== --- head/lib/libusb/libusb20_int.h Fri Mar 23 05:37:18 2018 (r331418) +++ head/lib/libusb/libusb20_int.h Fri Mar 23 09:40:41 2018 (r331419) @@ -107,7 +107,6 @@ typedef int (libusb20_process_t)(struct libusb20_devic typedef int (libusb20_reset_device_t)(struct libusb20_device *pdev); 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_port_path_t)(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize); typedef int (libusb20_get_power_usage_t)(struct libusb20_device *pdev, uint16_t *power_usage); 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); @@ -131,7 +130,6 @@ typedef void (libusb20_tr_cancel_async_t)(struct libus m(n, check_connected) \ m(n, set_power_mode) \ m(n, get_power_mode) \ - m(n, get_port_path) \ m(n, get_power_usage) \ m(n, set_alt_index) \ m(n, set_config_index) \ @@ -237,8 +235,11 @@ struct libusb20_device { uint8_t is_opened; uint8_t parent_address; uint8_t parent_port; + uint8_t port_level; char usb_desc[96]; +#define LIBUSB20_DEVICE_PORT_PATH_MAX 32 + uint8_t port_path[LIBUSB20_DEVICE_PORT_PATH_MAX]; }; extern const struct libusb20_backend_methods libusb20_ugen20_backend; Modified: head/lib/libusb/libusb20_ugen20.c ============================================================================== --- head/lib/libusb/libusb20_ugen20.c Fri Mar 23 05:37:18 2018 (r331418) +++ head/lib/libusb/libusb20_ugen20.c Fri Mar 23 09:40:41 2018 (r331419) @@ -79,7 +79,6 @@ static libusb20_reset_device_t ugen20_reset_device; static libusb20_check_connected_t ugen20_check_connected; static libusb20_set_power_mode_t ugen20_set_power_mode; static libusb20_get_power_mode_t ugen20_get_power_mode; -static libusb20_get_port_path_t ugen20_get_port_path; static libusb20_get_power_usage_t ugen20_get_power_usage; static libusb20_kernel_driver_active_t ugen20_kernel_driver_active; static libusb20_detach_kernel_driver_t ugen20_detach_kernel_driver; @@ -136,6 +135,7 @@ ugen20_enumerate(struct libusb20_device *pdev, const c const char *tmp = id; struct usb_device_descriptor ddesc; struct usb_device_info devinfo; + struct usb_device_port_path udpp; uint32_t plugtime; char buf[64]; int f; @@ -219,6 +219,13 @@ ugen20_enumerate(struct libusb20_device *pdev, const c pdev->device_address, devinfo.udi_vendor, devinfo.udi_product, pdev->bus_number); + /* get device port path, if any */ + if (ioctl(f, IOUSB(USB_GET_DEV_PORT_PATH), &udpp) == 0 && + udpp.udp_port_level < LIBUSB20_DEVICE_PORT_PATH_MAX) { + memcpy(pdev->port_path, udpp.udp_port_no, udpp.udp_port_level); + pdev->port_level = udpp.udp_port_level; + } + error = 0; done: close(f); @@ -648,22 +655,6 @@ ugen20_get_power_mode(struct libusb20_device *pdev, ui } *power_mode = temp; return (0); /* success */ -} - -static int -ugen20_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize) -{ - struct usb_device_port_path udpp; - - if (ioctl(pdev->file_ctrl, IOUSB(USB_GET_DEV_PORT_PATH), &udpp)) - return (LIBUSB20_ERROR_OTHER); - - if (udpp.udp_port_level > bufsize) - return (LIBUSB20_ERROR_OVERFLOW); - - memcpy(buf, udpp.udp_port_no, udpp.udp_port_level); - - return (udpp.udp_port_level); /* success */ } static int From owner-svn-src-all@freebsd.org Fri Mar 23 09:40:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B346F5904A; Fri, 23 Mar 2018 09:40:51 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8490269AF5; Fri, 23 Mar 2018 09:40:50 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wr0-x235.google.com with SMTP id p53so3914545wrc.10; Fri, 23 Mar 2018 02:40:50 -0700 (PDT) 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=559ZytdChV8WC4P5pFapLq1ou8KI4ahg8XipA4c4dAI=; b=k/wvDgQRfSMtcDyl+CPpj9CaaDTR5y78UATMEJC6b/63Waa81SWd/zy4hWc9xTnDR1 sFNiu89k79Co4ouHNQYGmCakrou+PXSB9Pj0ImI32GWGrQnJYeWszjSXA4PowNtMSVOk lQ38ePZHtY/nae0TF3vElKym3i0aYg9mjIvnVqT+OXVbYPm/jysMGuEJ+B1J0uGkyqPu HNjmBkyY+LmU8Y37zbi4oB5TWW7ppsmRyL38zwQ9E1vphelq3s2upjV0onej6j+ybF3Z pgVaCjMU6/SQCtPKolzHOzflcX6t+ZoE+A26W+zLyOl5U2OOK+X0ARwBFuFEROejYlWL X3og== 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=559ZytdChV8WC4P5pFapLq1ou8KI4ahg8XipA4c4dAI=; b=dsB/W+Avvo1sMpaNY/osElDPIsgzHRyhc7DPA+SoH2FtRjn0TDxJQSRKapbkX62MHc OU+uF/U+WgOrLIqVVvQTdME2YS0CzibETtsMQNg5sjf0jVBiU2mK5hP16WQr5PJIp78l v7E/cC3zmjlB+15viV6vT0qVsw+uSjqWxCyp5BAIBjRKu9s8ec12TyXHwetllSGxdvS2 Tgk0DdCm2feZ7SN74yjAmUEUSdP0gc8cj6fCgGX7jH6CmfZBMGIMTiNIMQWiXHNIx/e2 owahFHTCCdlZzEhXzY6Rx1kr6ZB0pElE4++aB67KtK1+mZNtS1Fcih2Dfp0IvZPH+Pra jOwg== X-Gm-Message-State: AElRT7EpDH8dmsHZct5MHNH1X3Au9vqMupGQLCBDAUpjWzGOC1uWQ3Gy +hheblg0iTeWzVYspd8+0LUXhYsNBegmpx0VQaVE3Q== X-Google-Smtp-Source: AG47ELsDDBltR/NZw5OHiwKMYw9cJH9eK57IigZV7ltG09w/KetVm5qaTMMn1Z4on2liFRMlWF56JLy6UUrcF0xYzXI= X-Received: by 10.223.195.142 with SMTP id p14mr20646969wrf.32.1521798049395; Fri, 23 Mar 2018 02:40:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.192.2 with HTTP; Fri, 23 Mar 2018 02:40:48 -0700 (PDT) In-Reply-To: References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> From: Jonathan Looney Date: Fri, 23 Mar 2018 09:40:48 +0000 Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Justin Hibbits Cc: Andriy Gapon , Ruslan Bukin , "Jonathan T. Looney" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 09:40:51 -0000 On Thu, Mar 22, 2018 at 9:05 PM, Justin Hibbits wrote: > On Thu, Mar 22, 2018 at 3:44 PM, Andriy Gapon wrote: > > On 22/03/2018 17:39, Jonathan Looney wrote: > >> A tinderbox build didn't complain about atomic_fetchadd_64, so I assume > it is OK. > >> > > FWWI, TARGET=powerpc TARGET_ARCH=powerpc build failed for me. > > > > cc1: warnings being treated as errors > > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c: In function > 'tcp_log_selectauto': > > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: implicit > declaration > > of function 'atomic_fetchadd_64' > > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: nested > extern > > declaration of 'atomic_fetchadd_64' [-Wnested-externs] > > mips complains, too. Check out https://ci.freebsd.org/tinderbox . > Thanks for all the reports! I'm working on a fix now. Jonathan From owner-svn-src-all@freebsd.org Fri Mar 23 09:42:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1BE2F594C1; Fri, 23 Mar 2018 09:42:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E3B269FB1; Fri, 23 Mar 2018 09:42:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7938F1E3DD; Fri, 23 Mar 2018 09:42:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N9glgW095018; Fri, 23 Mar 2018 09:42:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N9gl5Q095017; Fri, 23 Mar 2018 09:42:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803230942.w2N9gl5Q095017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 23 Mar 2018 09:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331420 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 09:42:48 -0000 Author: avg Date: Fri Mar 23 09:42:47 2018 New Revision: 331420 URL: https://svnweb.freebsd.org/changeset/base/331420 Log: zfs: fix mismatch between format specifier and type vdev_dbgmsg_print_tree printed vdev_id of uint64_t type with %u format specifier. That caused subsequent parameters to be incorrectly read from the stack and lead to a crash when a wrong value was interpreted as a string pointer. This should be upstreamed. Reported by: pho MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 09:40:41 2018 (r331419) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 09:42:47 2018 (r331420) @@ -237,7 +237,7 @@ vdev_dbgmsg_print_tree(vdev_t *vd, int indent) } zfs_dbgmsg("%*svdev %u: %s%s, guid: %llu, path: %s, %s", indent, - "", vd->vdev_id, vd->vdev_ops->vdev_op_type, + "", (int)vd->vdev_id, vd->vdev_ops->vdev_op_type, vd->vdev_islog ? " (log)" : "", (u_longlong_t)vd->vdev_guid, vd->vdev_path ? vd->vdev_path : "N/A", state); From owner-svn-src-all@freebsd.org Fri Mar 23 11:08:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7F6FF606E3; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A6246DDFD; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60A891F0BD; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NB8xec035953; Fri, 23 Mar 2018 11:08:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NB8xdM035952; Fri, 23 Mar 2018 11:08:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803231108.w2NB8xdM035952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 23 Mar 2018 11:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331421 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 331421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 11:08:59 -0000 Author: andrew Date: Fri Mar 23 11:08:59 2018 New Revision: 331421 URL: https://svnweb.freebsd.org/changeset/base/331421 Log: If sc->sc_ep_max is already set use it to find the number of RX and TX endpoints. The Allwinner driver will need to set this as the EPINFO register isn't useful there. Submitted by: jmcneill Reviewed by: hselasky Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D5881 Modified: head/sys/dev/usb/controller/musb_otg.c Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Fri Mar 23 09:42:47 2018 (r331420) +++ head/sys/dev/usb/controller/musb_otg.c Fri Mar 23 11:08:59 2018 (r331421) @@ -3168,19 +3168,24 @@ musbotg_init(struct musbotg_softc *sc) MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); - /* read out number of endpoints */ + if (sc->sc_ep_max == 0) { + /* read out number of endpoints */ - nrx = - (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); + nrx = + (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); - ntx = - (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); + ntx = + (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); + sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; + } else { + nrx = ntx = sc->sc_ep_max; + } + /* these numbers exclude the control endpoint */ DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx); - sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; if (sc->sc_ep_max == 0) { DPRINTFN(2, "ERROR: Looks like the clocks are off!\n"); } From owner-svn-src-all@freebsd.org Fri Mar 23 12:01:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2602F65399; Fri, 23 Mar 2018 12:01:27 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (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 4E31E7025E; Fri, 23 Mar 2018 12:01:26 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:57006) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ezLNu-000o5d-6W (Exim 4.89_2) (return-path ); Fri, 23 Mar 2018 12:01:26 +0000 Date: Fri, 23 Mar 2018 11:52:27 +0000 From: Ruslan Bukin To: Alan Somers Cc: Conrad Meyer , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr... Message-ID: <20180323115227.GA21270@bsdpad.com> References: <201803140300.w2E30HmE024745@repo.freebsd.org> <20180323084636.GA18215@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180323084636.GA18215@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 12:01:27 -0000 On Fri, Mar 23, 2018 at 08:46:36AM +0000, Ruslan Bukin wrote: > On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote: > > On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]cem@freebsd.org> wrote: > > > > Author: cem > > Date: Wed Mar 14 03:00:17 2018 > > New Revision: 330894 > > URL: [2]https://svnweb.freebsd.org/changeset/base/330894 > > > > Log: > >   Update to Zstandard 1.3.3 > > > > I think this broke the build on RISC-V.  Could you please take a look? > > I can confirm it breaks RISC-V > I found the problem: after this commit kernel become slightly bigger: it was 0x5fd080 bytes, become 0x61b080 bytes. Spike gives us 0x600000 free space only between start of physram to place where it puts DTB. So DTB appears under our BSS section and we clear it during boot, so DTB is no longer valid and kernel get stuck in fdt header checking routine. I'm currently looking for a solution and rearrangements, it will take some time. Thanks Ruslan From owner-svn-src-all@freebsd.org Fri Mar 23 13:52:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 995E8F6E2BF; Fri, 23 Mar 2018 13:52:27 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D6587501C; Fri, 23 Mar 2018 13:52:27 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3836120BF1; Fri, 23 Mar 2018 13:52:27 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NDqRhw021115; Fri, 23 Mar 2018 13:52:27 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NDqQUK021113; Fri, 23 Mar 2018 13:52:26 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201803231352.w2NDqQUK021113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 23 Mar 2018 13:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331422 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 331422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 13:52:27 -0000 Author: ken Date: Fri Mar 23 13:52:26 2018 New Revision: 331422 URL: https://svnweb.freebsd.org/changeset/base/331422 Log: Disable T10 Protection Information / EEDP handling for type 2 protection. The mps(4) and mpr(4) drivers and hardware handle T10 Protection Information, which is a system of checksums and guard blocks to protect data while it is being transferred and while it is on disk. It is also known as T10 DIF. For more details, see section 4.22 of the SBC-4 spec. Supporting Type 2 protection requires using 32 byte CDBs, and filling in the fields in those CDBs. We don't yet support that in the da(4) driver. Type 1 and Type 3 protection don't require that, and can be handled by the mps(4)/mpr(4) driver's code and firmware without any additional input from the da(4) driver. If a drive has Type 2 protection enabled (you frequently see this with SAS drives shipped from Dell), don't set the various EEDP fields in the mps(4)/mpr(4) driver command fields. Otherwise, you wind up with errors like this that would otherwise make no sense: (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00 (da9:mpr0:0:18:0): CAM status: SCSI Status Error (da9:mpr0:0:18:0): SCSI status: Check Condition (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code) (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Field Replaceable Unit: 0 (da9:mpr0:0:18:0): Command Specific Info: 0 (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Descriptor 0x80: f8 21 (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00 (da9:mpr0:0:18:0): Error 22, Unretryable error In other words, what kind of strange SAS hard drive doesn't support a standard 10 byte SCSI READ command? In this case, one that has Type 2 protection enabled. We can revisit this when we put Type 2 protection support in the da(4) driver, but for now this will help people who put Type 2 formatted drives in a system and wonder what in the world is going on. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/dev/mpr/mpr_sas.c head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Fri Mar 23 11:08:59 2018 (r331421) +++ head/sys/dev/mpr/mpr_sas.c Fri Mar 23 13:52:26 2018 (r331422) @@ -2130,8 +2130,8 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union CDB.EEDP32.PrimaryReferenceTag); req->CDB.EEDP32.PrimaryApplicationTagMask = 0xFFFF; - req->CDB.CDB32[1] = (req->CDB.CDB32[1] & 0x1F) | - 0x20; + req->CDB.CDB32[1] = + (req->CDB.CDB32[1] & 0x1F) | 0x20; } else { eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_APPTAG; @@ -3502,8 +3502,19 @@ mprsas_async(void *callback_arg, uint32_t code, struct if ((mprsas_get_ccbstatus((union ccb *)&cdai) == CAM_REQ_CMP) && (rcap_buf.prot & SRC16_PROT_EN)) { - lun->eedp_formatted = TRUE; - lun->eedp_block_size = scsi_4btoul(rcap_buf.length); + switch (rcap_buf.prot & SRC16_P_TYPE) { + case SRC16_PTYPE_1: + case SRC16_PTYPE_3: + lun->eedp_formatted = TRUE; + lun->eedp_block_size = + scsi_4btoul(rcap_buf.length); + break; + case SRC16_PTYPE_2: + default: + lun->eedp_formatted = FALSE; + lun->eedp_block_size = 0; + break; + } } else { lun->eedp_formatted = FALSE; lun->eedp_block_size = 0; Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Fri Mar 23 11:08:59 2018 (r331421) +++ head/sys/dev/mps/mps_sas.c Fri Mar 23 13:52:26 2018 (r331422) @@ -3231,8 +3231,19 @@ mpssas_async(void *callback_arg, uint32_t code, struct if ((mpssas_get_ccbstatus((union ccb *)&cdai) == CAM_REQ_CMP) && (rcap_buf.prot & SRC16_PROT_EN)) { - lun->eedp_formatted = TRUE; - lun->eedp_block_size = scsi_4btoul(rcap_buf.length); + switch (rcap_buf.prot & SRC16_P_TYPE) { + case SRC16_PTYPE_1: + case SRC16_PTYPE_3: + lun->eedp_formatted = TRUE; + lun->eedp_block_size = + scsi_4btoul(rcap_buf.length); + break; + case SRC16_PTYPE_2: + default: + lun->eedp_formatted = FALSE; + lun->eedp_block_size = 0; + break; + } } else { lun->eedp_formatted = FALSE; lun->eedp_block_size = 0; From owner-svn-src-all@freebsd.org Fri Mar 23 14:38:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58B31F4CC17; Fri, 23 Mar 2018 14:38:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0714A76F42; Fri, 23 Mar 2018 14:38:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F219621257; Fri, 23 Mar 2018 14:38:56 +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 w2NEcuJJ041424; Fri, 23 Mar 2018 14:38:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NEcuOv041423; Fri, 23 Mar 2018 14:38:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803231438.w2NEcuOv041423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Mar 2018 14:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331425 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 14:38:57 -0000 Author: markj Date: Fri Mar 23 14:38:56 2018 New Revision: 331425 URL: https://svnweb.freebsd.org/changeset/base/331425 Log: Correct a couple of assertion messages in vm_page_reclaim_run(). MFC after: 3 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Mar 23 14:36:24 2018 (r331424) +++ head/sys/vm/vm_page.c Fri Mar 23 14:38:56 2018 (r331425) @@ -2473,7 +2473,7 @@ retry: goto unlock; } KASSERT(m_new->wire_count == 0, - ("page %p is wired", m)); + ("page %p is wired", m_new)); /* * Replace "m" with the new page. For @@ -2485,7 +2485,7 @@ retry: pmap_remove_all(m); m_new->aflags = m->aflags; KASSERT(m_new->oflags == VPO_UNMANAGED, - ("page %p is managed", m)); + ("page %p is managed", m_new)); m_new->oflags = m->oflags & VPO_NOSYNC; pmap_copy_page(m, m_new); m_new->valid = m->valid; From owner-svn-src-all@freebsd.org Fri Mar 23 14:39:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E89FF4CCCF; Fri, 23 Mar 2018 14:39:35 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3CD24770A5; Fri, 23 Mar 2018 14:39:35 +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 37AF121258; Fri, 23 Mar 2018 14:39:35 +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 w2NEdZEm041494; Fri, 23 Mar 2018 14:39:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NEdY03041489; Fri, 23 Mar 2018 14:39:34 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231439.w2NEdY03041489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 14:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331426 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 331426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 14:39:35 -0000 Author: emaste Date: Fri Mar 23 14:39:34 2018 New Revision: 331426 URL: https://svnweb.freebsd.org/changeset/base/331426 Log: Rationalize license text on Linuxolator files Many licenses on Linuxolator files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the standard 2-Clause FreeBSD license for those files where I have permission from each of the listed copyright holders. Approved by: rdivacky, marcel MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_ioctl.h head/sys/compat/linux/linux_ipc.h head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_misc.h head/sys/compat/linux/linux_signal.h Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_ioctl.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1999 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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. + * 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. 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. + * 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$ */ Modified: head/sys/compat/linux/linux_ipc.h ============================================================================== --- head/sys/compat/linux/linux_ipc.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_ipc.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2000 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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. + * 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. 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. + * 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$ */ Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_mib.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1999 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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. + * 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. 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. + * 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$ */ Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_misc.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 Roman Divacky * All rights reserved. @@ -8,24 +8,22 @@ * 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. + * 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. 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. + * 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$ */ Modified: head/sys/compat/linux/linux_signal.h ============================================================================== --- head/sys/compat/linux/linux_signal.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_signal.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2000 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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. + * 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. 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. + * 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$ */ From owner-svn-src-all@freebsd.org Fri Mar 23 15:25:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F314BF5115E; Fri, 23 Mar 2018 15:25:54 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (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 95A79796A7; Fri, 23 Mar 2018 15:25:54 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:18176) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ezOZl-0004sy-7F (Exim 4.89_2) (return-path ); Fri, 23 Mar 2018 15:25:53 +0000 Date: Fri, 23 Mar 2018 15:16:54 +0000 From: Ruslan Bukin To: Alan Somers Cc: Conrad Meyer , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr... Message-ID: <20180323151654.GA24598@bsdpad.com> References: <201803140300.w2E30HmE024745@repo.freebsd.org> <20180323084636.GA18215@bsdpad.com> <20180323115227.GA21270@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180323115227.GA21270@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:25:55 -0000 On Fri, Mar 23, 2018 at 11:52:27AM +0000, Ruslan Bukin wrote: > On Fri, Mar 23, 2018 at 08:46:36AM +0000, Ruslan Bukin wrote: > > On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote: > > > On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]cem@freebsd.org> wrote: > > > > > > Author: cem > > > Date: Wed Mar 14 03:00:17 2018 > > > New Revision: 330894 > > > URL: [2]https://svnweb.freebsd.org/changeset/base/330894 > > > > > > Log: > > >   Update to Zstandard 1.3.3 > > > > > > I think this broke the build on RISC-V.  Could you please take a look? > > > > I can confirm it breaks RISC-V > > > > I found the problem: after this commit kernel become slightly bigger: it was 0x5fd080 bytes, become 0x61b080 bytes. > > Spike gives us 0x600000 free space only between start of physram to place where it puts DTB. > So DTB appears under our BSS section and we clear it during boot, so DTB is no longer valid and kernel get stuck in fdt header checking routine. > > I'm currently looking for a solution and rearrangements, it will take some time. > I found that Berkeley Boot Loader (BBL) miscalculates the size of payload (freebsd kernel) -- they does not include BSS section to calculatons. I made a fix to our local riscv-pk (https://github.com/freebsd-riscv/riscv-pk) and created a pull request: https://github.com/riscv/riscv-pk/pull/91 Thanks Ruslan From owner-svn-src-all@freebsd.org Fri Mar 23 15:35:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A270AF51E2F; Fri, 23 Mar 2018 15:35:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54DDC79E51; Fri, 23 Mar 2018 15:35:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FC2B21C2A; Fri, 23 Mar 2018 15:35:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFZ7Le071663; Fri, 23 Mar 2018 15:35:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFZ7Hj071662; Fri, 23 Mar 2018 15:35:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231535.w2NFZ7Hj071662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 15:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331428 - head/sys/dev/ed X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ed X-SVN-Commit-Revision: 331428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:35:07 -0000 Author: imp Date: Fri Mar 23 15:35:07 2018 New Revision: 331428 URL: https://svnweb.freebsd.org/changeset/base/331428 Log: kill traling white space Modified: head/sys/dev/ed/if_ed_pci.c Modified: head/sys/dev/ed/if_ed_pci.c ============================================================================== --- head/sys/dev/ed/if_ed_pci.c Fri Mar 23 14:59:30 2018 (r331427) +++ head/sys/dev/ed/if_ed_pci.c Fri Mar 23 15:35:07 2018 (r331428) @@ -147,4 +147,3 @@ MODULE_DEPEND(ed, pci, 1, 1, 1); MODULE_DEPEND(ed, ether, 1, 1, 1); MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ed, pci_ids, sizeof(pci_ids[0]), nitems(pci_ids) - 1); - From owner-svn-src-all@freebsd.org Fri Mar 23 15:35:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAA01F51E92; Fri, 23 Mar 2018 15:35:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E87479F3A; Fri, 23 Mar 2018 15:35:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 999B421C2B; Fri, 23 Mar 2018 15:35:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFZFYP071720; Fri, 23 Mar 2018 15:35:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFZFEO071719; Fri, 23 Mar 2018 15:35:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231535.w2NFZFEO071719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 15:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331429 - head/sys/dev/xl X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/xl X-SVN-Commit-Revision: 331429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:35:16 -0000 Author: imp Date: Fri Mar 23 15:35:15 2018 New Revision: 331429 URL: https://svnweb.freebsd.org/changeset/base/331429 Log: Add PNP info to xl as an example. Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Fri Mar 23 15:35:07 2018 (r331428) +++ head/sys/dev/xl/if_xl.c Fri Mar 23 15:35:15 2018 (r331429) @@ -334,6 +334,8 @@ static devclass_t xl_devclass; DRIVER_MODULE_ORDERED(xl, pci, xl_driver, xl_devclass, NULL, NULL, SI_ORDER_ANY); DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, NULL, NULL); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, xl, xl_devs, sizeof(xl_devs[0]), + nitems(xl_devs) - 1); static void xl_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) From owner-svn-src-all@freebsd.org Fri Mar 23 15:35:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37CCFF51ECB; Fri, 23 Mar 2018 15:35:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55D0379FE1; Fri, 23 Mar 2018 15:35:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EAB621C2C; Fri, 23 Mar 2018 15:35:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFZKYf071774; Fri, 23 Mar 2018 15:35:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFZJ6E071772; Fri, 23 Mar 2018 15:35:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231535.w2NFZJ6E071772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 15:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331430 - in head/sys: dev/adlink modules/adlink X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: dev/adlink modules/adlink X-SVN-Commit-Revision: 331430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:35:23 -0000 Author: imp Date: Fri Mar 23 15:35:19 2018 New Revision: 331430 URL: https://svnweb.freebsd.org/changeset/base/331430 Log: Convert the PCI ID selection from a simple if into a table. Mark the table with PNP info. Fix compilation by returning FILTER_STRAY in two places, as suggested by comments. Create a simple module from this. Left unconnected because I can't test it as a module. Added: head/sys/modules/adlink/ head/sys/modules/adlink/Makefile (contents, props changed) Modified: head/sys/dev/adlink/adlink.c Modified: head/sys/dev/adlink/adlink.c ============================================================================== --- head/sys/dev/adlink/adlink.c Fri Mar 23 15:35:15 2018 (r331429) +++ head/sys/dev/adlink/adlink.c Fri Mar 23 15:35:19 2018 (r331430) @@ -137,7 +137,7 @@ adlink_intr(void *arg) sc = arg; u = bus_read_4(sc->res[0], 0x38); if (!(u & 0x00800000)) - return; // XXX - FILTER_STRAY? + return (FILTER_STRAY); bus_write_4(sc->res[0], 0x38, u | 0x003f4000); sc->sample += sc->p0->chunksize / 2; @@ -150,7 +150,7 @@ adlink_intr(void *arg) if (sc->p0->state != STATE_RUN) { printf("adlink: stopping %d\n", sc->p0->state); - return; // XXX - FILTER_STRAY? + return (FILTER_STRAY); } pg = pg->next; @@ -346,14 +346,32 @@ adlink_ioctl(struct cdev *dev, u_long cmd, caddr_t dat static devclass_t adlink_devclass; +struct pci_id +{ + uint16_t vendor; + uint16_t device; + const char *desc; +} adlink_id[] = { + { .vendor = 0x10e8, .device = 0x80da, + .desc ="Adlink PCI-9812 4 ch 12 bit 20 msps" } +}; + static int adlink_probe(device_t self) { + int i; + uint16_t vendor, device; - if (pci_get_devid(self) != 0x80da10e8) - return (ENXIO); - device_set_desc(self, "Adlink PCI-9812 4 ch 12 bit 20 msps"); - return (BUS_PROBE_DEFAULT); + vendor = pci_get_vendor(self); + device = pci_get_device(self); + for (i = 0; i < nitems(adlink_id); i++) { + if (adlink_id[i].vendor == vendor && + adlink_id[i].device == device) { + device_set_desc(self, adlink_id[i].desc); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); } static struct resource_spec adlink_res_spec[] = { @@ -420,5 +438,6 @@ static driver_t adlink_driver = { }; DRIVER_MODULE(adlink, pci, adlink_driver, adlink_devclass, 0, 0); - +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, adlink, adlink_id, sizeof(adlink_id[0]), + nitems(adlink_id)); #endif /* _KERNEL */ Added: head/sys/modules/adlink/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/adlink/Makefile Fri Mar 23 15:35:19 2018 (r331430) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/adlink + +KMOD= adlink +SRCS= adlink.c \ + device_if.h bus_if.h + +.include From owner-svn-src-all@freebsd.org Fri Mar 23 15:44:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C85DF52B71; Fri, 23 Mar 2018 15:44:32 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E1057A898; Fri, 23 Mar 2018 15:44:32 +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 24E1821DD3; Fri, 23 Mar 2018 15:44:32 +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 w2NFiVbj076902; Fri, 23 Mar 2018 15:44:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFiVrQ076901; Fri, 23 Mar 2018 15:44:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803231544.w2NFiVrQ076901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Mar 2018 15:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331431 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 331431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:44:32 -0000 Author: kib Date: Fri Mar 23 15:44:31 2018 New Revision: 331431 URL: https://svnweb.freebsd.org/changeset/base/331431 Log: Update comment to match current field names. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/i386/i386/vm86.c Modified: head/sys/i386/i386/vm86.c ============================================================================== --- head/sys/i386/i386/vm86.c Fri Mar 23 15:35:19 2018 (r331430) +++ head/sys/i386/i386/vm86.c Fri Mar 23 15:44:31 2018 (r331431) @@ -417,8 +417,8 @@ vm86_initialize(void) * pcb_esp = stack frame pointer at time of switch * pcb_ebx = va of vm86 page table * pcb_eip = argument pointer to initial call - * pcb_spare[0] = saved TSS descriptor, word 0 - * pcb_space[1] = saved TSS descriptor, word 1 + * pcb_vm86[0] = saved TSS descriptor, word 0 + * pcb_vm86[1] = saved TSS descriptor, word 1 */ #define new_ptd pcb_esi #define vm86_frame pcb_ebp From owner-svn-src-all@freebsd.org Fri Mar 23 15:46:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3C66F52FF4; Fri, 23 Mar 2018 15:46:53 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72D117ABC2; Fri, 23 Mar 2018 15:46:53 +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 6D79821DD5; Fri, 23 Mar 2018 15:46:53 +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 w2NFkrRt077146; Fri, 23 Mar 2018 15:46:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFkrl3077145; Fri, 23 Mar 2018 15:46:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803231546.w2NFkrl3077145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Mar 2018 15:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331432 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 331432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:46:53 -0000 Author: kib Date: Fri Mar 23 15:46:53 2018 New Revision: 331432 URL: https://svnweb.freebsd.org/changeset/base/331432 Log: There is no need to disable interrupts around npxsave call. i386 was changed to only require critical section around the thread FPU state manipulations, and vm86_bioscall callers already enter critical section for other reasons. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/vm86bios.s Modified: head/sys/i386/i386/vm86bios.s ============================================================================== --- head/sys/i386/i386/vm86bios.s Fri Mar 23 15:44:31 2018 (r331431) +++ head/sys/i386/i386/vm86bios.s Fri Mar 23 15:46:53 2018 (r331432) @@ -61,8 +61,6 @@ ENTRY(vm86_bioscall) pushl %edi pushl %gs - pushfl - cli movl PCPU(CURTHREAD),%ecx cmpl %ecx,PCPU(FPCURTHREAD) /* do we need to save fp? */ jne 1f @@ -73,8 +71,6 @@ ENTRY(vm86_bioscall) addl $4,%esp popl %edx /* recover our pcb */ 1: - popfl - movl SCR_VMFRAME(%edx),%ebx /* target frame location */ movl %ebx,%edi /* destination */ movl SCR_ARGFRAME(%edx),%esi /* source (set on entry) */ From owner-svn-src-all@freebsd.org Fri Mar 23 15:50:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1688AF533FE; Fri, 23 Mar 2018 15:50:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD2647AE29; Fri, 23 Mar 2018 15:50:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3DCB21DD9; Fri, 23 Mar 2018 15:50:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFo47a077351; Fri, 23 Mar 2018 15:50:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFo1kH077319; Fri, 23 Mar 2018 15:50:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231550.w2NFo1kH077319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 15:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331433 - in head/sys/compat/linuxkpi/common: include/asm include/linux include/net src X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/asm include/linux include/net src X-SVN-Commit-Revision: 331433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:50:05 -0000 Author: emaste Date: Fri Mar 23 15:50:01 2018 New Revision: 331433 URL: https://svnweb.freebsd.org/changeset/base/331433 Log: linuxkpi whitespace cleanup Reviewed by: hselasky, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14807 Modified: head/sys/compat/linuxkpi/common/include/asm/byteorder.h head/sys/compat/linuxkpi/common/include/linux/bitops.h head/sys/compat/linuxkpi/common/include/linux/cdev.h head/sys/compat/linuxkpi/common/include/linux/compiler.h head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h head/sys/compat/linuxkpi/common/include/linux/err.h head/sys/compat/linuxkpi/common/include/linux/errno.h head/sys/compat/linuxkpi/common/include/linux/etherdevice.h head/sys/compat/linuxkpi/common/include/linux/fs.h head/sys/compat/linuxkpi/common/include/linux/idr.h head/sys/compat/linuxkpi/common/include/linux/if_ether.h head/sys/compat/linuxkpi/common/include/linux/if_vlan.h head/sys/compat/linuxkpi/common/include/linux/io.h head/sys/compat/linuxkpi/common/include/linux/jiffies.h head/sys/compat/linuxkpi/common/include/linux/kernel.h head/sys/compat/linuxkpi/common/include/linux/kmod.h head/sys/compat/linuxkpi/common/include/linux/kobject.h head/sys/compat/linuxkpi/common/include/linux/ktime.h head/sys/compat/linuxkpi/common/include/linux/list.h head/sys/compat/linuxkpi/common/include/linux/log2.h head/sys/compat/linuxkpi/common/include/linux/miscdevice.h head/sys/compat/linuxkpi/common/include/linux/mutex.h head/sys/compat/linuxkpi/common/include/linux/pci.h head/sys/compat/linuxkpi/common/include/linux/rwlock.h head/sys/compat/linuxkpi/common/include/linux/rwsem.h head/sys/compat/linuxkpi/common/include/linux/slab.h head/sys/compat/linuxkpi/common/include/linux/spinlock.h head/sys/compat/linuxkpi/common/include/linux/sysfs.h head/sys/compat/linuxkpi/common/include/linux/usb.h head/sys/compat/linuxkpi/common/include/linux/workqueue.h head/sys/compat/linuxkpi/common/include/net/if_inet6.h head/sys/compat/linuxkpi/common/include/net/ipv6.h head/sys/compat/linuxkpi/common/include/net/netevent.h head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/compat/linuxkpi/common/src/linux_idr.c head/sys/compat/linuxkpi/common/src/linux_radix.c head/sys/compat/linuxkpi/common/src/linux_usb.c Modified: head/sys/compat/linuxkpi/common/include/asm/byteorder.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/byteorder.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/asm/byteorder.h Fri Mar 23 15:50:01 2018 (r331433) @@ -87,7 +87,7 @@ static inline void be16_add_cpu(uint16_t *var, uint16_t val) -{ +{ *var = cpu_to_be16(be16_to_cpu(*var) + val); } Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Fri Mar 23 15:50:01 2018 (r331433) @@ -54,7 +54,7 @@ #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) #define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l))) #define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l))) -#define BITS_PER_BYTE 8 +#define BITS_PER_BYTE 8 #define hweight8(x) bitcount((uint8_t)(x)) #define hweight16(x) bitcount16(x) Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Fri Mar 23 15:50:01 2018 (r331433) @@ -112,7 +112,7 @@ cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t int error; cdev->dev = dev; - + /* Setup arguments for make_dev_s() */ make_dev_args_init(&args); args.mda_devsw = &linuxcdevsw; Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/compiler.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/compiler.h Fri Mar 23 15:50:01 2018 (r331433) @@ -84,7 +84,7 @@ #define __PASTE(a,b) ___PASTE(a,b) #define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x)) - + #define WRITE_ONCE(x,v) do { \ barrier(); \ ACCESS_ONCE(x) = (v); \ Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Fri Mar 23 15:50:01 2018 (r331433) @@ -124,10 +124,10 @@ extern const struct kobj_type linux_dev_ktype; extern const struct kobj_type linux_class_ktype; struct class_attribute { - struct attribute attr; - ssize_t (*show)(struct class *, struct class_attribute *, char *); - ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t); - const void *(*namespace)(struct class *, const struct class_attribute *); + struct attribute attr; + ssize_t (*show)(struct class *, struct class_attribute *, char *); + ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t); + const void *(*namespace)(struct class *, const struct class_attribute *); }; #define CLASS_ATTR(_name, _mode, _show, _store) \ @@ -223,7 +223,7 @@ static inline char * dev_name(const struct device *dev) { - return kobject_name(&dev->kobj); + return kobject_name(&dev->kobj); } #define dev_set_name(_dev, _fmt, ...) \ @@ -533,7 +533,7 @@ class_remove_file(struct class *class, const struct cl static inline int dev_to_node(struct device *dev) { - return -1; + return -1; } char *kvasprintf(gfp_t, const char *, va_list); Modified: head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h Fri Mar 23 15:50:01 2018 (r331433) @@ -38,7 +38,7 @@ enum dma_attr { DMA_ATTR_WRITE_BARRIER, DMA_ATTR_WEAK_ struct dma_attrs { unsigned long flags; }; - + #define DEFINE_DMA_ATTRS(x) struct dma_attrs x = { } static inline void Modified: head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Fri Mar 23 15:50:01 2018 (r331433) @@ -97,7 +97,7 @@ dma_supported(struct device *dev, u64 mask) /* XXX busdma takes care of this elsewhere. */ return (1); } - + static inline int dma_set_mask(struct device *dev, u64 dma_mask) { @@ -150,7 +150,7 @@ dma_zalloc_coherent(struct device *dev, size_t size, d return (dma_alloc_coherent(dev, size, dma_handle, flag | __GFP_ZERO)); } - + static inline void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle) @@ -180,7 +180,7 @@ dma_map_sg_attrs(struct device *dev, struct scatterlis { struct scatterlist *sg; int i; - + for_each_sg(sgl, sg, nents, i) sg_dma_address(sg) = sg_phys(sg); @@ -192,7 +192,7 @@ dma_unmap_sg_attrs(struct device *dev, struct scatterl enum dma_data_direction dir, struct dma_attrs *attrs) { } - + static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction) @@ -258,9 +258,9 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_a } static inline unsigned int dma_set_max_seg_size(struct device *dev, - unsigned int size) + unsigned int size) { - return (0); + return (0); } Modified: head/sys/compat/linuxkpi/common/include/linux/err.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/err.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/err.h Fri Mar 23 15:50:01 2018 (r331433) @@ -70,10 +70,10 @@ ERR_CAST(void *ptr) static inline int PTR_ERR_OR_ZERO(const void *ptr) { - if (IS_ERR(ptr)) - return PTR_ERR(ptr); - else - return 0; + if (IS_ERR(ptr)) + return PTR_ERR(ptr); + else + return 0; } #define PTR_RET(p) PTR_ERR_OR_ZERO(p) Modified: head/sys/compat/linuxkpi/common/include/linux/errno.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/errno.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/errno.h Fri Mar 23 15:50:01 2018 (r331433) @@ -35,13 +35,13 @@ #define ECHRNG EDOM #define ETIME ETIMEDOUT -#define ECOMM ESTALE -#define ENODATA ECONNREFUSED +#define ECOMM ESTALE +#define ENODATA ECONNREFUSED #define ENOIOCTLCMD ENOIOCTL /* Use same value as Linux, because BSD's ERESTART is negative */ #define ERESTARTSYS 512 -#define ENOTSUPP EOPNOTSUPP -#define ENONET EHOSTDOWN +#define ENOTSUPP EOPNOTSUPP +#define ENONET EHOSTDOWN #define ERESTARTNOINTR 513 #define ERESTARTNOHAND 514 Modified: head/sys/compat/linuxkpi/common/include/linux/etherdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/etherdevice.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/etherdevice.h Fri Mar 23 15:50:01 2018 (r331433) @@ -51,31 +51,31 @@ struct ethtool_modinfo { u32 eeprom_len; }; -static inline bool +static inline bool is_zero_ether_addr(const u8 * addr) { return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == 0x00); } -static inline bool +static inline bool is_multicast_ether_addr(const u8 * addr) { return (0x01 & addr[0]); } -static inline bool +static inline bool is_broadcast_ether_addr(const u8 * addr) { return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == (6 * 0xff)); } -static inline bool +static inline bool is_valid_ether_addr(const u8 * addr) { return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); } -static inline void +static inline void ether_addr_copy(u8 * dst, const u8 * src) { memcpy(dst, src, 6); Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Fri Mar 23 15:50:01 2018 (r331433) @@ -82,7 +82,7 @@ struct linux_file_wait_queue { struct linux_file { struct file *_file; const struct file_operations *f_op; - void *private_data; + void *private_data; int f_flags; int f_mode; /* Just starting mode. */ struct dentry *f_dentry; @@ -140,7 +140,7 @@ struct file_operations { int (*fasync)(int, struct file *, int); /* Although not supported in FreeBSD, to align with Linux code - * we are adding llseek() only when it is mapped to no_llseek which returns + * we are adding llseek() only when it is mapped to no_llseek which returns * an illegal seek error */ loff_t (*llseek)(struct file *, loff_t, int); @@ -270,7 +270,7 @@ iput(struct inode *inode) vrele(inode); } -static inline loff_t +static inline loff_t no_llseek(struct file *file, loff_t offset, int whence) { Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/idr.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/idr.h Fri Mar 23 15:50:01 2018 (r331433) @@ -96,7 +96,7 @@ int idr_for_each(struct idr *idp, int (*fn)(int id, vo #define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */ #define IDA_BITMAP_LONGS (IDA_CHUNK_SIZE / sizeof(long) - 1) -#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8) +#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8) struct ida_bitmap { long nr_busy; Modified: head/sys/compat/linuxkpi/common/include/linux/if_ether.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/if_ether.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/if_ether.h Fri Mar 23 15:50:01 2018 (r331433) @@ -35,17 +35,17 @@ #include -#define ETH_HLEN ETHER_HDR_LEN /* Total octets in header. */ +#define ETH_HLEN ETHER_HDR_LEN /* Total octets in header. */ #ifndef ETH_ALEN -#define ETH_ALEN ETHER_ADDR_LEN +#define ETH_ALEN ETHER_ADDR_LEN #endif -#define ETH_FCS_LEN 4 /* Octets in the FCS */ -#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) - * that VLAN requires. */ +#define ETH_FCS_LEN 4 /* Octets in the FCS */ +#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) + * that VLAN requires. */ /* * defined Ethernet Protocol ID's. */ -#define ETH_P_IP ETHERTYPE_IP +#define ETH_P_IP ETHERTYPE_IP #define ETH_P_IPV6 ETHERTYPE_IPV6 #define ETH_P_MPLS_UC ETHERTYPE_MPLS #define ETH_P_MPLS_MC ETHERTYPE_MPLS_MCAST Modified: head/sys/compat/linuxkpi/common/include/linux/if_vlan.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/if_vlan.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/if_vlan.h Fri Mar 23 15:50:01 2018 (r331433) @@ -39,7 +39,7 @@ #include #include -#define VLAN_N_VID 4096 +#define VLAN_N_VID 4096 static inline int is_vlan_dev(struct ifnet *ifp) Modified: head/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/io.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/io.h Fri Mar 23 15:50:01 2018 (r331433) @@ -71,7 +71,7 @@ __raw_writeq(uint64_t b, volatile void *addr) static inline void writel(uint32_t b, void *addr) { - *(volatile uint32_t *)addr = b; + *(volatile uint32_t *)addr = b; } #undef writel_relaxed @@ -85,21 +85,21 @@ writel_relaxed(uint32_t b, void *addr) static inline void writeq(uint64_t b, void *addr) { - *(volatile uint64_t *)addr = b; + *(volatile uint64_t *)addr = b; } #undef writeb static inline void writeb(uint8_t b, void *addr) { - *(volatile uint8_t *)addr = b; + *(volatile uint8_t *)addr = b; } #undef writew static inline void writew(uint16_t b, void *addr) { - *(volatile uint16_t *)addr = b; + *(volatile uint16_t *)addr = b; } #undef ioread8 Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/jiffies.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h Fri Mar 23 15:50:01 2018 (r331433) @@ -38,7 +38,7 @@ #include #include -#define jiffies ticks +#define jiffies ticks #define jiffies_64 ticks #define jiffies_to_msecs(x) (((int64_t)(int)(x)) * 1000 / hz) Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Fri Mar 23 15:50:01 2018 (r331433) @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include @@ -170,12 +170,12 @@ scnprintf(char *buf, size_t size, const char *fmt, ... */ #ifdef DEBUG #define pr_debug(fmt, ...) \ - log(LOG_DEBUG, fmt, ##__VA_ARGS__) + log(LOG_DEBUG, fmt, ##__VA_ARGS__) #define pr_devel(fmt, ...) \ log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__) #else #define pr_debug(fmt, ...) \ - ({ if (0) log(LOG_DEBUG, fmt, ##__VA_ARGS__); 0; }) + ({ if (0) log(LOG_DEBUG, fmt, ##__VA_ARGS__); 0; }) #define pr_devel(fmt, ...) \ ({ if (0) log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__); 0; }) #endif @@ -238,19 +238,19 @@ scnprintf(char *buf, size_t size, const char *fmt, ... #ifndef WARN #define WARN(condition, ...) ({ \ - bool __ret_warn_on = (condition); \ - if (unlikely(__ret_warn_on)) \ - pr_warning(__VA_ARGS__); \ - unlikely(__ret_warn_on); \ + bool __ret_warn_on = (condition); \ + if (unlikely(__ret_warn_on)) \ + pr_warning(__VA_ARGS__); \ + unlikely(__ret_warn_on); \ }) #endif #ifndef WARN_ONCE #define WARN_ONCE(condition, ...) ({ \ - bool __ret_warn_on = (condition); \ - if (unlikely(__ret_warn_on)) \ - pr_warn_once(__VA_ARGS__); \ - unlikely(__ret_warn_on); \ + bool __ret_warn_on = (condition); \ + if (unlikely(__ret_warn_on)) \ + pr_warn_once(__VA_ARGS__); \ + unlikely(__ret_warn_on); \ }) #endif @@ -259,7 +259,7 @@ scnprintf(char *buf, size_t size, const char *fmt, ... const __typeof(((type *)0)->member) *__p = (ptr); \ (type *)((uintptr_t)__p - offsetof(type, member)); \ }) - + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define u64_to_user_ptr(val) ((void *)(uintptr_t)(val)) @@ -412,7 +412,7 @@ extern bool linux_cpu_has_clflush; #endif typedef struct pm_message { - int event; + int event; } pm_message_t; /* Swap values of a and b */ Modified: head/sys/compat/linuxkpi/common/include/linux/kmod.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kmod.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/kmod.h Fri Mar 23 15:50:01 2018 (r331433) @@ -41,7 +41,7 @@ #define request_module(...) \ ({\ char modname[128]; \ - int fileid; \ + int fileid; \ snprintf(modname, sizeof(modname), __VA_ARGS__); \ kern_kldload(curthread, modname, &fileid); \ }) Modified: head/sys/compat/linuxkpi/common/include/linux/kobject.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kobject.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/kobject.h Fri Mar 23 15:50:01 2018 (r331433) @@ -61,17 +61,17 @@ struct kobject { extern struct kobject *mm_kobj; struct attribute { - const char *name; + const char *name; struct module *owner; mode_t mode; }; struct kobj_attribute { - struct attribute attr; - ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, - char *buf); - ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, - const char *buf, size_t count); + struct attribute attr; + ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, + char *buf); + ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count); }; static inline void Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/ktime.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/ktime.h Fri Mar 23 15:50:01 2018 (r331433) @@ -40,8 +40,8 @@ /* time values in nanoseconds */ typedef s64 ktime_t; -#define KTIME_MAX ((s64)~((u64)1 << 63)) -#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) static inline int64_t ktime_to_ns(ktime_t kt) Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Fri Mar 23 15:50:01 2018 (r331433) @@ -93,7 +93,7 @@ INIT_LIST_HEAD(struct list_head *list) list->next = list->prev = list; } - + static inline int list_empty(const struct list_head *head) { @@ -159,7 +159,7 @@ linux_list_add(struct list_head *new, struct list_head static inline void list_del_init(struct list_head *entry) -{ +{ list_del(entry); INIT_LIST_HEAD(entry); @@ -167,8 +167,8 @@ list_del_init(struct list_head *entry) #define list_entry(ptr, type, field) container_of(ptr, type, field) -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) #define list_last_entry(ptr, type, member) \ list_entry((ptr)->prev, type, member) @@ -196,7 +196,7 @@ list_del_init(struct list_head *entry) p = list_entry((p)->field.next, typeof(*p), field)) #define list_for_each_entry_safe(p, n, h, field) \ - for (p = list_entry((h)->next, typeof(*p), field), \ + for (p = list_entry((h)->next, typeof(*p), field), \ n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h);\ p = n, n = list_entry(n->field.next, typeof(*n), field)) @@ -208,7 +208,7 @@ list_del_init(struct list_head *entry) for (p = list_next_entry((p), field); &(p)->field != (h); \ p = list_next_entry((p), field)) -#define list_for_each_entry_safe_from(pos, n, head, member) \ +#define list_for_each_entry_safe_from(pos, n, head, member) \ for (n = list_entry((pos)->member.next, typeof(*pos), member); \ &(pos)->member != (head); \ pos = n, n = list_entry(n->member.next, typeof(*n), member)) @@ -218,7 +218,7 @@ list_del_init(struct list_head *entry) p = list_entry((p)->field.prev, typeof(*p), field)) #define list_for_each_entry_safe_reverse(p, n, h, field) \ - for (p = list_entry((h)->prev, typeof(*p), field), \ + for (p = list_entry((h)->prev, typeof(*p), field), \ n = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \ p = n, n = list_entry(n->field.prev, typeof(*n), field)) @@ -259,7 +259,7 @@ list_move_tail(struct list_head *entry, struct list_he } static inline void -linux_list_splice(const struct list_head *list, struct list_head *prev, +linux_list_splice(const struct list_head *list, struct list_head *prev, struct list_head *next) { struct list_head *first; @@ -280,7 +280,7 @@ list_splice(const struct list_head *list, struct list_ { linux_list_splice(list, head, head->next); -} +} static inline void list_splice_tail(struct list_head *list, struct list_head *head) @@ -288,15 +288,15 @@ list_splice_tail(struct list_head *list, struct list_h linux_list_splice(list, head->prev, head); } - + static inline void list_splice_init(struct list_head *list, struct list_head *head) { linux_list_splice(list, head, head->next); - INIT_LIST_HEAD(list); + INIT_LIST_HEAD(list); } - + static inline void list_splice_tail_init(struct list_head *list, struct list_head *head) { @@ -344,9 +344,9 @@ static inline void hlist_del(struct hlist_node *n) { - if (n->next) - n->next->pprev = n->pprev; - *n->pprev = n->next; + if (n->next) + n->next->pprev = n->pprev; + *n->pprev = n->next; } static inline void @@ -379,7 +379,7 @@ hlist_add_before(struct hlist_node *n, struct hlist_no next->pprev = &n->next; *(n->pprev) = n; } - + static inline void hlist_add_after(struct hlist_node *n, struct hlist_node *next) { @@ -390,7 +390,7 @@ hlist_add_after(struct hlist_node *n, struct hlist_nod if (next->next) next->next->pprev = &next->next; } - + static inline void hlist_move_list(struct hlist_head *old, struct hlist_head *new) { @@ -433,11 +433,11 @@ static inline void list_cut_position(struct list_head } static inline int list_is_last(const struct list_head *list, - const struct list_head *head) + const struct list_head *head) { - return list->next == head; + return list->next == head; } - + #define hlist_entry(ptr, type, field) container_of(ptr, type, field) #define hlist_for_each(p, head) \ Modified: head/sys/compat/linuxkpi/common/include/linux/log2.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/log2.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/log2.h Fri Mar 23 15:50:01 2018 (r331433) @@ -50,7 +50,7 @@ is_power_of_2(unsigned long n) static inline unsigned long rounddown_pow_of_two(unsigned long x) { - return (1UL << (flsl(x) - 1)); + return (1UL << (flsl(x) - 1)); } #define ilog2(n) \ Modified: head/sys/compat/linuxkpi/common/include/linux/miscdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/miscdevice.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/miscdevice.h Fri Mar 23 15:50:01 2018 (r331433) @@ -59,7 +59,7 @@ misc_register(struct miscdevice *misc) misc->cdev->owner = THIS_MODULE; misc->cdev->ops = misc->fops; kobject_set_name(&misc->cdev->kobj, misc->name); - if (cdev_add(misc->cdev, misc->this_device->devt, 1)) + if (cdev_add(misc->cdev, misc->this_device->devt, 1)) return -EINVAL; return (0); } Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/mutex.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/mutex.h Fri Mar 23 15:50:01 2018 (r331433) @@ -116,7 +116,7 @@ mutex_is_owned(mutex_t *m) #ifdef WITNESS_ALL /* NOTE: the maximum WITNESS name is 64 chars */ #define __mutex_name(name, file, line) \ - (((const char *){file ":" #line "-" name}) + \ + (((const char *){file ":" #line "-" name}) + \ (sizeof(file) > 16 ? sizeof(file) - 16 : 0)) #else #define __mutex_name(name, file, line) name Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Mar 23 15:50:01 2018 (r331433) @@ -96,8 +96,8 @@ struct pci_device_id { #define PCI_SUBDEVICE_ID_QEMU 0x1100 #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) -#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) -#define PCI_FUNC(devfn) ((devfn) & 0x07) +#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) +#define PCI_FUNC(devfn) ((devfn) & 0x07) #define PCI_VDEVICE(_vendor, _device) \ .vendor = PCI_VENDOR_ID_##_vendor, .device = (_device), \ @@ -467,7 +467,7 @@ pci_find_capability(struct pci_dev *pdev, int capid) static inline int pci_pcie_cap(struct pci_dev *dev) { - return pci_find_capability(dev, PCI_CAP_ID_EXP); + return pci_find_capability(dev, PCI_CAP_ID_EXP); } @@ -598,12 +598,12 @@ pci_enable_msix_range(struct pci_dev *dev, struct msix static inline int pci_channel_offline(struct pci_dev *pdev) { - return false; + return false; } static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) { - return -ENODEV; + return -ENODEV; } static inline void pci_disable_sriov(struct pci_dev *dev) { @@ -666,169 +666,167 @@ typedef unsigned int __bitwise pci_channel_state_t; typedef unsigned int __bitwise pci_ers_result_t; enum pci_channel_state { - pci_channel_io_normal = 1, - pci_channel_io_frozen = 2, - pci_channel_io_perm_failure = 3, + pci_channel_io_normal = 1, + pci_channel_io_frozen = 2, + pci_channel_io_perm_failure = 3, }; enum pci_ers_result { - PCI_ERS_RESULT_NONE = 1, - PCI_ERS_RESULT_CAN_RECOVER = 2, - PCI_ERS_RESULT_NEED_RESET = 3, - PCI_ERS_RESULT_DISCONNECT = 4, - PCI_ERS_RESULT_RECOVERED = 5, + PCI_ERS_RESULT_NONE = 1, + PCI_ERS_RESULT_CAN_RECOVER = 2, + PCI_ERS_RESULT_NEED_RESET = 3, + PCI_ERS_RESULT_DISCONNECT = 4, + PCI_ERS_RESULT_RECOVERED = 5, }; /* PCI bus error event callbacks */ struct pci_error_handlers { - pci_ers_result_t (*error_detected)(struct pci_dev *dev, - enum pci_channel_state error); - pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); - pci_ers_result_t (*link_reset)(struct pci_dev *dev); - pci_ers_result_t (*slot_reset)(struct pci_dev *dev); - void (*resume)(struct pci_dev *dev); + pci_ers_result_t (*error_detected)(struct pci_dev *dev, + enum pci_channel_state error); + pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); + pci_ers_result_t (*link_reset)(struct pci_dev *dev); + pci_ers_result_t (*slot_reset)(struct pci_dev *dev); + void (*resume)(struct pci_dev *dev); }; /* FreeBSD does not support SRIOV - yet */ static inline struct pci_dev *pci_physfn(struct pci_dev *dev) { - return dev; + return dev; } static inline bool pci_is_pcie(struct pci_dev *dev) { - return !!pci_pcie_cap(dev); + return !!pci_pcie_cap(dev); } static inline u16 pcie_flags_reg(struct pci_dev *dev) { - int pos; - u16 reg16; + int pos; + u16 reg16; - pos = pci_find_capability(dev, PCI_CAP_ID_EXP); - if (!pos) - return 0; + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return 0; - pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16); + pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16); - return reg16; + return reg16; } static inline int pci_pcie_type(struct pci_dev *dev) { - return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; + return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; } static inline int pcie_cap_version(struct pci_dev *dev) { - return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS; + return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS; } static inline bool pcie_cap_has_lnkctl(struct pci_dev *dev) { - int type = pci_pcie_type(dev); + int type = pci_pcie_type(dev); - return pcie_cap_version(dev) > 1 || - type == PCI_EXP_TYPE_ROOT_PORT || - type == PCI_EXP_TYPE_ENDPOINT || - type == PCI_EXP_TYPE_LEG_END; + return pcie_cap_version(dev) > 1 || + type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_ENDPOINT || + type == PCI_EXP_TYPE_LEG_END; } static inline bool pcie_cap_has_devctl(const struct pci_dev *dev) { - return true; + return true; } static inline bool pcie_cap_has_sltctl(struct pci_dev *dev) { - int type = pci_pcie_type(dev); + int type = pci_pcie_type(dev); - return pcie_cap_version(dev) > 1 || - type == PCI_EXP_TYPE_ROOT_PORT || - (type == PCI_EXP_TYPE_DOWNSTREAM && - pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT); + return pcie_cap_version(dev) > 1 || type == PCI_EXP_TYPE_ROOT_PORT || + (type == PCI_EXP_TYPE_DOWNSTREAM && + pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT); } static inline bool pcie_cap_has_rtctl(struct pci_dev *dev) { - int type = pci_pcie_type(dev); + int type = pci_pcie_type(dev); - return pcie_cap_version(dev) > 1 || - type == PCI_EXP_TYPE_ROOT_PORT || - type == PCI_EXP_TYPE_RC_EC; + return pcie_cap_version(dev) > 1 || type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_RC_EC; } static bool pcie_capability_reg_implemented(struct pci_dev *dev, int pos) { - if (!pci_is_pcie(dev)) - return false; + if (!pci_is_pcie(dev)) + return false; - switch (pos) { - case PCI_EXP_FLAGS_TYPE: - return true; - case PCI_EXP_DEVCAP: - case PCI_EXP_DEVCTL: - case PCI_EXP_DEVSTA: - return pcie_cap_has_devctl(dev); - case PCI_EXP_LNKCAP: - case PCI_EXP_LNKCTL: - case PCI_EXP_LNKSTA: - return pcie_cap_has_lnkctl(dev); - case PCI_EXP_SLTCAP: - case PCI_EXP_SLTCTL: - case PCI_EXP_SLTSTA: - return pcie_cap_has_sltctl(dev); - case PCI_EXP_RTCTL: - case PCI_EXP_RTCAP: - case PCI_EXP_RTSTA: - return pcie_cap_has_rtctl(dev); - case PCI_EXP_DEVCAP2: - case PCI_EXP_DEVCTL2: - case PCI_EXP_LNKCAP2: - case PCI_EXP_LNKCTL2: - case PCI_EXP_LNKSTA2: - return pcie_cap_version(dev) > 1; - default: - return false; - } + switch (pos) { + case PCI_EXP_FLAGS_TYPE: + return true; + case PCI_EXP_DEVCAP: + case PCI_EXP_DEVCTL: + case PCI_EXP_DEVSTA: + return pcie_cap_has_devctl(dev); + case PCI_EXP_LNKCAP: + case PCI_EXP_LNKCTL: + case PCI_EXP_LNKSTA: + return pcie_cap_has_lnkctl(dev); + case PCI_EXP_SLTCAP: + case PCI_EXP_SLTCTL: + case PCI_EXP_SLTSTA: + return pcie_cap_has_sltctl(dev); + case PCI_EXP_RTCTL: + case PCI_EXP_RTCAP: + case PCI_EXP_RTSTA: + return pcie_cap_has_rtctl(dev); + case PCI_EXP_DEVCAP2: + case PCI_EXP_DEVCTL2: + case PCI_EXP_LNKCAP2: + case PCI_EXP_LNKCTL2: + case PCI_EXP_LNKSTA2: + return pcie_cap_version(dev) > 1; + default: + return false; + } } static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst) { - if (pos & 3) - return -EINVAL; + if (pos & 3) + return -EINVAL; - if (!pcie_capability_reg_implemented(dev, pos)) - return -EINVAL; + if (!pcie_capability_reg_implemented(dev, pos)) + return -EINVAL; - return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst); + return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst); } static inline int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *dst) { - if (pos & 3) - return -EINVAL; + if (pos & 3) + return -EINVAL; - if (!pcie_capability_reg_implemented(dev, pos)) - return -EINVAL; + if (!pcie_capability_reg_implemented(dev, pos)) + return -EINVAL; - return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst); + return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst); } static inline int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) { - if (pos & 1) - return -EINVAL; + if (pos & 1) + return -EINVAL; - if (!pcie_capability_reg_implemented(dev, pos)) - return 0; + if (!pcie_capability_reg_implemented(dev, pos)) + return 0; - return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val); + return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val); } static inline int pcie_get_minimum_link(struct pci_dev *dev, Modified: head/sys/compat/linuxkpi/common/include/linux/rwlock.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rwlock.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/rwlock.h Fri Mar 23 15:50:01 2018 (r331433) @@ -48,9 +48,9 @@ typedef struct { #define read_unlock_irq(lock) read_unlock((lock)) #define write_lock_irq(lock) write_lock((lock)) #define write_unlock_irq(lock) write_unlock((lock)) -#define read_lock_irqsave(lock, flags) \ +#define read_lock_irqsave(lock, flags) \ do {(flags) = 0; read_lock(lock); } while (0) -#define write_lock_irqsave(lock, flags) \ +#define write_lock_irqsave(lock, flags) \ do {(flags) = 0; write_lock(lock); } while (0) #define read_unlock_irqrestore(lock, flags) \ do { read_unlock(lock); } while (0) Modified: head/sys/compat/linuxkpi/common/include/linux/rwsem.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rwsem.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/rwsem.h Fri Mar 23 15:50:01 2018 (r331433) @@ -55,7 +55,7 @@ struct rw_semaphore { #ifdef WITNESS_ALL /* NOTE: the maximum WITNESS name is 64 chars */ #define __rwsem_name(name, file, line) \ - (((const char *){file ":" #line "-" name}) + \ + (((const char *){file ":" #line "-" name}) + \ (sizeof(file) > 16 ? sizeof(file) - 16 : 0)) #else #define __rwsem_name(name, file, line) name Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Fri Mar 23 15:50:01 2018 (r331433) @@ -49,9 +49,9 @@ MALLOC_DECLARE(M_KMALLOC); #define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 0) #define vfree(arg) kfree(arg) #define kvfree(arg) kfree(arg) -#define vmalloc_node(size, node) __vmalloc(size, GFP_KERNEL, 0) -#define vmalloc_user(size) __vmalloc(size, GFP_KERNEL | __GFP_ZERO, 0) -#define vmalloc(size) __vmalloc(size, GFP_KERNEL, 0) +#define vmalloc_node(size, node) __vmalloc(size, GFP_KERNEL, 0) +#define vmalloc_user(size) __vmalloc(size, GFP_KERNEL | __GFP_ZERO, 0) +#define vmalloc(size) __vmalloc(size, GFP_KERNEL, 0) #define __kmalloc(...) kmalloc(__VA_ARGS__) #define kmalloc_node(chunk, flags, n) kmalloc(chunk, flags) @@ -62,7 +62,7 @@ MALLOC_DECLARE(M_KMALLOC); #define kmem_cache linux_kmem_cache #define kmem_cache_create(...) linux_kmem_cache_create(__VA_ARGS__) #define kmem_cache_alloc(...) linux_kmem_cache_alloc(__VA_ARGS__) -#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) +#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) #define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__) #define KMEM_CACHE(__struct, flags) \ @@ -79,7 +79,7 @@ struct linux_kmem_cache { }; #define SLAB_HWCACHE_ALIGN (1 << 0) -#define SLAB_TYPESAFE_BY_RCU (1 << 1) +#define SLAB_TYPESAFE_BY_RCU (1 << 1) #define SLAB_RECLAIM_ACCOUNT (1 << 2) #define SLAB_DESTROY_BY_RCU \ Modified: head/sys/compat/linuxkpi/common/include/linux/spinlock.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/spinlock.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/spinlock.h Fri Mar 23 15:50:01 2018 (r331433) @@ -125,7 +125,7 @@ typedef struct { #ifdef WITNESS_ALL /* NOTE: the maximum WITNESS name is 64 chars */ #define __spin_lock_name(name, file, line) \ - (((const char *){file ":" #line "-" name}) + \ + (((const char *){file ":" #line "-" name}) + \ (sizeof(file) > 16 ? sizeof(file) - 16 : 0)) #else #define __spin_lock_name(name, file, line) name Modified: head/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sysfs.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/sysfs.h Fri Mar 23 15:50:01 2018 (r331433) @@ -45,14 +45,14 @@ struct sysfs_ops { struct attribute_group { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Mar 23 16:15:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7622F55B86; Fri, 23 Mar 2018 16:15:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65E037C474; Fri, 23 Mar 2018 16:15:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60B44222D5; Fri, 23 Mar 2018 16:15:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NGF8jr091857; Fri, 23 Mar 2018 16:15:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGF7n0091852; Fri, 23 Mar 2018 16:15:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803231615.w2NGF7n0091852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 23 Mar 2018 16:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331434 - in stable/11/lib: . libcapsicum X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/lib: . libcapsicum X-SVN-Commit-Revision: 331434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:15:09 -0000 Author: ian Date: Fri Mar 23 16:15:07 2018 New Revision: 331434 URL: https://svnweb.freebsd.org/changeset/base/331434 Log: MFC r306657, r306673, r306726, r307737, r309366, r310135, r323990, r324414 r306657: libcapsicum: introduce Capsicum helpers Capsicum helpers are a set of inline functions which goal is to reduce duplicated patterns used to Capsicumize applications. Reviewed by: cem, AllanJude, bapt, ed, emaste Differential Revision: https://reviews.freebsd.org/D8013 r306673: libcapsicum: limit stderr Don't limit stdout twice, instead limit stderr. Pointed out by: rpokala@ r306726: Add man pages for Capsicum helpers. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D8154 r307737: Fix few sentence in the man page. Pointed out by: wblock r309366: capsicum_helpers: Squash errors from closed fds Squash EBADF from closed stdin, stdout, or stderr in caph_limit_stdio(). Any program used during special shell scripts may commonly be forked from a parent process with closed standard stream. Do the common sense thing for this common use. Reported by: Iblis Lin Reviewed by: oshogbo@ (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8657 r310135: capsicum_helpers: Add LOOKUP flag Add a helper routine for opening a directory that is restricted to being used for opening relative files as stdio streams. I think this will really help basic adaptation of multi-file programs to Capsicum. Rather than having each program initialize a rights object and ioctl/fcntl arrays for their root fd for relative opens, consolidate in the logical place. Reviewed by: oshogbo@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8743 r323990: capsicum_helpers: Add SEEK to default stdio rights set PR: 219173 Sponsored by: Dell EMC Isilon r324414: capsicum_helpers: Add EVENT to default stdio rights set Without it, calling caph_limit_stdio(3) breaks Irssi. Reviewed by: oshogbo Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12622 Added: stable/11/lib/libcapsicum/ - copied from r306657, head/lib/libcapsicum/ stable/11/lib/libcapsicum/Makefile.depend - copied unchanged from r308605, head/lib/libcapsicum/Makefile.depend stable/11/lib/libcapsicum/capsicum_helpers.3 - copied, changed from r306726, head/lib/libcapsicum/capsicum_helpers.3 Modified: stable/11/lib/Makefile stable/11/lib/libcapsicum/Makefile stable/11/lib/libcapsicum/capsicum_helpers.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/Makefile ============================================================================== --- stable/11/lib/Makefile Fri Mar 23 15:50:01 2018 (r331433) +++ stable/11/lib/Makefile Fri Mar 23 16:15:07 2018 (r331434) @@ -38,6 +38,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libbz2 \ libcalendar \ libcam \ + libcapsicum \ ${_libcasper} \ ${_libcom_err} \ libcompat \ Modified: stable/11/lib/libcapsicum/Makefile ============================================================================== --- head/lib/libcapsicum/Makefile Mon Oct 3 20:48:18 2016 (r306657) +++ stable/11/lib/libcapsicum/Makefile Fri Mar 23 16:15:07 2018 (r331434) @@ -4,4 +4,14 @@ PACKAGE=lib${LIB} INCS= capsicum_helpers.h +MAN+= capsicum_helpers.3 + +MLINKS+=capsicum_helpers.3 caph_limit_stream.3 +MLINKS+=capsicum_helpers.3 caph_limit_stdin.3 +MLINKS+=capsicum_helpers.3 caph_limit_stderr.3 +MLINKS+=capsicum_helpers.3 caph_limit_stdout.3 +MLINKS+=capsicum_helpers.3 caph_limit_stdio.3 +MLINKS+=capsicum_helpers.3 caph_cache_tzdata.3 +MLINKS+=capsicum_helpers.3 caph_cache_catpages.3 + .include Copied: stable/11/lib/libcapsicum/Makefile.depend (from r308605, head/lib/libcapsicum/Makefile.depend) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libcapsicum/Makefile.depend Fri Mar 23 16:15:07 2018 (r331434, copy of r308605, head/lib/libcapsicum/Makefile.depend) @@ -0,0 +1,11 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Copied and modified: stable/11/lib/libcapsicum/capsicum_helpers.3 (from r306726, head/lib/libcapsicum/capsicum_helpers.3) ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.3 Wed Oct 5 20:02:34 2016 (r306726, copy source) +++ stable/11/lib/libcapsicum/capsicum_helpers.3 Fri Mar 23 16:15:07 2018 (r331434) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd October 21, 2016 .Dt CAPSICUM_HELPERS 3 .Os .Sh NAME @@ -57,7 +57,8 @@ .Sh DESCRIPTION The .Nm capsicum helpers -are a set of a inline functions which simplify Capsicumizing programs. +are a set of a inline functions which simplify modifying programs to use +Capsicum. The goal is to reduce duplicated code patterns. The .Nm capsicum helpers @@ -70,7 +71,7 @@ restricts capabilities on .Fa fd to only those needed by POSIX stream objects (that is, FILEs). .Pp -The following flags can be provided: +These flags can be provided: .Pp .Bl -tag -width "CAPH_IGNORE_EBADF" -compact -offset indent .It Dv CAPH_IGNORE_EBADF Modified: stable/11/lib/libcapsicum/capsicum_helpers.h ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.h Mon Oct 3 20:48:18 2016 (r306657) +++ stable/11/lib/libcapsicum/capsicum_helpers.h Fri Mar 23 16:15:07 2018 (r331434) @@ -41,6 +41,7 @@ #define CAPH_IGNORE_EBADF 0x0001 #define CAPH_READ 0x0002 #define CAPH_WRITE 0x0004 +#define CAPH_LOOKUP 0x0008 static __inline int caph_limit_stream(int fd, int flags) @@ -48,12 +49,15 @@ caph_limit_stream(int fd, int flags) cap_rights_t rights; unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ }; - cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL); + cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, + CAP_IOCTL, CAP_SEEK); if ((flags & CAPH_READ) != 0) cap_rights_set(&rights, CAP_READ); if ((flags & CAPH_WRITE) != 0) cap_rights_set(&rights, CAP_WRITE); + if ((flags & CAPH_LOOKUP) != 0) + cap_rights_set(&rights, CAP_LOOKUP); if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) { if (errno == EBADF && (flags & CAPH_IGNORE_EBADF) != 0) @@ -94,12 +98,12 @@ caph_limit_stdout(void) static __inline int caph_limit_stdio(void) { + const int iebadf = CAPH_IGNORE_EBADF; - if (caph_limit_stdin() == -1 || caph_limit_stdout() == -1 || - caph_limit_stdout() == -1) { + if (caph_limit_stream(STDIN_FILENO, CAPH_READ | iebadf) == -1 || + caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | iebadf) == -1 || + caph_limit_stream(STDERR_FILENO, CAPH_WRITE | iebadf) == -1) return (-1); - } - return (0); } From owner-svn-src-all@freebsd.org Fri Mar 23 16:23:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDEC8F5675F; Fri, 23 Mar 2018 16:23:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DA3F7CBA8; Fri, 23 Mar 2018 16:23:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E3B522490; Fri, 23 Mar 2018 16:23:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NGNF9w096795; Fri, 23 Mar 2018 16:23:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGNF3i096794; Fri, 23 Mar 2018 16:23:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231623.w2NGNF3i096794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 16:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331435 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:23:16 -0000 Author: imp Date: Fri Mar 23 16:23:15 2018 New Revision: 331435 URL: https://svnweb.freebsd.org/changeset/base/331435 Log: Flag when we have a pending TUR. Don't schedule another one when we have one pending. Otherwise, we can race and send two, which is wasteful in close proximity. It can also cause the acaquire/release count for TUR to be > 1, which is undexpected. PR: 226510 Differential Review: https://reviews.freebsd.org/D14792 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Mar 23 16:15:07 2018 (r331434) +++ head/sys/cam/scsi/scsi_da.c Fri Mar 23 16:23:15 2018 (r331435) @@ -116,7 +116,8 @@ typedef enum { DA_FLAG_CAN_ATA_LOG = 0x008000, DA_FLAG_CAN_ATA_IDLOG = 0x010000, DA_FLAG_CAN_ATA_SUPCAP = 0x020000, - DA_FLAG_CAN_ATA_ZONE = 0x040000 + DA_FLAG_CAN_ATA_ZONE = 0x040000, + DA_FLAG_TUR_PENDING = 0x080000 } da_flags; typedef enum { @@ -2068,7 +2069,8 @@ daasync(void *callback_arg, u_int32_t code, case AC_SCSI_AEN: softc = (struct da_softc *)periph->softc; cam_periph_lock(periph); - if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { + if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) && + (softc->flags & DA_FLAG_TUR_PENDING) == 0) { if (da_periph_acquire(periph, DA_REF_TUR) == 0) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); daschedule(periph); @@ -3113,6 +3115,7 @@ more: bp = cam_iosched_next_bio(softc->cam_iosched); if (bp == NULL) { if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { + softc->flags |= DA_FLAG_TUR_PENDING; cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); scsi_test_unit_ready(&start_ccb->csio, /*retries*/ da_retry_count, @@ -5570,7 +5573,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) if (daerror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_RECOVERY | SF_NO_PRINT) == ERESTART) - return; + return; /* Will complete again, keep reference */ if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, @@ -5579,6 +5582,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) /*getcount_only*/0); } xpt_release_ccb(done_ccb); + softc->flags &= ~DA_FLAG_TUR_PENDING; da_periph_release_locked(periph, DA_REF_TUR); return; } @@ -5700,6 +5704,7 @@ damediapoll(void *arg) struct da_softc *softc = periph->softc; if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) && + (softc->flags & DA_FLAG_TUR_PENDING) == 0 && LIST_EMPTY(&softc->pending_ccbs)) { if (da_periph_acquire(periph, DA_REF_TUR) == 0) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); From owner-svn-src-all@freebsd.org Fri Mar 23 16:38:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37AE5F57DFF; Fri, 23 Mar 2018 16:38:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFA387D963; Fri, 23 Mar 2018 16:38:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 159B710A8BE; Fri, 23 Mar 2018 12:38:52 -0400 (EDT) From: John Baldwin To: Alexey Dokuchaev Cc: Warner Losh , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r331209 - head Date: Thu, 22 Mar 2018 08:52:47 -0700 Message-ID: <3226647.aiAOVF4eaK@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <20180322043938.GA8311@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <20180322043938.GA8311@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 23 Mar 2018 12:38:52 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:38:53 -0000 On Thursday, March 22, 2018 04:39:38 AM Alexey Dokuchaev wrote: > On Wed, Mar 21, 2018 at 10:34:15PM -0600, Warner Losh wrote: > > On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev > > wrote: > > > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > > > ... > > > > How does this fit with the recommended installation steps of doing > > > > 'make installkernel' and rebooting before doing a 'make installworld'? > > > > > > Rebooting? I vaguely recall recommended procedure was to switch to single > > > user mode prior to `installworld', but personally I've never bothered and > > > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? > > > > Old advice was to do the installworld in single user, as that's the safest > > (and also ensures you have a new kernel and don't install before rebooting). > > However, we've had enough experience to see that usually an installworld + > > reboot is sufficient. > > Right, but John had mentioned extra reboot *between* installkernel and > installworld, which I've never heard of before. >From the end up of src/UPDATING: To rebuild everything and install it on the current system. ----------------------------------------------------------- # Note: sometimes if you are running current you gotta do more than # is listed here if you are upgrading from a really old current. make buildworld make kernel KERNCONF=YOUR_KERNEL_HERE [1] [3] mergemaster -Fp [5] make installworld mergemaster -Fi [4] make delete-old [6] See also https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html Often you can take shortcuts, but this is the only process we guarantee will always work. (We will also sometimes add additional shims to make some of the common shortcuts work, but we don't guarantee that.) -- John Baldwin From owner-svn-src-all@freebsd.org Fri Mar 23 16:56:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB8BAF59A79; Fri, 23 Mar 2018 16:56:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D0FD7F433; Fri, 23 Mar 2018 16:56:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9394E2297A; Fri, 23 Mar 2018 16:56:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NGuk4I014968; Fri, 23 Mar 2018 16:56:46 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGuifK014950; Fri, 23 Mar 2018 16:56:44 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803231656.w2NGuifK014950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 23 Mar 2018 16:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331436 - in head: share/man/man9 sys/net sys/netinet sys/netinet6 sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head: share/man/man9 sys/net sys/netinet sys/netinet6 sys/netpfil/pf X-SVN-Commit-Revision: 331436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:56:47 -0000 Author: kp Date: Fri Mar 23 16:56:44 2018 New Revision: 331436 URL: https://svnweb.freebsd.org/changeset/base/331436 Log: netpfil: Introduce PFIL_FWD flag Forwarded packets passed through PFIL_OUT, which made it difficult for firewalls to figure out if they were forwarding or producing packets. This in turn is an issue for pf for IPv6 fragment handling: it needs to call ip6_output() or ip6_forward() to handle the fragments. Figuring out which was difficult (and until now, incorrect). Having pfil distinguish the two removes an ugly piece of code from pf. Introduce a new variant of the netpfil callbacks with a flags variable, which has PFIL_FWD set for forwarded packets. This allows pf to reliably work out if a packet is forwarded. Reviewed by: ae, kevans Differential Revision: https://reviews.freebsd.org/D13715 Modified: head/share/man/man9/pfil.9 head/sys/net/if_bridge.c head/sys/net/if_enc.c head/sys/net/if_ethersubr.c head/sys/net/pfil.c head/sys/net/pfil.h head/sys/net/pfvar.h head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet6/ip6_fastfwd.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf.h head/sys/netpfil/pf/pf_ioctl.c Modified: head/share/man/man9/pfil.9 ============================================================================== --- head/share/man/man9/pfil.9 Fri Mar 23 16:23:15 2018 (r331435) +++ head/share/man/man9/pfil.9 Fri Mar 23 16:56:44 2018 (r331436) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2017 +.Dd March 10, 2018 .Dt PFIL 9 .Os .Sh NAME @@ -37,7 +37,9 @@ .Nm pfil_head_unregister , .Nm pfil_head_get , .Nm pfil_add_hook , +.Nm pfil_add_hook_flags , .Nm pfil_remove_hook , +.Nm pfil_remove_hook_flags , .Nm pfil_run_hooks , .Nm pfil_rlock , .Nm pfil_runlock , @@ -51,6 +53,8 @@ .In net/pfil.h .Bd -literal typedef int (*pfil_func_t)(void *arg, struct mbuf **mp, struct ifnet *, int dir, struct inpcb); +.Bd -literal +typedef int (*pfil_func_flags_t)(void *arg, struct mbuf **mp, struct ifnet *, int dir, int flags, struct inpcb); .Ft int .Fn pfil_head_register "struct pfil_head *head" .Ft int @@ -58,11 +62,15 @@ typedef int (*pfil_func_t)(void *arg, struct mbuf **mp .Ft "struct pfil_head *" .Fn pfil_head_get "int af" "u_long dlt" .Ft int -.Fn pfil_add_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *" +.Fn pfil_add_hook "pfil_func_t" "void *arg" "struct pfil_head *" .Ft int -.Fn pfil_remove_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *" +.Fn pfil_add_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct pfil_head *" .Ft int -.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *" +.Fn pfil_remove_hook "pfil_func_t" "void *arg" "struct pfil_head *" +.Ft int +.Fn pfil_remove_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct pfil_head *" +.Ft int +.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet *" "int dir" "int flags" "struct inpcb *" .Ft void .Fn pfil_rlock "struct pfil_head *" "struct rm_priotracker *" .Ft void @@ -116,6 +124,7 @@ with the and .Fn pfil_remove_hook functions, respectively. +.I The head is looked up using the .Fn pfil_head_get function, which takes the key and data link type that the packet filter @@ -135,6 +144,10 @@ interface that the packet is traversing, and the direc or .Dv PFIL_OUT ) that the packet is traveling. +The +.Vt flags +argument will indicate if an outgoing packet is simply being forwarded with the +value PFIL_FWD. The filter may change which mbuf the .Vt "mbuf\ **" argument references. Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/if_bridge.c Fri Mar 23 16:56:44 2018 (r331436) @@ -3176,7 +3176,8 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru if (PFIL_HOOKED(&V_link_pfil_hook) && V_pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { - error = pfil_run_hooks(&V_link_pfil_hook, mp, ifp, dir, NULL); + error = pfil_run_hooks(&V_link_pfil_hook, mp, ifp, dir, 0, + NULL); if (*mp == NULL || error != 0) /* packet consumed by filter */ return (error); @@ -3228,21 +3229,21 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru */ if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_member && ifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_bridge && dir == PFIL_IN && bifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; @@ -3282,21 +3283,21 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru case ETHERTYPE_IPV6: if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_member && ifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, ifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_bridge && dir == PFIL_IN && bifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); break; #endif default: Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/if_enc.c Fri Mar 23 16:56:44 2018 (r331436) @@ -301,7 +301,7 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * /* Make a packet looks like it was received on enc(4) */ rcvif = (*ctx->mp)->m_pkthdr.rcvif; (*ctx->mp)->m_pkthdr.rcvif = ifp; - if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, ctx->inp) != 0 || + if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, 0, ctx->inp) != 0 || *ctx->mp == NULL) { *ctx->mp = NULL; /* consumed by filter */ return (EACCES); Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/if_ethersubr.c Fri Mar 23 16:56:44 2018 (r331436) @@ -449,7 +449,8 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m) int i; if (PFIL_HOOKED(&V_link_pfil_hook)) { - i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_OUT, NULL); + i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_OUT, 0, + NULL); if (i != 0) return (EACCES); @@ -782,7 +783,8 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) /* Do not grab PROMISC frames in case we are re-entered. */ if (PFIL_HOOKED(&V_link_pfil_hook) && !(m->m_flags & M_PROMISC)) { - i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_IN, NULL); + i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_IN, 0, + NULL); if (i != 0 || m == NULL) return; Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/pfil.c Fri Mar 23 16:56:44 2018 (r331436) @@ -57,7 +57,8 @@ MTX_SYSINIT(pfil_heads_lock, &pfil_global_lock, "pfil_ static struct packet_filter_hook *pfil_chain_get(int, struct pfil_head *); static int pfil_chain_add(pfil_chain_t *, struct packet_filter_hook *, int); -static int pfil_chain_remove(pfil_chain_t *, pfil_func_t, void *); +static int pfil_chain_remove(pfil_chain_t *, void *, void *); +static int pfil_add_hook_priv(void *, void *, int, struct pfil_head *, bool); LIST_HEAD(pfilheadhead, pfil_head); VNET_DEFINE(struct pfilheadhead, pfil_head_list); @@ -95,7 +96,7 @@ VNET_DEFINE(struct rmlock, pfil_lock); */ int pfil_run_hooks(struct pfil_head *ph, struct mbuf **mp, struct ifnet *ifp, - int dir, struct inpcb *inp) + int dir, int flags, struct inpcb *inp) { struct rm_priotracker rmpt; struct packet_filter_hook *pfh; @@ -106,6 +107,12 @@ pfil_run_hooks(struct pfil_head *ph, struct mbuf **mp, KASSERT(ph->ph_nhooks >= 0, ("Pfil hook count dropped < 0")); for (pfh = pfil_chain_get(dir, ph); pfh != NULL; pfh = TAILQ_NEXT(pfh, pfil_chain)) { + if (pfh->pfil_func_flags != NULL) { + rv = (*pfh->pfil_func_flags)(pfh->pfil_arg, &m, ifp, + dir, flags, inp); + if (rv != 0 || m == NULL) + break; + } if (pfh->pfil_func != NULL) { rv = (*pfh->pfil_func)(pfh->pfil_arg, &m, ifp, dir, inp); @@ -256,6 +263,21 @@ pfil_head_get(int type, u_long val) } /* + * pfil_add_hook_flags() adds a function to the packet filter hook. the + * flags are: + * PFIL_IN call me on incoming packets + * PFIL_OUT call me on outgoing packets + * PFIL_ALL call me on all of the above + * PFIL_WAITOK OK to call malloc with M_WAITOK. + */ +int +pfil_add_hook_flags(pfil_func_flags_t func, void *arg, int flags, + struct pfil_head *ph) +{ + return (pfil_add_hook_priv(func, arg, flags, ph, true)); +} + +/* * pfil_add_hook() adds a function to the packet filter hook. the * flags are: * PFIL_IN call me on incoming packets @@ -266,6 +288,13 @@ pfil_head_get(int type, u_long val) int pfil_add_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { + return (pfil_add_hook_priv(func, arg, flags, ph, false)); +} + +static int +pfil_add_hook_priv(void *func, void *arg, int flags, + struct pfil_head *ph, bool hasflags) +{ struct packet_filter_hook *pfh1 = NULL; struct packet_filter_hook *pfh2 = NULL; int err; @@ -288,7 +317,8 @@ pfil_add_hook(pfil_func_t func, void *arg, int flags, } PFIL_WLOCK(ph); if (flags & PFIL_IN) { - pfh1->pfil_func = func; + pfh1->pfil_func_flags = hasflags ? func : NULL; + pfh1->pfil_func = hasflags ? NULL : func; pfh1->pfil_arg = arg; err = pfil_chain_add(&ph->ph_in, pfh1, flags & ~PFIL_OUT); if (err) @@ -296,7 +326,8 @@ pfil_add_hook(pfil_func_t func, void *arg, int flags, ph->ph_nhooks++; } if (flags & PFIL_OUT) { - pfh2->pfil_func = func; + pfh2->pfil_func_flags = hasflags ? func : NULL; + pfh2->pfil_func = hasflags ? NULL : func; pfh2->pfil_arg = arg; err = pfil_chain_add(&ph->ph_out, pfh2, flags & ~PFIL_IN); if (err) { @@ -319,6 +350,17 @@ error: } /* + * pfil_remove_hook_flags removes a specific function from the packet filter hook + * chain. + */ +int +pfil_remove_hook_flags(pfil_func_flags_t func, void *arg, int flags, + struct pfil_head *ph) +{ + return (pfil_remove_hook((pfil_func_t)func, arg, flags, ph)); +} + +/* * pfil_remove_hook removes a specific function from the packet filter hook * chain. */ @@ -354,7 +396,9 @@ pfil_chain_add(pfil_chain_t *chain, struct packet_filt * First make sure the hook is not already there. */ TAILQ_FOREACH(pfh, chain, pfil_chain) - if (pfh->pfil_func == pfh1->pfil_func && + if (((pfh->pfil_func != NULL && pfh->pfil_func == pfh1->pfil_func) || + (pfh->pfil_func_flags != NULL && + pfh->pfil_func_flags == pfh1->pfil_func_flags)) && pfh->pfil_arg == pfh1->pfil_arg) return (EEXIST); @@ -373,12 +417,13 @@ pfil_chain_add(pfil_chain_t *chain, struct packet_filt * Internal: Remove a pfil hook from a hook chain. */ static int -pfil_chain_remove(pfil_chain_t *chain, pfil_func_t func, void *arg) +pfil_chain_remove(pfil_chain_t *chain, void *func, void *arg) { struct packet_filter_hook *pfh; TAILQ_FOREACH(pfh, chain, pfil_chain) - if (pfh->pfil_func == func && pfh->pfil_arg == arg) { + if ((pfh->pfil_func == func || pfh->pfil_func_flags == func) && + pfh->pfil_arg == arg) { TAILQ_REMOVE(chain, pfh, pfil_chain); free(pfh, M_IFADDR); return (0); Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/pfil.h Fri Mar 23 16:56:44 2018 (r331436) @@ -48,6 +48,8 @@ struct inpcb; typedef int (*pfil_func_t)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *); +typedef int (*pfil_func_flags_t)(void *, struct mbuf **, struct ifnet *, + int, int, struct inpcb *); /* * The packet filter hooks are designed for anything to call them to @@ -56,13 +58,15 @@ typedef int (*pfil_func_t)(void *, struct mbuf **, str */ struct packet_filter_hook { TAILQ_ENTRY(packet_filter_hook) pfil_chain; - pfil_func_t pfil_func; - void *pfil_arg; + pfil_func_t pfil_func; + pfil_func_flags_t pfil_func_flags; + void *pfil_arg; }; #define PFIL_IN 0x00000001 #define PFIL_OUT 0x00000002 #define PFIL_WAITOK 0x00000004 +#define PFIL_FWD 0x00000008 #define PFIL_ALL (PFIL_IN|PFIL_OUT) typedef TAILQ_HEAD(pfil_chain, packet_filter_hook) pfil_chain_t; @@ -102,13 +106,15 @@ VNET_DECLARE(struct rmlock, pfil_lock); /* Public functions for pfil hook management by packet filters. */ struct pfil_head *pfil_head_get(int, u_long); +int pfil_add_hook_flags(pfil_func_flags_t, void *, int, struct pfil_head *); int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *); +int pfil_remove_hook_flags(pfil_func_flags_t, void *, int, struct pfil_head *); int pfil_remove_hook(pfil_func_t, void *, int, struct pfil_head *); #define PFIL_HOOKED(p) ((p)->ph_nhooks > 0) /* Public functions to run the packet inspection by protocols. */ -int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, - int, struct inpcb *inp); +int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, int, + int, struct inpcb *inp); /* Public functions for pfil head management by protocols. */ int pfil_head_register(struct pfil_head *); Modified: head/sys/net/pfvar.h ============================================================================== --- head/sys/net/pfvar.h Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/pfvar.h Fri Mar 23 16:56:44 2018 (r331436) @@ -1578,13 +1578,13 @@ extern void pf_addrcpy(struct pf_addr *, struct pf_ void pf_free_rule(struct pf_rule *); #ifdef INET -int pf_test(int, struct ifnet *, struct mbuf **, struct inpcb *); +int pf_test(int, int, struct ifnet *, struct mbuf **, struct inpcb *); int pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *, struct pf_pdesc *); #endif /* INET */ #ifdef INET6 -int pf_test6(int, struct ifnet *, struct mbuf **, struct inpcb *); +int pf_test6(int, int, struct ifnet *, struct mbuf **, struct inpcb *); int pf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *, struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet/ip_fastfwd.c Fri Mar 23 16:56:44 2018 (r331436) @@ -232,7 +232,7 @@ ip_tryforward(struct mbuf *m) goto passin; if (pfil_run_hooks( - &V_inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL) || + &V_inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, 0, NULL) || m == NULL) goto drop; @@ -305,8 +305,8 @@ passin: if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; - if (pfil_run_hooks(&V_inet_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, NULL) || - m == NULL) { + if (pfil_run_hooks(&V_inet_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, PFIL_FWD, + NULL) || m == NULL) { goto drop; } Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet/ip_input.c Fri Mar 23 16:56:44 2018 (r331436) @@ -600,7 +600,7 @@ tooshort: goto passin; odst = ip->ip_dst; - if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_IN, NULL) != 0) + if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_IN, 0, NULL) != 0) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet/ip_output.c Fri Mar 23 16:56:44 2018 (r331436) @@ -117,7 +117,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, st /* Run through list of hooks for output packets. */ odst.s_addr = ip->ip_dst.s_addr; - *error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, PFIL_OUT, inp); + *error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, PFIL_OUT, 0, inp); m = *mp; if ((*error) != 0 || m == NULL) return 1; /* Finished */ Modified: head/sys/netinet6/ip6_fastfwd.c ============================================================================== --- head/sys/netinet6/ip6_fastfwd.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_fastfwd.c Fri Mar 23 16:56:44 2018 (r331436) @@ -157,7 +157,7 @@ ip6_tryforward(struct mbuf *m) */ if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passin; - if (pfil_run_hooks(&V_inet6_pfil_hook, &m, rcvif, PFIL_IN, + if (pfil_run_hooks(&V_inet6_pfil_hook, &m, rcvif, PFIL_IN, 0, NULL) != 0 || m == NULL) goto dropin; /* @@ -201,7 +201,7 @@ passin: if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passout; if (pfil_run_hooks(&V_inet6_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, - NULL) != 0 || m == NULL) + PFIL_FWD, NULL) != 0 || m == NULL) goto dropout; /* Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_forward.c Fri Mar 23 16:56:44 2018 (r331436) @@ -324,8 +324,9 @@ again2: goto pass; odst = ip6->ip6_dst; - /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&V_inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, NULL); + /* Run through list of hooks for forwarded packets. */ + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, + PFIL_FWD, NULL); if (error != 0 || m == NULL) goto freecopy; /* consumed by filter */ ip6 = mtod(m, struct ip6_hdr *); Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_input.c Fri Mar 23 16:56:44 2018 (r331436) @@ -761,7 +761,7 @@ ip6_input(struct mbuf *m) odst = ip6->ip6_dst; if (pfil_run_hooks(&V_inet6_pfil_hook, &m, - m->m_pkthdr.rcvif, PFIL_IN, NULL)) + m->m_pkthdr.rcvif, PFIL_IN, 0, NULL)) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_output.c Fri Mar 23 16:56:44 2018 (r331436) @@ -785,7 +785,7 @@ again: odst = ip6->ip6_dst; /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&V_inet6_pfil_hook, &m, ifp, PFIL_OUT, inp); + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, ifp, PFIL_OUT, 0, inp); if (error != 0 || m == NULL) goto done; /* adjust pointer */ Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netpfil/pf/pf.c Fri Mar 23 16:56:44 2018 (r331436) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -5506,7 +5507,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, goto bad; if (oifp != ifp) { - if (pf_test(PF_OUT, ifp, &m0, NULL) != PF_PASS) + if (pf_test(PF_OUT, 0, ifp, &m0, NULL) != PF_PASS) goto bad; else if (m0 == NULL) goto done; @@ -5668,7 +5669,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, goto bad; if (oifp != ifp) { - if (pf_test6(PF_FWD, ifp, &m0, NULL) != PF_PASS) + if (pf_test6(PF_OUT, PFIL_FWD, ifp, &m0, NULL) != PF_PASS) goto bad; else if (m0 == NULL) goto done; @@ -5858,7 +5859,7 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, #ifdef INET int -pf_test(int dir, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) +pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { struct pfi_kif *kif; u_short action, reason = 0, log = 0; @@ -6245,7 +6246,7 @@ done: #ifdef INET6 int -pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) +pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { struct pfi_kif *kif; u_short action, reason = 0, log = 0; @@ -6257,28 +6258,9 @@ pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0, struct pf_ruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; - int fwdir = dir; M_ASSERTPKTHDR(m); - /* Detect packet forwarding. - * If the input interface is different from the output interface we're - * forwarding. - * We do need to be careful about bridges. If the - * net.link.bridge.pfil_bridge sysctl is set we can be filtering on a - * bridge, so if the input interface is a bridge member and the output - * interface is its bridge or a member of the same bridge we're not - * actually forwarding but bridging. - */ - if (dir == PF_OUT && m->m_pkthdr.rcvif && ifp != m->m_pkthdr.rcvif && - (m->m_pkthdr.rcvif->if_bridge == NULL || - (m->m_pkthdr.rcvif->if_bridge != ifp->if_softc && - m->m_pkthdr.rcvif->if_bridge != ifp->if_bridge))) - fwdir = PF_FWD; - - if (dir == PF_FWD) - dir = PF_OUT; - if (!V_pf_status.running) return (PF_PASS); @@ -6656,7 +6638,7 @@ done: PF_STATE_UNLOCK(s); /* If reassembled packet passed, create new fragments. */ - if (action == PF_PASS && *m0 && fwdir == PF_FWD && + if (action == PF_PASS && *m0 && (pflags & PFIL_FWD) && (mtag = m_tag_find(m, PF_REASSEMBLED, NULL)) != NULL) action = pf_refragment6(ifp, m0, mtag); Modified: head/sys/netpfil/pf/pf.h ============================================================================== --- head/sys/netpfil/pf/pf.h Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netpfil/pf/pf.h Fri Mar 23 16:56:44 2018 (r331436) @@ -45,7 +45,7 @@ #endif #endif -enum { PF_INOUT, PF_IN, PF_OUT, PF_FWD }; +enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netpfil/pf/pf_ioctl.c Fri Mar 23 16:56:44 2018 (r331436) @@ -165,15 +165,15 @@ static void pf_tbladdr_copyout(struct pf_addr_wrap * */ #ifdef INET static int pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); static int pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); #endif #ifdef INET6 static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); static int pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); #endif static int hook_pf(void); @@ -3649,12 +3649,12 @@ shutdown_pf(void) #ifdef INET static int -pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; - chk = pf_test(PF_IN, ifp, m, inp); + chk = pf_test(PF_IN, flags, ifp, m, inp); if (chk && *m) { m_freem(*m); *m = NULL; @@ -3666,12 +3666,12 @@ pf_check_in(void *arg, struct mbuf **m, struct ifnet * } static int -pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; - chk = pf_test(PF_OUT, ifp, m, inp); + chk = pf_test(PF_OUT, flags, ifp, m, inp); if (chk && *m) { m_freem(*m); *m = NULL; @@ -3685,7 +3685,7 @@ pf_check_out(void *arg, struct mbuf **m, struct ifnet #ifdef INET6 static int -pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; @@ -3696,7 +3696,7 @@ pf_check6_in(void *arg, struct mbuf **m, struct ifnet * filtering we have change this to lo0 as it is the case in IPv4. */ CURVNET_SET(ifp->if_vnet); - chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, inp); + chk = pf_test6(PF_IN, flags, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, inp); CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); @@ -3708,13 +3708,13 @@ pf_check6_in(void *arg, struct mbuf **m, struct ifnet } static int -pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; CURVNET_SET(ifp->if_vnet); - chk = pf_test6(PF_OUT, ifp, m, inp); + chk = pf_test6(PF_OUT, flags, ifp, m, inp); CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); @@ -3743,22 +3743,22 @@ hook_pf(void) pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); if (pfh_inet == NULL) return (ESRCH); /* XXX */ - pfil_add_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); - pfil_add_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); + pfil_add_hook_flags(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); + pfil_add_hook_flags(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); #endif #ifdef INET6 pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6); if (pfh_inet6 == NULL) { #ifdef INET - pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); - pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); #endif return (ESRCH); /* XXX */ } - pfil_add_hook(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6); - pfil_add_hook(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6); + pfil_add_hook_flags(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6); + pfil_add_hook_flags(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6); #endif V_pf_pfil_hooked = 1; @@ -3782,18 +3782,18 @@ dehook_pf(void) pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); if (pfh_inet == NULL) return (ESRCH); /* XXX */ - pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); - pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); #endif #ifdef INET6 pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6); if (pfh_inet6 == NULL) return (ESRCH); /* XXX */ - pfil_remove_hook(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6); - pfil_remove_hook(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6); #endif From owner-svn-src-all@freebsd.org Fri Mar 23 16:59:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 374C5F59E7F; Fri, 23 Mar 2018 16:59:52 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE4537F6D8; Fri, 23 Mar 2018 16:59:51 +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 D4E50229AA; Fri, 23 Mar 2018 16:59:51 +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 w2NGxp8n015111; Fri, 23 Mar 2018 16:59:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGxpwS015109; Fri, 23 Mar 2018 16:59:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231659.w2NGxpwS015109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 16:59:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331437 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 331437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:59:52 -0000 Author: hselasky Date: Fri Mar 23 16:59:51 2018 New Revision: 331437 URL: https://svnweb.freebsd.org/changeset/base/331437 Log: Create designated workqueue for each mlx5en(4) device instance. The mlx5e_destroy_ifp() function may be called from the system workqueue and in this case trying to flush all works will cause a dead lock. Instead of using the system workqueue, create a designated workqueue for each mlx5en(4) device instance. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Fri Mar 23 16:56:44 2018 (r331436) +++ head/sys/dev/mlx5/mlx5_en/en.h Fri Mar 23 16:59:51 2018 (r331437) @@ -769,6 +769,8 @@ struct mlx5e_priv { struct mlx5e_stats stats; int counter_set_id; + struct workqueue_struct *wq; + eventhandler_tag vlan_detach; eventhandler_tag vlan_attach; struct ifmedia media; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 16:56:44 2018 (r331436) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 16:59:51 2018 (r331437) @@ -642,7 +642,7 @@ mlx5e_update_stats(void *arg) { struct mlx5e_priv *priv = arg; - schedule_work(&priv->update_stats_work); + queue_work(priv->wq, &priv->update_stats_work); callout_reset(&priv->watchdog, hz, &mlx5e_update_stats, priv); } @@ -654,7 +654,7 @@ mlx5e_async_event_sub(struct mlx5e_priv *priv, switch (event) { case MLX5_DEV_EVENT_PORT_UP: case MLX5_DEV_EVENT_PORT_DOWN: - schedule_work(&priv->update_carrier_work); + queue_work(priv->wq, &priv->update_carrier_work); break; default: @@ -2686,7 +2686,7 @@ mlx5e_set_rx_mode(struct ifnet *ifp) { struct mlx5e_priv *priv = ifp->if_softc; - schedule_work(&priv->set_rx_mode_work); + queue_work(priv->wq, &priv->set_rx_mode_work); } static int @@ -3540,11 +3540,20 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_sysctl; } mlx5e_build_ifp_priv(mdev, priv, ncv); + + snprintf(unit, sizeof(unit), "mce%u_wq", + device_get_unit(mdev->pdev->dev.bsddev)); + priv->wq = alloc_workqueue(unit, 0, 1); + if (priv->wq == NULL) { + if_printf(ifp, "%s: alloc_workqueue failed\n", __func__); + goto err_free_sysctl; + } + err = mlx5_alloc_map_uar(mdev, &priv->cq_uar); if (err) { if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n", __func__, err); - goto err_free_sysctl; + goto err_free_wq; } err = mlx5_core_alloc_pd(mdev, &priv->pdn); if (err) { @@ -3666,6 +3675,9 @@ err_dealloc_pd: err_unmap_free_uar: mlx5_unmap_free_uar(mdev, &priv->cq_uar); +err_free_wq: + destroy_workqueue(priv->wq); + err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); @@ -3728,7 +3740,7 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); mlx5e_disable_async_events(priv); - flush_scheduled_work(); + destroy_workqueue(priv->wq); mlx5e_priv_mtx_destroy(priv); free(priv, M_MLX5EN); } From owner-svn-src-all@freebsd.org Fri Mar 23 17:03:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A5E2F5A5D6; Fri, 23 Mar 2018 17:03:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CE467FD2E; Fri, 23 Mar 2018 17:03:43 +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 4618022B3C; Fri, 23 Mar 2018 17:03:43 +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 w2NH3h2W020020; Fri, 23 Mar 2018 17:03:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NH3hvr020019; Fri, 23 Mar 2018 17:03:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231703.w2NH3hvr020019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 17:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331438 - head/sys/contrib/rdma/krping X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/contrib/rdma/krping X-SVN-Commit-Revision: 331438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:03:43 -0000 Author: hselasky Date: Fri Mar 23 17:03:42 2018 New Revision: 331438 URL: https://svnweb.freebsd.org/changeset/base/331438 Log: Exit krping on device removal to avoid endless hang situation. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/contrib/rdma/krping/krping.c Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Fri Mar 23 16:59:51 2018 (r331437) +++ head/sys/contrib/rdma/krping/krping.c Fri Mar 23 17:03:42 2018 (r331438) @@ -301,6 +301,8 @@ static int krping_cma_event_handler(struct rdma_cm_id case RDMA_CM_EVENT_DEVICE_REMOVAL: printk(KERN_ERR PFX "cma detected device removal!!!!\n"); + cb->state = ERROR; + wake_up_interruptible(&cb->sem); break; default: From owner-svn-src-all@freebsd.org Fri Mar 23 17:16:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B5B5F5B6F5; Fri, 23 Mar 2018 17:16:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2E2D805E0; Fri, 23 Mar 2018 17:16:36 +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 C9AF622CE6; Fri, 23 Mar 2018 17:16:36 +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 w2NHGac0025081; Fri, 23 Mar 2018 17:16:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHGagt025060; Fri, 23 Mar 2018 17:16:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231716.w2NHGagt025060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 17:16:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331439 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:16:37 -0000 Author: emaste Date: Fri Mar 23 17:16:36 2018 New Revision: 331439 URL: https://svnweb.freebsd.org/changeset/base/331439 Log: Sort headers in MD Linuxulator files Bring #includes closer to style(9) and reduce differences between the (three) MD versions of linux_machdep.c and linux_sysvec.c. Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_machdep.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_machdep.c Modified: head/sys/amd64/linux/linux_machdep.c ============================================================================== --- head/sys/amd64/linux/linux_machdep.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux/linux_machdep.c Fri Mar 23 17:16:36 2018 (r331439) @@ -33,15 +33,14 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include +#include #include -#include #include +#include #include -#include #include +#include #include #include #include @@ -55,8 +54,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include +#include #include #include @@ -72,21 +72,21 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include #include #include -#include +#include #include +#include #include #include #include #include -#include #include Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:16:36 2018 (r331439) @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include #include #include #include Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux32/linux32_machdep.c Fri Mar 23 17:16:36 2018 (r331439) @@ -36,13 +36,12 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include -#include -#include #include -#include -#include #include +#include +#include #include +#include #include #include #include @@ -54,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -63,19 +63,19 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include #include +#include #include #include #include #include #include -#include static void bsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:16:36 2018 (r331439) @@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include #include #include #include Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/i386/linux/linux_machdep.c Fri Mar 23 17:16:36 2018 (r331439) @@ -30,45 +30,45 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#include #include +#include #include #include #include #include #include -#include #include #include #include #include #include +#include #include #include #include +#include +#include #include #include -#include #include #include #include #include -#include #include +#include #include #include #include +#include #include #include #include #include #include -#include #include /* needed for pcb definition in linux_set_thread_area */ From owner-svn-src-all@freebsd.org Fri Mar 23 17:22:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7E01F5C091; Fri, 23 Mar 2018 17:22:28 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A89580E37; Fri, 23 Mar 2018 17:22:28 +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 7583022E6D; Fri, 23 Mar 2018 17:22:28 +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 w2NHMSfO030139; Fri, 23 Mar 2018 17:22:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHMS9W030138; Fri, 23 Mar 2018 17:22:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803231722.w2NHMS9W030138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 17:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331440 - head/stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/i386/libi386 X-SVN-Commit-Revision: 331440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:22:29 -0000 Author: kevans Date: Fri Mar 23 17:22:28 2018 New Revision: 331440 URL: https://svnweb.freebsd.org/changeset/base/331440 Log: Match broken style of vidconsole.c This particular function uses a broken mix of indentation styles. Match it for the newly added SGR 22 bits. Reported by: jkim X-MFC-With: r331416 Modified: head/stand/i386/libi386/vidconsole.c Modified: head/stand/i386/libi386/vidconsole.c ============================================================================== --- head/stand/i386/libi386/vidconsole.c Fri Mar 23 17:16:36 2018 (r331439) +++ head/stand/i386/libi386/vidconsole.c Fri Mar 23 17:22:28 2018 (r331440) @@ -449,9 +449,9 @@ vidc_term_emu(int c) fg_c = bg_c; bg_c = t; break; - case 22: /* normal intensity */ - fg_c &= ~0x8; - break; + case 22: /* normal intensity */ + fg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; From owner-svn-src-all@freebsd.org Fri Mar 23 17:25:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C178CF5C3DC; Fri, 23 Mar 2018 17:25:19 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74ADF810DF; Fri, 23 Mar 2018 17:25:19 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FB2922E7A; Fri, 23 Mar 2018 17:25:19 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NHPJwH030278; Fri, 23 Mar 2018 17:25:19 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHPJ6V030277; Fri, 23 Mar 2018 17:25:19 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201803231725.w2NHPJ6V030277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Fri, 23 Mar 2018 17:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331441 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 331441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:25:19 -0000 Author: cognet Date: Fri Mar 23 17:25:19 2018 New Revision: 331441 URL: https://svnweb.freebsd.org/changeset/base/331441 Log: In __sync_bool_compare_and_swap(), return true if the returned value is the same as the expected one, not the desired one. Pointy hat to: cognet MFC after: 3 days Modified: head/sys/mips/mips/stdatomic.c Modified: head/sys/mips/mips/stdatomic.c ============================================================================== --- head/sys/mips/mips/stdatomic.c Fri Mar 23 17:22:28 2018 (r331440) +++ head/sys/mips/mips/stdatomic.c Fri Mar 23 17:25:19 2018 (r331441) @@ -327,7 +327,7 @@ __sync_bool_compare_and_swap_4(uint32_t *mem, uint32_t { return (do_compare_and_swap_4(mem, expected, desired) == - desired); + expected); } #define EMIT_FETCH_AND_OP_4(name, op) \ From owner-svn-src-all@freebsd.org Fri Mar 23 17:28:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01F3CF5C84E; Fri, 23 Mar 2018 17:28:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4CBC813F1; Fri, 23 Mar 2018 17:28:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B89722E7B; Fri, 23 Mar 2018 17:28:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NHS4po030411; Fri, 23 Mar 2018 17:28:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHS4ck030409; Fri, 23 Mar 2018 17:28:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231728.w2NHS4ck030409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 17:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331442 - in head/sys/amd64: linux linux32 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys/amd64: linux linux32 X-SVN-Commit-Revision: 331442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:28:05 -0000 Author: emaste Date: Fri Mar 23 17:28:04 2018 New Revision: 331442 URL: https://svnweb.freebsd.org/changeset/base/331442 Log: Fixup return style(9) in amd64 linux*_sysvec.c Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:25:19 2018 (r331441) +++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:28:04 2018 (r331442) @@ -184,15 +184,15 @@ linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) - return signal; + return (signal); switch (trap_code) { case T_PROTFLT: case T_TSSFLT: case T_DOUBLEFLT: case T_PAGEFLT: - return SIGSEGV; + return (SIGSEGV); default: - return signal; + return (signal); } } Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:25:19 2018 (r331441) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:28:04 2018 (r331442) @@ -193,15 +193,15 @@ static int linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) - return signal; + return (signal); switch (trap_code) { case T_PROTFLT: case T_TSSFLT: case T_DOUBLEFLT: case T_PAGEFLT: - return SIGSEGV; + return (SIGSEGV); default: - return signal; + return (signal); } } From owner-svn-src-all@freebsd.org Fri Mar 23 17:33:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87F5CF5D0DE; Fri, 23 Mar 2018 17:33: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3455081A60; Fri, 23 Mar 2018 17:33: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 2F28A2300C; Fri, 23 Mar 2018 17:33: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 w2NHXFbL035308; Fri, 23 Mar 2018 17:33:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHXEo9035304; Fri, 23 Mar 2018 17:33:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231733.w2NHXEo9035304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 17:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331443 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:33:15 -0000 Author: hselasky Date: Fri Mar 23 17:33:14 2018 New Revision: 331443 URL: https://svnweb.freebsd.org/changeset/base/331443 Log: Improve support for health recovery in mlx5core. This patch accumulates the following Linux commits: - 04c0c1ab38e95105d950db5b84e727637e149ce7 net/mlx5: PCI error recovery health care simulation - 0179720d6be2096b8d0a4d143254ff9e77747daa net/mlx5: Introduce trigger_health_work function - 3fece5d676939f42f434c63dfe1bd42d7d94e6f0 net/mlx5: Continue health polling until it is explicitly stopped Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 17:33:14 2018 (r331443) @@ -498,6 +498,7 @@ struct mlx5_core_health { struct workqueue_struct *wq; unsigned long flags; struct work_struct work; + struct delayed_work recover_work; }; #define MLX5_CQ_LINEAR_ARRAY_SIZE 1024 @@ -887,6 +888,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); +void mlx5_trigger_health_work(struct mlx5_core_dev *dev); #define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ mlx5_buf_alloc(dev, size, direct, buf) Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:33:14 2018 (r331443) @@ -74,6 +74,7 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum m unsigned long param); void mlx5_enter_error_state(struct mlx5_core_dev *dev); void mlx5_disable_device(struct mlx5_core_dev *dev); +void mlx5_recover_device(struct mlx5_core_dev *dev); void mlx5e_init(void); void mlx5e_cleanup(void); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 17:33:14 2018 (r331443) @@ -40,14 +40,15 @@ enum { MLX5_NIC_IFC_FULL = 0, MLX5_NIC_IFC_DISABLED = 1, - MLX5_NIC_IFC_NO_DRAM_NIC = 2 + MLX5_NIC_IFC_NO_DRAM_NIC = 2, + MLX5_NIC_IFC_INVALID = 3, }; enum { MLX5_DROP_NEW_HEALTH_WORK, }; -static u8 get_nic_interface(struct mlx5_core_dev *dev) +static u8 get_nic_state(struct mlx5_core_dev *dev) { return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 3; } @@ -80,7 +81,7 @@ static int in_fatal(struct mlx5_core_dev *dev) struct mlx5_core_health *health = &dev->priv.health; struct mlx5_health_buffer __iomem *h = health->health; - if (get_nic_interface(dev) == MLX5_NIC_IFC_DISABLED) + if (get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) return 1; if (ioread32be(&h->fw_ver) == 0xffffffff) @@ -112,9 +113,9 @@ unlock: static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) { - u8 nic_interface = get_nic_interface(dev); + u8 nic_state = get_nic_state(dev); - switch (nic_interface) { + switch (nic_state) { case MLX5_NIC_IFC_FULL: mlx5_core_warn(dev, "Expected to see disabled NIC but it is full driver\n"); break; @@ -128,23 +129,58 @@ static void mlx5_handle_bad_state(struct mlx5_core_dev break; default: mlx5_core_warn(dev, "Expected to see disabled NIC but it is has invalid value %d\n", - nic_interface); + nic_state); } mlx5_disable_device(dev); } +static void health_recover(struct work_struct *work) +{ + struct mlx5_core_health *health; + struct delayed_work *dwork; + struct mlx5_core_dev *dev; + struct mlx5_priv *priv; + u8 nic_state; + + dwork = container_of(work, struct delayed_work, work); + health = container_of(dwork, struct mlx5_core_health, recover_work); + priv = container_of(health, struct mlx5_priv, health); + dev = container_of(priv, struct mlx5_core_dev, priv); + + nic_state = get_nic_state(dev); + if (nic_state == MLX5_NIC_IFC_INVALID) { + dev_err(&dev->pdev->dev, "health recovery flow aborted since the nic state is invalid\n"); + return; + } + + dev_err(&dev->pdev->dev, "starting health recovery flow\n"); + mlx5_recover_device(dev); +} + +/* How much time to wait until health resetting the driver (in msecs) */ +#define MLX5_RECOVERY_DELAY_MSECS 60000 static void health_care(struct work_struct *work) { + unsigned long recover_delay = msecs_to_jiffies(MLX5_RECOVERY_DELAY_MSECS); struct mlx5_core_health *health; struct mlx5_core_dev *dev; struct mlx5_priv *priv; + unsigned long flags; health = container_of(work, struct mlx5_core_health, work); priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); mlx5_core_warn(dev, "handling bad device here\n"); mlx5_handle_bad_state(dev); + + spin_lock_irqsave(&health->wq_lock, flags); + if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) + schedule_delayed_work(&health->recover_work, recover_delay); + else + dev_err(&dev->pdev->dev, + "new health works are not permitted at this stage\n"); + spin_unlock_irqrestore(&health->wq_lock, flags); } static int get_next_poll_jiffies(void) @@ -158,6 +194,20 @@ static int get_next_poll_jiffies(void) return next; } +void mlx5_trigger_health_work(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; + + spin_lock_irqsave(&health->wq_lock, flags); + if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) + queue_work(health->wq, &health->work); + else + dev_err(&dev->pdev->dev, + "new health works are not permitted at this stage\n"); + spin_unlock_irqrestore(&health->wq_lock, flags); +} + static const char *hsynd_str(u8 synd) { switch (synd) { @@ -224,10 +274,8 @@ static void poll_health(unsigned long data) if (dev->state != MLX5_DEVICE_STATE_UP) return; - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { - mod_timer(&health->timer, get_next_poll_jiffies()); - return; - } + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) + goto out; count = ioread32be(health->health_counter); if (count == health->prev) @@ -239,21 +287,16 @@ static void poll_health(unsigned long data) if (health->miss_counter == MAX_MISSES) { mlx5_core_err(dev, "device's health compromised - reached miss count\n"); print_health_info(dev); - } else { - mod_timer(&health->timer, get_next_poll_jiffies()); } if (in_fatal(dev) && !health->sick) { health->sick = true; print_health_info(dev); - spin_lock(&health->wq_lock); - if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) - queue_work(health->wq, &health->work); - else - dev_err(&dev->pdev->dev, - "new health works are not permitted at this stage\n"); - spin_unlock(&health->wq_lock); + mlx5_trigger_health_work(dev); } + +out: + mod_timer(&health->timer, get_next_poll_jiffies()); } void mlx5_start_health_poll(struct mlx5_core_dev *dev) @@ -281,10 +324,12 @@ void mlx5_stop_health_poll(struct mlx5_core_dev *dev) void mlx5_drain_health_wq(struct mlx5_core_dev *dev) { struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; - spin_lock(&health->wq_lock); + spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); - spin_unlock(&health->wq_lock); + spin_unlock_irqrestore(&health->wq_lock, flags); + cancel_delayed_work_sync(&health->recover_work); cancel_work_sync(&health->work); } @@ -316,6 +361,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev) spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); + INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 17:33:14 2018 (r331443) @@ -1257,11 +1257,6 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; } -void mlx5_disable_device(struct mlx5_core_dev *dev) -{ - mlx5_pci_err_detected(dev->pdev, 0); -} - /* wait for the device to show vital signs. For now we check * that we can read the device ID and that the health buffer * shows a non zero value which is different than 0xffffffff @@ -1376,6 +1371,18 @@ static const struct pci_device_id mlx5_core_pci_table[ }; MODULE_DEVICE_TABLE(pci, mlx5_core_pci_table); + +void mlx5_disable_device(struct mlx5_core_dev *dev) +{ + mlx5_pci_err_detected(dev->pdev, 0); +} + +void mlx5_recover_device(struct mlx5_core_dev *dev) +{ + mlx5_pci_disable_device(dev); + if (mlx5_pci_slot_reset(dev->pdev) == PCI_ERS_RESULT_RECOVERED) + mlx5_pci_resume(dev->pdev); +} struct pci_driver mlx5_core_driver = { .name = DRIVER_NAME, From owner-svn-src-all@freebsd.org Fri Mar 23 18:02:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9DC2F5F6BD; Fri, 23 Mar 2018 18:02:21 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9FF9F82F98; Fri, 23 Mar 2018 18:02:21 +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 9ACA3234C2; Fri, 23 Mar 2018 18:02:21 +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 w2NI2Lvk047416; Fri, 23 Mar 2018 18:02:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NI2Kfm047409; Fri, 23 Mar 2018 18:02:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231802.w2NI2Kfm047409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331445 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:02:22 -0000 Author: hselasky Date: Fri Mar 23 18:02:20 2018 New Revision: 331445 URL: https://svnweb.freebsd.org/changeset/base/331445 Log: Add support for fast unload in shutdown flow in mlx5core. This patch accumulates the following Linux commits: - 8812c24d28f4972c4f2b9998bf30b1f2a1b62adf net/mlx5: Add fast unload support in shutdown flow - 59211bd3b6329c3e5f4a90ac3d7f87ffa7867073 net/mlx5: Split the load/unload flow into hardware and software flows - 4525abeaae54560254a1bb8970b3d4c225d32ef4 net/mlx5: Expose command polling interface Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_fw.c head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:02:20 2018 (r331445) @@ -779,6 +779,7 @@ struct mlx5_cmd_work_ent { u64 ts2; u16 op; u8 busy; + bool polling; }; struct mlx5_pas { @@ -866,6 +867,7 @@ static inline u32 mlx5_base_mkey(const u32 key) return key & 0xffffff00u; } +void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); int mlx5_cmd_init(struct mlx5_core_dev *dev); void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); void mlx5_cmd_use_events(struct mlx5_core_dev *dev); @@ -877,6 +879,8 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size, mlx5_cmd_cbk_t callback, void *context); +int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, + void *out, int out_size); int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Mar 23 18:02:20 2018 (r331445) @@ -859,6 +859,7 @@ static void cmd_work_handler(struct work_struct *work) unsigned long cb_timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); struct mlx5_cmd_layout *lay; struct semaphore *sem; + bool poll_cmd = ent->polling; sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; down(sem); @@ -897,7 +898,7 @@ static void cmd_work_handler(struct work_struct *work) iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); mmiowb(); /* if not in polling don't use ent after this point*/ - if (cmd->mode == CMD_MODE_POLLING) { + if (cmd->mode == CMD_MODE_POLLING || poll_cmd) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ mlx5_cmd_comp_handler(dev, 1U << ent->idx); @@ -940,7 +941,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct struct mlx5_cmd *cmd = &dev->cmd; int err; - if (cmd->mode == CMD_MODE_POLLING) { + if (cmd->mode == CMD_MODE_POLLING || ent->polling) { wait_for_completion(&ent->done); err = ent->ret; } else if (!wait_for_completion_timeout(&ent->done, timeout)) { @@ -969,7 +970,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t callback, - void *context, int page_queue, u8 *status) + void *context, int page_queue, u8 *status, + bool force_polling) { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; @@ -986,6 +988,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, if (IS_ERR(ent)) return PTR_ERR(ent); + ent->polling = force_polling; + if (!callback) init_completion(&ent->done); @@ -1260,7 +1264,8 @@ static int is_manage_pages(void *in) static int cmd_exec_helper(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size, - mlx5_cmd_cbk_t callback, void *context) + mlx5_cmd_cbk_t callback, void *context, + bool force_polling) { struct mlx5_cmd_msg *inb; struct mlx5_cmd_msg *outb; @@ -1300,7 +1305,7 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, } err = mlx5_cmd_invoke(dev, inb, in_size, outb, out, out_size, callback, - context, pages_queue, &status); + context, pages_queue, &status, force_polling); if (err) { if (err == -ETIMEDOUT) return err; @@ -1331,7 +1336,7 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, { int err; - err = cmd_exec_helper(dev, in, in_size, out, out_size, NULL, NULL); + err = cmd_exec_helper(dev, in, in_size, out, out_size, NULL, NULL, false); return err ? : mlx5_cmd_check(dev, in, out); } EXPORT_SYMBOL(mlx5_cmd_exec); @@ -1340,9 +1345,19 @@ int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void * void *out, int out_size, mlx5_cmd_cbk_t callback, void *context) { - return cmd_exec_helper(dev, in, in_size, out, out_size, callback, context); + return cmd_exec_helper(dev, in, in_size, out, out_size, callback, context, false); } EXPORT_SYMBOL(mlx5_cmd_exec_cb); + +int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, + void *out, int out_size) +{ + int err; + + err = cmd_exec_helper(dev, in, in_size, out, out_size, NULL, NULL, true); + return err ? : mlx5_cmd_check(dev, in, out); +} +EXPORT_SYMBOL(mlx5_cmd_exec_polling); static void destroy_msg_cache(struct mlx5_core_dev *dev) { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:02:20 2018 (r331445) @@ -70,9 +70,10 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev); int mlx5_query_board_id(struct mlx5_core_dev *dev); int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); +int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, unsigned long param); -void mlx5_enter_error_state(struct mlx5_core_dev *dev); +void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); void mlx5_disable_device(struct mlx5_core_dev *dev); void mlx5_recover_device(struct mlx5_core_dev *dev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Fri Mar 23 18:02:20 2018 (r331445) @@ -218,6 +218,34 @@ int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev) return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } +int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev) +{ + u32 out[MLX5_ST_SZ_DW(teardown_hca_out)] = {0}; + u32 in[MLX5_ST_SZ_DW(teardown_hca_in)] = {0}; + int force_state; + int ret; + + if (!MLX5_CAP_GEN(dev, force_teardown)) { + mlx5_core_dbg(dev, "force teardown is not supported in the firmware\n"); + return -EOPNOTSUPP; + } + + MLX5_SET(teardown_hca_in, in, opcode, MLX5_CMD_OP_TEARDOWN_HCA); + MLX5_SET(teardown_hca_in, in, profile, MLX5_TEARDOWN_HCA_IN_PROFILE_FORCE_CLOSE); + + ret = mlx5_cmd_exec_polling(dev, in, sizeof(in), out, sizeof(out)); + if (ret) + return ret; + + force_state = MLX5_GET(teardown_hca_out, out, force_state); + if (force_state == MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL) { + mlx5_core_err(dev, "teardown with force mode failed\n"); + return -EIO; + } + + return 0; +} + int mlx5_core_set_dc_cnak_trace(struct mlx5_core_dev *dev, int enable, u64 addr) { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:02:20 2018 (r331445) @@ -90,7 +90,7 @@ static int in_fatal(struct mlx5_core_dev *dev) return 0; } -void mlx5_enter_error_state(struct mlx5_core_dev *dev) +void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { mutex_lock(&dev->intf_state_mutex); if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { @@ -99,7 +99,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev) } mlx5_core_err(dev, "start\n"); - if (pci_channel_offline(dev->pdev) || in_fatal(dev)) { + if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:02:20 2018 (r331445) @@ -868,11 +868,65 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev, mlx5_pci_disable_device(dev); } -static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) +static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) { struct pci_dev *pdev = dev->pdev; int err; + err = mlx5_query_hca_caps(dev); + if (err) { + dev_err(&pdev->dev, "query hca failed\n"); + goto out; + } + + err = mlx5_query_board_id(dev); + if (err) { + dev_err(&pdev->dev, "query board id failed\n"); + goto out; + } + + err = mlx5_eq_init(dev); + if (err) { + dev_err(&pdev->dev, "failed to initialize eq\n"); + goto out; + } + + MLX5_INIT_DOORBELL_LOCK(&priv->cq_uar_lock); + + err = mlx5_init_cq_table(dev); + if (err) { + dev_err(&pdev->dev, "failed to initialize cq table\n"); + goto err_eq_cleanup; + } + + mlx5_init_qp_table(dev); + mlx5_init_srq_table(dev); + mlx5_init_mr_table(dev); + + return 0; + +err_eq_cleanup: + mlx5_eq_cleanup(dev); + +out: + return err; +} + +static void mlx5_cleanup_once(struct mlx5_core_dev *dev) +{ + mlx5_cleanup_mr_table(dev); + mlx5_cleanup_srq_table(dev); + mlx5_cleanup_qp_table(dev); + mlx5_cleanup_cq_table(dev); + mlx5_eq_cleanup(dev); +} + +static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, + bool boot) +{ + struct pci_dev *pdev = dev->pdev; + int err; + mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", @@ -900,12 +954,10 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_cmd_cleanup; } - mlx5_pagealloc_init(dev); - err = mlx5_core_enable_hca(dev); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""enable hca failed\n"); - goto err_pagealloc_cleanup; + goto err_cmd_cleanup; } err = mlx5_core_set_issi(dev); @@ -958,34 +1010,21 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st mlx5_start_health_poll(dev); - err = mlx5_query_hca_caps(dev); - if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""query hca failed\n"); + if (boot && mlx5_init_once(dev, priv)) { + dev_err(&pdev->dev, "sw objs init failed\n"); goto err_stop_poll; } - err = mlx5_query_board_id(dev); - if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""query board id failed\n"); - goto err_stop_poll; - } - err = mlx5_enable_msix(dev); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""enable msix failed\n"); - goto err_stop_poll; + goto err_cleanup_once; } - err = mlx5_eq_init(dev); - if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""failed to initialize eq\n"); - goto disable_msix; - } - err = mlx5_alloc_uuars(dev, &priv->uuari); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""Failed allocating uar, aborting\n"); - goto err_eq_cleanup; + goto err_disable_msix; } err = mlx5_start_eqs(dev); @@ -1003,23 +1042,16 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st if (map_bf_area(dev)) device_printf((&pdev->dev)->bsddev, "ERR: ""Failed to map blue flame area\n"); - MLX5_INIT_DOORBELL_LOCK(&priv->cq_uar_lock); - - mlx5_init_cq_table(dev); - mlx5_init_qp_table(dev); - mlx5_init_srq_table(dev); - mlx5_init_mr_table(dev); - err = mlx5_init_fs(dev); if (err) { mlx5_core_err(dev, "flow steering init %d\n", err); - goto err_init_tables; + goto err_free_comp_eqs; } err = mlx5_register_device(dev); if (err) { dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); - goto err_reg_dev; + goto err_fs; } mlx5_fwdump_prep(dev); @@ -1031,13 +1063,11 @@ out: mutex_unlock(&dev->intf_state_mutex); return 0; -err_reg_dev: +err_fs: mlx5_cleanup_fs(dev); -err_init_tables: - mlx5_cleanup_mr_table(dev); - mlx5_cleanup_srq_table(dev); - mlx5_cleanup_qp_table(dev); - mlx5_cleanup_cq_table(dev); + +err_free_comp_eqs: + free_comp_eqs(dev); unmap_bf_area(dev); err_stop_eqs: @@ -1046,12 +1076,13 @@ err_stop_eqs: err_free_uar: mlx5_free_uuars(dev, &priv->uuari); -err_eq_cleanup: - mlx5_eq_cleanup(dev); - -disable_msix: +err_disable_msix: mlx5_disable_msix(dev); +err_cleanup_once: + if (boot) + mlx5_cleanup_once(dev); + err_stop_poll: mlx5_stop_health_poll(dev); if (mlx5_cmd_teardown_hca(dev)) { @@ -1068,9 +1099,6 @@ err_pagealloc_stop: err_disable_hca: mlx5_core_disable_hca(dev); -err_pagealloc_cleanup: - mlx5_pagealloc_cleanup(dev); - err_cmd_cleanup: mlx5_cmd_cleanup(dev); @@ -1081,13 +1109,16 @@ out_err: return err; } -static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) +static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, + bool cleanup) { int err = 0; mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__); + if (cleanup) + mlx5_cleanup_once(dev); goto out; } @@ -1095,17 +1126,14 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_unregister_device(dev); mlx5_cleanup_fs(dev); - mlx5_cleanup_mr_table(dev); - mlx5_cleanup_srq_table(dev); - mlx5_cleanup_qp_table(dev); - mlx5_cleanup_cq_table(dev); unmap_bf_area(dev); mlx5_wait_for_reclaim_vfs_pages(dev); free_comp_eqs(dev); mlx5_stop_eqs(dev); mlx5_free_uuars(dev, &priv->uuari); - mlx5_eq_cleanup(dev); mlx5_disable_msix(dev); + if (cleanup) + mlx5_cleanup_once(dev); mlx5_stop_health_poll(dev); err = mlx5_cmd_teardown_hca(dev); if (err) { @@ -1115,7 +1143,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_pagealloc_stop(dev); mlx5_reclaim_startup_pages(dev); mlx5_core_disable_hca(dev); - mlx5_pagealloc_cleanup(dev); mlx5_cmd_cleanup(dev); out: @@ -1184,7 +1211,9 @@ static int init_one(struct pci_dev *pdev, goto close_pci; } - err = mlx5_load_one(dev, priv); + mlx5_pagealloc_init(dev); + + err = mlx5_load_one(dev, priv, true); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""mlx5_register_device failed %d\n", err); goto clean_health; @@ -1193,6 +1222,7 @@ static int init_one(struct pci_dev *pdev, return 0; clean_health: + mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); close_pci: mlx5_pci_close(dev, priv); @@ -1206,12 +1236,13 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; - if (mlx5_unload_one(dev, priv)) { + if (mlx5_unload_one(dev, priv, true)) { dev_err(&dev->pdev->dev, "mlx5_unload_one failed\n"); mlx5_health_cleanup(dev); return; } + mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); mlx5_pci_close(dev, priv); pci_set_drvdata(pdev, NULL); @@ -1225,8 +1256,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p struct mlx5_priv *priv = &dev->priv; dev_info(&pdev->dev, "%s was called\n", __func__); - mlx5_enter_error_state(dev); - mlx5_unload_one(dev, priv); + mlx5_enter_error_state(dev, false); + mlx5_unload_one(dev, priv, false); if (state) { pci_save_state(pdev->dev.bsddev); mlx5_drain_health_wq(dev); @@ -1310,7 +1341,7 @@ static void mlx5_pci_resume(struct pci_dev *pdev) pci_save_state(pdev->dev.bsddev); wait_vital(pdev); - err = mlx5_load_one(dev, priv); + err = mlx5_load_one(dev, priv, false); if (err) dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" , __func__, err); @@ -1324,13 +1355,41 @@ static const struct pci_error_handlers mlx5_err_handle .resume = mlx5_pci_resume }; +static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) +{ + int err; + + if (!MLX5_CAP_GEN(dev, force_teardown)) { + mlx5_core_dbg(dev, "force teardown is not supported in the firmware\n"); + return -EOPNOTSUPP; + } + + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); + return -EAGAIN; + } + + err = mlx5_cmd_force_teardown_hca(dev); + if (err) { + mlx5_core_dbg(dev, "Firmware couldn't do fast unload error: %d\n", err); + return err; + } + + mlx5_enter_error_state(dev, true); + + return 0; +} + static void shutdown_one(struct pci_dev *pdev) { struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; + int err; set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state); - mlx5_unload_one(dev, priv); + err = mlx5_try_fast_unload(dev); + if (err) + mlx5_unload_one(dev, priv, false); mlx5_pci_disable_device(dev); } Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_ifc.h Fri Mar 23 18:02:20 2018 (r331445) @@ -941,7 +941,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 max_indirection[0x8]; u8 reserved_8[0x1]; u8 log_max_mrw_sz[0x7]; - u8 reserved_9[0x2]; + u8 force_teardown[0x1]; + u8 reserved_9[0x1]; u8 log_max_bsf_list_size[0x6]; u8 reserved_10[0x2]; u8 log_max_klm_list_size[0x6]; @@ -3149,18 +3150,25 @@ struct mlx5_ifc_icmd_access_reg_in_bits { u8 register_data[0][0x20]; }; +enum { + MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_SUCCESS = 0x0, + MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL = 0x1, +}; + struct mlx5_ifc_teardown_hca_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; u8 syndrome[0x20]; - u8 reserved_1[0x40]; + u8 reserved_1[0x3f]; + + u8 force_state[0x1]; }; enum { MLX5_TEARDOWN_HCA_IN_PROFILE_GRACEFUL_CLOSE = 0x0, - MLX5_TEARDOWN_HCA_IN_PROFILE_PANIC_CLOSE = 0x1, + MLX5_TEARDOWN_HCA_IN_PROFILE_FORCE_CLOSE = 0x1, }; struct mlx5_ifc_teardown_hca_in_bits { From owner-svn-src-all@freebsd.org Fri Mar 23 18:09:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CD68F5FFCD; Fri, 23 Mar 2018 18:09:10 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02DCE83594; Fri, 23 Mar 2018 18:09:10 +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 ED251234D6; Fri, 23 Mar 2018 18:09:09 +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 w2NI99Fo050850; Fri, 23 Mar 2018 18:09:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NI9916050847; Fri, 23 Mar 2018 18:09:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231809.w2NI9916050847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331446 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:09:10 -0000 Author: hselasky Date: Fri Mar 23 18:09:09 2018 New Revision: 331446 URL: https://svnweb.freebsd.org/changeset/base/331446 Log: Cancel delayed recovery work when unloading the mlx5core driver. linux commit 2a0165a034ac024b60cca49c61e46f4afa2e4d98 Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 18:02:20 2018 (r331445) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:09:09 2018 (r331446) @@ -892,6 +892,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); +void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); #define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:02:20 2018 (r331445) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:09:09 2018 (r331446) @@ -46,6 +46,7 @@ enum { enum { MLX5_DROP_NEW_HEALTH_WORK, + MLX5_DROP_NEW_RECOVERY_WORK, }; static u8 get_nic_state(struct mlx5_core_dev *dev) @@ -175,7 +176,7 @@ static void health_care(struct work_struct *work) mlx5_handle_bad_state(dev); spin_lock_irqsave(&health->wq_lock, flags); - if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) + if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) schedule_delayed_work(&health->recover_work, recover_delay); else dev_err(&dev->pdev->dev, @@ -306,6 +307,7 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) init_timer(&health->timer); health->sick = 0; clear_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); + clear_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); health->health = &dev->iseg->health; health->health_counter = &dev->iseg->health_counter; @@ -328,9 +330,21 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev) spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); spin_unlock_irqrestore(&health->wq_lock, flags); cancel_delayed_work_sync(&health->recover_work); cancel_work_sync(&health->work); +} + +void mlx5_drain_health_recovery(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; + + spin_lock_irqsave(&health->wq_lock, flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + spin_unlock_irqrestore(&health->wq_lock, flags); + cancel_delayed_work_sync(&dev->priv.health.recover_work); } void mlx5_health_cleanup(struct mlx5_core_dev *dev) Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:02:20 2018 (r331445) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:09:09 2018 (r331446) @@ -1114,6 +1114,9 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, { int err = 0; + if (cleanup) + mlx5_drain_health_recovery(dev); + mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__); From owner-svn-src-all@freebsd.org Fri Mar 23 18:11:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 029ECF60387; Fri, 23 Mar 2018 18:11:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98FF983892; Fri, 23 Mar 2018 18:11:06 +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 940CA235FC; Fri, 23 Mar 2018 18:11:06 +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 w2NIB6Qx051700; Fri, 23 Mar 2018 18:11:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIB6o8051699; Fri, 23 Mar 2018 18:11:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231811.w2NIB6o8051699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331447 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:11:07 -0000 Author: hselasky Date: Fri Mar 23 18:11:06 2018 New Revision: 331447 URL: https://svnweb.freebsd.org/changeset/base/331447 Log: Hide verbose proclamation of error when forced in mlx5core. When mlx5_enter_error_state() operation is forced by shutdown, the messages surrounding setting the error state are not informational and confuse users. Submitted by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:09:09 2018 (r331446) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:11:06 2018 (r331447) @@ -99,14 +99,16 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, return; } - mlx5_core_err(dev, "start\n"); + if (!force) + mlx5_core_err(dev, "internal state error detected\n"); if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); - mlx5_core_err(dev, "end\n"); + if (!force) + mlx5_core_err(dev, "system error event triggered\n"); unlock: mutex_unlock(&dev->intf_state_mutex); From owner-svn-src-all@freebsd.org Fri Mar 23 18:20:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADCADF6138A; Fri, 23 Mar 2018 18:20:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D78684340; Fri, 23 Mar 2018 18:20:43 +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 485D523673; Fri, 23 Mar 2018 18:20:43 +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 w2NIKhuj056110; Fri, 23 Mar 2018 18:20:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIKhrD056107; Fri, 23 Mar 2018 18:20:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231820.w2NIKhrD056107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331449 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:20:44 -0000 Author: hselasky Date: Fri Mar 23 18:20:42 2018 New Revision: 331449 URL: https://svnweb.freebsd.org/changeset/base/331449 Log: Handle software reset of firmware in error flow in mlx5core. Some mlx5 adapter firmware allows the driver to reset the firmware in the event of an error. When a software reset is issued on any physical function all PFs enter reset state. This is a recoverable condition. The existing recovery flow was designed to allow the recovery of a VF after a PF driver reload. This patch expands the scope of that flow to recover PFs or VFs after a SW reset has been issued. When a software reset is issued the following occurs: 1. The NIC interface mode is set to SW_RESET (7) while the reset is in progress. 2. Once the reset completes the NIC interface mode is set to NIC disabled (1). After the reset has been issued (added in a subsequent patch) the health poll for other functions will detect that the NIC interface state has been set to disabled. This will cause it to enter the existing recovery flow. If the PCI is still working (meaning it doesn't return 0xff on all reads) it means recovery can proceed immediately instead of waiting 60 seconds. The error detetion has also been refactored to avoid incorrect or misleading log messages. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 18:15:01 2018 (r331448) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:20:42 2018 (r331449) @@ -492,7 +492,7 @@ struct mlx5_core_health { struct timer_list timer; u32 prev; int miss_counter; - bool sick; + u32 fatal_error; /* wq spinlock to synchronize draining */ spinlock_t wq_lock; struct workqueue_struct *wq; Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:15:01 2018 (r331448) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:20:42 2018 (r331449) @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "mlx5_core.h" @@ -41,7 +42,7 @@ enum { MLX5_NIC_IFC_FULL = 0, MLX5_NIC_IFC_DISABLED = 1, MLX5_NIC_IFC_NO_DRAM_NIC = 2, - MLX5_NIC_IFC_INVALID = 3, + MLX5_NIC_IFC_SW_RESET = 7, }; enum { @@ -49,9 +50,17 @@ enum { MLX5_DROP_NEW_RECOVERY_WORK, }; -static u8 get_nic_state(struct mlx5_core_dev *dev) +enum { + MLX5_SENSOR_NO_ERR = 0, + MLX5_SENSOR_PCI_COMM_ERR = 1, + MLX5_SENSOR_PCI_ERR = 2, + MLX5_SENSOR_NIC_DISABLED = 3, + MLX5_SENSOR_NIC_SW_RESET = 4, +}; + +static u8 get_nic_mode(struct mlx5_core_dev *dev) { - return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 3; + return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; } static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) @@ -77,20 +86,39 @@ no_trig: spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); } -static int in_fatal(struct mlx5_core_dev *dev) +static bool sensor_pci_no_comm(struct mlx5_core_dev *dev) { struct mlx5_core_health *health = &dev->priv.health; struct mlx5_health_buffer __iomem *h = health->health; + bool err = ioread32be(&h->fw_ver) == 0xffffffff; - if (get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) - return 1; + return err; +} - if (ioread32be(&h->fw_ver) == 0xffffffff) - return 1; +static bool sensor_nic_disabled(struct mlx5_core_dev *dev) +{ + return get_nic_mode(dev) == MLX5_NIC_IFC_DISABLED; +} - return 0; +static bool sensor_nic_sw_reset(struct mlx5_core_dev *dev) +{ + return get_nic_mode(dev) == MLX5_NIC_IFC_SW_RESET; } +static u32 check_fatal_sensors(struct mlx5_core_dev *dev) +{ + if (sensor_pci_no_comm(dev)) + return MLX5_SENSOR_PCI_COMM_ERR; + if (pci_channel_offline(dev->pdev)) + return MLX5_SENSOR_PCI_ERR; + if (sensor_nic_disabled(dev)) + return MLX5_SENSOR_NIC_DISABLED; + if (sensor_nic_sw_reset(dev)) + return MLX5_SENSOR_NIC_SW_RESET; + + return MLX5_SENSOR_NO_ERR; +} + void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { mutex_lock(&dev->intf_state_mutex); @@ -101,7 +129,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (!force) mlx5_core_err(dev, "internal state error detected\n"); - if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { + if (check_fatal_sensors(dev) || force) { dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } @@ -116,57 +144,80 @@ unlock: static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) { - u8 nic_state = get_nic_state(dev); + u8 nic_mode = get_nic_mode(dev); - switch (nic_state) { - case MLX5_NIC_IFC_FULL: - mlx5_core_warn(dev, "Expected to see disabled NIC but it is full driver\n"); - break; - - case MLX5_NIC_IFC_DISABLED: - mlx5_core_warn(dev, "starting teardown\n"); - break; - - case MLX5_NIC_IFC_NO_DRAM_NIC: - mlx5_core_warn(dev, "Expected to see disabled NIC but it is no dram nic\n"); - break; - default: - mlx5_core_warn(dev, "Expected to see disabled NIC but it is has invalid value %d\n", - nic_state); + if (nic_mode == MLX5_NIC_IFC_SW_RESET) { + /* The IFC mode field is 3 bits, so it will read 0x7 in two cases: + * 1. PCI has been disabled (ie. PCI-AER, PF driver unloaded + * and this is a VF), this is not recoverable by SW reset. + * Logging of this is handled elsewhere. + * 2. FW reset has been issued by another function, driver can + * be reloaded to recover after the mode switches to + * MLX5_NIC_IFC_DISABLED. + */ + if (dev->priv.health.fatal_error != MLX5_SENSOR_PCI_COMM_ERR) + mlx5_core_warn(dev, "NIC SW reset is already progress\n"); + else + mlx5_core_warn(dev, "Communication with FW over the PCI link is down\n"); + } else { + mlx5_core_warn(dev, "NIC mode %d\n", nic_mode); } mlx5_disable_device(dev); } +#define MLX5_FW_RESET_WAIT_MS 1000 +#define MLX5_NIC_STATE_POLL_MS 5 static void health_recover(struct work_struct *work) { + unsigned long end = jiffies + msecs_to_jiffies(MLX5_FW_RESET_WAIT_MS); struct mlx5_core_health *health; struct delayed_work *dwork; struct mlx5_core_dev *dev; struct mlx5_priv *priv; - u8 nic_state; + u8 nic_mode; dwork = container_of(work, struct delayed_work, work); health = container_of(dwork, struct mlx5_core_health, recover_work); priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); - nic_state = get_nic_state(dev); - if (nic_state == MLX5_NIC_IFC_INVALID) { - dev_err(&dev->pdev->dev, "health recovery flow aborted since the nic state is invalid\n"); + if (sensor_pci_no_comm(dev)) { + dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); return; } + nic_mode = get_nic_mode(dev); + while (nic_mode != MLX5_NIC_IFC_DISABLED && + !time_after(jiffies, end)) { + msleep(MLX5_NIC_STATE_POLL_MS); + nic_mode = get_nic_mode(dev); + } + + if (nic_mode != MLX5_NIC_IFC_DISABLED) { + dev_err(&dev->pdev->dev, "health recovery flow aborted, unexpected NIC IFC mode %d.\n", + nic_mode); + return; + } + dev_err(&dev->pdev->dev, "starting health recovery flow\n"); mlx5_recover_device(dev); } /* How much time to wait until health resetting the driver (in msecs) */ #define MLX5_RECOVERY_DELAY_MSECS 60000 +#define MLX5_RECOVERY_NO_DELAY 0 +static unsigned long get_recovery_delay(struct mlx5_core_dev *dev) +{ + return dev->priv.health.fatal_error == MLX5_SENSOR_PCI_ERR || + dev->priv.health.fatal_error == MLX5_SENSOR_PCI_COMM_ERR ? + MLX5_RECOVERY_DELAY_MSECS : MLX5_RECOVERY_NO_DELAY; +} + static void health_care(struct work_struct *work) { - unsigned long recover_delay = msecs_to_jiffies(MLX5_RECOVERY_DELAY_MSECS); struct mlx5_core_health *health; + unsigned long recover_delay; struct mlx5_core_dev *dev; struct mlx5_priv *priv; unsigned long flags; @@ -176,6 +227,7 @@ static void health_care(struct work_struct *work) dev = container_of(priv, struct mlx5_core_dev, priv); mlx5_core_warn(dev, "handling bad device here\n"); mlx5_handle_bad_state(dev); + recover_delay = msecs_to_jiffies(get_recovery_delay(dev)); spin_lock_irqsave(&health->wq_lock, flags); if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) @@ -272,6 +324,7 @@ static void poll_health(unsigned long data) { struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data; struct mlx5_core_health *health = &dev->priv.health; + u32 fatal_error; u32 count; if (dev->state != MLX5_DEVICE_STATE_UP) @@ -292,8 +345,11 @@ static void poll_health(unsigned long data) print_health_info(dev); } - if (in_fatal(dev) && !health->sick) { - health->sick = true; + fatal_error = check_fatal_sensors(dev); + + if (fatal_error && !health->fatal_error) { + mlx5_core_err(dev, "Fatal error %u detected\n", fatal_error); + dev->priv.health.fatal_error = fatal_error; print_health_info(dev); mlx5_trigger_health_work(dev); } @@ -307,7 +363,7 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) struct mlx5_core_health *health = &dev->priv.health; init_timer(&health->timer); - health->sick = 0; + health->fatal_error = MLX5_SENSOR_NO_ERR; clear_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); clear_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); health->health = &dev->iseg->health; From owner-svn-src-all@freebsd.org Fri Mar 23 18:24:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BD9AF61A38; Fri, 23 Mar 2018 18:24:03 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BBB28473D; Fri, 23 Mar 2018 18:24:02 +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 96950237FB; Fri, 23 Mar 2018 18:24:02 +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 w2NIO2KA060737; Fri, 23 Mar 2018 18:24:02 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIO2EF060735; Fri, 23 Mar 2018 18:24:02 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803231824.w2NIO2EF060735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 23 Mar 2018 18:24:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331450 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:24:03 -0000 Author: jeff Date: Fri Mar 23 18:24:02 2018 New Revision: 331450 URL: https://svnweb.freebsd.org/changeset/base/331450 Log: Fix two compliation problems on non-amd64 architectures. Modified: head/sys/vm/vm_page.c head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Mar 23 18:20:42 2018 (r331449) +++ head/sys/vm/vm_page.c Fri Mar 23 18:24:02 2018 (r331450) @@ -1783,7 +1783,9 @@ again: */ KASSERT(m != NULL, ("missing page")); +#if VM_NRESERVLEVEL > 0 found: +#endif vm_page_alloc_check(m); /* Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Fri Mar 23 18:20:42 2018 (r331449) +++ head/sys/vm/vm_reserv.c Fri Mar 23 18:24:02 2018 (r331450) @@ -419,7 +419,7 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) index)); KASSERT(rv->popcnt > 0, ("vm_reserv_depopulate: reserv %p's popcnt is corrupted", rv)); - KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, + KASSERT(rv->domain < vm_ndomains, ("vm_reserv_depopulate: reserv %p's domain is corrupted %d", rv, rv->domain)); if (rv->popcnt == VM_LEVEL_0_NPAGES) { @@ -531,7 +531,7 @@ vm_reserv_populate(vm_reserv_t rv, int index) ("vm_reserv_populate: reserv %p is already full", rv)); KASSERT(rv->pages->psind == 0, ("vm_reserv_populate: reserv %p is already promoted", rv)); - KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, + KASSERT(rv->domain < vm_ndomains, ("vm_reserv_populate: reserv %p's domain is corrupted %d", rv, rv->domain)); popmap_set(rv->popmap, index); @@ -1218,7 +1218,7 @@ vm_reserv_reclaim(vm_reserv_t rv) vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); - KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, + KASSERT(rv->domain < vm_ndomains, ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", rv, rv->domain)); TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); From owner-svn-src-all@freebsd.org Fri Mar 23 18:24:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 421E1F61A8A; Fri, 23 Mar 2018 18:24:10 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E56BA84823; Fri, 23 Mar 2018 18:24:09 +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 DE798237FC; Fri, 23 Mar 2018 18:24:09 +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 w2NIO9xH060788; Fri, 23 Mar 2018 18:24:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIO9uH060786; Fri, 23 Mar 2018 18:24:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231824.w2NIO9uH060786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331451 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:24:10 -0000 Author: hselasky Date: Fri Mar 23 18:24:09 2018 New Revision: 331451 URL: https://svnweb.freebsd.org/changeset/base/331451 Log: Issue a software reset on firmware assert in mlx5core. If a FW assert is considered fatal, indicated by a new bit in the health buffer, reset the FW. After the reset, follow the normal recovery flow. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Fri Mar 23 18:24:02 2018 (r331450) +++ head/sys/dev/mlx5/device.h Fri Mar 23 18:24:09 2018 (r331451) @@ -410,6 +410,10 @@ struct mlx5_cmd_layout { u8 status_own; }; +enum mlx5_fatal_assert_bit_offsets { + MLX5_RFR_OFFSET = 31, +}; + struct mlx5_health_buffer { __be32 assert_var[5]; __be32 rsvd0[3]; @@ -418,10 +422,18 @@ struct mlx5_health_buffer { __be32 rsvd1[2]; __be32 fw_ver; __be32 hw_id; - __be32 rsvd2; + __be32 rfr; u8 irisc_index; u8 synd; __be16 ext_synd; +}; + +enum mlx5_initializing_bit_offsets { + MLX5_FW_RESET_SUPPORTED_OFFSET = 30, +}; + +enum mlx5_cmd_addr_l_sz_offset { + MLX5_NIC_IFC_OFFSET = 8, }; struct mlx5_init_seg { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:24:02 2018 (r331450) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:24:09 2018 (r331451) @@ -56,6 +56,7 @@ enum { MLX5_SENSOR_PCI_ERR = 2, MLX5_SENSOR_NIC_DISABLED = 3, MLX5_SENSOR_NIC_SW_RESET = 4, + MLX5_SENSOR_FW_SYND_RFR = 5, }; static u8 get_nic_mode(struct mlx5_core_dev *dev) @@ -63,6 +64,18 @@ static u8 get_nic_mode(struct mlx5_core_dev *dev) return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; } +static bool sensor_fw_synd_rfr(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + struct mlx5_health_buffer __iomem *h = health->health; + u32 rfr = ioread32be(&h->rfr) >> MLX5_RFR_OFFSET; + u8 synd = ioread8(&h->synd); + + if (rfr && synd) + mlx5_core_dbg(dev, "FW requests reset, synd: %d\n", synd); + return rfr && synd; +} + static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) { unsigned long flags; @@ -115,10 +128,44 @@ static u32 check_fatal_sensors(struct mlx5_core_dev *d return MLX5_SENSOR_NIC_DISABLED; if (sensor_nic_sw_reset(dev)) return MLX5_SENSOR_NIC_SW_RESET; + if (sensor_fw_synd_rfr(dev)) + return MLX5_SENSOR_FW_SYND_RFR; return MLX5_SENSOR_NO_ERR; } +static void reset_fw_if_needed(struct mlx5_core_dev *dev) +{ + bool supported = (ioread32be(&dev->iseg->initializing) >> + MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + u32 cmdq_addr, fatal_error; + + if (!supported) + return; + + /* The reset only needs to be issued by one PF. The health buffer is + * shared between all functions, and will be cleared during a reset. + * Check again to avoid a redundant 2nd reset. If the fatal erros was + * PCI related a reset won't help. + */ + fatal_error = check_fatal_sensors(dev); + if (fatal_error == MLX5_SENSOR_PCI_COMM_ERR || + fatal_error == MLX5_SENSOR_NIC_DISABLED || + fatal_error == MLX5_SENSOR_NIC_SW_RESET) { + mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help."); + return; + } + + mlx5_core_warn(dev, "Issuing FW Reset\n"); + /* Write the NIC interface field to initiate the reset, the command + * interface address also resides here, don't overwrite it. + */ + cmdq_addr = ioread32be(&dev->iseg->cmdq_addr_l_sz); + iowrite32be((cmdq_addr & 0xFFFFF000) | + MLX5_NIC_IFC_SW_RESET << MLX5_NIC_IFC_OFFSET, + &dev->iseg->cmdq_addr_l_sz); +} + void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { mutex_lock(&dev->intf_state_mutex); @@ -130,6 +177,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (!force) mlx5_core_err(dev, "internal state error detected\n"); if (check_fatal_sensors(dev) || force) { + reset_fw_if_needed(dev); dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } @@ -230,11 +278,14 @@ static void health_care(struct work_struct *work) recover_delay = msecs_to_jiffies(get_recovery_delay(dev)); spin_lock_irqsave(&health->wq_lock, flags); - if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) + if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) { + mlx5_core_warn(dev, "Scheduling recovery work with %lums delay\n", + recover_delay); schedule_delayed_work(&health->recover_work, recover_delay); - else + } else { dev_err(&dev->pdev->dev, "new health works are not permitted at this stage\n"); + } spin_unlock_irqrestore(&health->wq_lock, flags); } From owner-svn-src-all@freebsd.org Fri Mar 23 18:32:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75C25F62627; Fri, 23 Mar 2018 18:32:04 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23CD684DF8; Fri, 23 Mar 2018 18:32:04 +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 1EC5823980; Fri, 23 Mar 2018 18:32:04 +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 w2NIW4Hc065877; Fri, 23 Mar 2018 18:32:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIW30D065870; Fri, 23 Mar 2018 18:32:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231832.w2NIW30D065870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331452 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core modules/mlx5 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core modules/mlx5 X-SVN-Commit-Revision: 331452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:32:04 -0000 Author: hselasky Date: Fri Mar 23 18:32:03 2018 New Revision: 331452 URL: https://svnweb.freebsd.org/changeset/base/331452 Log: Add mutual exclusion mechanism for software reset of firmware in mlx5core. Since the FW can be shared between PCI functions it is common that more than one health poll will detected a failure, this can lead to multiple resets. The solution is to use a FW locking mechanism using semaphore space to provide a way to synchronize between functions. The FW semaphore is acquired via config cycle access. First the VSEC gateway must be acquired, then the semaphore can be locked by writing a value to it and confirmed it's locked by reading the same value back. The process in the same to free the semaphore, except the value written should be zero. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/modules/mlx5/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/conf/files Fri Mar 23 18:32:03 2018 (r331452) @@ -4732,6 +4732,8 @@ dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_crspace.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_diagnostics.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:32:03 2018 (r331452) @@ -651,6 +651,7 @@ struct mlx5_core_dev { struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; struct mlx5_dump_data *dump_data; + u32 vsec_addr; }; enum { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:32:03 2018 (r331452) @@ -64,6 +64,16 @@ enum { MLX5_CMD_TIME, /* print command execution time */ }; +enum mlx5_semaphore_space_address { + MLX5_SEMAPHORE_SW_RESET = 0x20, +}; + +enum { + UNLOCK = 0, + LOCK = 1, + CAP_ID = 0x9, +}; + struct mlx5_core_dev; int mlx5_query_hca_caps(struct mlx5_core_dev *dev); @@ -95,4 +105,8 @@ struct mlx5_crspace_regmap { extern struct pci_driver mlx5_core_driver; +void mlx5_vsec_init(struct mlx5_core_dev *dev); +int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, int state); +int mlx5_pciconf_set_sem_addr_space(struct mlx5_core_dev *dev, + u32 sem_space_address, int state); #endif /* __MLX5_CORE_H__ */ Added: head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c Fri Mar 23 18:32:03 2018 (r331452) @@ -0,0 +1,248 @@ +/*- + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. 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 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 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 +#include +#include +#include "mlx5_core.h" + +enum { + PCI_CTRL_OFFSET = 0x4, + PCI_COUNTER_OFFSET = 0x8, + PCI_SEMAPHORE_OFFSET = 0xc, + + PCI_ADDR_OFFSET = 0x10, + PCI_DATA_OFFSET = 0x14, + + PCI_FLAG_BIT_OFFS = 31, + PCI_SPACE_BIT_OFFS = 0, + PCI_SPACE_BIT_LEN = 16, + PCI_SIZE_VLD_BIT_OFFS = 28, + PCI_SIZE_VLD_BIT_LEN = 1, + PCI_STATUS_BIT_OFFS = 29, + PCI_STATUS_BIT_LEN = 3, +}; + +enum { + IFC_MAX_RETRIES = 2048 +}; + +#define MLX5_EXTRACT_C(source, offset, size) \ + ((((unsigned)(source)) >> (offset)) & MLX5_ONES32(size)) +#define MLX5_EXTRACT(src, start, len) \ + (((len) == 32) ? (src) : MLX5_EXTRACT_C(src, start, len)) +#define MLX5_ONES32(size) \ + ((size) ? (0xffffffff >> (32 - (size))) : 0) +#define MLX5_MASK32(offset, size) \ + (MLX5_ONES32(size) << (offset)) +#define MLX5_MERGE_C(rsrc1, rsrc2, start, len) \ + ((((rsrc2) << (start)) & (MLX5_MASK32((start), (len)))) | \ + ((rsrc1) & (~MLX5_MASK32((start), (len))))) +#define MLX5_MERGE(rsrc1, rsrc2, start, len) \ + (((len) == 32) ? (rsrc2) : MLX5_MERGE_C(rsrc1, rsrc2, start, len)) + +static int mlx5_pciconf_wait_on_flag(struct mlx5_core_dev *dev, + u8 expected_val) +{ + int retries = 0; + u32 flag; + + for(;;) { + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_ADDR_OFFSET, &flag); + flag = MLX5_EXTRACT(flag, PCI_FLAG_BIT_OFFS, 1); + if (flag == expected_val) + return (0); + retries++; + if (retries > IFC_MAX_RETRIES) + return (-EBUSY); + if ((retries & 0xf) == 0) + usleep_range(1000, 2000); + } +} + +static int mlx5_pciconf_read(struct mlx5_core_dev *dev, + unsigned int offset, u32 *data) +{ + u32 address; + int ret; + + if (MLX5_EXTRACT(offset, 31, 1)) + return -EINVAL; + address = MLX5_MERGE(offset, 0, PCI_FLAG_BIT_OFFS, 1); + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_ADDR_OFFSET, address); + ret = mlx5_pciconf_wait_on_flag(dev, 1); + if (ret) + return (ret); + return pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_DATA_OFFSET, data); +} + +static int mlx5_pciconf_write(struct mlx5_core_dev *dev, + unsigned int offset, u32 data) +{ + u32 address; + + if (MLX5_EXTRACT(offset, 31, 1)) + return -EINVAL; + + /* Set flag to 0x1 */ + address = MLX5_MERGE(offset, 1, PCI_FLAG_BIT_OFFS, 1); + + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_DATA_OFFSET, data); + + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_ADDR_OFFSET, address); + + /* Wait for the flag to be cleared */ + return mlx5_pciconf_wait_on_flag(dev, 0); + +} + +int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, int state) +{ + u32 counter = 0; + int retries = 0; + u32 lock_val; + + if (state == UNLOCK) { + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, 0); + return (0); + } + do { + if (retries > IFC_MAX_RETRIES * 10) + return -EBUSY; + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, &lock_val); + if (lock_val != 0) { + retries++; + if (retries > IFC_MAX_RETRIES * 10) + return -EBUSY; + usleep_range(1000, 2000); + continue; + } + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_COUNTER_OFFSET, &counter); + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, counter); + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, &lock_val); + retries++; + } while (counter != lock_val); + return 0; +} + +#define MLX5_PROTECTED_CR_SPACE_DOMAIN 0x6 +static int mlx5_pciconf_set_addr_space(struct mlx5_core_dev *dev, + u16 space) +{ + u32 val; + + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_CTRL_OFFSET, &val); + + val = MLX5_MERGE(val, space, PCI_SPACE_BIT_OFFS, + PCI_SPACE_BIT_LEN); + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_CTRL_OFFSET, val); + + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_CTRL_OFFSET, &val); + + if (MLX5_EXTRACT(val, PCI_STATUS_BIT_OFFS, + PCI_STATUS_BIT_LEN) == 0) + return -EINVAL; + + return 0; +} + +#define MLX5_CR_SPACE_DOMAIN 0x2 +static int mlx5_get_vendor_cap_addr(struct mlx5_core_dev *dev) +{ + int vend_cap; + int ret; + + vend_cap = pci_find_capability(dev->pdev, CAP_ID); + if (!vend_cap) + return 0; + dev->vsec_addr = vend_cap; + ret = mlx5_pciconf_cap9_sem(dev, LOCK); + if (ret) { + mlx5_core_warn(dev, + "pciconf_cap9_sem locking failure\n"); + return 0; + } + if (mlx5_pciconf_set_addr_space(dev, MLX5_CR_SPACE_DOMAIN)) + vend_cap = 0; + ret = mlx5_pciconf_cap9_sem(dev, UNLOCK); + if (ret) + mlx5_core_warn(dev, + "pciconf_cap9_sem unlocking failure\n"); + return vend_cap; +} + +#define MLX5_SEMAPHORE_SPACE_DOMAIN 0xA +int mlx5_pciconf_set_sem_addr_space(struct mlx5_core_dev *dev, + u32 sem_space_address, int state) +{ + u32 data, id = 0; + int ret; + + ret = mlx5_pciconf_set_addr_space(dev, + MLX5_SEMAPHORE_SPACE_DOMAIN); + if (ret) + return (ret); + + if (state == LOCK) + /* Get a unique ID based on the counter */ + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_COUNTER_OFFSET, &id); + + /* Try to modify lock */ + ret = mlx5_pciconf_write(dev, sem_space_address, id); + if (ret) + return (ret); + + /* Verify lock was modified */ + ret = mlx5_pciconf_read(dev, sem_space_address, &data); + if (ret) + return -EINVAL; + + if (data != id) + return -EBUSY; + + return 0; +} + +void mlx5_vsec_init(struct mlx5_core_dev *dev) +{ + dev->vsec_addr = mlx5_get_vendor_cap_addr(dev); +} + Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:32:03 2018 (r331452) @@ -48,6 +48,8 @@ enum { enum { MLX5_DROP_NEW_HEALTH_WORK, MLX5_DROP_NEW_RECOVERY_WORK, + MLX5_SKIP_SW_RESET, + MLX5_SW_RESET_SEM_LOCKED, }; enum { @@ -59,6 +61,33 @@ enum { MLX5_SENSOR_FW_SYND_RFR = 5, }; +static int lock_sem_sw_reset(struct mlx5_core_dev *dev, int state) +{ + int ret, err; + + /* Lock GW access */ + ret = mlx5_pciconf_cap9_sem(dev, LOCK); + if (ret) { + mlx5_core_warn(dev, "Timed out locking gateway %d, %d\n", state, ret); + return ret; + } + + ret = mlx5_pciconf_set_sem_addr_space(dev, MLX5_SEMAPHORE_SW_RESET, state); + if (ret && state == LOCK) { + if (ret == -EBUSY) + mlx5_core_dbg(dev, "SW reset FW semaphore already locked, another function will handle the reset\n"); + else + mlx5_core_warn(dev, "SW reset semaphore lock return %d\n", ret); + } + + /* Unlock GW access */ + err = mlx5_pciconf_cap9_sem(dev, UNLOCK); + if (err) + mlx5_core_warn(dev, "Timed out unlocking gateway: state %d, err %d\n", state, err); + + return ret; +} + static u8 get_nic_mode(struct mlx5_core_dev *dev) { return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; @@ -138,6 +167,7 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d { bool supported = (ioread32be(&dev->iseg->initializing) >> MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + struct mlx5_core_health *health = &dev->priv.health; u32 cmdq_addr, fatal_error; if (!supported) @@ -151,7 +181,8 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d fatal_error = check_fatal_sensors(dev); if (fatal_error == MLX5_SENSOR_PCI_COMM_ERR || fatal_error == MLX5_SENSOR_NIC_DISABLED || - fatal_error == MLX5_SENSOR_NIC_SW_RESET) { + fatal_error == MLX5_SENSOR_NIC_SW_RESET || + test_bit(MLX5_SKIP_SW_RESET, &health->flags)) { mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help."); return; } @@ -223,6 +254,7 @@ static void health_recover(struct work_struct *work) struct delayed_work *dwork; struct mlx5_core_dev *dev; struct mlx5_priv *priv; + bool recover = true; u8 nic_mode; dwork = container_of(work, struct delayed_work, work); @@ -232,7 +264,8 @@ static void health_recover(struct work_struct *work) if (sensor_pci_no_comm(dev)) { dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); - return; + recover = false; + goto clear_sem; } nic_mode = get_nic_mode(dev); @@ -245,11 +278,21 @@ static void health_recover(struct work_struct *work) if (nic_mode != MLX5_NIC_IFC_DISABLED) { dev_err(&dev->pdev->dev, "health recovery flow aborted, unexpected NIC IFC mode %d.\n", nic_mode); - return; + recover = false; } - dev_err(&dev->pdev->dev, "starting health recovery flow\n"); - mlx5_recover_device(dev); +clear_sem: + if (test_and_clear_bit(MLX5_SW_RESET_SEM_LOCKED, &health->flags)) { + mlx5_core_dbg(dev, "Unlocking FW reset semaphore\n"); + lock_sem_sw_reset(dev, UNLOCK); + } + + test_and_clear_bit(MLX5_SKIP_SW_RESET, &health->flags); + + if (recover) { + dev_err(&dev->pdev->dev, "starting health recovery flow\n"); + mlx5_recover_device(dev); + } } /* How much time to wait until health resetting the driver (in msecs) */ @@ -269,10 +312,29 @@ static void health_care(struct work_struct *work) struct mlx5_core_dev *dev; struct mlx5_priv *priv; unsigned long flags; + int ret; health = container_of(work, struct mlx5_core_health, work); priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); + + if (mlx5_core_is_pf(dev)) { + ret = lock_sem_sw_reset(dev, LOCK); + if (!ret) { + mlx5_core_warn(dev, "Locked FW reset semaphore\n"); + set_bit(MLX5_SW_RESET_SEM_LOCKED, &health->flags); + } + else if (ret == -EBUSY) { + /* sw reset will be skipped only in case we detect the + * semaphore was already taken. In case of an error + * while taking the semaphore we prefer to issue a + * reset since longer cr-dump time and multiple resets + * are better than a stuck fw. + */ + set_bit(MLX5_SKIP_SW_RESET, &health->flags); + } + } + mlx5_core_warn(dev, "handling bad device here\n"); mlx5_handle_bad_state(dev); recover_delay = msecs_to_jiffies(get_recovery_delay(dev)); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:32:03 2018 (r331452) @@ -873,6 +873,8 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, s struct pci_dev *pdev = dev->pdev; int err; + mlx5_vsec_init(dev); + err = mlx5_query_hca_caps(dev); if (err) { dev_err(&pdev->dev, "query hca failed\n"); Modified: head/sys/modules/mlx5/Makefile ============================================================================== --- head/sys/modules/mlx5/Makefile Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/modules/mlx5/Makefile Fri Mar 23 18:32:03 2018 (r331452) @@ -6,6 +6,7 @@ SRCS= \ mlx5_alloc.c \ mlx5_cmd.c \ mlx5_cq.c \ +mlx5_crspace.c \ mlx5_diagnostics.c \ mlx5_eq.c \ mlx5_fs_cmd.c \ From owner-svn-src-all@freebsd.org Fri Mar 23 18:34:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3F14F62935; Fri, 23 Mar 2018 18:34:35 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A254E8515F; Fri, 23 Mar 2018 18:34:35 +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 99287239A6; Fri, 23 Mar 2018 18:34:35 +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 w2NIYZKb066036; Fri, 23 Mar 2018 18:34:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIYZ5j066035; Fri, 23 Mar 2018 18:34:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231834.w2NIYZ5j066035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331453 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:34:36 -0000 Author: hselasky Date: Fri Mar 23 18:34:35 2018 New Revision: 331453 URL: https://svnweb.freebsd.org/changeset/base/331453 Log: Don't save PCI state when PCI error is detected in mlx5core. When a PCI error is detected the PCI state could be corrupt, don't save it in that flow. Save the state after initialization. After restoring the PCI state during slot reset save it again, restoring the state destroys the previously saved state info. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:32:03 2018 (r331452) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:34:35 2018 (r331453) @@ -1224,6 +1224,7 @@ static int init_one(struct pci_dev *pdev, goto clean_health; } + pci_save_state(pdev->dev.bsddev); return 0; clean_health: @@ -1264,7 +1265,6 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p mlx5_enter_error_state(dev, false); mlx5_unload_one(dev, priv, false); if (state) { - pci_save_state(pdev->dev.bsddev); mlx5_drain_health_wq(dev); mlx5_pci_disable_device(dev); } @@ -1289,6 +1289,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci pci_set_master(pdev); pci_set_powerstate(pdev->dev.bsddev, PCI_POWERSTATE_D0); pci_restore_state(pdev->dev.bsddev); + pci_save_state(pdev->dev.bsddev); return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; } @@ -1343,7 +1344,6 @@ static void mlx5_pci_resume(struct pci_dev *pdev) dev_info(&pdev->dev, "%s was called\n", __func__); - pci_save_state(pdev->dev.bsddev); wait_vital(pdev); err = mlx5_load_one(dev, priv, false); From owner-svn-src-all@freebsd.org Fri Mar 23 18:34:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A5DCF62965; Fri, 23 Mar 2018 18:34:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 118D285180; Fri, 23 Mar 2018 18:34:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEF0E239A7; Fri, 23 Mar 2018 18:34:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NIYcoc066085; Fri, 23 Mar 2018 18:34:38 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIYcm6066082; Fri, 23 Mar 2018 18:34:38 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803231834.w2NIYcm6066082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 23 Mar 2018 18:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331454 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 331454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:34:39 -0000 Author: sbruno Date: Fri Mar 23 18:34:38 2018 New Revision: 331454 URL: https://svnweb.freebsd.org/changeset/base/331454 Log: Revert r331379 as the "simple" lock changes have revealed a deeper problem and need for a rethink. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Modified: head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet/ip_output.c Fri Mar 23 18:34:38 2018 (r331454) @@ -1314,14 +1314,12 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; case IP_PORTRANGE: - INP_RLOCK(inp); if (inp->inp_flags & INP_HIGHPORT) optval = IP_PORTRANGE_HIGH; else if (inp->inp_flags & INP_LOWPORT) optval = IP_PORTRANGE_LOW; else optval = 0; - INP_RUNLOCK(inp); break; case IP_ONESBCAST: @@ -1347,11 +1345,9 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; #ifdef RSS case IP_RSSBUCKETID: - INP_RLOCK(inp); retval = rss_hash2bucket(inp->inp_flowid, inp->inp_flowtype, &rss_bucket); - INP_RUNLOCK(inp); if (retval == 0) optval = rss_bucket; else Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet/raw_ip.c Fri Mar 23 18:34:38 2018 (r331454) @@ -639,12 +639,10 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt) sizeof optval); if (error) break; - INP_WLOCK(inp); if (optval) inp->inp_flags |= INP_HDRINCL; else inp->inp_flags &= ~INP_HDRINCL; - INP_WUNLOCK(inp); break; case IP_FW3: /* generic ipfw v.3 functions */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet6/ip6_output.c Fri Mar 23 18:34:38 2018 (r331454) @@ -1498,10 +1498,8 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt) error = soopt_mcopyin(sopt, m); /* XXX */ if (error != 0) break; - INP_WLOCK(in6p); error = ip6_pcbopts(&in6p->in6p_outputopts, m, so, sopt); - INP_WUNLOCK(in6p); m_freem(m); /* XXX */ break; } @@ -1637,13 +1635,11 @@ do { \ error = EINVAL; break; } - INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(IPV6_HOPLIMIT, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } @@ -1694,10 +1690,8 @@ do { \ * available only prior to bind(2). * see ipng mailing list, Jun 22 2001. */ - INP_WLOCK(in6p); if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { - INP_WUNLOCK(in6p); error = EINVAL; break; } @@ -1706,7 +1700,6 @@ do { \ in6p->inp_vflag &= ~INP_IPV4; else in6p->inp_vflag |= INP_IPV4; - INP_WUNLOCK(in6p); break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ @@ -1756,13 +1749,11 @@ do { \ break; { struct ip6_pktopts **optp; - INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } @@ -1827,6 +1818,12 @@ do { \ int optlen; struct ip6_pktopts **optp; + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + /* * We only ensure valsize is not too large * here. Further validation will be done @@ -1836,21 +1833,12 @@ do { \ sizeof(optbuf_storage), 0); if (error) break; - - INP_WLOCK(in6p); - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - INP_WUNLOCK(in6p); - error = EINVAL; - break; - } optlen = sopt->sopt_valsize; optbuf = optbuf_storage; optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, optbuf, optlen, optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } #undef OPTSET @@ -2035,12 +2023,10 @@ do { \ break; #ifdef RSS case IPV6_RSSBUCKETID: - INP_RLOCK(in6p); retval = rss_hash2bucket(in6p->inp_flowid, in6p->inp_flowtype, &rss_bucket); - INP_RUNLOCK(in6p); if (retval == 0) optval = rss_bucket; else @@ -2243,8 +2229,6 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf * int error = 0; struct thread *td = sopt->sopt_td; - INP_WLOCK_ASSERT(sotoinpcb(so)); - /* turn off any old options. */ if (opt) { #ifdef DIAGNOSTIC @@ -3103,8 +3087,6 @@ int ip6_optlen(struct inpcb *in6p) { int len; - - INP_WLOCK_ASSERT(in6p); if (!in6p->in6p_outputopts) return 0; From owner-svn-src-all@freebsd.org Fri Mar 23 18:36:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D231F62BFA; Fri, 23 Mar 2018 18:36:00 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF589854B3; Fri, 23 Mar 2018 18:35:59 +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 8FEB0239A9; Fri, 23 Mar 2018 18:35:59 +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 w2NIZxx2066190; Fri, 23 Mar 2018 18:35:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIZxI4066189; Fri, 23 Mar 2018 18:35:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231835.w2NIZxI4066189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:35:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331455 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:36:00 -0000 Author: hselasky Date: Fri Mar 23 18:35:59 2018 New Revision: 331455 URL: https://svnweb.freebsd.org/changeset/base/331455 Log: Fix incorrect page count when mlx5core is in internal error. Change page cleanup flow when in internal error to properly decrement the page counts when reclaiming pages. That prevents timing out waiting for extra pages that were actually cleaned up previously. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Mar 23 18:34:38 2018 (r331454) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Mar 23 18:35:59 2018 (r331455) @@ -380,6 +380,37 @@ out_free: return err; } +static int reclaim_pages_cmd(struct mlx5_core_dev *dev, + u32 *in, int in_size, u32 *out, int out_size) +{ + struct mlx5_fw_page *fwp; + struct rb_node *p; + u32 func_id; + u32 npages; + u32 i = 0; + + if (dev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) + return mlx5_cmd_exec(dev, in, in_size, out, out_size); + + /* No hard feelings, we want our pages back! */ + npages = MLX5_GET(manage_pages_in, in, input_num_entries); + func_id = MLX5_GET(manage_pages_in, in, function_id); + + p = rb_first(&dev->priv.page_root); + while (p && i < npages) { + fwp = rb_entry(p, struct mlx5_fw_page, rb_node); + p = rb_next(p); + if (fwp->func_id != func_id) + continue; + + MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->dma_addr); + i++; + } + + MLX5_SET(manage_pages_out, out, output_num_entries, i); + return 0; +} + static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, int *nclaimed) { @@ -404,7 +435,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u3 MLX5_SET(manage_pages_in, in, input_num_entries, npages); mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); - err = mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); + err = reclaim_pages_cmd(dev, in, sizeof(in), out, outlen); if (err) { mlx5_core_err(dev, "failed reclaiming pages\n"); goto out_free; @@ -531,19 +562,13 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *d p = rb_first(&dev->priv.page_root); if (p) { fwp = rb_entry(p, struct mlx5_fw_page, rb_node); - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { - --dev->priv.fw_pages; - free_4k(dev, fwp->dma_addr); - nclaimed = 1; - } else { - err = reclaim_pages(dev, fwp->func_id, - optimal_reclaimed_pages(), - &nclaimed); - if (err) { - mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", - err); - return err; - } + err = reclaim_pages(dev, fwp->func_id, + optimal_reclaimed_pages(), + &nclaimed); + if (err) { + mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", + err); + return err; } if (nclaimed) From owner-svn-src-all@freebsd.org Fri Mar 23 18:38:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DE7AF62FAB; Fri, 23 Mar 2018 18:38:13 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BDA385893; Fri, 23 Mar 2018 18:38:13 +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 06B69239AD; Fri, 23 Mar 2018 18:38:13 +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 w2NIcC4k066300; Fri, 23 Mar 2018 18:38:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIcCt9066299; Fri, 23 Mar 2018 18:38:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231838.w2NIcCt9066299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331456 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 331456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:38:13 -0000 Author: hselasky Date: Fri Mar 23 18:38:12 2018 New Revision: 331456 URL: https://svnweb.freebsd.org/changeset/base/331456 Log: Don't wait for completions when a mlx5en(4) device is in internal error state. If the device is in internal error state the hardware will not generate completions. Just move on to destroy the resources. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 18:35:59 2018 (r331455) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 18:38:12 2018 (r331456) @@ -907,8 +907,7 @@ mlx5e_destroy_rq(struct mlx5e_rq *rq) wq_sz = mlx5_wq_ll_get_size(&rq->wq); for (i = 0; i != wq_sz; i++) { if (rq->mbuf[i].mbuf != NULL) { - bus_dmamap_unload(rq->dma_tag, - rq->mbuf[i].dma_map); + bus_dmamap_unload(rq->dma_tag, rq->mbuf[i].dma_map); m_freem(rq->mbuf[i].mbuf); } bus_dmamap_destroy(rq->dma_tag, rq->mbuf[i].dma_map); @@ -1064,8 +1063,11 @@ mlx5e_close_rq(struct mlx5e_rq *rq) static void mlx5e_close_rq_wait(struct mlx5e_rq *rq) { + struct mlx5_core_dev *mdev = rq->channel->priv->mdev; + /* wait till RQ is empty */ - while (!mlx5_wq_ll_is_empty(&rq->wq)) { + while (!mlx5_wq_ll_is_empty(&rq->wq) && + (mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR)) { msleep(4); rq->cq.mcq.comp(&rq->cq.mcq); } @@ -1404,6 +1406,7 @@ void mlx5e_drain_sq(struct mlx5e_sq *sq) { int error; + struct mlx5_core_dev *mdev= sq->priv->mdev; /* * Check if already stopped. @@ -1436,7 +1439,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* wait till SQ is empty or link is down */ mtx_lock(&sq->lock); while (sq->cc != sq->pc && - (sq->priv->media_status_last & IFM_ACTIVE) != 0) { + (sq->priv->media_status_last & IFM_ACTIVE) != 0 && + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq); @@ -1453,7 +1457,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* wait till SQ is empty */ mtx_lock(&sq->lock); - while (sq->cc != sq->pc) { + while (sq->cc != sq->pc && + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq); From owner-svn-src-all@freebsd.org Fri Mar 23 19:30:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43E20F675E3; Fri, 23 Mar 2018 19:30:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E678388082; Fri, 23 Mar 2018 19:30:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD106241AA; Fri, 23 Mar 2018 19:30:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NJU0Z2091940; Fri, 23 Mar 2018 19:30:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NJU0QR091939; Fri, 23 Mar 2018 19:30:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803231930.w2NJU0QR091939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Mar 2018 19:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331458 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 331458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 19:30:01 -0000 Author: jhb Date: Fri Mar 23 19:30:00 2018 New Revision: 331458 URL: https://svnweb.freebsd.org/changeset/base/331458 Log: MFC 328909: Always give ELF brands a chance to veto a match. If a brand provides a header_supported hook, check it when trying to find a brand based on a matching interpreter as well as in the final loop for the fallback brand. Previously a brand might reject a binary via a header_supported hook in one of the earlier loops, but still be chosen by one of these later loops. Sponsored by: DARPA / AFRL Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Fri Mar 23 18:41:28 2018 (r331457) +++ stable/11/sys/kern/imgact_elf.c Fri Mar 23 19:30:00 2018 (r331458) @@ -320,7 +320,7 @@ __elfN(get_brandinfo)(struct image_params *imgp, const strcmp((const char *)&hdr->e_ident[OLD_EI_BRAND], bi->compat_3_brand) == 0))) { /* Looks good, but give brand a chance to veto */ - if (!bi->header_supported || + if (bi->header_supported == NULL || bi->header_supported(imgp)) { /* * Again, prefer strictly matching @@ -368,7 +368,8 @@ __elfN(get_brandinfo)(struct image_params *imgp, const /* ELF image p_filesz includes terminating zero */ strlen(bi->interp_path) + 1 == interp_name_len && strncmp(interp, bi->interp_path, interp_name_len) - == 0) + == 0 && (bi->header_supported == NULL || + bi->header_supported(imgp))) return (bi); } } @@ -380,7 +381,9 @@ __elfN(get_brandinfo)(struct image_params *imgp, const (interp != NULL && (bi->flags & BI_BRAND_ONLY_STATIC) != 0)) continue; if (hdr->e_machine == bi->machine && - __elfN(fallback_brand) == bi->brand) + __elfN(fallback_brand) == bi->brand && + (bi->header_supported == NULL || + bi->header_supported(imgp))) return (bi); } return (NULL); From owner-svn-src-all@freebsd.org Fri Mar 23 19:31:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AF9F679AB; Fri, 23 Mar 2018 19:31:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3AEBF88309; Fri, 23 Mar 2018 19:31:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35E0A2430A; Fri, 23 Mar 2018 19:31:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NJVqk5093626; Fri, 23 Mar 2018 19:31:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NJVqv5093624; Fri, 23 Mar 2018 19:31:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803231931.w2NJVqv5093624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Mar 2018 19:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331459 - in head/sys: mips/include sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: mips/include sys X-SVN-Commit-Revision: 331459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 19:31:53 -0000 Author: jhb Date: Fri Mar 23 19:31:52 2018 New Revision: 331459 URL: https://svnweb.freebsd.org/changeset/base/331459 Log: Move remaining EF_MIPS_* flags to . Reviewed by: brooks Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14789 Modified: head/sys/mips/include/elf.h head/sys/sys/elf_common.h Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Fri Mar 23 19:30:00 2018 (r331458) +++ head/sys/mips/include/elf.h Fri Mar 23 19:31:52 2018 (r331459) @@ -243,24 +243,4 @@ __ElfType(Auxinfo); #define R_MIPS_COPY 126 #define R_MIPS_JUMP_SLOT 127 -/* - * ELF Flags - */ - -#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code */ -#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code */ -#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code */ -#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code */ -#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code */ -#define EF_MIPS_ARCH_32 0x50000000 /* -mips32 code */ -#define EF_MIPS_ARCH_64 0x60000000 /* -mips64 code */ -#define EF_MIPS_ARCH_32R2 0x70000000 /* -mips32r2 code */ -#define EF_MIPS_ARCH_64R2 0x80000000 /* -mips64r2 code */ - -#define EF_MIPS_ABI 0x0000f000 -#define EF_MIPS_ABI_O32 0x00001000 -#define EF_MIPS_ABI_O64 0x00002000 -#define EF_MIPS_ABI_EABI32 0x00003000 -#define EF_MIPS_ABI_EABI64 0x00004000 - #endif /* __MIPS_ELF_H */ Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Fri Mar 23 19:30:00 2018 (r331458) +++ head/sys/sys/elf_common.h Fri Mar 23 19:31:52 2018 (r331459) @@ -344,10 +344,24 @@ typedef struct { #define EF_MIPS_UCODE 0x00000010 #define EF_MIPS_ABI2 0x00000020 /* N32 */ #define EF_MIPS_OPTIONS_FIRST 0x00000080 +#define EF_MIPS_ABI 0x0000F000 +#define EF_MIPS_ABI_O32 0x00001000 +#define EF_MIPS_ABI_O64 0x00002000 +#define EF_MIPS_ABI_EABI32 0x00003000 +#define EF_MIPS_ABI_EABI64 0x00004000 #define EF_MIPS_ARCH_ASE 0x0F000000 /* Architectural extensions */ #define EF_MIPS_ARCH_ASE_MDMX 0x08000000 /* MDMX multimedia extension */ #define EF_MIPS_ARCH_ASE_M16 0x04000000 /* MIPS-16 ISA extensions */ #define EF_MIPS_ARCH 0xF0000000 /* Architecture field */ +#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code */ +#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code */ +#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code */ +#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code */ +#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code */ +#define EF_MIPS_ARCH_32 0x50000000 /* -mips32 code */ +#define EF_MIPS_ARCH_64 0x60000000 /* -mips64 code */ +#define EF_MIPS_ARCH_32R2 0x70000000 /* -mips32r2 code */ +#define EF_MIPS_ARCH_64R2 0x80000000 /* -mips64r2 code */ #define EF_PPC_EMB 0x80000000 #define EF_PPC_RELOCATABLE 0x00010000 From owner-svn-src-all@freebsd.org Fri Mar 23 20:20:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8096AF6B2DF; Fri, 23 Mar 2018 20:20:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CBD18A34D; Fri, 23 Mar 2018 20:20:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 277C5249C1; Fri, 23 Mar 2018 20:20:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NKK5tP017571; Fri, 23 Mar 2018 20:20:05 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NKK4KY017563; Fri, 23 Mar 2018 20:20:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803232020.w2NKK4KY017563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 23 Mar 2018 20:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331460 - in stable/11: gnu/lib gnu/usr.bin share/man/man5 share/mk tools/build/mk tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11: gnu/lib gnu/usr.bin share/man/man5 share/mk tools/build/mk tools/build/options X-SVN-Commit-Revision: 331460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 20:20:05 -0000 Author: ian Date: Fri Mar 23 20:20:04 2018 New Revision: 331460 URL: https://svnweb.freebsd.org/changeset/base/331460 Log: MFC r307656, r307659, r307674-r307675, r307679, r307683 Support for WITHOUT_GNU_DIFF and WITHOUT_GNU_GREP, plus manually regenerated src.conf.5, which seems to have picked up a couple changes beyond what was in this MFC. r307656: Put each SUBDIR on a separate line for ease of maintenance Additional patches to this file are in progress, and having each SUBDIR entry on a separate line makes it easier to change the order in which the patches are reviewed, tested, and applied. r307659: Switch gnu/usr.bin/Makefile to SUBDIR.${MK_*} optional subdir style r307674: Add knobs to make GNU diff and GNU grep optional This is added to facilitate experiments building FreeBSD without copyleft software. If WITHOUT_GNU_DIFF is set no /usr/bin/diff or /usr/bin/diff3 will be built. If WITHOUT_GNU_GREP is set then BSD grep will be installed as /usr/bin/bsdgrep or /usr/bin/grep, depending on the WITH_BSD_GREP knob. Reviewed by: brooks (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: Differential Revision: https://reviews.freebsd.org/D8288 r307675: Remove trailing whitespace from r307674 r307679: Build libgnuregex only if necessary for other components Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D8298 r307683: Correct typo in r307679: the variable is MK_GNU_GREP_COMPAT Added: stable/11/tools/build/options/WITHOUT_GNU_DIFF - copied unchanged from r307675, head/tools/build/options/WITHOUT_GNU_DIFF stable/11/tools/build/options/WITHOUT_GNU_GREP - copied unchanged from r307675, head/tools/build/options/WITHOUT_GNU_GREP Modified: stable/11/gnu/lib/Makefile stable/11/gnu/usr.bin/Makefile stable/11/share/man/man5/src.conf.5 stable/11/share/mk/src.opts.mk stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/gnu/lib/Makefile ============================================================================== --- stable/11/gnu/lib/Makefile Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/gnu/lib/Makefile Fri Mar 23 20:20:04 2018 (r331460) @@ -2,7 +2,9 @@ .include -SUBDIR= csu libgcc libdialog libregex +SUBDIR= csu +SUBDIR+= libdialog +SUBDIR+= libgcc .if ${MK_GCC} != "no" SUBDIR+= libgcov libgomp @@ -18,6 +20,11 @@ SUBDIR+= tests .if ${MK_BINUTILS} != "no" && ${MK_GDB} != "no" SUBDIR+= libreadline +.endif + +.if ${MK_GNU_DIFF} != "no" || ${MK_GNU_GREP} != "no" || \ + ${MK_GNU_GREP_COMPAT} != "no" || ${MK_GDB} != "no" +SUBDIR+= libregex .endif # libsupc++ uses libstdc++ headers, although 'make includes' should Modified: stable/11/gnu/usr.bin/Makefile ============================================================================== --- stable/11/gnu/usr.bin/Makefile Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/gnu/usr.bin/Makefile Fri Mar 23 20:20:04 2018 (r331460) @@ -2,53 +2,27 @@ .include -SUBDIR= ${_binutils} \ - ${_cc} \ - diff \ - diff3 \ - ${_dtc} \ - ${_gdb} \ - ${_gperf} \ - grep \ - ${_groff} \ - ${_rcs} \ - ${_tests} - -SUBDIR_DEPEND_gdb= ${_binutils} - .if ${MK_CXX} != "no" -.if ${MK_GCC} != "no" -_gperf= gperf +SUBDIR.${MK_GCC}+= gperf +SUBDIR.${MK_GROFF}+= groff .endif -.if ${MK_GROFF} != "no" -_groff= groff -.endif -.endif -.if ${MK_GPL_DTC} != "no" -_dtc= dtc -.endif +SUBDIR.${MK_BINUTILS}+= binutils +SUBDIR.${MK_DIALOG}+= dialog -.if ${MK_RCS} != "no" -_rcs= rcs -.endif - -.if ${MK_TESTS} != "no" -_tests= tests -.endif - .if ${MK_BINUTILS} != "no" -_binutils= binutils -.if ${MK_GDB} != "no" -_gdb= gdb +SUBDIR.${MK_GDB}+= gdb +SUBDIR_DEPEND_gdb= binutils .endif -.endif -.if ${MK_GCC} != "no" -_cc= cc -.endif +SUBDIR.${MK_GCC}+= cc +SUBDIR.${MK_GNU_DIFF}+= diff diff3 +SUBDIR.${MK_GNU_GREP}+= grep +SUBDIR.${MK_GPL_DTC}+= dtc +SUBDIR.${MK_RCS}+= rcs +SUBDIR.${MK_TESTS}+= tests -SUBDIR.${MK_DIALOG}+= dialog +.info MK_GNU_DIFF=${MK_GNU_DIFF} SUBDIR_PARALLEL= Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/share/man/man5/src.conf.5 Fri Mar 23 20:20:04 2018 (r331460) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 8, 2018 +.Dd March 23, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -392,6 +392,8 @@ When set, it enforces these options: .Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP .It .Va WITHOUT_GCC_BOOTSTRAP +.It +.Va WITHOUT_LLD_BOOTSTRAP .El .It Va WITHOUT_CRYPT Set to not build any crypto code. @@ -731,6 +733,14 @@ This is the default on platforms where gcc is the syst .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITHOUT_GNU_DIFF +Set to not build GNU +.Xr diff 1 +and +.Xr diff3 1 . +.It Va WITHOUT_GNU_GREP +Set to not build GNU +.Xr grep 1 . .It Va WITHOUT_GNU_GREP_COMPAT Set this option to omit the gnu extensions to grep from being included in BSD grep. @@ -982,6 +992,11 @@ Set to use LLVM's libunwind stack unwinder (instead of .Pp This is a default setting on arm64/aarch64. +.It Va WITH_LOADER_FIREWIRE +Enable firewire support in /boot/loader and /boot/zfsloader on x86. +This option is a nop on all other platforms. +.It Va WITHOUT_LOADER_GELI +Disable inclusion of GELI crypto support in the boot chain binaries. .It Va WITHOUT_LOCALES Set to not build localization files; see .Xr locale 1 . Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/share/mk/src.opts.mk Fri Mar 23 20:20:04 2018 (r331460) @@ -100,6 +100,8 @@ __DEFAULT_YES_OPTIONS = \ GCOV \ GDB \ GNU \ + GNU_DIFF \ + GNU_GREP \ GNU_GREP_COMPAT \ GPIO \ GPL_DTC \ Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 23 20:20:04 2018 (r331460) @@ -2442,6 +2442,39 @@ OLD_FILES+=usr/share/man/man3/gpio_pin_tristate.3.gz OLD_FILES+=usr/share/man/man8/gpioctl.8.gz .endif +.if ${MK_GNU_DIFF} == no +OLD_FILES+=usr/bin/diff +OLD_FILES+=usr/bin/diff3 +OLD_FILES+=usr/share/man/man1/diff.1.gz +OLD_FILES+=usr/share/man/man1/diff3.1.gz +OLD_FILES+=usr/share/man/man7/diff.7.gz +.endif + +.if ${MK_GNU_GREP} == no +OLD_FILES+=usr/bin/gnugrep +OLD_FILES+=usr/share/man/man1/gnugrep.1.gz +.if ${MK_BSD_GREP} == no +OLD_FILES+=usr/bin/bzgrep +OLD_FILES+=usr/bin/bzegrep +OLD_FILES+=usr/bin/bzfgrep +OLD_FILES+=usr/bin/egrep +OLD_FILES+=usr/bin/fgrep +OLD_FILES+=usr/bin/grep +OLD_FILES+=usr/bin/zegrep +OLD_FILES+=usr/bin/zfgrep +OLD_FILES+=usr/bin/zgrep +OLD_FILES+=usr/share/man/man1/bzegrep.1.gz +OLD_FILES+=usr/share/man/man1/bzfgrep.1.gz +OLD_FILES+=usr/share/man/man1/bzgrep.1.gz +OLD_FILES+=usr/share/man/man1/egrep.1.gz +OLD_FILES+=usr/share/man/man1/fgrep.1.gz +OLD_FILES+=usr/share/man/man1/grep.1.gz +OLD_FILES+=usr/share/man/man1/zegrep.1.gz +OLD_FILES+=usr/share/man/man1/zfgrep.1.gz +OLD_FILES+=usr/share/man/man1/zgrep.1.gz +.endif +.endif + # Also includes vgrind(1) .if ${MK_GROFF} == no OLD_FILES+=usr/bin/addftinfo Copied: stable/11/tools/build/options/WITHOUT_GNU_DIFF (from r307675, head/tools/build/options/WITHOUT_GNU_DIFF) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_GNU_DIFF Fri Mar 23 20:20:04 2018 (r331460, copy of r307675, head/tools/build/options/WITHOUT_GNU_DIFF) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr diff 1 +and +.Xr diff3 1 . Copied: stable/11/tools/build/options/WITHOUT_GNU_GREP (from r307675, head/tools/build/options/WITHOUT_GNU_GREP) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_GNU_GREP Fri Mar 23 20:20:04 2018 (r331460, copy of r307675, head/tools/build/options/WITHOUT_GNU_GREP) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr grep 1 . From owner-svn-src-all@freebsd.org Fri Mar 23 20:32:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B086F6C629; Fri, 23 Mar 2018 20:32:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 409C68B2BC; Fri, 23 Mar 2018 20:32:55 +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 2119B24CEF; Fri, 23 Mar 2018 20:32:55 +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 w2NKWsaE027073; Fri, 23 Mar 2018 20:32:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NKWseV027069; Fri, 23 Mar 2018 20:32:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803232032.w2NKWseV027069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 20:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331462 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 20:32:55 -0000 Author: emaste Date: Fri Mar 23 20:32:54 2018 New Revision: 331462 URL: https://svnweb.freebsd.org/changeset/base/331462 Log: Remove redundant cast from Linuxulator SYSINITs Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 20:29:34 2018 (r331461) +++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 20:32:54 2018 (r331462) @@ -810,7 +810,7 @@ linux_vdso_install(void *param) (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t)linux_vdso_install, NULL); + linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -819,7 +819,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t)linux_vdso_deinstall, NULL); + linux_vdso_deinstall, NULL); static char GNULINUX_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 20:29:34 2018 (r331461) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 20:32:54 2018 (r331462) @@ -1008,7 +1008,7 @@ linux_vdso_install(void *param) (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t)linux_vdso_install, NULL); + linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -1017,7 +1017,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t)linux_vdso_deinstall, NULL); + linux_vdso_deinstall, NULL); static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Fri Mar 23 20:29:34 2018 (r331461) +++ head/sys/i386/linux/linux_sysvec.c Fri Mar 23 20:32:54 2018 (r331462) @@ -983,7 +983,7 @@ linux_vdso_install(void *param) elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t)linux_vdso_install, NULL); + linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -992,7 +992,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t)linux_vdso_deinstall, NULL); + linux_vdso_deinstall, NULL); static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; From owner-svn-src-all@freebsd.org Fri Mar 23 20:56:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED4E6F6E05B; Fri, 23 Mar 2018 20:56:19 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9792D8C1ED; Fri, 23 Mar 2018 20:56:19 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 921D025043; Fri, 23 Mar 2018 20:56:19 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NKuJJ3037844; Fri, 23 Mar 2018 20:56:19 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NKuJr5037840; Fri, 23 Mar 2018 20:56:19 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201803232056.w2NKuJr5037840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Fri, 23 Mar 2018 20:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331463 - in head: release/amd64 usr.sbin/makefs/cd9660 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: in head: release/amd64 usr.sbin/makefs/cd9660 X-SVN-Commit-Revision: 331463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 20:56:20 -0000 Author: benno Date: Fri Mar 23 20:56:18 2018 New Revision: 331463 URL: https://svnweb.freebsd.org/changeset/base/331463 Log: Allow makefs to properly tag UEFI El Torito boot images. Use them in amd64 ISOs. UEFI booting requires an EFI System Partition (ESP). On most storage devices this will be in a specific partition type. To allow booting from CD/ISO filesystems, UEFI will look for an ESP in the form of a FAT filesystem image embedded in the image. Historically FreeBSD has added one of these to its amd64 ISO images but marked it as simply another i386 boot image. Luckily for us most UEFI implementations are rather forgiving and work this out for us. This change adds the ability to mark a boot image as being a UEFI image. It also modifies our ISO generation to use this marking for the UEFI image we embed. Reported by: Thomas Schmitt Reviewed by: emaste, imp MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D14809 Modified: head/release/amd64/mkisoimages.sh head/usr.sbin/makefs/cd9660/cd9660_eltorito.c head/usr.sbin/makefs/cd9660/cd9660_eltorito.h Modified: head/release/amd64/mkisoimages.sh ============================================================================== --- head/release/amd64/mkisoimages.sh Fri Mar 23 20:32:54 2018 (r331462) +++ head/release/amd64/mkisoimages.sh Fri Mar 23 20:56:18 2018 (r331463) @@ -38,7 +38,7 @@ if [ "$1" = "-b" ]; then umount efi rmdir efi mdconfig -d -u $device - bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable" + bootable="-o bootimage=efi;efiboot.img -o no-emul-boot $bootable" shift else Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 20:32:54 2018 (r331462) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 20:56:18 2018 (r331463) @@ -104,9 +104,12 @@ cd9660_add_boot_disk(iso9660_disk *diskStructure, cons else if (strcmp(sysname, "macppc") == 0 || strcmp(sysname, "mac68k") == 0) new_image->system = ET_SYS_MAC; + else if (strcmp(sysname, "efi") == 0 || + strcmp(sysname, "uefi") == 0) + new_image->system = ET_SYS_UEFI; else { warnx("boot disk system must be " - "i386, powerpc, macppc, or mac68k"); + "efi, i386, powerpc, macppc, mac68k"); free(temp); free(new_image); return 0; @@ -338,12 +341,12 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir int used_sectors; int num_entries = 0; int catalog_sectors; - struct boot_catalog_entry *x86_head, *mac_head, *ppc_head, + struct boot_catalog_entry *x86_head, *mac_head, *ppc_head, *uefi_head, *valid_entry, *default_entry, *temp, *head, **headp, *next; struct cd9660_boot_image *tmp_disk; headp = NULL; - x86_head = mac_head = ppc_head = NULL; + x86_head = mac_head = ppc_head = uefi_head = NULL; /* If there are no boot disks, don't bother building boot information */ if (TAILQ_EMPTY(&diskStructure->boot_images)) @@ -421,6 +424,9 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir break; case ET_SYS_MAC: headp = &mac_head; + break; + case ET_SYS_UEFI: + headp = &uefi_head; break; default: warnx("%s: internal error: unknown system type", Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.h ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.h Fri Mar 23 20:32:54 2018 (r331462) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.h Fri Mar 23 20:56:18 2018 (r331463) @@ -44,6 +44,7 @@ #define ET_SYS_X86 0 #define ET_SYS_PPC 1 #define ET_SYS_MAC 2 +#define ET_SYS_UEFI 0xef #define ET_BOOT_ENTRY_SIZE 0x20 From owner-svn-src-all@freebsd.org Fri Mar 23 21:02:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD229F6E838; Fri, 23 Mar 2018 21:02:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9088B8C868; Fri, 23 Mar 2018 21:02:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B8DB251E2; Fri, 23 Mar 2018 21:02:46 +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 w2NL2kKg042503; Fri, 23 Mar 2018 21:02:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NL2kNN042501; Fri, 23 Mar 2018 21:02:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803232102.w2NL2kNN042501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 21:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331464 - in head/stand: defaults efi/loader X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: defaults efi/loader X-SVN-Commit-Revision: 331464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 21:02:47 -0000 Author: kevans Date: Fri Mar 23 21:02:46 2018 New Revision: 331464 URL: https://svnweb.freebsd.org/changeset/base/331464 Log: efi loader: Respect efi_max_resolution in loader.conf(5) Default the max resolution to 1080p, we'll accept Width x Height specifications along with the following presets: - 480p - 720p - 1080p - 2160p or 4k - 5k PR: 224825 Differential Revision: https://reviews.freebsd.org/D14801 Modified: head/stand/defaults/loader.conf head/stand/efi/loader/framebuffer.c Modified: head/stand/defaults/loader.conf ============================================================================== --- head/stand/defaults/loader.conf Fri Mar 23 20:56:18 2018 (r331463) +++ head/stand/defaults/loader.conf Fri Mar 23 21:02:46 2018 (r331464) @@ -75,6 +75,9 @@ acpi_video_load="NO" # Load the ACPI video extension #geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root bootenv_autolist="YES" # Auto populate the list of ZFS Boot Environments #beastie_disable="NO" # Turn the beastie boot menu on and off +efi_max_resolution="1080p" # Set the max resolution for EFI loader to use: + # 480p, 720p, 1080p, 2160p/4k, 5k, or specify + # WidthxHeight (e.g. 1920x1080) #kernels="kernel kernel.old" # Kernels to display in the boot menu #loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none #comconsole_speed="9600" # Set the current serial console speed Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Fri Mar 23 20:56:18 2018 (r331463) +++ head/stand/efi/loader/framebuffer.c Fri Mar 23 21:02:46 2018 (r331464) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -45,6 +46,40 @@ static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCO static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID; +static struct named_resolution { + const char *name; + const char *alias; + unsigned int width; + unsigned int height; +} resolutions[] = { + { + .name = "480p", + .width = 640, + .height = 480, + }, + { + .name = "720p", + .width = 1280, + .height = 720, + }, + { + .name = "1080p", + .width = 1920, + .height = 1080, + }, + { + .name = "2160p", + .alias = "4k", + .width = 3840, + .height = 2160, + }, + { + .name = "5k", + .width = 5120, + .height = 2880, + } +}; + static u_int efifb_color_depth(struct efi_fb *efifb) { @@ -462,6 +497,57 @@ print_efifb(int mode, struct efi_fb *efifb, int verbos } } +static bool +efi_resolution_compare(struct named_resolution *res, const char *cmp) +{ + + if (strcasecmp(res->name, cmp) == 0) + return (true); + if (res->alias != NULL && strcasecmp(res->alias, cmp) == 0) + return (true); + return (false); +} + + +static void +efi_get_max_resolution(int *width, int *height) +{ + struct named_resolution *res; + char *maxres; + char *height_start, *width_start; + int idx; + + *width = *height = 0; + maxres = getenv("efi_max_resolution"); + /* No max_resolution set? Bail out; choose highest resolution */ + if (maxres == NULL) + return; + /* See if it matches one of our known resolutions */ + for (idx = 0; idx < nitems(resolutions); ++idx) { + res = &resolutions[idx]; + if (efi_resolution_compare(res, maxres)) { + *width = res->width; + *height = res->height; + return; + } + } + /* Not a known resolution, try to parse it; make a copy we can modify */ + maxres = strdup(maxres); + if (maxres == NULL) + return; + height_start = strchr(maxres, 'x'); + if (height_start == NULL) { + free(maxres); + return; + } + width_start = maxres; + *height_start++ = 0; + /* Errors from this will effectively mean "no max" */ + *width = (int)strtol(width_start, NULL, 0); + *height = (int)strtol(height_start, NULL, 0); + free(maxres); +} + static int gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) { @@ -470,16 +556,22 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) EFI_STATUS status; UINTN infosz; UINT32 best_mode, currdim, maxdim, mode; + int height, max_height, max_width, width; best_mode = maxdim = 0; + efi_get_max_resolution(&max_width, &max_height); for (mode = 0; mode < gop->Mode->MaxMode; mode++) { status = gop->QueryMode(gop, mode, &infosz, &info); if (EFI_ERROR(status)) continue; efifb_from_gop(&efifb, gop->Mode, info); - currdim = info->HorizontalResolution * info->VerticalResolution; - /* XXX TODO: Allow tunable or something for max resolution */ + width = info->HorizontalResolution; + height = info->VerticalResolution; + currdim = width * height; if (currdim > maxdim) { + if ((max_width != 0 && width > max_width) || + (max_height != 0 && height > max_height)) + continue; maxdim = currdim; best_mode = mode; } From owner-svn-src-all@freebsd.org Fri Mar 23 21:06:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97727F6ED89; Fri, 23 Mar 2018 21:06:07 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 497ED8CC1C; Fri, 23 Mar 2018 21:06:07 +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 43ECF251F8; Fri, 23 Mar 2018 21:06:07 +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 w2NL671q042700; Fri, 23 Mar 2018 21:06:07 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NL66nX042691; Fri, 23 Mar 2018 21:06:06 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803232106.w2NL66nX042691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 23 Mar 2018 21:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331465 - in stable/11/usr.bin: . diff diff/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/usr.bin: . diff diff/tests X-SVN-Commit-Revision: 331465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 21:06:08 -0000 Author: ian Date: Fri Mar 23 21:06:06 2018 New Revision: 331465 URL: https://svnweb.freebsd.org/changeset/base/331465 Log: MFC r315051, r315101, r315103, r315107, r315180, r315197, r315293, r315319, r315590, r315649, r315726, r315743, r315746-r315747, r315779, r315985, r316002, r316639, r316959, r317187, r317194, r317205-r317207, r317381, r319489, r319847, r321076-r321079, r321227, r326822 Add the BSD-licensed diff from OpenBSD, which is optionally built and installed when WITHOUT_GNU_DIFF is set. r315051: Import diff from OpenBSD Some of the modifications from the previous summer of code has been integrated Modification for compatibility with GNU diff output has been added Main difference with OpenBSD: Implement multiple GNU diff options: * --ignore-file-name-case * --no-ignore-file-name-case * --normal * --tabsize * --strip-trailing-cr Make diff -p compatible with GNU diff Implement diff -l Make diff -r compatible with GNU diff Capsicumize diffing 2 regular files Add a simple test suite Approved by: AsiaBSDcon devsummit Obtained from: OpenBSD, GSoC Relnotes: yes r315101: Fix wrong date in diff(1) Reported by: rgrimes r315103: Implement a stub --horizon-lines=NUM for compatibility with GNU diff3 some options of GNU diff3 would call diff with --horizon-lines, rcs is depending on that. Reported by: antoine r315107: Fix building with recent gcc Reported by: lwhsu, ngie r315180: Readd codes that creates a tmp file for diffing stdout or devices r315197: Do not die if cap_rights_limit reports ENOSYS Reported by: mmel r315293: Integrate contrib/netbsd-tests/usr.bin/diff/t_diff.sh in as .../usr.bin/diff/diff_test Some minor adjustment needed to be done for :same as it currently has the test script hardcoded into the test, instead of using an idiom like $(dirname $0) Sponsored by: Dell EMC Isilon r315319: diff(1): sort long options under -D example in SYNOPSYS Sponsored by: Dell EMC Isilon r315590: diff(1): add --strip-trailing-cr to last example in the SYNOPSIS This syncs the last example in the SYNOPSIS with the other examples. Reviewed by: bapt Sponsored by: Dell EMC Isilon Differential Revision: D10017 r315649: Cache tzdata when running under capsicum PR: 217957 Reported by: tobik@ r315726: diff(1): fix SYNOPSIS section noting non-existent option, --no-ignore-case `--no-ignore-case` should be `--no-ignore-file-name-case` per code for compatibility with [g]diff(1). Sponsored by: Dell EMC Isilon r315743: Use MAX and MIN macros from sys/param.h r315746: Use strndup(3) instead of malloc + memcpy r315747: Use MIN macros from sys/param.h r315779: diff(1): document remaining long options While here, try and tie together some of the short options with their long option equivalents, where possible. Sponsored by: Dell EMC Isilon r315985: diff: Fix mtime of file1 in -u/-c header line. PR: 218018 Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10140 r316002: diff: Show nanoseconds in -u/-c header line. Show nanoseconds in the -u/-c header line. The present portability conditionals cannot handle the POSIX standard st_mtim, so remove them and unconditionally use st_mtim. PR: 218018 Reported by: jbeich Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10145 r316639: add a stub --speed-large-files for compatibility with GNU diff There is no intention to implement it, but lots of scripts/tools using diff(1) passes GNU diff option r316959: Clean up headers declaration r317187: Add a regression test for diff -D r317194: Implement a basic --changed-group-format etcupdate(8) requires that option, while GNU diff supports many more variation of that options, their behaviour beside the simple verion implemented here are quite inconsistent as such I do not plan to implement those. The only special keyword supported by this implementation are: %< and %> %= is not implemented as the documentation of GNU diff says: common lines, but it actually when tested print the changes from the first file r317205: Document all long options r317206: Update the TODO list to reflect what has been changed r317207: Cross reference pr(1) which diff might call with -l option r317381: Fix the following warning from gcc 4.2 in usr.bin/diff: usr.bin/diff/diffreg.c: In function 'change': usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function This version of gcc is not smart enough to see that 'i' cannot actually be used unitialized. However, the variable is confusingly re-used, so it is better to give it another name, and clearly initialize it before attempting to use it. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10484 r319489: Add -H as an alias for --speed-large-file to match GNU diff. This is undocumented to match GNU diff where -H is also undocumented. Some existing software (such as kompare) uses this option by default. Reviewed by: emaste, rpokala Differential Revision: https://reviews.freebsd.org/D11022 r319847: Add some testcases for `diff --side-by-side` support These are were created proactively, in anticipation of the support being fully implemented sometime in the future. The tests currently fail on ^/head@r319845, however. Expect them to fail. PR: 219933 Tested with: gdiff r321076: Don't emit "diff: diff arguments" when diffing files if -q is specified. This improves compatibility with GNU diff. Found by accident with `diff -Nrq /usr/tests /usr/tests.new | grep Kyuafile`. Relnotes: yes r321077: Add some tests for brief (--brief/-q) format MFC with: r321076 r321078: Fix exit status with -rq when there is a file in one directory but not another, i.e., when print_only is called. Prior to this change, -rq was always returning 0. After this change it will return 1 if there is a difference between two directories. This fixes compatibility with GNU diff and unbreaks backwards compatibility expectations. Found when trying to extend diff_test:brief_format_test. MFC with: r321076, r321077 r321079: Add tests that exercise -q, like -rq and add tests that test -q like -Nrq MFC with: r321076, r321077, r321078 r321227: Use more flexible expression for replacing t_diff in contrib/netbsd-tests/usr.bin/diff/t_diff.sh with the name of the script via `basename $0`. This was a change I forgot to port over from ^/head/gnu/usr.bin/diff/tests/Makefile@r272787. r326822: Replace homemade equivalent of tolower(3) by towlower(3) This will help in the futur making diff -i works with multibyte Relnotes: Yes Added: stable/11/usr.bin/diff/ - copied from r315051, head/usr.bin/diff/ stable/11/usr.bin/diff/tests/diff_test.sh - copied, changed from r315051, head/usr.bin/diff/tests/diff.sh stable/11/usr.bin/diff/tests/group-format.out - copied unchanged from r317194, head/usr.bin/diff/tests/group-format.out stable/11/usr.bin/diff/tests/header.out - copied unchanged from r315985, head/usr.bin/diff/tests/header.out stable/11/usr.bin/diff/tests/header_ns.out - copied unchanged from r316002, head/usr.bin/diff/tests/header_ns.out stable/11/usr.bin/diff/tests/ifdef.out - copied unchanged from r317187, head/usr.bin/diff/tests/ifdef.out Deleted: stable/11/usr.bin/diff/tests/diff.sh Modified: stable/11/usr.bin/Makefile stable/11/usr.bin/diff/TODO stable/11/usr.bin/diff/diff.1 stable/11/usr.bin/diff/diff.c stable/11/usr.bin/diff/diff.h stable/11/usr.bin/diff/diffdir.c stable/11/usr.bin/diff/diffreg.c stable/11/usr.bin/diff/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/Makefile ============================================================================== --- stable/11/usr.bin/Makefile Fri Mar 23 21:02:46 2018 (r331464) +++ stable/11/usr.bin/Makefile Fri Mar 23 21:06:06 2018 (r331465) @@ -217,6 +217,9 @@ SUBDIR.${MK_GAMES}+= number SUBDIR.${MK_GAMES}+= pom SUBDIR.${MK_GAMES}+= primes SUBDIR.${MK_GAMES}+= random +.if ${MK_GNU_DIFF} == "no" +SUBDIR+= diff +.endif .if ${MK_GPL_DTC} != "yes" .if ${COMPILER_FEATURES:Mc++11} SUBDIR+= dtc Modified: stable/11/usr.bin/diff/TODO ============================================================================== --- head/usr.bin/diff/TODO Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/TODO Fri Mar 23 21:06:06 2018 (r331465) @@ -5,14 +5,14 @@ * make a libsdiff and use that directly to avoid duplicating the code to be implemented: ---suppress-common-lines: depends on -y --ignore-blank-lines --horizon-lines --ignore-tab-expansion --line-format Will probably be not implemented: ---GTYPE-group-format +--GTYPE-group-format (partially implement - minimal) --LTYPE-line-format ---speed-large-file: (Do we need that? only a stub?) --help (We have a manpage already) +--suppress-common-lines: depends on -y (won't be implemented, as it conflicts +the way sdiff expects it and in any case we have sdiff for that feature) Modified: stable/11/usr.bin/diff/diff.1 ============================================================================== --- head/usr.bin/diff/diff.1 Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diff.1 Fri Mar 23 21:06:06 2018 (r331465) @@ -30,7 +30,7 @@ .\" @(#)diff.1 8.1 (Berkeley) 6/30/93 .\" $FreeBSD$ .\" -.Dd Septembr 03, 2017 +.Dd April 20, 2017 .Dt DIFF 1 .Os .Sh NAME @@ -43,45 +43,105 @@ .Fl c | e | f | .Fl n | q | u .Oc +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -starting-file +.Op Fl -speed-large-files .Op Fl -strip-trailing-cr .Op Fl -tabsize -.Op Fl I Ar pattern -.Op Fl L Ar label +.Op Fl -text +.Op Fl -unified +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl L Ar label | Fl -label Ar label .Ar file1 file2 .Nm diff .Op Fl abdilpTtw -.Op Fl I Ar pattern -.Op Fl L Ar label +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl L Ar label | Fl -label Ar label +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -starting-file .Op Fl -strip-trailing-cr .Op Fl -tabsize -.Fl C Ar number +.Op Fl -text +.Fl C Ar number | -context Ar number .Ar file1 file2 .Nm diff .Op Fl abdiltw -.Op Fl I Ar pattern +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -starting-file .Op Fl -strip-trailing-cr .Op Fl -tabsize -.Fl D Ar string +.Op Fl -text +.Fl D Ar string | Fl -ifdef Ar string .Ar file1 file2 .Nm diff .Op Fl abdilpTtw -.Op Fl I Ar pattern -.Op Fl L Ar label +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl L Ar label | Fl -label Ar label +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal -.Op Fl -tabsize +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -starting-file .Op Fl -strip-trailing-cr -.Fl U Ar number +.Op Fl -tabsize +.Op Fl -text +.Fl U Ar number | Fl -unified Ar number .Ar file1 file2 .Nm diff .Op Fl abdilNPprsTtw @@ -89,16 +149,37 @@ .Fl c | e | f | .Fl n | q | u .Oc +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -context +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -new-file +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -recursive +.Op Fl -report-identical-files +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -strip-trailing-cr .Op Fl -tabsize -.Op Fl I Ar pattern +.Op Fl -text +.Op Fl -unidirectional-new-file +.Op Fl -unified +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern .Bk -words -.Op Fl L Ar label -.Op Fl S Ar name -.Op Fl X Ar file -.Op Fl x Ar pattern +.Op Fl L Ar label | Fl -label Ar label +.Op Fl S Ar name | Fl -starting-file Ar name +.Op Fl X Ar file | Fl -exclude-from Ar file +.Op Fl x Ar pattern | Fl -exclude Ar pattern .Ek .Ar dir1 dir2 .Sh DESCRIPTION @@ -114,7 +195,7 @@ No output is produced if the files are identical. .Pp Output options (mutually exclusive): .Bl -tag -width Ds -.It Fl C Ar number +.It Fl C Ar number Fl -context Ar number Like .Fl c but produces a diff with @@ -142,7 +223,7 @@ both files with .Sq !\ \& . Changes which lie within 3 lines of each other are grouped together on output. -.It Fl D Ar string +.It Fl D Ar string Fl -ifdef Ar string Creates a merged version of .Ar file1 and @@ -156,7 +237,7 @@ while defining .Ar string will yield .Ar file2 . -.It Fl e +.It Fl e -ed Produces output in a form suitable as input for the editor utility, .Xr ed 1 , which can then be used to convert file1 into file2. @@ -170,7 +251,7 @@ from their state in .Ar dir1 to their state in .Ar dir2 . -.It Fl f +.It Fl f -forward-ed Identical output to that of the .Fl e flag, but in reverse order. @@ -183,10 +264,10 @@ but in the opposite order and with a count of changed insert or delete command. This is the form used by .Xr rcsdiff 1 . -.It Fl q +.It Fl q -brief Just print a line when the files differ. Does not output a list of changes. -.It Fl U Ar number +.It Fl U Ar number Fl -unified Ar number Like .Fl u but produces a diff with @@ -207,7 +288,7 @@ a single section. .Pp Comparison options: .Bl -tag -width Ds -.It Fl a +.It Fl a -text Treat all files as .Tn ASCII text. @@ -222,11 +303,11 @@ to produce a diff. .It Fl b Causes trailing blanks (spaces and tabs) to be ignored, and other strings of blanks to compare equal. -.It Fl d +.It Fl d -minimal Try very hard to produce a diff as small as possible. This may consume a lot of processing power and memory when processing large files with many changes. -.It Fl I Ar pattern +.It Fl I Ar pattern Fl -ignore-matching-lines Ar pattern Ignores changes, insertions, and deletions whose lines match the extended regular expression .Ar pattern . @@ -238,32 +319,32 @@ ignored. See .Xr re_format 7 for more information on regular expression patterns. -.It Fl i +.It Fl i -ignore-case Ignores the case of letters. E.g., .Dq A will compare equal to .Dq a . -.It Fl l +.It Fl l -paginate Pass the output through .Xr pr 1 to paginate it. -.It Fl L Ar label +.It Fl L Ar label Fl -label Ar label Print .Ar label instead of the first (and second, if this option is specified twice) file name and time in the context or unified diff header. -.It Fl p +.It Fl p -show-c-function With unified and context diffs, show with each change the first 40 characters of the last line before the context beginning with a letter, an underscore or a dollar sign. For C source code following standard layout conventions, this will show the prototype of the function the change applies to. -.It Fl T +.It Fl T -initial-tab Print a tab rather than a space before the rest of the line for the normal, context or unified output formats. This makes the alignment of tabs in the line consistent. -.It Fl t +.It Fl t -expand-tabs Will expand tabs in output lines. Normal or .Fl c @@ -271,48 +352,70 @@ output adds character(s) to the front of each line whi the indentation of the original source lines and make the output listing difficult to interpret. This option will preserve the original source's indentation. -.It Fl w +.It Fl w -ignore-all-blanks Is similar to -.Fl b +.Fl b -ignore-space-change but causes whitespace (blanks and tabs) to be totally ignored. E.g., .Dq if (\ \&a == b \&) will compare equal to .Dq if(a==b) . +.It Fl -changed-group-format Ar GFMT +Format input groups in the provided +.Pp +the format is a string with special keywords: +.Bl -tag -width %< +.It %< +lines from FILE1 +.It %< +lines from FILE2 .El +.It Fl -ignore-file-name-case +ignore case when comparing file names +.It Fl -no-ignore-file-name-case +do not ignore case wen comparing file names (default) +.It Fl -normal +default diff output +.It Fl -speed-large-files +stub option for compatibility with GNU diff +.It Fl -strip-trailing-cr +strip carriage return on input files +.It Fl tabsize Ar number +Number of spaces representing a tab (default 8) +.El .Pp Directory comparison options: .Bl -tag -width Ds -.It Fl N +.It Fl N -new-file If a file is found in only one directory, act as if it was found in the other directory too but was of zero size. -.It Fl P +.It Fl P -unidirectional-new-file If a file is found only in .Ar dir2 , act as if it was found in .Ar dir1 too but was of zero size. -.It Fl r +.It Fl r -recursive Causes application of .Nm recursively to common subdirectories encountered. -.It Fl S Ar name +.It Fl S Ar name Fl -starting-file Ar name Re-starts a directory .Nm in the middle, beginning with file .Ar name . -.It Fl s +.It Fl s -report-identical-files Causes .Nm to report files which are the same, which are otherwise not mentioned. -.It Fl X Ar file +.It Fl X Ar file Fl -exclude-from Ar file Exclude files and subdirectories from comparison whose basenames match lines in .Ar file . Multiple .Fl X options may be specified. -.It Fl x Ar pattern +.It Fl x Ar pattern Fl -exclude Ar pattern Exclude files and subdirectories from comparison whose basenames match .Ar pattern . Patterns are matched using shell-style globbing via @@ -360,7 +463,7 @@ The default (without .Fl e , .Fl c , or -.Fl n +.Fl n -rcs .\" -C options) output contains lines of these forms, where @@ -480,6 +583,7 @@ An error occurred. .Xr diff3 1 , .Xr ed 1 , .Xr patch 1 , +.Xr pr 1 , .Xr sdiff 1 .Rs .%A James W. Hunt Modified: stable/11/usr.bin/diff/diff.c ============================================================================== --- head/usr.bin/diff/diff.c Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diff.c Fri Mar 23 21:06:06 2018 (r331465) @@ -27,11 +27,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include -#include #include #include #include @@ -43,17 +41,20 @@ int lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; int diff_format, diff_context, status, ignore_file_case; int tabsize = 8; char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +char *group_format = NULL; struct stat stb1, stb2; struct excludes *excludes_list; regex_t ignore_re; -#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uwX:x:" +#define OPTIONS "0123456789aBbC:cdD:efHhI:iL:lnNPpqrS:sTtU:uwX:x:" enum { OPT_TSIZE = CHAR_MAX + 1, OPT_STRIPCR, OPT_IGN_FN_CASE, OPT_NO_IGN_FN_CASE, OPT_NORMAL, + OPT_HORIZON_LINES, + OPT_CHANGED_GROUP_FORMAT, }; static struct option longopts[] = { @@ -64,6 +65,7 @@ static struct option longopts[] = { { "minimal", no_argument, 0, 'd' }, { "ed", no_argument, 0, 'e' }, { "forward-ed", no_argument, 0, 'f' }, + { "speed-large-files", no_argument, NULL, 'H' }, { "ignore-matching-lines", required_argument, 0, 'I' }, { "ignore-case", no_argument, 0, 'i' }, { "paginate", no_argument, NULL, 'l' }, @@ -83,10 +85,12 @@ static struct option longopts[] = { { "exclude", required_argument, 0, 'x' }, { "exclude-from", required_argument, 0, 'X' }, { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, + { "horizon-lines", required_argument, NULL, OPT_HORIZON_LINES }, { "no-ignore-file-name-case", no_argument, NULL, OPT_NO_IGN_FN_CASE }, { "normal", no_argument, NULL, OPT_NORMAL }, { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "changed-group-format", required_argument, NULL, OPT_CHANGED_GROUP_FORMAT}, { NULL, 0, 0, '\0'} }; @@ -154,6 +158,9 @@ main(int argc, char **argv) case 'f': diff_format = D_REVERSE; break; + case 'H': + /* ignore but needed for compatibility with GNU diff */ + break; case 'h': /* silently ignore for backwards compatibility */ break; @@ -225,6 +232,12 @@ main(int argc, char **argv) case 'x': push_excludes(optarg); break; + case OPT_CHANGED_GROUP_FORMAT: + diff_format = D_GFORMAT; + group_format = optarg; + break; + case OPT_HORIZON_LINES: + break; /* XXX TODO for compatibility with GNU diff3 */ case OPT_IGN_FN_CASE: ignore_file_case = 1; break; @@ -347,9 +360,8 @@ read_excludes_file(char *file) while ((buf = fgetln(fp, &len)) != NULL) { if (buf[len - 1] == '\n') len--; - pattern = xmalloc(len + 1); - memcpy(pattern, buf, len); - pattern[len] = '\0'; + if ((pattern = strndup(buf, len)) == NULL) + err(2, "xstrndup"); push_excludes(pattern); } if (strcmp(file, "-") != 0) Modified: stable/11/usr.bin/diff/diff.h ============================================================================== --- head/usr.bin/diff/diff.h Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diff.h Fri Mar 23 21:06:06 2018 (r331465) @@ -47,6 +47,7 @@ #define D_NREVERSE 5 /* Reverse ed script with numbered lines and no trailing . */ #define D_BRIEF 6 /* Say if the files differ */ +#define D_GFORMAT 7 /* Diff with defined changed group format */ /* * Output flags @@ -87,6 +88,7 @@ extern int lflag, Nflag, Pflag, rflag, sflag, Tflag, c extern int diff_format, diff_context, status, ignore_file_case; extern int tabsize; extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +extern char *group_format; extern struct stat stb1, stb2; extern struct excludes *excludes_list; extern regex_t ignore_re; Modified: stable/11/usr.bin/diff/diffdir.c ============================================================================== --- head/usr.bin/diff/diffdir.c Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diffdir.c Fri Mar 23 21:06:06 2018 (r331465) @@ -28,17 +28,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include #include #include -#include #include #include "diff.h" -#include "xmalloc.h" static int selectfile(const struct dirent *); static void diffit(struct dirent *, char *, size_t, char *, size_t, int); @@ -57,6 +53,8 @@ diffdir(char *p1, char *p2, int flags) char path1[PATH_MAX], path2[PATH_MAX]; int pos; + edp1 = edp2 = NULL; + dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); if (dirlen1 >= sizeof(path1) - 1) { warnc(ENAMETOOLONG, "%s", p1); @@ -136,16 +134,20 @@ diffdir(char *p1, char *p2, int flags) if (Nflag) diffit(dent1, path1, dirlen1, path2, dirlen2, flags); - else + else { print_only(path1, dirlen1, dent1->d_name); + status = 1; + } dp1++; } else { /* file only in second dir, only diff if -N or -P */ if (Nflag || Pflag) diffit(dent2, path1, dirlen1, path2, dirlen2, flags); - else + else { print_only(path2, dirlen2, dent2->d_name); + status = 1; + } dp2++; } } Modified: stable/11/usr.bin/diff/diffreg.c ============================================================================== --- head/usr.bin/diff/diffreg.c Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diffreg.c Fri Mar 23 21:06:06 2018 (r331465) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -94,15 +95,6 @@ __FBSDID("$FreeBSD$"); #define _PATH_PR "/usr/bin/pr" -#ifdef ST_MTIM_NSEC -# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC) -#else -# define TIMESPEC_NS(timespec) 0 -#endif - -#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) -#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) - /* * diff - compare two files. */ @@ -194,13 +186,14 @@ struct context_vec { }; #define diff_output printf +static FILE *opentemp(const char *); static void output(char *, FILE *, char *, FILE *, int); static void check(FILE *, FILE *, int); static void range(int, int, const char *); static void uni_range(int, int); static void dump_context_vec(FILE *, FILE *, int); static void dump_unified_vec(FILE *, FILE *, int); -static void prepare(int, FILE *, off_t, int); +static void prepare(int, FILE *, size_t, int); static void prune(void); static void equiv(struct line *, int, struct line *, int, int *); static void unravel(int); @@ -236,7 +229,7 @@ static long *ixold; /* will be overlaid on klist */ static struct cand *clist; /* merely a free storage pot for candidates */ static int clistlen; /* the length of clist */ static struct line *sfile[2]; /* shortened by pruning common prefix/suffix */ -static u_char *chrtran; /* translation table for case-folding */ +static int (*chrtran)(int); /* translation table for case-folding */ static struct context_vec *context_vec_start; static struct context_vec *context_vec_end; static struct context_vec *context_vec_ptr; @@ -246,65 +239,20 @@ static char lastbuf[FUNCTION_CONTEXT_SIZE]; static int lastline; static int lastmatchline; +static int +clow2low(int c) +{ -/* - * chrtran points to one of 2 translation tables: cup2low if folding upper to - * lower case clow2low if not folding case - */ -static u_char clow2low[256] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, - 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, - 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, - 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, - 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, - 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, - 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, - 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, - 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, - 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, - 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, - 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, - 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, - 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, - 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, - 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, - 0xfd, 0xfe, 0xff -}; + return (c); +} -static u_char cup2low[256] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, - 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, - 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x60, 0x61, - 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, - 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x60, 0x61, 0x62, - 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, - 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, - 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, - 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, - 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, - 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, - 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, - 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, - 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, - 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, - 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, - 0xfd, 0xfe, 0xff -}; +static int +cup2low(int c) +{ + return tolower(c); +} + int diffreg(char *file1, char *file2, int flags, int capsicum) { @@ -315,6 +263,8 @@ diffreg(char *file1, char *file2, int flags, int capsi struct kevent *e; cap_rights_t rights_ro; + e = NULL; + kq = -1; f1 = f2 = NULL; rval = D_SAME; anychange = 0; @@ -333,7 +283,14 @@ diffreg(char *file1, char *file2, int flags, int capsi if (flags & D_EMPTY1) f1 = fopen(_PATH_DEVNULL, "r"); else { - if (strcmp(file1, "-") == 0) + if (!S_ISREG(stb1.st_mode)) { + if ((f1 = opentemp(file1)) == NULL || + fstat(fileno(f1), &stb1) < 0) { + warn("%s", file1); + status |= 2; + goto closem; + } + } else if (strcmp(file1, "-") == 0) f1 = stdin; else f1 = fopen(file1, "r"); @@ -347,7 +304,14 @@ diffreg(char *file1, char *file2, int flags, int capsi if (flags & D_EMPTY2) f2 = fopen(_PATH_DEVNULL, "r"); else { - if (strcmp(file2, "-") == 0) + if (!S_ISREG(stb2.st_mode)) { + if ((f2 = opentemp(file2)) == NULL || + fstat(fileno(f2), &stb2) < 0) { + warn("%s", file2); + status |= 2; + goto closem; + } + } else if (strcmp(file2, "-") == 0) f2 = stdin; else f2 = fopen(file2, "r"); @@ -407,9 +371,11 @@ diffreg(char *file1, char *file2, int flags, int capsi if (capsicum) { cap_rights_init(&rights_ro, CAP_READ, CAP_FSTAT, CAP_SEEK); - if (cap_rights_limit(fileno(f1), &rights_ro) < 0) + if (cap_rights_limit(fileno(f1), &rights_ro) < 0 + && errno != ENOSYS) err(2, "unable to limit rights on: %s", file1); - if (cap_rights_limit(fileno(f2), &rights_ro) < 0) + if (cap_rights_limit(fileno(f2), &rights_ro) < 0 && + errno != ENOSYS) err(2, "unable to limit rights on: %s", file2); if (fileno(f1) == STDIN_FILENO || fileno(f2) == STDIN_FILENO) { /* stding has already been limited */ @@ -421,6 +387,7 @@ diffreg(char *file1, char *file2, int flags, int capsi err(2, "unable to limit stdio"); caph_cache_catpages(); + caph_cache_tzdata(); if (cap_enter() < 0 && errno != ENOSYS) err(2, "unable to enter capability mode"); } @@ -474,7 +441,7 @@ diffreg(char *file1, char *file2, int flags, int capsi ixnew = xreallocarray(ixnew, len[1] + 2, sizeof(*ixnew)); check(f1, f2, flags); output(file1, f1, file2, f2, flags); - if (ostdout != -1) { + if (ostdout != -1 && e != NULL) { /* close the pipe to pr and restore stdout */ int wstatus; @@ -537,6 +504,37 @@ files_differ(FILE *f1, FILE *f2, int flags) } } +static FILE * +opentemp(const char *f) +{ + char buf[BUFSIZ], tempfile[PATH_MAX]; + ssize_t nread; + int ifd, ofd; + + if (strcmp(f, "-") == 0) + ifd = STDIN_FILENO; + else if ((ifd = open(f, O_RDONLY, 0644)) < 0) + return (NULL); + + (void)strlcpy(tempfile, _PATH_TMP "/diff.XXXXXXXX", sizeof(tempfile)); + + if ((ofd = mkstemp(tempfile)) < 0) { + close(ifd); + return (NULL); + } + unlink(tempfile); + while ((nread = read(ifd, buf, BUFSIZ)) > 0) { + if (write(ofd, buf, nread) != nread) { + close(ifd); + close(ofd); + return (NULL); + } + } + close(ifd); + lseek(ofd, (off_t)0, SEEK_SET); + return (fdopen(ofd, "r")); +} + char * splice(char *dir, char *path) { @@ -555,7 +553,7 @@ splice(char *dir, char *path) } static void -prepare(int i, FILE *fd, off_t filesize, int flags) +prepare(int i, FILE *fd, size_t filesize, int flags) { struct line *p; int h; @@ -563,7 +561,7 @@ prepare(int i, FILE *fd, off_t filesize, int flags) rewind(fd); - sz = ((unsigned long)filesize <= SIZE_MAX ? filesize : SIZE_MAX) / 25; + sz = MIN(filesize, SIZE_MAX) / 25; if (sz < 100) sz = 100; @@ -658,7 +656,7 @@ stone(int *a, int n, int *b, int *c, int flags) bound = UINT_MAX; else { sq = isqrt(n); - bound = MAXIMUM(256, sq); + bound = MAX(256, sq); } k = 0; @@ -830,7 +828,7 @@ check(FILE *f1, FILE *f2, int flags) ctnew++; } } - if (chrtran[c] != chrtran[d]) { + if (chrtran(c) != chrtran(d)) { jackpot++; J[i] = 0; if (c != '\n' && c != EOF) @@ -965,7 +963,7 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, i } if (m == 0) change(file1, f1, file2, f2, 1, 0, 1, len[1], &flags); - if (diff_format == D_IFDEF) { + if (diff_format == D_IFDEF || diff_format == D_GFORMAT) { for (;;) { #define c i0 if ((c = getc(f1)) == EOF) @@ -1038,10 +1036,13 @@ change(char *file1, FILE *f1, char *file2, FILE *f2, i int *pflags) { static size_t max_context = 64; - int i; + long curpos; + int i, nc, f; + const char *walk; restart: - if (diff_format != D_IFDEF && a > b && c > d) + if ((diff_format != D_IFDEF || diff_format == D_GFORMAT) && + a > b && c > d) return; if (ignore_pats != NULL) { char *line; @@ -1069,7 +1070,7 @@ restart: return; } proceed: - if (*pflags & D_HEADER) { + if (*pflags & D_HEADER && diff_format != D_BRIEF) { diff_output("%s %s %s\n", diffargs, file1, file2); *pflags &= ~D_HEADER; } @@ -1138,13 +1139,40 @@ proceed: } break; } + if (diff_format == D_GFORMAT) { + curpos = ftell(f1); + /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ + nc = ixold[a > b ? b : a - 1] - curpos; + for (i = 0; i < nc; i++) + diff_output("%c", getc(f1)); + for (walk = group_format; *walk != '\0'; walk++) { + if (*walk == '%') { + walk++; + switch (*walk) { + case '<': + fetch(ixold, a, b, f1, '<', 1, *pflags); + break; + case '>': + fetch(ixnew, c, d, f2, '>', 0, *pflags); + break; + default: + diff_output("%%%c", *walk); + break; + } + continue; + } + diff_output("%c", *walk); + } + } if (diff_format == D_NORMAL || diff_format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1, *pflags); if (a <= b && c <= d && diff_format == D_NORMAL) diff_output("---\n"); } - i = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); - if (i != 0 && diff_format == D_EDIT) { + f = 0; + if (diff_format != D_GFORMAT) + f = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); + if (f != 0 && diff_format == D_EDIT) { /* * A non-zero return value for D_EDIT indicates that the * last line printed was a bare dot (".") that has been @@ -1153,10 +1181,10 @@ proceed: * back and restart where we left off. */ diff_output(".\n"); - diff_output("%ds/.//\n", a + i - 1); - b = a + i - 1; + diff_output("%ds/.//\n", a + f - 1); + b = a + f - 1; a = b + 1; - c += i; + c += f; goto restart; } if ((diff_format == D_EDIT || diff_format == D_REVERSE) && c <= d) @@ -1177,7 +1205,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int old * When doing #ifdef's, copy down to current line * if this is the first file, so that stuff makes it to output. */ - if (diff_format == D_IFDEF && oldfile) { + if ((diff_format == D_IFDEF) && oldfile) { long curpos = ftell(lb); /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ nc = f[a > b ? b : a - 1] - curpos; @@ -1201,7 +1229,8 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int old for (i = a; i <= b; i++) { fseek(lb, f[i - 1], SEEK_SET); nc = f[i] - f[i - 1]; - if (diff_format != D_IFDEF && ch != '\0') { + if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && + ch != '\0') { diff_output("%c", ch); if (Tflag && (diff_format == D_NORMAL || diff_format == D_CONTEXT || diff_format == D_UNIFIED)) @@ -1271,7 +1300,7 @@ readhash(FILE *f, int flags) return (0); break; } - sum = sum * 127 + chrtran[t]; + sum = sum * 127 + chrtran(t); } else for (i = 0; (t = getc(f)) != '\n'; i++) { @@ -1303,7 +1332,7 @@ readhash(FILE *f, int flags) i++; space = 0; } - sum = sum * 127 + chrtran[t]; + sum = sum * 127 + chrtran(t); i++; continue; case EOF: @@ -1395,10 +1424,10 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) return; b = d = 0; /* gcc */ - lowa = MAXIMUM(1, cvp->a - diff_context); - upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); - lowc = MAXIMUM(1, cvp->c - diff_context); - upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); + lowa = MAX(1, cvp->a - diff_context); + upb = MIN(len[0], context_vec_ptr->b + diff_context); + lowc = MAX(1, cvp->c - diff_context); + upd = MIN(len[1], context_vec_ptr->d + diff_context); diff_output("***************"); if ((flags & D_PROTOTYPE)) { @@ -1498,10 +1527,10 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags) return; b = d = 0; /* gcc */ - lowa = MAXIMUM(1, cvp->a - diff_context); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Mar 23 22:36:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4644F5133A; Fri, 23 Mar 2018 22:36:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A2A6685F3; Fri, 23 Mar 2018 22:36:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50DEA260CC; Fri, 23 Mar 2018 22:36:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NMaPuJ088066; Fri, 23 Mar 2018 22:36:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NMaP8f088065; Fri, 23 Mar 2018 22:36:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803232236.w2NMaP8f088065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Mar 2018 22:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331466 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 331466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 22:36:25 -0000 Author: jhb Date: Fri Mar 23 22:36:24 2018 New Revision: 331466 URL: https://svnweb.freebsd.org/changeset/base/331466 Log: Add a workaround to the hypervisor detection for older versions of KVM. Originally KVM set %eax to 0 in the cpuid leaf 0x4000000 rather than to the highest supported leaf in the hypervisor "branch". Detect this case and fixup the %eax value so that the hypervisor is still detected. Reported by: jpaetzel Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14810 Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Fri Mar 23 21:06:06 2018 (r331465) +++ head/sys/x86/x86/identcpu.c Fri Mar 23 22:36:24 2018 (r331466) @@ -1304,6 +1304,18 @@ identify_hypervisor(void) if (cpu_feature2 & CPUID2_HV) { vm_guest = VM_GUEST_VM; do_cpuid(0x40000000, regs); + + /* + * KVM from Linux kernels prior to commit + * 57c22e5f35aa4b9b2fe11f73f3e62bbf9ef36190 set %eax + * to 0 rather than a valid hv_high value. Check for + * the KVM signature bytes and fixup %eax to the + * highest supported leaf in that case. + */ + if (regs[0] == 0 && regs[1] == 0x4b4d564b && + regs[2] == 0x564b4d56 && regs[3] == 0x0000004d) + regs[0] = 0x40000001; + if (regs[0] >= 0x40000000) { hv_high = regs[0]; ((u_int *)&hv_vendor)[0] = regs[1]; From owner-svn-src-all@freebsd.org Fri Mar 23 22:52:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94296F52950; Fri, 23 Mar 2018 22:52:27 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32B3169227; Fri, 23 Mar 2018 22:52:27 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DBF626406; Fri, 23 Mar 2018 22:52:27 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NMqRxb097699; Fri, 23 Mar 2018 22:52:27 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NMqRPk097698; Fri, 23 Mar 2018 22:52:27 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201803232252.w2NMqRPk097698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Fri, 23 Mar 2018 22:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331467 - head/usr.sbin/makefs/cd9660 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.sbin/makefs/cd9660 X-SVN-Commit-Revision: 331467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 22:52:27 -0000 Author: benno Date: Fri Mar 23 22:52:26 2018 New Revision: 331467 URL: https://svnweb.freebsd.org/changeset/base/331467 Log: Correctly mark the last El Torito section header. Reported by: Thomas Schmitt Reviewed by: emaste, imp MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D14812 Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:36:24 2018 (r331466) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:52:26 2018 (r331467) @@ -294,7 +294,10 @@ cd9660_boot_setup_section_head(char platform) return NULL; sh = &entry->entry_data.SH; - /* More by default. The last one will manually be set to 0x91 */ + /* + * More by default. + * The last one will manually be set to ET_SECTION_HEADER_LAST + */ sh->header_indicator[0] = ET_SECTION_HEADER_MORE; sh->platform_id[0] = platform; sh->num_section_entries[0] = 0; @@ -463,6 +466,13 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir LIST_INSERT_AFTER(head, temp, ll_struct); tmp_disk = TAILQ_NEXT(tmp_disk, image_list); } + + /* Find the last Section Header entry and mark it as the last. */ + LIST_FOREACH(next, &diskStructure->boot_entries, ll_struct) { + if (next->entry_type == ET_ENTRY_SH) + head = next; + } + head->entry_data.SH.header_indicator[0] = ET_SECTION_HEADER_LAST; /* TODO: Remaining boot disks when implemented */ From owner-svn-src-all@freebsd.org Fri Mar 23 22:59:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE59EF5346D; Fri, 23 Mar 2018 22:59:45 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C25D6988B; Fri, 23 Mar 2018 22:59:45 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6661E26413; Fri, 23 Mar 2018 22:59:45 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NMxjHc098020; Fri, 23 Mar 2018 22:59:45 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NMxjrr098019; Fri, 23 Mar 2018 22:59:45 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201803232259.w2NMxjrr098019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Fri, 23 Mar 2018 22:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331468 - head/usr.sbin/makefs/cd9660 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.sbin/makefs/cd9660 X-SVN-Commit-Revision: 331468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 22:59:45 -0000 Author: benno Date: Fri Mar 23 22:59:45 2018 New Revision: 331468 URL: https://svnweb.freebsd.org/changeset/base/331468 Log: Don't try to modify El Torito section headers if there aren't any. MFC after: 1 week Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:52:26 2018 (r331467) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:59:45 2018 (r331468) @@ -468,11 +468,14 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir } /* Find the last Section Header entry and mark it as the last. */ + head = NULL; LIST_FOREACH(next, &diskStructure->boot_entries, ll_struct) { if (next->entry_type == ET_ENTRY_SH) head = next; } - head->entry_data.SH.header_indicator[0] = ET_SECTION_HEADER_LAST; + if (head != NULL) + head->entry_data.SH.header_indicator[0] = + ET_SECTION_HEADER_LAST; /* TODO: Remaining boot disks when implemented */ From owner-svn-src-all@freebsd.org Fri Mar 23 23:02:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82134F53A25; Fri, 23 Mar 2018 23:02:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33E4F69D2E; Fri, 23 Mar 2018 23:02:51 +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 2E6C0265AB; Fri, 23 Mar 2018 23:02:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NN2p4W002905; Fri, 23 Mar 2018 23:02:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NN2pHf002904; Fri, 23 Mar 2018 23:02:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803232302.w2NN2pHf002904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 23:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331469 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 23:02:51 -0000 Author: kevans Date: Fri Mar 23 23:02:50 2018 New Revision: 331469 URL: https://svnweb.freebsd.org/changeset/base/331469 Log: loader.conf(5): Document efi_max_resolution Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Fri Mar 23 22:59:45 2018 (r331468) +++ head/stand/defaults/loader.conf.5 Fri Mar 23 23:02:50 2018 (r331469) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd March 19, 2018 +.Dd March 23, 2018 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -220,6 +220,13 @@ selects the video console which prevents any input and replacing it with .Dq spinning character (useful for embedded products and such). +.It Va efi_max_resolution +Specify the maximum desired resolution for the EFI console. +The following pre-defined values are accepted: 480p, 720p, 1080p, 2160p or 4k, +5k. +The standard +.Va WidthxHeight +format is also accepted, e.g., 1920x1080. .It Va kernel .Pq Dq kernel .It Va kernels From owner-svn-src-all@freebsd.org Fri Mar 23 23:47:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 135D2F5705D; Fri, 23 Mar 2018 23:47:00 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB28E6B94C; Fri, 23 Mar 2018 23:46:59 +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 A2CB026C39; Fri, 23 Mar 2018 23:46:59 +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 w2NNkx1e023095; Fri, 23 Mar 2018 23:46:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NNkx8E023094; Fri, 23 Mar 2018 23:46:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803232346.w2NNkx8E023094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 23:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331470 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 23:47:00 -0000 Author: kevans Date: Fri Mar 23 23:46:59 2018 New Revision: 331470 URL: https://svnweb.freebsd.org/changeset/base/331470 Log: loader.conf(5): Convert list of values to much better looking table format Discussed with: jhb, rpokala Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Fri Mar 23 23:02:50 2018 (r331469) +++ head/stand/defaults/loader.conf.5 Fri Mar 23 23:46:59 2018 (r331470) @@ -222,11 +222,17 @@ replacing it with character (useful for embedded products and such). .It Va efi_max_resolution Specify the maximum desired resolution for the EFI console. -The following pre-defined values are accepted: 480p, 720p, 1080p, 2160p or 4k, -5k. -The standard -.Va WidthxHeight -format is also accepted, e.g., 1920x1080. +The following values are accepted: +.Bl -column "WidthxHeight" +.It Sy Value Ta Sy Resolution +.It 480p Ta 640x480 +.It 720p Ta 1280x720 +.It 1080p Ta 1920x1080 +.It 2160p Ta 3840x2160 +.It 4k Ta 3840x2160 +.It 5k Ta 5120x2880 +.It Va Width Ns x Ns Va Height Ta Va Width Ns x Ns Va Height +.El .It Va kernel .Pq Dq kernel .It Va kernels From owner-svn-src-all@freebsd.org Sat Mar 24 00:26:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 385AEF5A7B4; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E02906D7B6; Sat, 24 Mar 2018 00:26:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAFF4272E2; Sat, 24 Mar 2018 00:26:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O0QgRp044071; Sat, 24 Mar 2018 00:26:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O0Qgun044067; Sat, 24 Mar 2018 00:26:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803240026.w2O0Qgun044067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 24 Mar 2018 00:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331471 - in stable: 10/bin/ps 11/bin/ps X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/bin/ps 11/bin/ps X-SVN-Commit-Revision: 331471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 00:26:43 -0000 Author: jhb Date: Sat Mar 24 00:26:42 2018 New Revision: 331471 URL: https://svnweb.freebsd.org/changeset/base/331471 Log: MFC 330872: Add a "jail" keyword to list the name of a jail rather than its ID. Modified: stable/10/bin/ps/extern.h stable/10/bin/ps/keyword.c stable/10/bin/ps/print.c stable/10/bin/ps/ps.1 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/bin/ps/extern.h stable/11/bin/ps/keyword.c stable/11/bin/ps/print.c stable/11/bin/ps/ps.1 Directory Properties: stable/11/ (props changed) Modified: stable/10/bin/ps/extern.h ============================================================================== --- stable/10/bin/ps/extern.h Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/extern.h Sat Mar 24 00:26:42 2018 (r331471) @@ -53,6 +53,7 @@ char *emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, char *, size_t); double getpcpu(const KINFO *); +char *jailname(KINFO *, VARENT *); char *kvar(KINFO *, VARENT *); char *label(KINFO *, VARENT *); char *loginclass(KINFO *, VARENT *); Modified: stable/10/bin/ps/keyword.c ============================================================================== --- stable/10/bin/ps/keyword.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/keyword.c Sat Mar 24 00:26:42 2018 (r331471) @@ -96,6 +96,7 @@ static VAR var[] = { {"ignored", "", "sigignore", 0, NULL, 0, CHAR, NULL, 0}, {"inblk", "INBLK", NULL, USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, {"inblock", "", "inblk", 0, NULL, 0, CHAR, NULL, 0}, + {"jail", "JAIL", NULL, LJUST, jailname, 0, CHAR, NULL, 0}, {"jid", "JID", NULL, 0, kvar, KOFF(ki_jid), INT, "d", 0}, {"jobc", "JOBC", NULL, 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, {"ktrace", "KTRACE", NULL, 0, kvar, KOFF(ki_traceflag), INT, "x", 0}, Modified: stable/10/bin/ps/print.c ============================================================================== --- stable/10/bin/ps/print.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/print.c Sat Mar 24 00:26:42 2018 (r331471) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused) return (strdup("-")); } return (strdup(k->ki_p->ki_loginclass)); +} + +char * +jailname(KINFO *k, VARENT *ve __unused) +{ + char *name; + + if (k->ki_p->ki_jid == 0) + return (strdup("-")); + name = jail_getname(k->ki_p->ki_jid); + if (name == NULL) + return (strdup("-")); + return (name); } Modified: stable/10/bin/ps/ps.1 ============================================================================== --- stable/10/bin/ps/ps.1 Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/ps.1 Sat Mar 24 00:26:42 2018 (r331471) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd August 12, 2016 +.Dd March 13, 2018 .Dt PS 1 .Os .Sh NAME @@ -554,6 +554,8 @@ group name (from egid) (alias .It Cm inblk total blocks read (alias .Cm inblock ) +.It Cm jail +jail name .It Cm jid jail ID .It Cm jobc From owner-svn-src-all@freebsd.org Sat Mar 24 00:26:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCB3DF5A7BD; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6ACED6D7B8; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65B64272E3; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O0QhoZ044080; Sat, 24 Mar 2018 00:26:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O0Qgm3044076; Sat, 24 Mar 2018 00:26:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803240026.w2O0Qgm3044076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 24 Mar 2018 00:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331471 - in stable: 10/bin/ps 11/bin/ps X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/bin/ps 11/bin/ps X-SVN-Commit-Revision: 331471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 00:26:44 -0000 Author: jhb Date: Sat Mar 24 00:26:42 2018 New Revision: 331471 URL: https://svnweb.freebsd.org/changeset/base/331471 Log: MFC 330872: Add a "jail" keyword to list the name of a jail rather than its ID. Modified: stable/11/bin/ps/extern.h stable/11/bin/ps/keyword.c stable/11/bin/ps/print.c stable/11/bin/ps/ps.1 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/bin/ps/extern.h stable/10/bin/ps/keyword.c stable/10/bin/ps/print.c stable/10/bin/ps/ps.1 Directory Properties: stable/10/ (props changed) Modified: stable/11/bin/ps/extern.h ============================================================================== --- stable/11/bin/ps/extern.h Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/extern.h Sat Mar 24 00:26:42 2018 (r331471) @@ -55,6 +55,7 @@ char *emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, char *, size_t); double getpcpu(const KINFO *); +char *jailname(KINFO *, VARENT *); char *kvar(KINFO *, VARENT *); char *label(KINFO *, VARENT *); char *loginclass(KINFO *, VARENT *); Modified: stable/11/bin/ps/keyword.c ============================================================================== --- stable/11/bin/ps/keyword.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/keyword.c Sat Mar 24 00:26:42 2018 (r331471) @@ -108,6 +108,7 @@ static VAR var[] = { {"inblk", "INBLK", NULL, "read-blocks", USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, {"inblock", "", "inblk", NULL, 0, NULL, 0, CHAR, NULL, 0}, + {"jail", "JAIL", NULL, "jail-name", LJUST, jailname, 0, CHAR, NULL, 0}, {"jid", "JID", NULL, "jail-id", 0, kvar, KOFF(ki_jid), INT, "d", 0}, {"jobc", "JOBC", NULL, "job-control-count", 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, Modified: stable/11/bin/ps/print.c ============================================================================== --- stable/11/bin/ps/print.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/print.c Sat Mar 24 00:26:42 2018 (r331471) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused) return (strdup("-")); } return (strdup(k->ki_p->ki_loginclass)); +} + +char * +jailname(KINFO *k, VARENT *ve __unused) +{ + char *name; + + if (k->ki_p->ki_jid == 0) + return (strdup("-")); + name = jail_getname(k->ki_p->ki_jid); + if (name == NULL) + return (strdup("-")); + return (name); } Modified: stable/11/bin/ps/ps.1 ============================================================================== --- stable/11/bin/ps/ps.1 Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/ps.1 Sat Mar 24 00:26:42 2018 (r331471) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd January 23, 2018 +.Dd March 13, 2018 .Dt PS 1 .Os .Sh NAME @@ -566,6 +566,8 @@ group name (from egid) (alias .It Cm inblk total blocks read (alias .Cm inblock ) +.It Cm jail +jail name .It Cm jid jail ID .It Cm jobc From owner-svn-src-all@freebsd.org Sat Mar 24 01:07:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7F2DF5D8E8; Sat, 24 Mar 2018 01:07:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69A626F293; Sat, 24 Mar 2018 01:07:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64A1A2794F; Sat, 24 Mar 2018 01:07:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O17wWO063874; Sat, 24 Mar 2018 01:07:58 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O17wqZ063873; Sat, 24 Mar 2018 01:07:58 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803240107.w2O17wqZ063873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 24 Mar 2018 01:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331472 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 331472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 01:07:58 -0000 Author: np Date: Sat Mar 24 01:07:58 2018 New Revision: 331472 URL: https://svnweb.freebsd.org/changeset/base/331472 Log: cxgbe(4): Always initialize requested_speed to a valid value. This fixes an avoidable EINVAL when the user tries to disable AN after the port is initialized but l1cfg doesn't have a valid speed to use. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Mar 24 00:26:42 2018 (r331471) +++ head/sys/dev/cxgbe/t4_main.c Sat Mar 24 01:07:58 2018 (r331472) @@ -3981,12 +3981,11 @@ init_l1cfg(struct port_info *pi) ASSERT_SYNCHRONIZED_OP(sc); + lc->requested_speed = port_top_speed(pi); /* in Gbps */ if (t4_autoneg != 0 && lc->supported & FW_PORT_CAP_ANEG) { lc->requested_aneg = AUTONEG_ENABLE; - lc->requested_speed = 0; } else { lc->requested_aneg = AUTONEG_DISABLE; - lc->requested_speed = port_top_speed(pi); /* in Gbps */ } lc->requested_fc = t4_pause_settings & (PAUSE_TX | PAUSE_RX); From owner-svn-src-all@freebsd.org Sat Mar 24 01:15:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F289EF5E52B; Sat, 24 Mar 2018 01:15:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6D626F96D; Sat, 24 Mar 2018 01:15:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1BE927B17; Sat, 24 Mar 2018 01:15:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O1FcC3068559; Sat, 24 Mar 2018 01:15:38 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O1FcFB068558; Sat, 24 Mar 2018 01:15:38 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803240115.w2O1FcFB068558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 24 Mar 2018 01:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331473 - stable/11/share/misc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/misc X-SVN-Commit-Revision: 331473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 01:15:39 -0000 Author: eadler Date: Sat Mar 24 01:15:38 2018 New Revision: 331473 URL: https://svnweb.freebsd.org/changeset/base/331473 Log: MFC: r331285 [bsd-family-tree] Announce NetBSD 7.1.2 Modified: stable/11/share/misc/bsd-family-tree Directory Properties: stable/11/ (props changed) Modified: stable/11/share/misc/bsd-family-tree ============================================================================== --- stable/11/share/misc/bsd-family-tree Sat Mar 24 01:07:58 2018 (r331472) +++ stable/11/share/misc/bsd-family-tree Sat Mar 24 01:15:38 2018 (r331473) @@ -365,6 +365,8 @@ FreeBSD 5.2 | | | | | | | | | | | | | | NetBSD 7.1.1 | DragonFly 5.0.2 | | | | | | | + | | | | NetBSD 7.1.2 | | + | | | | | | | | | | | v | | | v | | | | | | | | | @@ -736,6 +738,7 @@ DragonFly 5.0.0 2017-10-16 [DFB] DragonFly 5.0.1 2017-11-06 [DFB] DragonFly 5.0.2 2017-12-04 [DFB] NetBSD 7.1.1 2017-12-22 [NBD] +NetBSD 7.1.2 2018-03-15 [NBD] Bibliography ------------------------ From owner-svn-src-all@freebsd.org Sat Mar 24 01:53:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 352D7F606E2; Sat, 24 Mar 2018 01:53:44 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D52E270EAC; Sat, 24 Mar 2018 01:53:43 +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 CE6D025F; Sat, 24 Mar 2018 01:53:43 +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 w2O1rhnQ088235; Sat, 24 Mar 2018 01:53:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O1rhck088233; Sat, 24 Mar 2018 01:53:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240153.w2O1rhck088233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 01:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331474 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 331474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 01:53:44 -0000 Author: kevans Date: Sat Mar 24 01:53:43 2018 New Revision: 331474 URL: https://svnweb.freebsd.org/changeset/base/331474 Log: efi loader: Choose a console mode instead if hw.vga.textmode is set Not all systems use efifb; pull hw.vga.textmode and choose a good console mode instead if it's set to something non-zero. This is basically a revival of the code that used to live in boot1, but instead rebased onto this different way of doing mode selection in loader.efi. Interestingly enough, the regression that was previously introduced where GOP would not reflect the console setting does not seem to exist when console mode selection is done here. I've not done any investigation as to why this is the case. Nevertheless, boot1.efi is still not the best place to do mode selection. Modified: head/stand/efi/loader/framebuffer.c Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Sat Mar 24 01:15:38 2018 (r331473) +++ head/stand/efi/loader/framebuffer.c Sat Mar 24 01:53:43 2018 (r331474) @@ -588,6 +588,29 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) } static int +text_autoresize() +{ + SIMPLE_TEXT_OUTPUT_INTERFACE *conout; + EFI_STATUS status; + UINTN i, max_dim, best_mode, cols, rows; + + conout = ST->ConOut; + max_dim = best_mode = 0; + for (i = 0; i < conout->Mode->MaxMode; i++) { + status = conout->QueryMode(conout, i, &cols, &rows); + if (EFI_ERROR(status)) + continue; + if (cols * rows > max_dim) { + max_dim = cols * rows; + best_mode = i; + } + } + if (max_dim > 0) + conout->SetMode(conout, best_mode); + return (CMD_OK); +} + +static int uga_autoresize(EFI_UGA_DRAW_PROTOCOL *gop) { @@ -601,8 +624,14 @@ command_autoresize(int argc, char *argv[]) { EFI_GRAPHICS_OUTPUT *gop; EFI_UGA_DRAW_PROTOCOL *uga; + char *textmode; EFI_STATUS status; u_int mode; + + textmode = getenv("hw.vga.textmode"); + /* If it's set and non-zero, we'll select a console mode instead */ + if (textmode != NULL && strcmp(textmode, "0") != 0) + return (text_autoresize()); gop = NULL; uga = NULL; From owner-svn-src-all@freebsd.org Sat Mar 24 02:01:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F41BAF60B10; Sat, 24 Mar 2018 02:01:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2E9A71297; Sat, 24 Mar 2018 02:01:25 +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 9DE933B8; Sat, 24 Mar 2018 02:01:25 +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 w2O21PAL090794; Sat, 24 Mar 2018 02:01:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O21P1d090791; Sat, 24 Mar 2018 02:01:25 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240201.w2O21P1d090791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 02:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331475 - in head/stand: efi/libefi i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: efi/libefi i386/libi386 X-SVN-Commit-Revision: 331475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 02:01:26 -0000 Author: kevans Date: Sat Mar 24 02:01:25 2018 New Revision: 331475 URL: https://svnweb.freebsd.org/changeset/base/331475 Log: loader consoles: Implement SGR 24, 25 Mostly for completeness sake- implement 24 (no underline) and 25 (no blink) MFC after: 3 days Modified: head/stand/efi/libefi/efi_console.c head/stand/i386/libi386/vidconsole.c Modified: head/stand/efi/libefi/efi_console.c ============================================================================== --- head/stand/efi/libefi/efi_console.c Sat Mar 24 01:53:43 2018 (r331474) +++ head/stand/efi/libefi/efi_console.c Sat Mar 24 02:01:25 2018 (r331475) @@ -386,6 +386,10 @@ efi_term_emu(int c) case 22: /* normal intensity */ fg_c &= ~0x8; break; + case 24: /* not underline */ + case 25: /* not blinking */ + bg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; Modified: head/stand/i386/libi386/vidconsole.c ============================================================================== --- head/stand/i386/libi386/vidconsole.c Sat Mar 24 01:53:43 2018 (r331474) +++ head/stand/i386/libi386/vidconsole.c Sat Mar 24 02:01:25 2018 (r331475) @@ -452,6 +452,10 @@ vidc_term_emu(int c) case 22: /* normal intensity */ fg_c &= ~0x8; break; + case 24: /* not underline */ + case 25: /* not blinking */ + bg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; From owner-svn-src-all@freebsd.org Sat Mar 24 04:03:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EC25F682EE; Sat, 24 Mar 2018 04:03:56 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C84F76431; Sat, 24 Mar 2018 04:03:56 +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 35C8219D2; Sat, 24 Mar 2018 04:03:56 +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 w2O43uCC053692; Sat, 24 Mar 2018 04:03:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O43uNT053691; Sat, 24 Mar 2018 04:03:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240403.w2O43uNT053691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 04:03:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331477 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:03:56 -0000 Author: kevans Date: Sat Mar 24 04:03:55 2018 New Revision: 331477 URL: https://svnweb.freebsd.org/changeset/base/331477 Log: lualoader: Privatize some more config.lua bits These functions are also not quite suitable for a public API, so privatize them to config. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Mar 24 04:00:01 2018 (r331476) +++ head/stand/lua/config.lua Sat Mar 24 04:03:55 2018 (r331477) @@ -92,6 +92,16 @@ local function setEnv(key, value) return loader.setenv(key, value) end +-- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.' +-- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where +-- ${key} is a module name. +local function setKey(key, name, value) + if modules[key] == nil then + modules[key] = {} + end + modules[key][name] = value +end + local pattern_table = { { str = "^%s*(#.*)", @@ -111,42 +121,42 @@ local pattern_table = { { str = "^%s*([%w_]+)_name%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "name", v) + setKey(k, "name", v) end, }, -- module_type="value" { str = "^%s*([%w_]+)_type%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "type", v) + setKey(k, "type", v) end, }, -- module_flags="value" { str = "^%s*([%w_]+)_flags%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "flags", v) + setKey(k, "flags", v) end, }, -- module_before="value" { str = "^%s*([%w_]+)_before%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "before", v) + setKey(k, "before", v) end, }, -- module_after="value" { str = "^%s*([%w_]+)_after%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "after", v) + setKey(k, "after", v) end, }, -- module_error="value" { str = "^%s*([%w_]+)_error%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "error", v) + setKey(k, "error", v) end, }, -- exec="command" @@ -178,6 +188,73 @@ local pattern_table = { }, } +local function isValidComment(line) + if line ~= nil then + local s = line:match("^%s*#.*") + if s == nil then + s = line:match("^%s*$") + end + if s == nil then + return false + end + end + return true +end + +local function loadModule(mod, silent) + local status = true + local pstatus + for k, v in pairs(mod) do + if v.load == "YES" then + local str = "load " + if v.flags ~= nil then + str = str .. v.flags .. " " + end + if v.type ~= nil then + str = str .. "-t " .. v.type .. " " + end + if v.name ~= nil then + str = str .. v.name + else + str = str .. k + end + if v.before ~= nil then + pstatus = cli_execute_unparsed(v.before) == 0 + if not pstatus and not silent then + print(MSG_FAILEXBEF:format(v.before, k)) + end + status = status and pstatus + end + + if cli_execute_unparsed(str) ~= 0 then + if not silent then + print(MSG_FAILEXMOD:format(str)) + end + if v.error ~= nil then + cli_execute_unparsed(v.error) + end + status = false + end + + if v.after ~= nil then + pstatus = cli_execute_unparsed(v.after) == 0 + if not pstatus and not silent then + print(MSG_FAILEXAF:format(v.after, k)) + end + status = status and pstatus + end + +-- else +-- if not silent then +-- print("Skipping module '". . k .. "'") +-- end + end + end + + return status +end + + local function readFile(name, silent) local f = io.open(name) if f == nil then @@ -252,82 +329,6 @@ function config.setCarouselIndex(id, idx) carousel_choices[id] = idx end --- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.' --- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where --- ${key} is a module name. -function config.setKey(key, name, value) - if modules[key] == nil then - modules[key] = {} - end - modules[key][name] = value -end - -function config.isValidComment(line) - if line ~= nil then - local s = line:match("^%s*#.*") - if s == nil then - s = line:match("^%s*$") - end - if s == nil then - return false - end - end - return true -end - -function config.loadmod(mod, silent) - local status = true - local pstatus - for k, v in pairs(mod) do - if v.load == "YES" then - local str = "load " - if v.flags ~= nil then - str = str .. v.flags .. " " - end - if v.type ~= nil then - str = str .. "-t " .. v.type .. " " - end - if v.name ~= nil then - str = str .. v.name - else - str = str .. k - end - if v.before ~= nil then - pstatus = cli_execute_unparsed(v.before) == 0 - if not pstatus and not silent then - print(MSG_FAILEXBEF:format(v.before, k)) - end - status = status and pstatus - end - - if cli_execute_unparsed(str) ~= 0 then - if not silent then - print(MSG_FAILEXMOD:format(str)) - end - if v.error ~= nil then - cli_execute_unparsed(v.error) - end - status = false - end - - if v.after ~= nil then - pstatus = cli_execute_unparsed(v.after) == 0 - if not pstatus and not silent then - print(MSG_FAILEXAF:format(v.after, k)) - end - status = status and pstatus - end - --- else --- if not silent then --- print("Skipping module '". . k .. "'") --- end - end - end - - return status -end - -- Returns true if we processed the file successfully, false if we did not. -- If 'silent' is true, being unable to read the file is not considered a -- failure. @@ -358,7 +359,7 @@ function config.parse(text) if k ~= nil then found = true - if config.isValidComment(c) then + if isValidComment(c) then val.process(k, v) else print(MSG_MALFORMED:format(n, @@ -520,7 +521,7 @@ function config.loadelf() end print(MSG_MODLOADING) - if not config.loadmod(modules, not config.verbose) then + if not loadModule(modules, not config.verbose) then print(MSG_MODLOADFAIL) end end From owner-svn-src-all@freebsd.org Sat Mar 24 04:00:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A8B8F67CBF; Sat, 24 Mar 2018 04:00:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1907475E63; Sat, 24 Mar 2018 04:00:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE6441836; Sat, 24 Mar 2018 04:00:01 +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 w2O40115049007; Sat, 24 Mar 2018 04:00:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4011C049006; Sat, 24 Mar 2018 04:00:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240400.w2O4011C049006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 04:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331476 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:00:02 -0000 Author: kevans Date: Sat Mar 24 04:00:01 2018 New Revision: 331476 URL: https://svnweb.freebsd.org/changeset/base/331476 Log: lualoader: Make config env-related bits private API This pertains exclusively to the set/restore functionality that we offer, where any changes made by loader.conf previously will be effectively removed upon reload of the configuration. We don't currently have a need to export these, so don't bother. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Mar 24 02:01:25 2018 (r331475) +++ head/stand/lua/config.lua Sat Mar 24 04:00:01 2018 (r331476) @@ -34,6 +34,10 @@ local hook = require("hook") local config = {} local modules = {} local carousel_choices = {} +-- Which variables we changed +local env_changed = {} +-- Values to restore env to (nil to unset) +local env_restore = {} local MSG_FAILEXEC = "Failed to exec '%s'" local MSG_FAILSETENV = "Failed to '%s' with value: %s" @@ -50,6 +54,44 @@ local MSG_KERNLOADING = "Loading kernel..." local MSG_MODLOADING = "Loading configured modules..." local MSG_MODLOADFAIL = "Could not load one or more modules!" +local function restoreEnv() + -- Examine changed environment variables + for k, v in pairs(env_changed) do + local restore_value = env_restore[k] + if restore_value == nil then + -- This one doesn't need restored for some reason + goto continue + end + local current_value = loader.getenv(k) + if current_value ~= v then + -- This was overwritten by some action taken on the menu + -- most likely; we'll leave it be. + goto continue + end + restore_value = restore_value.value + if restore_value ~= nil then + loader.setenv(k, restore_value) + else + loader.unsetenv(k) + end + ::continue:: + end + + env_changed = {} + env_restore = {} +end + +local function setEnv(key, value) + -- Track the original value for this if we haven't already + if env_restore[key] == nil then + env_restore[key] = {value = loader.getenv(key)} + end + + env_changed[key] = value + + return loader.setenv(key, value) +end + local pattern_table = { { str = "^%s*(#.*)", @@ -120,7 +162,7 @@ local pattern_table = { { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if config.setenv(k, v) ~= 0 then + if setEnv(k, v) ~= 0 then print(MSG_FAILSETENV:format(k, v)) end end, @@ -129,7 +171,7 @@ local pattern_table = { { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - if config.setenv(k, v) ~= 0 then + if setEnv(k, v) ~= 0 then print(MSG_FAILSETENV:format(k, tostring(v))) end end, @@ -195,10 +237,6 @@ local function checkNextboot() end -- Module exports --- Which variables we changed -config.env_changed = {} --- Values to restore env to (nil to unset) -config.env_restore = {} config.verbose = false -- The first item in every carousel is always the default item. @@ -214,44 +252,6 @@ function config.setCarouselIndex(id, idx) carousel_choices[id] = idx end -function config.restoreEnv() - -- Examine changed environment variables - for k, v in pairs(config.env_changed) do - local restore_value = config.env_restore[k] - if restore_value == nil then - -- This one doesn't need restored for some reason - goto continue - end - local current_value = loader.getenv(k) - if current_value ~= v then - -- This was overwritten by some action taken on the menu - -- most likely; we'll leave it be. - goto continue - end - restore_value = restore_value.value - if restore_value ~= nil then - loader.setenv(k, restore_value) - else - loader.unsetenv(k) - end - ::continue:: - end - - config.env_changed = {} - config.env_restore = {} -end - -function config.setenv(key, value) - -- Track the original value for this if we haven't already - if config.env_restore[key] == nil then - config.env_restore[key] = {value = loader.getenv(key)} - end - - config.env_changed[key] = value - - return loader.setenv(key, value) -end - -- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.' -- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where -- ${key} is a module name. @@ -503,7 +503,7 @@ end -- Reload configuration function config.reload(file) modules = {} - config.restoreEnv() + restoreEnv() config.load(file) hook.runAll("config.reloaded") end From owner-svn-src-all@freebsd.org Sat Mar 24 04:21:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38557F69642; Sat, 24 Mar 2018 04:21:23 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD32B771FF; Sat, 24 Mar 2018 04:21:22 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D80341C71; Sat, 24 Mar 2018 04:21:22 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O4LM6H062229; Sat, 24 Mar 2018 04:21:22 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4LMgS062228; Sat, 24 Mar 2018 04:21:22 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201803240421.w2O4LMgS062228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Sat, 24 Mar 2018 04:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331478 - head/usr.sbin/ctld X-SVN-Group: head X-SVN-Commit-Author: jmg X-SVN-Commit-Paths: head/usr.sbin/ctld X-SVN-Commit-Revision: 331478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:21:23 -0000 Author: jmg Date: Sat Mar 24 04:21:22 2018 New Revision: 331478 URL: https://svnweb.freebsd.org/changeset/base/331478 Log: minor work smithing... Modified: head/usr.sbin/ctld/ctld.8 Modified: head/usr.sbin/ctld/ctld.8 ============================================================================== --- head/usr.sbin/ctld/ctld.8 Sat Mar 24 04:03:55 2018 (r331477) +++ head/usr.sbin/ctld/ctld.8 Sat Mar 24 04:21:22 2018 (r331478) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 28, 2017 +.Dd March 23, 2018 .Dt CTLD 8 .Os .Sh NAME @@ -47,8 +47,11 @@ passing connections to the kernel part of the native i .Pp Upon startup, the .Nm -daemon parses the configuration file and exits, if it encounters any errors. -Then it compares the configuration with the kernel list of LUNs managed +daemon parses the configuration file. +If it encounters any errors, +.Nm +exits. +It then compares the configuration with the kernel list of LUNs managed by previously running .Nm instances, removes LUNs no longer existing in the configuration file, From owner-svn-src-all@freebsd.org Sat Mar 24 04:41:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38DA1F6B263; Sat, 24 Mar 2018 04:41:50 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAD7478092; Sat, 24 Mar 2018 04:41:49 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D574F20FB; Sat, 24 Mar 2018 04:41:49 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O4fnT6073208; Sat, 24 Mar 2018 04:41:49 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4fncf073200; Sat, 24 Mar 2018 04:41:49 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201803240441.w2O4fncf073200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 24 Mar 2018 04:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r331479 - vendor/tzdata/dist X-SVN-Group: vendor X-SVN-Commit-Author: philip X-SVN-Commit-Paths: vendor/tzdata/dist X-SVN-Commit-Revision: 331479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:41:50 -0000 Author: philip Date: Sat Mar 24 04:41:49 2018 New Revision: 331479 URL: https://svnweb.freebsd.org/changeset/base/331479 Log: Import tzdata 2018d Added: vendor/tzdata/dist/ziguard.awk (contents, props changed) Modified: vendor/tzdata/dist/CONTRIBUTING vendor/tzdata/dist/Makefile vendor/tzdata/dist/NEWS vendor/tzdata/dist/africa vendor/tzdata/dist/antarctica vendor/tzdata/dist/asia vendor/tzdata/dist/australasia vendor/tzdata/dist/backzone vendor/tzdata/dist/checktab.awk vendor/tzdata/dist/europe vendor/tzdata/dist/northamerica vendor/tzdata/dist/southamerica vendor/tzdata/dist/theory.html vendor/tzdata/dist/version vendor/tzdata/dist/zishrink.awk vendor/tzdata/dist/zone.tab vendor/tzdata/dist/zone1970.tab Modified: vendor/tzdata/dist/CONTRIBUTING ============================================================================== --- vendor/tzdata/dist/CONTRIBUTING Sat Mar 24 04:21:22 2018 (r331478) +++ vendor/tzdata/dist/CONTRIBUTING Sat Mar 24 04:41:49 2018 (r331479) @@ -25,7 +25,8 @@ justification. Citations should use https: URLs if av Please submit changes against either the latest release in or the master branch of the development -repository. If you use Git the following workflow may be helpful: +repository. The latter is preferred. If you use Git the following +workflow may be helpful: * Copy the development repository. @@ -42,6 +43,12 @@ repository. If you use Git the following workflow may git checkout -b mybranch + * Sleuth by using 'git blame'. For example, when fixing data for + Africa/Sao_Tome, if the command 'git blame africa' outputs a line + '2951fa3b (Paul Eggert 2018-01-08 09:03:13 -0800 1068) Zone + Africa/Sao_Tome 0:26:56 - LMT 1884', commit 2951fa3b should + provide some justification for the 'Zone Africa/Sao_Tome' line. + * Edit source files. Include commentary that justifies the changes by citing reliable sources. @@ -66,6 +73,9 @@ repository. If you use Git the following workflow may for others to review. git send-email master + + For an archived example of such an email, see + . * Start anew by getting current with the master branch again (the second step above). Modified: vendor/tzdata/dist/Makefile ============================================================================== --- vendor/tzdata/dist/Makefile Sat Mar 24 04:21:22 2018 (r331478) +++ vendor/tzdata/dist/Makefile Sat Mar 24 04:41:49 2018 (r331479) @@ -10,6 +10,15 @@ VERSION= unknown # Email address for bug reports. BUGEMAIL= tz@iana.org +# Choose source data features. To get new features right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +DATAFORM= main + # Change the line below for your time zone (after finding the zone you want in # the time zone files, or adding it to a time zone file). # Alternately, if you discover you've got the wrong time zone, you can just @@ -25,10 +34,10 @@ LOCALTIME= GMT # for handling POSIX-style time zone environment variables, # change the line below (after finding the zone you want in the # time zone files, or adding it to a time zone file). -# (When a POSIX-style environment variable is handled, the rules in the +# When a POSIX-style environment variable is handled, the rules in the # template file are used to determine "spring forward" and "fall back" days and # times; the environment variable itself specifies UT offsets of standard and -# summer time.) +# daylight saving time. # Alternately, if you discover you've got the wrong time zone, you can just # zic -p rightzone # to correct things. @@ -189,13 +198,18 @@ LDLIBS= # -DHAVE_STDINT_H if you have a non-C99 compiler with # -DHAVE_STRFTIME_L if declares locale_t and strftime_l # -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function # -DHAVE_SYMLINK=0 if your system lacks the symlink function # -DHAVE_SYS_STAT_H=0 if your compiler lacks a # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a # -DHAVE_TZSET=0 if your system lacks a tzset function # -DHAVE_UNISTD_H=0 if your compiler lacks a # -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. # -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; # not needed by the main-program tz code, which is single-threaded. # Append other compiler flags as needed, e.g., -pthread on GNU/Linux. @@ -394,13 +408,19 @@ SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. XEmacs 21.5.34 displays them correctly, +# presumably because they are Latin-1. +UNUSUAL_OK_CHARSET= °±½¾× + # OK_CHAR matches any character allowed in the distributed files. -# This is the same as SAFE_CHAR, except that multibyte letters are -# also allowed so that commentary can contain people's names and quote -# non-English sources. For non-letters the sources are limited to -# ASCII renderings for the convenience of maintainers whose text editors -# mishandle UTF-8 by default (e.g., XEmacs 21.4.22). -OK_CHAR= '[][:alpha:]'$(SAFE_CHARSET)'-]' +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' # SAFE_LINE matches a line of safe characters. # SAFE_SHARP_LINE is similar, except any OK character can follow '#'; @@ -462,10 +482,12 @@ TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl TZS_YEAR= 2050 TZS= to$(TZS_YEAR).tzs @@ -499,7 +521,8 @@ VERSION_DEPS= \ SHELL= /bin/sh -all: tzselect yearistype zic zdump libtz.a $(TABDATA) +all: tzselect yearistype zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi ALL: all date $(ENCHILADA) @@ -534,11 +557,15 @@ version: $(VERSION_DEPS) printf '%s\n' "$$V" >$@.out mv $@.out $@ -# This file can be tailored by setting BACKWARD, PACKRATDATA, etc. -tzdata.zi: $(TZDATA_ZI_DEPS) +# These files can be tailored by setting BACKWARD, PACKRATDATA, etc. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) -v outfile='$@' -f ziguard.awk $(TDATA) $(PACKRATDATA) \ + >$@.out + mv $@.out $@ +tzdata.zi: $(DATAFORM).zi version version=`sed 1q version` && \ LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \ - $(TDATA) $(PACKRATDATA) >$@.out + $(DATAFORM).zi >$@.out mv $@.out $@ version.h: version @@ -614,19 +641,29 @@ posix_packrat: zones: $(REDO) +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@ + $(TZS_NEW): tzdata.zi zdump zic - mkdir -p tzs.dir + rm -fr tzs.dir + mkdir tzs.dir $(zic) -d tzs.dir tzdata.zi $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ tzdata.zi | LC_ALL=C sort >$@.out wd=`pwd` && \ - zones=`$(AWK) -v wd="$$wd" \ - '/^Z/{print wd "/tzs.dir/" $$2}' tzdata.zi \ - | LC_ALL=C sort` && \ - ./zdump -i -c $(TZS_YEAR) $$zones >>$@.out - sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out - rm -fr tzs.dir $@.out - mv $@.sed.out $@ + set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2` && \ + shift && \ + ZDS=$$* && \ + $(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs.dir + mv $@.out $@ # If $(TZS) does not already exist (e.g., old-format tarballs), create it. # If it exists but 'make check_tzs' fails, a maintainer should inspect the @@ -669,8 +706,10 @@ check_character_set: $(ENCHILADA) sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ - CONTRIBUTING LICENSE Makefile README \ + CONTRIBUTING LICENSE README \ version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \ + Makefile && \ ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ @@ -702,7 +741,7 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA_TO_CHECK) +check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi @@ -720,17 +759,26 @@ check_tzs: $(TZS) $(TZS_NEW) check_web: tz-how-to.html $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html -# Check that tzdata.zi generates the same binary data that its sources do. -check_zishrink: tzdata.zi zic leapseconds $(PACKRATDATA) $(TDATA) +# Check that zishrink.awk does not alter the data, and that ziguard.awk +# preserves main-format data. +check_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \ + $(DATAFORM).zi tzdata.zi for type in posix right; do \ - mkdir -p time_t.dir/$$type time_t.dir/$$type-shrunk && \ + mkdir -p time_t.dir/$$type time_t.dir/$$type-t \ + time_t.dir/$$type-shrunk && \ case $$type in \ right) leap='-L leapseconds';; \ *) leap=;; \ esac && \ - $(ZIC) $$leap -d time_t.dir/$$type $(TDATA) && \ - $(AWK) '/^Rule/' $(TDATA) | \ - $(ZIC) $$leap -d time_t.dir/$$type - $(PACKRATDATA) && \ + $(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \ + case $(DATAFORM) in \ + main) \ + $(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) $$leap -d time_t.dir/$$type-t - \ + $(PACKRATDATA) && \ + diff -r time_t.dir/$$type time_t.dir/$$type-t;; \ + esac && \ $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \ diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \ done @@ -740,7 +788,7 @@ clean_misc: rm -f core *.o *.out \ date tzselect version.h zdump zic yearistype libtz.a clean: clean_misc - rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW) + rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW) maintainer-clean: clean @echo 'This command is intended for maintainers to use; it' @@ -856,6 +904,9 @@ tarballs traditional_tarballs signatures traditional_s VERSION=`cat version` && \ $(MAKE) VERSION="$$VERSION" $@_version +# These *_version rules are intended for use if VERSION is set by some +# other means. Ordinarily these rules are used only by the above +# non-_version rules, which set VERSION on the 'make' command line. tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz traditional_tarballs_version: \ tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz @@ -917,13 +968,17 @@ zic.o: private.h tzfile.h version.h .KEEP_STATE: .PHONY: ALL INSTALL all -.PHONY: check check_character_set check_links +.PHONY: check check_character_set check_links check_name_lengths .PHONY: check_public check_sorted check_tables .PHONY: check_time_t_alternatives check_tzs check_web check_white_space .PHONY: check_zishrink -.PHONY: clean clean_misc force_tzs +.PHONY: clean clean_misc dummy.zd force_tzs .PHONY: install install_data maintainer-clean names .PHONY: posix_only posix_packrat posix_right .PHONY: public right_only right_posix signatures signatures_version -.PHONY: tarballs tarballs_version typecheck +.PHONY: tarballs tarballs_version +.PHONY: traditional_signatures traditional_signatures_version +.PHONY: traditional_tarballs traditional_tarballs_version +.PHONY: typecheck .PHONY: zonenames zones +.PHONY: $(ZDS) Modified: vendor/tzdata/dist/NEWS ============================================================================== --- vendor/tzdata/dist/NEWS Sat Mar 24 04:21:22 2018 (r331478) +++ vendor/tzdata/dist/NEWS Sat Mar 24 04:41:49 2018 (r331479) @@ -1,9 +1,146 @@ News for the tz database +Release 2018d - 2018-03-22 07:05:46 -0700 + + Briefly: + + Palestine starts DST a week earlier in 2018. + Add support for vanguard and rearguard data consumers. + Add subsecond precision to source data format, though not to data. + + Changes to future time stamps + + In 2018, Palestine starts DST on March 24, not March 31. + Adjust future predictions accordingly. (Thanks to Sharef Mustafa.) + + Changes to past and future time stamps + + Casey Station in Antarctica changed from +11 to +08 on 2018-03-11 + at 04:00. (Thanks to Steffen Thorsen.) + + Changes to past time stamps + + Historical transitions for Uruguay, represented by + America/Montevideo, have been updated per official legal documents, + replacing previous data mainly originating from the inventions of + Shanks & Pottenger. This has resulted in adjustments ranging from + 30 to 90 minutes in either direction over at least two dozen + distinct periods ranging from one day to several years in length. + A mere handful of pre-1991 transitions are unaffected; data since + then has come from more reliable contemporaneous reporting. These + changes affect various timestamps in 1920-1923, 1936, 1939, + 1942-1943, 1959, 1966-1970, 1972, 1974-1980, and 1988-1990. + Additionally, Uruguay's pre-standard-time UT offset has been + adjusted westward by 7 seconds, from UT-03:44:44 to UT-03:44:51, to + match the location of the Observatory of the National Meteorological + Institute in Montevideo. + (Thanks to Jeremie Bonjour, Tim Parenti, and Michael Deckers.) + + Enderbury and Kiritimati skipped New Year's Eve 1994, not + New Year's Day 1995. (Thanks to Kerry Shetline.) + + Fix the 1912-01-01 transition for Portugual and its colonies. + This transition was at 00:00 according to the new UT offset, not + according to the old one. Also assume that Cape Verde switched on + the same date as the rest, not in 1907. This affects + Africa/Bissau, Africa/Sao_Tome, Asia/Macau, Atlantic/Azores, + Atlantic/Cape_Verde, Atlantic/Madeira, and Europe/Lisbon. + (Thanks to Michael Deckers.) + + Fix an off-by-1 error for pre-1913 timestamps in Jamaica and in + Turks & Caicos. + + Changes to past time zone abbreviations + + MMT took effect in Uruguay from 1908-06-10, not 1898-06-28. There + is no clock change associated with the transition. + + Changes to build procedure + + The new DATAFORM macro in the Makefile lets the installer choose + among three source data formats. The idea is to lessen downstream + disruption when data formats are improved. + + * DATAFORM=vanguard installs from the latest, bleeding-edge + format. DATAFORM=main (the default) installs from the format + used in the 'africa' etc. files. DATAFORM=rearguard installs + from a trailing-edge format. Eventually, elements of today's + vanguard format should move to the main format, and similarly + the main format's features should eventually move to the + rearguard format. + + * In the current version, the main and rearguard formats are + identical and match that of 2018c, so this change does not + affect default behavior. The vanguard format currently contains + one feature not in the main format: negative SAVE values. This + improves support for Ireland, which uses Irish Standard Time + (IST, UTC+01) in summer and GMT (UTC) in winter. tzcode has + supported negative SAVE values for decades, and this feature + should move to the main format soon. However, it will not move + to the rearguard format for quite some time because some + downstream parsers do not support it. + + * The build procedure constructs three files vanguard.zi, main.zi, + and rearguard.zi, one for each format. The files represent the + same data as closely as the formats allow. These three files + are intended for downstream data consumers and are not + installed. Zoneinfo parsers that do not support negative SAVE values + should start using rearguard.zi, so that they will be unaffected + when the negative-DST feature moves from vanguard to main. + Bleeding-edge Zoneinfo parsers that support the new features + already can use vanguard.zi; in this respect, current tzcode is + bleeding-edge. + + The Makefile should now be safe for parallelized builds, and 'make + -j to2050new.tzs' is now much faster on a multiprocessor host + with GNU Make. + + When built with -DSUPPRESS_TZDIR, the tzcode library no longer + prepends TZDIR/ to file names that do not begin with '/'. This is + not recommended for general use, due to its security implications. + (From a suggestion by Manuela Friedrich.) + + Changes to code + + zic now accepts subsecond precision in expressions like + 00:19:32.13, which is approximately the legal time of the + Netherlands from 1835 to 1937. However, because it is + questionable whether the few recorded uses of non-integer offsets + had subsecond precision in practice, there are no plans for tzdata + to use this feature. (Thanks to Steve Allen for pointing out + the limitations of historical data in this area.) + + The code is a bit more portable to MS-Windows. Installers can + compile with -DRESERVE_STD_EXT_IDS on MS-Windows platforms that + reserve identifiers like 'localtime'. (Thanks to Manuela + Friedrich). + + Changes to documentation and commentary + + theory.html now outlines tzdb's extensions to POSIX's model for + civil time, and has a section "POSIX features no longer needed" + that lists POSIX API components that are now vestigial. + (From suggestions by Steve Summit.) It also better distinguishes + time zones from tz regions. (From a suggestion by Guy Harris.) + + Commentary is now more consistent about using the phrase "daylight + saving time", to match the C name tm_isdst. Daylight saving time + need not occur in summer, and need not have a positive offset from + standard time. + + Commentary about historical transitions in Uruguay has been expanded + with links to many relevant legal documents. + (Thanks to Tim Parenti.) + + Commentary now uses some non-ASCII characters with Unicode value + less than U+0100, as they can be useful and should work even with + older editors such as XEmacs. + + Release 2018c - 2018-01-22 23:00:44 -0800 Briefly: - Revert Irish changes that relied on negative DST offsets. + Revert Irish changes that relied on negative SAVE values. Changes to tm_isdst @@ -14,8 +151,8 @@ Release 2018c - 2018-01-22 23:00:44 -0800 struct tm type. This reversion is intended to be a temporary workaround for problems discovered with downstream uses of releases 2018a and 2018b, which implemented Irish time by using - negative DST offsets in the Eire rules of the 'europe' file. - Although negative DST offsets have been part of tzcode for many + negative SAVE values in the Eire rules of the 'europe' file. + Although negative SAVE values have been part of tzcode for many years and are supported by many platforms, they were not documented before 2018a and ICU and OpenJDK do not currently support them. A mechanism to export data to platforms lacking @@ -900,7 +1037,7 @@ Release 2016b - 2016-03-12 17:30:14 -0800 Comments in zone tables have been improved. (Thanks to J William Piggott.) tzselect again limits its menu comments so that menus fit on a - 24x80 alphanumeric display. + 24×80 alphanumeric display. A new web page tz-how-to.html. (Thanks to Bill Seymour.) Modified: vendor/tzdata/dist/africa ============================================================================== --- vendor/tzdata/dist/africa Sat Mar 24 04:21:22 2018 (r331478) +++ vendor/tzdata/dist/africa Sat Mar 24 04:41:49 2018 (r331479) @@ -115,13 +115,13 @@ Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01 # Cape Verde / Cabo Verde # +# From Paul Eggert (2018-02-16): # Shanks gives 1907 for the transition to +02. -# Perhaps the 1911-05-26 Portuguese decree -# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf -# merely made it official? +# For now, ignore that and follow the 1911-05-26 Portuguese decree +# (see Europe/Lisbon). # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia +Zone Atlantic/Cape_Verde -1:34:04 - LMT 1912 Jan 01 2:00u # Praia -2:00 - -02 1942 Sep -2:00 1:00 -01 1945 Oct 15 -2:00 - -02 1975 Nov 25 2:00 @@ -370,15 +370,34 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct # See Africa/Abidjan. # Ghana -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S + +# From Paul Eggert (2018-01-30): # Whitman says DST was observed from 1931 to "the present"; -# Shanks & Pottenger say 1936 to 1942; -# and September 1 to January 1 is given by: -# Scott Keltie J, Epstein M (eds), The Statesman's Year-Book, -# 57th ed. Macmillan, London (1920), OCLC 609408015, pp xxviii. -# For lack of better info, assume DST was observed from 1920 to 1942. -Rule Ghana 1920 1942 - Sep 1 0:00 0:20 GHST -Rule Ghana 1920 1942 - Dec 31 0:00 0 GMT +# Shanks & Pottenger say 1936 to 1942 with 20 minutes of DST, +# with transitions on 09-01 and 12-31 at 00:00. +# Page 33 of Parish GCB, Colonial Reports - Annual. No. 1066. Gold +# Coast. Report for 1919. (March 1921), OCLC 784024077 +# http://libsysdigi.library.illinois.edu/ilharvest/africana/books2011-05/5530214/5530214_1919/5530214_1919_opt.pdf +# lists the Determination of the Time Ordinance, 1919, No. 18, +# "to advance the time observed locally by the space of twenty minutes +# during the last four months of each year; the object in view being +# to extend during those months the period of daylight-time available +# for evening recreation after office hours." +# Vanessa Ogle, The Global Transformation of Time, 1870-1950 (2015), p 33, +# writes "In 1919, the Gold Coast (Ghana as of 1957) made Greenwich +# time its legal time and simultaneously legalized a summer time of +# UTC - 00:20 minutes from March to October."; a footnote lists +# the ordinance as being dated 1919-11-24. +# The Crown Colonist, Volume 12 (1942), p 176, says "the Government +# intend advancing Gold Coast time half an hour ahead of G.M.T. +# The actual date of the alteration has not yet been announced." +# These sources are incomplete and contradictory. Possibly what is +# now Ghana observed different DST regimes in different years. For +# lack of better info, use Shanks except treat the minus sign as a +# typo, and assume DST started in 1920 not 1936. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Ghana 1920 1942 - Sep 1 0:00 0:20 - +Rule Ghana 1920 1942 - Dec 31 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Accra -0:00:52 - LMT 1918 0:00 Ghana GMT/+0020 @@ -388,13 +407,13 @@ Zone Africa/Accra -0:00:52 - LMT 1918 # Guinea-Bissau # +# From Paul Eggert (2018-02-16): # Shanks gives 1911-05-26 for the transition to WAT, # evidently confusing the date of the Portuguese decree -# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf -# with the date that it took effect, namely 1912-01-01. +# (see Europe/Lisbon) with the date that it took effect. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 +Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 1:00u -1:00 - -01 1975 0:00 - GMT @@ -590,9 +609,9 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 # at 2am (or 02:00) local time..." # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mauritius 1982 only - Oct 10 0:00 1:00 S +Rule Mauritius 1982 only - Oct 10 0:00 1:00 - Rule Mauritius 1983 only - Mar 21 0:00 0 - -Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 S +Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 - Rule Mauritius 2009 only - Mar lastSun 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis @@ -1037,6 +1056,8 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # São Tomé and Príncipe +# See Europe/Lisbon for info about the 1912 transition. + # From Steffen Thorsen (2018-01-08): # Multiple sources tell that São Tomé changed from UTC to UTC+1 as # they entered the year 2018. @@ -1045,7 +1066,7 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017 Zone Africa/Sao_Tome 0:26:56 - LMT 1884 - -0:36:45 - LMT 1912 # Lisbon Mean Time + -0:36:45 - LMT 1912 Jan 1 00:00u # Lisbon MT 0:00 - GMT 2018 Jan 1 01:00 1:00 - WAT Modified: vendor/tzdata/dist/antarctica ============================================================================== --- vendor/tzdata/dist/antarctica Sat Mar 24 04:21:22 2018 (r331478) +++ vendor/tzdata/dist/antarctica Sat Mar 24 04:41:49 2018 (r331479) @@ -75,7 +75,8 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2011 Oct 28 2:00 11:00 - +11 2012 Feb 21 17:00u 8:00 - +08 2016 Oct 22 - 11:00 - +11 + 11:00 - +11 2018 Mar 11 4:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb Modified: vendor/tzdata/dist/asia ============================================================================== --- vendor/tzdata/dist/asia Sat Mar 24 04:21:22 2018 (r331478) +++ vendor/tzdata/dist/asia Sat Mar 24 04:41:49 2018 (r331479) @@ -69,13 +69,13 @@ Rule EUAsia 1981 max - Mar lastSun 1:00u 1:00 S Rule EUAsia 1979 1995 - Sep lastSun 1:00u 0 - Rule EUAsia 1996 max - Oct lastSun 1:00u 0 - -Rule E-EurAsia 1981 max - Mar lastSun 0:00 1:00 S +Rule E-EurAsia 1981 max - Mar lastSun 0:00 1:00 - Rule E-EurAsia 1979 1995 - Sep lastSun 0:00 0 - Rule E-EurAsia 1996 max - Oct lastSun 0:00 0 - -Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 S +Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 - Rule RussiaAsia 1981 1983 - Oct 1 0:00 0 - Rule RussiaAsia 1984 1995 - Sep lastSun 2:00s 0 - -Rule RussiaAsia 1985 2010 - Mar lastSun 2:00s 1:00 S +Rule RussiaAsia 1985 2010 - Mar lastSun 2:00s 1:00 - Rule RussiaAsia 1996 2010 - Oct lastSun 2:00s 0 - # Afghanistan @@ -110,7 +110,7 @@ Zone Asia/Kabul 4:36:48 - LMT 1890 # (brief) # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 S +Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 - Rule Armenia 2011 only - Oct lastSun 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 @@ -136,7 +136,7 @@ Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 # http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 S +Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 - Rule Azer 1997 2015 - Oct lastSun 5:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baku 3:19:24 - LMT 1924 May 2 @@ -223,7 +223,7 @@ Zone Asia/Baku 3:19:24 - LMT 1924 May 2 # http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Dhaka 2009 only - Jun 19 23:00 1:00 S +Rule Dhaka 2009 only - Jun 19 23:00 1:00 - Rule Dhaka 2009 only - Dec 31 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -764,8 +764,9 @@ Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 S Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 D Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 D Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 S +# See Europe/Lisbon for info about the 1912 transition. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 +Zone Asia/Macau 7:34:20 - LMT 1911 Dec 31 16:00u 8:00 Macau C%sT @@ -1106,61 +1107,61 @@ Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov # thirtieth day of Shahrivar. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Iran 1978 1980 - Mar 21 0:00 1:00 D -Rule Iran 1978 only - Oct 21 0:00 0 S -Rule Iran 1979 only - Sep 19 0:00 0 S -Rule Iran 1980 only - Sep 23 0:00 0 S -Rule Iran 1991 only - May 3 0:00 1:00 D -Rule Iran 1992 1995 - Mar 22 0:00 1:00 D -Rule Iran 1991 1995 - Sep 22 0:00 0 S -Rule Iran 1996 only - Mar 21 0:00 1:00 D -Rule Iran 1996 only - Sep 21 0:00 0 S -Rule Iran 1997 1999 - Mar 22 0:00 1:00 D -Rule Iran 1997 1999 - Sep 22 0:00 0 S -Rule Iran 2000 only - Mar 21 0:00 1:00 D -Rule Iran 2000 only - Sep 21 0:00 0 S -Rule Iran 2001 2003 - Mar 22 0:00 1:00 D -Rule Iran 2001 2003 - Sep 22 0:00 0 S -Rule Iran 2004 only - Mar 21 0:00 1:00 D -Rule Iran 2004 only - Sep 21 0:00 0 S -Rule Iran 2005 only - Mar 22 0:00 1:00 D -Rule Iran 2005 only - Sep 22 0:00 0 S -Rule Iran 2008 only - Mar 21 0:00 1:00 D -Rule Iran 2008 only - Sep 21 0:00 0 S -Rule Iran 2009 2011 - Mar 22 0:00 1:00 D -Rule Iran 2009 2011 - Sep 22 0:00 0 S -Rule Iran 2012 only - Mar 21 0:00 1:00 D -Rule Iran 2012 only - Sep 21 0:00 0 S -Rule Iran 2013 2015 - Mar 22 0:00 1:00 D -Rule Iran 2013 2015 - Sep 22 0:00 0 S -Rule Iran 2016 only - Mar 21 0:00 1:00 D -Rule Iran 2016 only - Sep 21 0:00 0 S -Rule Iran 2017 2019 - Mar 22 0:00 1:00 D -Rule Iran 2017 2019 - Sep 22 0:00 0 S -Rule Iran 2020 only - Mar 21 0:00 1:00 D -Rule Iran 2020 only - Sep 21 0:00 0 S -Rule Iran 2021 2023 - Mar 22 0:00 1:00 D -Rule Iran 2021 2023 - Sep 22 0:00 0 S -Rule Iran 2024 only - Mar 21 0:00 1:00 D -Rule Iran 2024 only - Sep 21 0:00 0 S -Rule Iran 2025 2027 - Mar 22 0:00 1:00 D -Rule Iran 2025 2027 - Sep 22 0:00 0 S -Rule Iran 2028 2029 - Mar 21 0:00 1:00 D -Rule Iran 2028 2029 - Sep 21 0:00 0 S -Rule Iran 2030 2031 - Mar 22 0:00 1:00 D -Rule Iran 2030 2031 - Sep 22 0:00 0 S -Rule Iran 2032 2033 - Mar 21 0:00 1:00 D -Rule Iran 2032 2033 - Sep 21 0:00 0 S -Rule Iran 2034 2035 - Mar 22 0:00 1:00 D -Rule Iran 2034 2035 - Sep 22 0:00 0 S +Rule Iran 1978 1980 - Mar 21 0:00 1:00 - +Rule Iran 1978 only - Oct 21 0:00 0 - +Rule Iran 1979 only - Sep 19 0:00 0 - +Rule Iran 1980 only - Sep 23 0:00 0 - +Rule Iran 1991 only - May 3 0:00 1:00 - +Rule Iran 1992 1995 - Mar 22 0:00 1:00 - +Rule Iran 1991 1995 - Sep 22 0:00 0 - +Rule Iran 1996 only - Mar 21 0:00 1:00 - +Rule Iran 1996 only - Sep 21 0:00 0 - +Rule Iran 1997 1999 - Mar 22 0:00 1:00 - +Rule Iran 1997 1999 - Sep 22 0:00 0 - +Rule Iran 2000 only - Mar 21 0:00 1:00 - +Rule Iran 2000 only - Sep 21 0:00 0 - +Rule Iran 2001 2003 - Mar 22 0:00 1:00 - +Rule Iran 2001 2003 - Sep 22 0:00 0 - +Rule Iran 2004 only - Mar 21 0:00 1:00 - +Rule Iran 2004 only - Sep 21 0:00 0 - +Rule Iran 2005 only - Mar 22 0:00 1:00 - +Rule Iran 2005 only - Sep 22 0:00 0 - +Rule Iran 2008 only - Mar 21 0:00 1:00 - +Rule Iran 2008 only - Sep 21 0:00 0 - +Rule Iran 2009 2011 - Mar 22 0:00 1:00 - +Rule Iran 2009 2011 - Sep 22 0:00 0 - +Rule Iran 2012 only - Mar 21 0:00 1:00 - +Rule Iran 2012 only - Sep 21 0:00 0 - +Rule Iran 2013 2015 - Mar 22 0:00 1:00 - +Rule Iran 2013 2015 - Sep 22 0:00 0 - +Rule Iran 2016 only - Mar 21 0:00 1:00 - +Rule Iran 2016 only - Sep 21 0:00 0 - +Rule Iran 2017 2019 - Mar 22 0:00 1:00 - +Rule Iran 2017 2019 - Sep 22 0:00 0 - +Rule Iran 2020 only - Mar 21 0:00 1:00 - +Rule Iran 2020 only - Sep 21 0:00 0 - +Rule Iran 2021 2023 - Mar 22 0:00 1:00 - +Rule Iran 2021 2023 - Sep 22 0:00 0 - +Rule Iran 2024 only - Mar 21 0:00 1:00 - +Rule Iran 2024 only - Sep 21 0:00 0 - +Rule Iran 2025 2027 - Mar 22 0:00 1:00 - +Rule Iran 2025 2027 - Sep 22 0:00 0 - +Rule Iran 2028 2029 - Mar 21 0:00 1:00 - +Rule Iran 2028 2029 - Sep 21 0:00 0 - +Rule Iran 2030 2031 - Mar 22 0:00 1:00 - +Rule Iran 2030 2031 - Sep 22 0:00 0 - +Rule Iran 2032 2033 - Mar 21 0:00 1:00 - +Rule Iran 2032 2033 - Sep 21 0:00 0 - +Rule Iran 2034 2035 - Mar 22 0:00 1:00 - +Rule Iran 2034 2035 - Sep 22 0:00 0 - # # The following rules are approximations starting in the year 2038. # These are the best post-2037 approximations available, given the # restrictions of a single rule using a Gregorian-based data format. # At some point this table will need to be extended, though quite # possibly Iran will change the rules first. -Rule Iran 2036 max - Mar 21 0:00 1:00 D -Rule Iran 2036 max - Sep 21 0:00 0 S +Rule Iran 2036 max - Mar 21 0:00 1:00 - +Rule Iran 2036 max - Sep 21 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 @@ -1196,17 +1197,17 @@ Zone Asia/Tehran 3:25:44 - LMT 1916 # https://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Iraq 1982 only - May 1 0:00 1:00 D -Rule Iraq 1982 1984 - Oct 1 0:00 0 S -Rule Iraq 1983 only - Mar 31 0:00 1:00 D -Rule Iraq 1984 1985 - Apr 1 0:00 1:00 D -Rule Iraq 1985 1990 - Sep lastSun 1:00s 0 S -Rule Iraq 1986 1990 - Mar lastSun 1:00s 1:00 D +Rule Iraq 1982 only - May 1 0:00 1:00 - +Rule Iraq 1982 1984 - Oct 1 0:00 0 - +Rule Iraq 1983 only - Mar 31 0:00 1:00 - +Rule Iraq 1984 1985 - Apr 1 0:00 1:00 - +Rule Iraq 1985 1990 - Sep lastSun 1:00s 0 - +Rule Iraq 1986 1990 - Mar lastSun 1:00s 1:00 - # IATA SSIM (1991/1996) says Apr 1 12:01am UTC; guess the ':01' is a typo. # Shanks & Pottenger say Iraq did not observe DST 1992/1997; ignore this. # -Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 D -Rule Iraq 1991 2007 - Oct 1 3:00s 0 S +Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 - +Rule Iraq 1991 2007 - Oct 1 3:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baghdad 2:57:40 - LMT 1890 2:57:36 - BMT 1918 # Baghdad Mean Time? @@ -1478,8 +1479,7 @@ Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical -# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s), -# 35 degrees 39' 16.0" N. +# Observatory: 139° 44' 40.90" E (9h 18m 58.727s), 35° 39' 16.0" N. # This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996' # edited by National Astronomical Observatory of Japan.... # JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST). @@ -1487,10 +1487,10 @@ Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-16): # The ordinance No. 51 (1886) established "standard time" in Japan, -# which stands for the time on 135 degrees E. +# which stands for the time on 135° E. # In the ordinance No. 167 (1895), "standard time" was renamed to "central # standard time". And the same ordinance also established "western standard -# time", which stands for the time on 120 degrees E.... But "western standard +# time", which stands for the time on 120° E.... But "western standard # time" was abolished in the ordinance No. 529 (1937). In the ordinance No. # 167, there is no mention regarding for what place western standard time is # standard.... @@ -1903,9 +1903,9 @@ Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk # From 2005-08-12 our GMT-offset is +6, w/o any daylight saving. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Kyrgyz 1992 1996 - Apr Sun>=7 0:00s 1:00 S +Rule Kyrgyz 1992 1996 - Apr Sun>=7 0:00s 1:00 - Rule Kyrgyz 1992 1996 - Sep lastSun 0:00 0 - -Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 S +Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 - Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 @@ -2037,7 +2037,7 @@ Zone Asia/Beirut 2:22:00 - LMT 1880 # Malaysia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NBorneo 1935 1941 - Sep 14 0:00 0:20 TS # one-Third Summer +Rule NBorneo 1935 1941 - Sep 14 0:00 0:20 - Rule NBorneo 1935 1941 - Dec 14 0:00 0 - # # peninsular Malaysia @@ -2182,7 +2182,7 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé # http://zasag.mn/news/view/8969 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S +Rule Mongol 1983 1984 - Apr 1 0:00 1:00 - Rule Mongol 1983 only - Oct 1 0:00 0 - # Shanks & Pottenger and IATA SSIM say 1990s switches occurred at 00:00, # but McDow says the 2001 switches occurred at 02:00. Also, IATA SSIM @@ -2199,13 +2199,13 @@ Rule Mongol 1983 only - Oct 1 0:00 0 - # Mongolian Government meeting has concluded today to cancel daylight # saving time adoption in Mongolia. Source: http://zasag.mn/news/view/16192 -Rule Mongol 1985 1998 - Mar lastSun 0:00 1:00 S +Rule Mongol 1985 1998 - Mar lastSun 0:00 1:00 - Rule Mongol 1984 1998 - Sep lastSun 0:00 0 - # IATA SSIM (1999-09) says Mongolia no longer observes DST. -Rule Mongol 2001 only - Apr lastSat 2:00 1:00 S +Rule Mongol 2001 only - Apr lastSat 2:00 1:00 - Rule Mongol 2001 2006 - Sep lastSat 2:00 0 - -Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 S -Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 S +Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 - +Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 - Rule Mongol 2015 2016 - Sep lastSat 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2639,9 +2639,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # [Google translation]: "The Council also decided to start daylight # saving in Palestine as of one o'clock on Saturday morning, # 2016-03-26, to provide the clock 60 minutes ahead." -# -# From Paul Eggert (2016-03-12): -# Predict spring transitions on March's last Saturday at 01:00 from now on. # From Sharef Mustafa (2016-10-19): # [T]he Palestinian cabinet decision (Mar 8th 2016) published on @@ -2658,6 +2655,16 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # https://www.timeanddate.com/time/change/gaza-strip/gaza # https://www.timeanddate.com/time/change/west-bank/hebron +# From Sharef Mustafa (2018-03-16): +# Palestine summer time will start on Mar 24th 2018 by advancing the +# clock by 60 minutes as per Palestinian cabinet decision published on +# the offical website, though the decree did not specify the exact +# time of the time shift. +# http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817 +# +# From Paul Eggert (2018-03-16): +# For 2016 on, predict spring transitions on March's fourth Saturday at 01:00. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -2687,7 +2694,7 @@ Rule Palestine 2012 only - Sep 21 1:00 0 - Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 - Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S -Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S +Rule Palestine 2016 max - Mar Sat>=22 1:00 1:00 S Rule Palestine 2016 max - Oct lastSat 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2737,11 +2744,11 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct # http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Phil 1936 only - Nov 1 0:00 1:00 S +Rule Phil 1936 only - Nov 1 0:00 1:00 - Rule Phil 1937 only - Feb 1 0:00 0 - -Rule Phil 1954 only - Apr 12 0:00 1:00 S +Rule Phil 1954 only - Apr 12 0:00 1:00 - Rule Phil 1954 only - Jul 1 0:00 0 - -Rule Phil 1978 only - Mar 22 0:00 1:00 S +Rule Phil 1978 only - Mar 22 0:00 1:00 - Rule Phil 1978 only - Sep 21 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 @@ -3097,9 +3104,9 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # and is the basis for the information below. # # The 1906 transition was effective July 1 and standardized Indochina to -# Phù Liễn Observatory, legally 104 deg. 17'17" east of Paris. +# Phù Liễn Observatory, legally 104° 17' 17" east of Paris. # It's unclear whether this meant legal Paris Mean Time (00:09:21) or -# the Paris Meridian (2 deg. 20'14.03" E); the former yields 07:06:30.1333... +# the Paris Meridian (2° 20' 14.03" E); the former yields 07:06:30.1333... # and the latter 07:06:29.333... so either way it rounds to 07:06:30, # which is used below even though the modern-day Phù Liễn Observatory # is closer to 07:06:31. Abbreviate Phù Liễn Mean Time as PLMT. Modified: vendor/tzdata/dist/australasia ============================================================================== --- vendor/tzdata/dist/australasia Sat Mar 24 04:21:22 2018 (r331478) +++ vendor/tzdata/dist/australasia Sat Mar 24 04:41:49 2018 (r331479) @@ -196,20 +196,20 @@ Zone Australia/Broken_Hill 9:25:48 - LMT 1895 Feb # Lord Howe Island # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule LH 1981 1984 - Oct lastSun 2:00 1:00 D -Rule LH 1982 1985 - Mar Sun>=1 2:00 0 S -Rule LH 1985 only - Oct lastSun 2:00 0:30 D -Rule LH 1986 1989 - Mar Sun>=15 2:00 0 S -Rule LH 1986 only - Oct 19 2:00 0:30 D -Rule LH 1987 1999 - Oct lastSun 2:00 0:30 D -Rule LH 1990 1995 - Mar Sun>=1 2:00 0 S -Rule LH 1996 2005 - Mar lastSun 2:00 0 S -Rule LH 2000 only - Aug lastSun 2:00 0:30 D -Rule LH 2001 2007 - Oct lastSun 2:00 0:30 D -Rule LH 2006 only - Apr Sun>=1 2:00 0 S -Rule LH 2007 only - Mar lastSun 2:00 0 S -Rule LH 2008 max - Apr Sun>=1 2:00 0 S -Rule LH 2008 max - Oct Sun>=1 2:00 0:30 D +Rule LH 1981 1984 - Oct lastSun 2:00 1:00 - +Rule LH 1982 1985 - Mar Sun>=1 2:00 0 - +Rule LH 1985 only - Oct lastSun 2:00 0:30 - +Rule LH 1986 1989 - Mar Sun>=15 2:00 0 - +Rule LH 1986 only - Oct 19 2:00 0:30 - +Rule LH 1987 1999 - Oct lastSun 2:00 0:30 - +Rule LH 1990 1995 - Mar Sun>=1 2:00 0 - +Rule LH 1996 2005 - Mar lastSun 2:00 0 - +Rule LH 2000 only - Aug lastSun 2:00 0:30 - +Rule LH 2001 2007 - Oct lastSun 2:00 0:30 - +Rule LH 2006 only - Apr Sun>=1 2:00 0 - +Rule LH 2007 only - Mar lastSun 2:00 0 - +Rule LH 2008 max - Apr Sun>=1 2:00 0 - +Rule LH 2008 max - Oct Sun>=1 2:00 0:30 - Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb 10:00 - AEST 1981 Mar 10:30 LH +1030/+1130 1985 Jul @@ -367,15 +367,15 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # practice than guessing no DST. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S +Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - Rule Fiji 1999 2000 - Feb lastSun 3:00 0 - -Rule Fiji 2009 only - Nov 29 2:00 1:00 S +Rule Fiji 2009 only - Nov 29 2:00 1:00 - Rule Fiji 2010 only - Mar lastSun 3:00 0 - -Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 S +Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 - Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - -Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 S +Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - Rule Fiji 2015 max - Jan Sun>=14 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva @@ -406,11 +406,11 @@ Zone Pacific/Tarawa 11:32:04 - LMT 1901 # Bairiki 12:00 - +12 Zone Pacific/Enderbury -11:24:20 - LMT 1901 -12:00 - -12 1979 Oct - -11:00 - -11 1995 + -11:00 - -11 1994 Dec 31 13:00 - +13 Zone Pacific/Kiritimati -10:29:20 - LMT 1901 -10:40 - -1040 1979 Oct - -10:00 - -10 1995 + -10:00 - -10 1994 Dec 31 14:00 - +14 # N Mariana Is @@ -447,9 +447,9 @@ Zone Pacific/Nauru 11:07:40 - LMT 1921 Jan 15 # Uaobe # New Caledonia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 S +Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 - Rule NC 1978 1979 - Feb 27 0:00 0 - -Rule NC 1996 only - Dec 1 2:00s 1:00 S +Rule NC 1996 only - Dec 1 2:00s 1:00 - # Shanks & Pottenger say the following was at 2:00; go with IATA. Rule NC 1997 only - Mar 2 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -469,27 +469,28 @@ Rule NZ 1929 1933 - Mar Sun>=15 2:00 0 M Rule NZ 1934 1940 - Apr lastSun 2:00 0 M Rule NZ 1934 1940 - Sep lastSun 2:00 0:30 S Rule NZ 1946 only - Jan 1 0:00 0 S -# Since 1957 Chatham has been 45 minutes ahead of NZ, but there's no -# convenient single notation for the date and time of this transition -# so we must duplicate the Rule lines. +# Since 1957 Chatham has been 45 minutes ahead of NZ, but until 2018a +# there was no documented single notation for the date and time of this +# transition. Duplicate the Rule lines for now, to give the 2018a change *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Mar 24 04:42:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82AA4F6B440; Sat, 24 Mar 2018 04:42:57 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C80F782AD; Sat, 24 Mar 2018 04:42:57 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D62C2138; Sat, 24 Mar 2018 04:42:57 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O4guIF073970; Sat, 24 Mar 2018 04:42:56 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4guQc073969; Sat, 24 Mar 2018 04:42:56 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201803240442.w2O4guQc073969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 24 Mar 2018 04:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r331480 - vendor/tzdata/tzdata2018d X-SVN-Group: vendor X-SVN-Commit-Author: philip X-SVN-Commit-Paths: vendor/tzdata/tzdata2018d X-SVN-Commit-Revision: 331480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:42:57 -0000 Author: philip Date: Sat Mar 24 04:42:56 2018 New Revision: 331480 URL: https://svnweb.freebsd.org/changeset/base/331480 Log: Tag import of tzdata 2018d Added: vendor/tzdata/tzdata2018d/ - copied from r331479, vendor/tzdata/dist/ From owner-svn-src-all@freebsd.org Sat Mar 24 04:52:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26CE7F6C03E; Sat, 24 Mar 2018 04:52:31 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBAA4788D4; Sat, 24 Mar 2018 04:52:30 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C636D22D8; Sat, 24 Mar 2018 04:52:30 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O4qUMH078724; Sat, 24 Mar 2018 04:52:30 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4qUrH078716; Sat, 24 Mar 2018 04:52:30 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201803240452.w2O4qUrH078716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 24 Mar 2018 04:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331481 - head/contrib/tzdata X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/tzdata X-SVN-Commit-Revision: 331481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:52:31 -0000 Author: philip Date: Sat Mar 24 04:52:29 2018 New Revision: 331481 URL: https://svnweb.freebsd.org/changeset/base/331481 Log: Import tzdata 2018d Changes: https://github.com/eggert/tz/blob/2018d/NEWS MFC after: 3 days Added: head/contrib/tzdata/ziguard.awk - copied unchanged from r331479, vendor/tzdata/dist/ziguard.awk Modified: head/contrib/tzdata/CONTRIBUTING head/contrib/tzdata/Makefile head/contrib/tzdata/NEWS head/contrib/tzdata/africa head/contrib/tzdata/antarctica head/contrib/tzdata/asia head/contrib/tzdata/australasia head/contrib/tzdata/backzone head/contrib/tzdata/checktab.awk head/contrib/tzdata/europe head/contrib/tzdata/northamerica head/contrib/tzdata/southamerica head/contrib/tzdata/theory.html head/contrib/tzdata/version head/contrib/tzdata/zishrink.awk head/contrib/tzdata/zone.tab head/contrib/tzdata/zone1970.tab Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/CONTRIBUTING ============================================================================== --- head/contrib/tzdata/CONTRIBUTING Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/CONTRIBUTING Sat Mar 24 04:52:29 2018 (r331481) @@ -25,7 +25,8 @@ justification. Citations should use https: URLs if av Please submit changes against either the latest release in or the master branch of the development -repository. If you use Git the following workflow may be helpful: +repository. The latter is preferred. If you use Git the following +workflow may be helpful: * Copy the development repository. @@ -42,6 +43,12 @@ repository. If you use Git the following workflow may git checkout -b mybranch + * Sleuth by using 'git blame'. For example, when fixing data for + Africa/Sao_Tome, if the command 'git blame africa' outputs a line + '2951fa3b (Paul Eggert 2018-01-08 09:03:13 -0800 1068) Zone + Africa/Sao_Tome 0:26:56 - LMT 1884', commit 2951fa3b should + provide some justification for the 'Zone Africa/Sao_Tome' line. + * Edit source files. Include commentary that justifies the changes by citing reliable sources. @@ -66,6 +73,9 @@ repository. If you use Git the following workflow may for others to review. git send-email master + + For an archived example of such an email, see + . * Start anew by getting current with the master branch again (the second step above). Modified: head/contrib/tzdata/Makefile ============================================================================== --- head/contrib/tzdata/Makefile Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/Makefile Sat Mar 24 04:52:29 2018 (r331481) @@ -10,6 +10,15 @@ VERSION= unknown # Email address for bug reports. BUGEMAIL= tz@iana.org +# Choose source data features. To get new features right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +DATAFORM= main + # Change the line below for your time zone (after finding the zone you want in # the time zone files, or adding it to a time zone file). # Alternately, if you discover you've got the wrong time zone, you can just @@ -25,10 +34,10 @@ LOCALTIME= GMT # for handling POSIX-style time zone environment variables, # change the line below (after finding the zone you want in the # time zone files, or adding it to a time zone file). -# (When a POSIX-style environment variable is handled, the rules in the +# When a POSIX-style environment variable is handled, the rules in the # template file are used to determine "spring forward" and "fall back" days and # times; the environment variable itself specifies UT offsets of standard and -# summer time.) +# daylight saving time. # Alternately, if you discover you've got the wrong time zone, you can just # zic -p rightzone # to correct things. @@ -189,13 +198,18 @@ LDLIBS= # -DHAVE_STDINT_H if you have a non-C99 compiler with # -DHAVE_STRFTIME_L if declares locale_t and strftime_l # -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function # -DHAVE_SYMLINK=0 if your system lacks the symlink function # -DHAVE_SYS_STAT_H=0 if your compiler lacks a # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a # -DHAVE_TZSET=0 if your system lacks a tzset function # -DHAVE_UNISTD_H=0 if your compiler lacks a # -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. # -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; # not needed by the main-program tz code, which is single-threaded. # Append other compiler flags as needed, e.g., -pthread on GNU/Linux. @@ -394,13 +408,19 @@ SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. XEmacs 21.5.34 displays them correctly, +# presumably because they are Latin-1. +UNUSUAL_OK_CHARSET= °±½¾× + # OK_CHAR matches any character allowed in the distributed files. -# This is the same as SAFE_CHAR, except that multibyte letters are -# also allowed so that commentary can contain people's names and quote -# non-English sources. For non-letters the sources are limited to -# ASCII renderings for the convenience of maintainers whose text editors -# mishandle UTF-8 by default (e.g., XEmacs 21.4.22). -OK_CHAR= '[][:alpha:]'$(SAFE_CHARSET)'-]' +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' # SAFE_LINE matches a line of safe characters. # SAFE_SHARP_LINE is similar, except any OK character can follow '#'; @@ -462,10 +482,12 @@ TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl TZS_YEAR= 2050 TZS= to$(TZS_YEAR).tzs @@ -499,7 +521,8 @@ VERSION_DEPS= \ SHELL= /bin/sh -all: tzselect yearistype zic zdump libtz.a $(TABDATA) +all: tzselect yearistype zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi ALL: all date $(ENCHILADA) @@ -534,11 +557,15 @@ version: $(VERSION_DEPS) printf '%s\n' "$$V" >$@.out mv $@.out $@ -# This file can be tailored by setting BACKWARD, PACKRATDATA, etc. -tzdata.zi: $(TZDATA_ZI_DEPS) +# These files can be tailored by setting BACKWARD, PACKRATDATA, etc. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) -v outfile='$@' -f ziguard.awk $(TDATA) $(PACKRATDATA) \ + >$@.out + mv $@.out $@ +tzdata.zi: $(DATAFORM).zi version version=`sed 1q version` && \ LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \ - $(TDATA) $(PACKRATDATA) >$@.out + $(DATAFORM).zi >$@.out mv $@.out $@ version.h: version @@ -614,19 +641,29 @@ posix_packrat: zones: $(REDO) +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@ + $(TZS_NEW): tzdata.zi zdump zic - mkdir -p tzs.dir + rm -fr tzs.dir + mkdir tzs.dir $(zic) -d tzs.dir tzdata.zi $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ tzdata.zi | LC_ALL=C sort >$@.out wd=`pwd` && \ - zones=`$(AWK) -v wd="$$wd" \ - '/^Z/{print wd "/tzs.dir/" $$2}' tzdata.zi \ - | LC_ALL=C sort` && \ - ./zdump -i -c $(TZS_YEAR) $$zones >>$@.out - sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out - rm -fr tzs.dir $@.out - mv $@.sed.out $@ + set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2` && \ + shift && \ + ZDS=$$* && \ + $(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs.dir + mv $@.out $@ # If $(TZS) does not already exist (e.g., old-format tarballs), create it. # If it exists but 'make check_tzs' fails, a maintainer should inspect the @@ -669,8 +706,10 @@ check_character_set: $(ENCHILADA) sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ - CONTRIBUTING LICENSE Makefile README \ + CONTRIBUTING LICENSE README \ version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \ + Makefile && \ ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ @@ -702,7 +741,7 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA_TO_CHECK) +check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi @@ -720,17 +759,26 @@ check_tzs: $(TZS) $(TZS_NEW) check_web: tz-how-to.html $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html -# Check that tzdata.zi generates the same binary data that its sources do. -check_zishrink: tzdata.zi zic leapseconds $(PACKRATDATA) $(TDATA) +# Check that zishrink.awk does not alter the data, and that ziguard.awk +# preserves main-format data. +check_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \ + $(DATAFORM).zi tzdata.zi for type in posix right; do \ - mkdir -p time_t.dir/$$type time_t.dir/$$type-shrunk && \ + mkdir -p time_t.dir/$$type time_t.dir/$$type-t \ + time_t.dir/$$type-shrunk && \ case $$type in \ right) leap='-L leapseconds';; \ *) leap=;; \ esac && \ - $(ZIC) $$leap -d time_t.dir/$$type $(TDATA) && \ - $(AWK) '/^Rule/' $(TDATA) | \ - $(ZIC) $$leap -d time_t.dir/$$type - $(PACKRATDATA) && \ + $(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \ + case $(DATAFORM) in \ + main) \ + $(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) $$leap -d time_t.dir/$$type-t - \ + $(PACKRATDATA) && \ + diff -r time_t.dir/$$type time_t.dir/$$type-t;; \ + esac && \ $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \ diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \ done @@ -740,7 +788,7 @@ clean_misc: rm -f core *.o *.out \ date tzselect version.h zdump zic yearistype libtz.a clean: clean_misc - rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW) + rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW) maintainer-clean: clean @echo 'This command is intended for maintainers to use; it' @@ -856,6 +904,9 @@ tarballs traditional_tarballs signatures traditional_s VERSION=`cat version` && \ $(MAKE) VERSION="$$VERSION" $@_version +# These *_version rules are intended for use if VERSION is set by some +# other means. Ordinarily these rules are used only by the above +# non-_version rules, which set VERSION on the 'make' command line. tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz traditional_tarballs_version: \ tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz @@ -917,13 +968,17 @@ zic.o: private.h tzfile.h version.h .KEEP_STATE: .PHONY: ALL INSTALL all -.PHONY: check check_character_set check_links +.PHONY: check check_character_set check_links check_name_lengths .PHONY: check_public check_sorted check_tables .PHONY: check_time_t_alternatives check_tzs check_web check_white_space .PHONY: check_zishrink -.PHONY: clean clean_misc force_tzs +.PHONY: clean clean_misc dummy.zd force_tzs .PHONY: install install_data maintainer-clean names .PHONY: posix_only posix_packrat posix_right .PHONY: public right_only right_posix signatures signatures_version -.PHONY: tarballs tarballs_version typecheck +.PHONY: tarballs tarballs_version +.PHONY: traditional_signatures traditional_signatures_version +.PHONY: traditional_tarballs traditional_tarballs_version +.PHONY: typecheck .PHONY: zonenames zones +.PHONY: $(ZDS) Modified: head/contrib/tzdata/NEWS ============================================================================== --- head/contrib/tzdata/NEWS Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/NEWS Sat Mar 24 04:52:29 2018 (r331481) @@ -1,9 +1,146 @@ News for the tz database +Release 2018d - 2018-03-22 07:05:46 -0700 + + Briefly: + + Palestine starts DST a week earlier in 2018. + Add support for vanguard and rearguard data consumers. + Add subsecond precision to source data format, though not to data. + + Changes to future time stamps + + In 2018, Palestine starts DST on March 24, not March 31. + Adjust future predictions accordingly. (Thanks to Sharef Mustafa.) + + Changes to past and future time stamps + + Casey Station in Antarctica changed from +11 to +08 on 2018-03-11 + at 04:00. (Thanks to Steffen Thorsen.) + + Changes to past time stamps + + Historical transitions for Uruguay, represented by + America/Montevideo, have been updated per official legal documents, + replacing previous data mainly originating from the inventions of + Shanks & Pottenger. This has resulted in adjustments ranging from + 30 to 90 minutes in either direction over at least two dozen + distinct periods ranging from one day to several years in length. + A mere handful of pre-1991 transitions are unaffected; data since + then has come from more reliable contemporaneous reporting. These + changes affect various timestamps in 1920-1923, 1936, 1939, + 1942-1943, 1959, 1966-1970, 1972, 1974-1980, and 1988-1990. + Additionally, Uruguay's pre-standard-time UT offset has been + adjusted westward by 7 seconds, from UT-03:44:44 to UT-03:44:51, to + match the location of the Observatory of the National Meteorological + Institute in Montevideo. + (Thanks to Jeremie Bonjour, Tim Parenti, and Michael Deckers.) + + Enderbury and Kiritimati skipped New Year's Eve 1994, not + New Year's Day 1995. (Thanks to Kerry Shetline.) + + Fix the 1912-01-01 transition for Portugual and its colonies. + This transition was at 00:00 according to the new UT offset, not + according to the old one. Also assume that Cape Verde switched on + the same date as the rest, not in 1907. This affects + Africa/Bissau, Africa/Sao_Tome, Asia/Macau, Atlantic/Azores, + Atlantic/Cape_Verde, Atlantic/Madeira, and Europe/Lisbon. + (Thanks to Michael Deckers.) + + Fix an off-by-1 error for pre-1913 timestamps in Jamaica and in + Turks & Caicos. + + Changes to past time zone abbreviations + + MMT took effect in Uruguay from 1908-06-10, not 1898-06-28. There + is no clock change associated with the transition. + + Changes to build procedure + + The new DATAFORM macro in the Makefile lets the installer choose + among three source data formats. The idea is to lessen downstream + disruption when data formats are improved. + + * DATAFORM=vanguard installs from the latest, bleeding-edge + format. DATAFORM=main (the default) installs from the format + used in the 'africa' etc. files. DATAFORM=rearguard installs + from a trailing-edge format. Eventually, elements of today's + vanguard format should move to the main format, and similarly + the main format's features should eventually move to the + rearguard format. + + * In the current version, the main and rearguard formats are + identical and match that of 2018c, so this change does not + affect default behavior. The vanguard format currently contains + one feature not in the main format: negative SAVE values. This + improves support for Ireland, which uses Irish Standard Time + (IST, UTC+01) in summer and GMT (UTC) in winter. tzcode has + supported negative SAVE values for decades, and this feature + should move to the main format soon. However, it will not move + to the rearguard format for quite some time because some + downstream parsers do not support it. + + * The build procedure constructs three files vanguard.zi, main.zi, + and rearguard.zi, one for each format. The files represent the + same data as closely as the formats allow. These three files + are intended for downstream data consumers and are not + installed. Zoneinfo parsers that do not support negative SAVE values + should start using rearguard.zi, so that they will be unaffected + when the negative-DST feature moves from vanguard to main. + Bleeding-edge Zoneinfo parsers that support the new features + already can use vanguard.zi; in this respect, current tzcode is + bleeding-edge. + + The Makefile should now be safe for parallelized builds, and 'make + -j to2050new.tzs' is now much faster on a multiprocessor host + with GNU Make. + + When built with -DSUPPRESS_TZDIR, the tzcode library no longer + prepends TZDIR/ to file names that do not begin with '/'. This is + not recommended for general use, due to its security implications. + (From a suggestion by Manuela Friedrich.) + + Changes to code + + zic now accepts subsecond precision in expressions like + 00:19:32.13, which is approximately the legal time of the + Netherlands from 1835 to 1937. However, because it is + questionable whether the few recorded uses of non-integer offsets + had subsecond precision in practice, there are no plans for tzdata + to use this feature. (Thanks to Steve Allen for pointing out + the limitations of historical data in this area.) + + The code is a bit more portable to MS-Windows. Installers can + compile with -DRESERVE_STD_EXT_IDS on MS-Windows platforms that + reserve identifiers like 'localtime'. (Thanks to Manuela + Friedrich). + + Changes to documentation and commentary + + theory.html now outlines tzdb's extensions to POSIX's model for + civil time, and has a section "POSIX features no longer needed" + that lists POSIX API components that are now vestigial. + (From suggestions by Steve Summit.) It also better distinguishes + time zones from tz regions. (From a suggestion by Guy Harris.) + + Commentary is now more consistent about using the phrase "daylight + saving time", to match the C name tm_isdst. Daylight saving time + need not occur in summer, and need not have a positive offset from + standard time. + + Commentary about historical transitions in Uruguay has been expanded + with links to many relevant legal documents. + (Thanks to Tim Parenti.) + + Commentary now uses some non-ASCII characters with Unicode value + less than U+0100, as they can be useful and should work even with + older editors such as XEmacs. + + Release 2018c - 2018-01-22 23:00:44 -0800 Briefly: - Revert Irish changes that relied on negative DST offsets. + Revert Irish changes that relied on negative SAVE values. Changes to tm_isdst @@ -14,8 +151,8 @@ Release 2018c - 2018-01-22 23:00:44 -0800 struct tm type. This reversion is intended to be a temporary workaround for problems discovered with downstream uses of releases 2018a and 2018b, which implemented Irish time by using - negative DST offsets in the Eire rules of the 'europe' file. - Although negative DST offsets have been part of tzcode for many + negative SAVE values in the Eire rules of the 'europe' file. + Although negative SAVE values have been part of tzcode for many years and are supported by many platforms, they were not documented before 2018a and ICU and OpenJDK do not currently support them. A mechanism to export data to platforms lacking @@ -900,7 +1037,7 @@ Release 2016b - 2016-03-12 17:30:14 -0800 Comments in zone tables have been improved. (Thanks to J William Piggott.) tzselect again limits its menu comments so that menus fit on a - 24x80 alphanumeric display. + 24×80 alphanumeric display. A new web page tz-how-to.html. (Thanks to Bill Seymour.) Modified: head/contrib/tzdata/africa ============================================================================== --- head/contrib/tzdata/africa Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/africa Sat Mar 24 04:52:29 2018 (r331481) @@ -115,13 +115,13 @@ Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01 # Cape Verde / Cabo Verde # +# From Paul Eggert (2018-02-16): # Shanks gives 1907 for the transition to +02. -# Perhaps the 1911-05-26 Portuguese decree -# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf -# merely made it official? +# For now, ignore that and follow the 1911-05-26 Portuguese decree +# (see Europe/Lisbon). # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia +Zone Atlantic/Cape_Verde -1:34:04 - LMT 1912 Jan 01 2:00u # Praia -2:00 - -02 1942 Sep -2:00 1:00 -01 1945 Oct 15 -2:00 - -02 1975 Nov 25 2:00 @@ -370,15 +370,34 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct # See Africa/Abidjan. # Ghana -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S + +# From Paul Eggert (2018-01-30): # Whitman says DST was observed from 1931 to "the present"; -# Shanks & Pottenger say 1936 to 1942; -# and September 1 to January 1 is given by: -# Scott Keltie J, Epstein M (eds), The Statesman's Year-Book, -# 57th ed. Macmillan, London (1920), OCLC 609408015, pp xxviii. -# For lack of better info, assume DST was observed from 1920 to 1942. -Rule Ghana 1920 1942 - Sep 1 0:00 0:20 GHST -Rule Ghana 1920 1942 - Dec 31 0:00 0 GMT +# Shanks & Pottenger say 1936 to 1942 with 20 minutes of DST, +# with transitions on 09-01 and 12-31 at 00:00. +# Page 33 of Parish GCB, Colonial Reports - Annual. No. 1066. Gold +# Coast. Report for 1919. (March 1921), OCLC 784024077 +# http://libsysdigi.library.illinois.edu/ilharvest/africana/books2011-05/5530214/5530214_1919/5530214_1919_opt.pdf +# lists the Determination of the Time Ordinance, 1919, No. 18, +# "to advance the time observed locally by the space of twenty minutes +# during the last four months of each year; the object in view being +# to extend during those months the period of daylight-time available +# for evening recreation after office hours." +# Vanessa Ogle, The Global Transformation of Time, 1870-1950 (2015), p 33, +# writes "In 1919, the Gold Coast (Ghana as of 1957) made Greenwich +# time its legal time and simultaneously legalized a summer time of +# UTC - 00:20 minutes from March to October."; a footnote lists +# the ordinance as being dated 1919-11-24. +# The Crown Colonist, Volume 12 (1942), p 176, says "the Government +# intend advancing Gold Coast time half an hour ahead of G.M.T. +# The actual date of the alteration has not yet been announced." +# These sources are incomplete and contradictory. Possibly what is +# now Ghana observed different DST regimes in different years. For +# lack of better info, use Shanks except treat the minus sign as a +# typo, and assume DST started in 1920 not 1936. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Ghana 1920 1942 - Sep 1 0:00 0:20 - +Rule Ghana 1920 1942 - Dec 31 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Accra -0:00:52 - LMT 1918 0:00 Ghana GMT/+0020 @@ -388,13 +407,13 @@ Zone Africa/Accra -0:00:52 - LMT 1918 # Guinea-Bissau # +# From Paul Eggert (2018-02-16): # Shanks gives 1911-05-26 for the transition to WAT, # evidently confusing the date of the Portuguese decree -# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf -# with the date that it took effect, namely 1912-01-01. +# (see Europe/Lisbon) with the date that it took effect. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 +Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 1:00u -1:00 - -01 1975 0:00 - GMT @@ -590,9 +609,9 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 # at 2am (or 02:00) local time..." # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mauritius 1982 only - Oct 10 0:00 1:00 S +Rule Mauritius 1982 only - Oct 10 0:00 1:00 - Rule Mauritius 1983 only - Mar 21 0:00 0 - -Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 S +Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 - Rule Mauritius 2009 only - Mar lastSun 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis @@ -1037,6 +1056,8 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # São Tomé and Príncipe +# See Europe/Lisbon for info about the 1912 transition. + # From Steffen Thorsen (2018-01-08): # Multiple sources tell that São Tomé changed from UTC to UTC+1 as # they entered the year 2018. @@ -1045,7 +1066,7 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017 Zone Africa/Sao_Tome 0:26:56 - LMT 1884 - -0:36:45 - LMT 1912 # Lisbon Mean Time + -0:36:45 - LMT 1912 Jan 1 00:00u # Lisbon MT 0:00 - GMT 2018 Jan 1 01:00 1:00 - WAT Modified: head/contrib/tzdata/antarctica ============================================================================== --- head/contrib/tzdata/antarctica Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/antarctica Sat Mar 24 04:52:29 2018 (r331481) @@ -75,7 +75,8 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2011 Oct 28 2:00 11:00 - +11 2012 Feb 21 17:00u 8:00 - +08 2016 Oct 22 - 11:00 - +11 + 11:00 - +11 2018 Mar 11 4:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/asia Sat Mar 24 04:52:29 2018 (r331481) @@ -69,13 +69,13 @@ Rule EUAsia 1981 max - Mar lastSun 1:00u 1:00 S Rule EUAsia 1979 1995 - Sep lastSun 1:00u 0 - Rule EUAsia 1996 max - Oct lastSun 1:00u 0 - -Rule E-EurAsia 1981 max - Mar lastSun 0:00 1:00 S +Rule E-EurAsia 1981 max - Mar lastSun 0:00 1:00 - Rule E-EurAsia 1979 1995 - Sep lastSun 0:00 0 - Rule E-EurAsia 1996 max - Oct lastSun 0:00 0 - -Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 S +Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 - Rule RussiaAsia 1981 1983 - Oct 1 0:00 0 - Rule RussiaAsia 1984 1995 - Sep lastSun 2:00s 0 - -Rule RussiaAsia 1985 2010 - Mar lastSun 2:00s 1:00 S +Rule RussiaAsia 1985 2010 - Mar lastSun 2:00s 1:00 - Rule RussiaAsia 1996 2010 - Oct lastSun 2:00s 0 - # Afghanistan @@ -110,7 +110,7 @@ Zone Asia/Kabul 4:36:48 - LMT 1890 # (brief) # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 S +Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 - Rule Armenia 2011 only - Oct lastSun 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 @@ -136,7 +136,7 @@ Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 # http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 S +Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 - Rule Azer 1997 2015 - Oct lastSun 5:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baku 3:19:24 - LMT 1924 May 2 @@ -223,7 +223,7 @@ Zone Asia/Baku 3:19:24 - LMT 1924 May 2 # http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Dhaka 2009 only - Jun 19 23:00 1:00 S +Rule Dhaka 2009 only - Jun 19 23:00 1:00 - Rule Dhaka 2009 only - Dec 31 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -764,8 +764,9 @@ Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 S Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 D Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 D Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 S +# See Europe/Lisbon for info about the 1912 transition. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 +Zone Asia/Macau 7:34:20 - LMT 1911 Dec 31 16:00u 8:00 Macau C%sT @@ -1106,61 +1107,61 @@ Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov # thirtieth day of Shahrivar. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Iran 1978 1980 - Mar 21 0:00 1:00 D -Rule Iran 1978 only - Oct 21 0:00 0 S -Rule Iran 1979 only - Sep 19 0:00 0 S -Rule Iran 1980 only - Sep 23 0:00 0 S -Rule Iran 1991 only - May 3 0:00 1:00 D -Rule Iran 1992 1995 - Mar 22 0:00 1:00 D -Rule Iran 1991 1995 - Sep 22 0:00 0 S -Rule Iran 1996 only - Mar 21 0:00 1:00 D -Rule Iran 1996 only - Sep 21 0:00 0 S -Rule Iran 1997 1999 - Mar 22 0:00 1:00 D -Rule Iran 1997 1999 - Sep 22 0:00 0 S -Rule Iran 2000 only - Mar 21 0:00 1:00 D -Rule Iran 2000 only - Sep 21 0:00 0 S -Rule Iran 2001 2003 - Mar 22 0:00 1:00 D -Rule Iran 2001 2003 - Sep 22 0:00 0 S -Rule Iran 2004 only - Mar 21 0:00 1:00 D -Rule Iran 2004 only - Sep 21 0:00 0 S -Rule Iran 2005 only - Mar 22 0:00 1:00 D -Rule Iran 2005 only - Sep 22 0:00 0 S -Rule Iran 2008 only - Mar 21 0:00 1:00 D -Rule Iran 2008 only - Sep 21 0:00 0 S -Rule Iran 2009 2011 - Mar 22 0:00 1:00 D -Rule Iran 2009 2011 - Sep 22 0:00 0 S -Rule Iran 2012 only - Mar 21 0:00 1:00 D -Rule Iran 2012 only - Sep 21 0:00 0 S -Rule Iran 2013 2015 - Mar 22 0:00 1:00 D -Rule Iran 2013 2015 - Sep 22 0:00 0 S -Rule Iran 2016 only - Mar 21 0:00 1:00 D -Rule Iran 2016 only - Sep 21 0:00 0 S -Rule Iran 2017 2019 - Mar 22 0:00 1:00 D -Rule Iran 2017 2019 - Sep 22 0:00 0 S -Rule Iran 2020 only - Mar 21 0:00 1:00 D -Rule Iran 2020 only - Sep 21 0:00 0 S -Rule Iran 2021 2023 - Mar 22 0:00 1:00 D -Rule Iran 2021 2023 - Sep 22 0:00 0 S -Rule Iran 2024 only - Mar 21 0:00 1:00 D -Rule Iran 2024 only - Sep 21 0:00 0 S -Rule Iran 2025 2027 - Mar 22 0:00 1:00 D -Rule Iran 2025 2027 - Sep 22 0:00 0 S -Rule Iran 2028 2029 - Mar 21 0:00 1:00 D -Rule Iran 2028 2029 - Sep 21 0:00 0 S -Rule Iran 2030 2031 - Mar 22 0:00 1:00 D -Rule Iran 2030 2031 - Sep 22 0:00 0 S -Rule Iran 2032 2033 - Mar 21 0:00 1:00 D -Rule Iran 2032 2033 - Sep 21 0:00 0 S -Rule Iran 2034 2035 - Mar 22 0:00 1:00 D -Rule Iran 2034 2035 - Sep 22 0:00 0 S +Rule Iran 1978 1980 - Mar 21 0:00 1:00 - +Rule Iran 1978 only - Oct 21 0:00 0 - +Rule Iran 1979 only - Sep 19 0:00 0 - +Rule Iran 1980 only - Sep 23 0:00 0 - +Rule Iran 1991 only - May 3 0:00 1:00 - +Rule Iran 1992 1995 - Mar 22 0:00 1:00 - +Rule Iran 1991 1995 - Sep 22 0:00 0 - +Rule Iran 1996 only - Mar 21 0:00 1:00 - +Rule Iran 1996 only - Sep 21 0:00 0 - +Rule Iran 1997 1999 - Mar 22 0:00 1:00 - +Rule Iran 1997 1999 - Sep 22 0:00 0 - +Rule Iran 2000 only - Mar 21 0:00 1:00 - +Rule Iran 2000 only - Sep 21 0:00 0 - +Rule Iran 2001 2003 - Mar 22 0:00 1:00 - +Rule Iran 2001 2003 - Sep 22 0:00 0 - +Rule Iran 2004 only - Mar 21 0:00 1:00 - +Rule Iran 2004 only - Sep 21 0:00 0 - +Rule Iran 2005 only - Mar 22 0:00 1:00 - +Rule Iran 2005 only - Sep 22 0:00 0 - +Rule Iran 2008 only - Mar 21 0:00 1:00 - +Rule Iran 2008 only - Sep 21 0:00 0 - +Rule Iran 2009 2011 - Mar 22 0:00 1:00 - +Rule Iran 2009 2011 - Sep 22 0:00 0 - +Rule Iran 2012 only - Mar 21 0:00 1:00 - +Rule Iran 2012 only - Sep 21 0:00 0 - +Rule Iran 2013 2015 - Mar 22 0:00 1:00 - +Rule Iran 2013 2015 - Sep 22 0:00 0 - +Rule Iran 2016 only - Mar 21 0:00 1:00 - +Rule Iran 2016 only - Sep 21 0:00 0 - +Rule Iran 2017 2019 - Mar 22 0:00 1:00 - +Rule Iran 2017 2019 - Sep 22 0:00 0 - +Rule Iran 2020 only - Mar 21 0:00 1:00 - +Rule Iran 2020 only - Sep 21 0:00 0 - +Rule Iran 2021 2023 - Mar 22 0:00 1:00 - +Rule Iran 2021 2023 - Sep 22 0:00 0 - +Rule Iran 2024 only - Mar 21 0:00 1:00 - +Rule Iran 2024 only - Sep 21 0:00 0 - +Rule Iran 2025 2027 - Mar 22 0:00 1:00 - +Rule Iran 2025 2027 - Sep 22 0:00 0 - +Rule Iran 2028 2029 - Mar 21 0:00 1:00 - +Rule Iran 2028 2029 - Sep 21 0:00 0 - +Rule Iran 2030 2031 - Mar 22 0:00 1:00 - +Rule Iran 2030 2031 - Sep 22 0:00 0 - +Rule Iran 2032 2033 - Mar 21 0:00 1:00 - +Rule Iran 2032 2033 - Sep 21 0:00 0 - +Rule Iran 2034 2035 - Mar 22 0:00 1:00 - +Rule Iran 2034 2035 - Sep 22 0:00 0 - # # The following rules are approximations starting in the year 2038. # These are the best post-2037 approximations available, given the # restrictions of a single rule using a Gregorian-based data format. # At some point this table will need to be extended, though quite # possibly Iran will change the rules first. -Rule Iran 2036 max - Mar 21 0:00 1:00 D -Rule Iran 2036 max - Sep 21 0:00 0 S +Rule Iran 2036 max - Mar 21 0:00 1:00 - +Rule Iran 2036 max - Sep 21 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 @@ -1196,17 +1197,17 @@ Zone Asia/Tehran 3:25:44 - LMT 1916 # https://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Iraq 1982 only - May 1 0:00 1:00 D -Rule Iraq 1982 1984 - Oct 1 0:00 0 S -Rule Iraq 1983 only - Mar 31 0:00 1:00 D -Rule Iraq 1984 1985 - Apr 1 0:00 1:00 D -Rule Iraq 1985 1990 - Sep lastSun 1:00s 0 S -Rule Iraq 1986 1990 - Mar lastSun 1:00s 1:00 D +Rule Iraq 1982 only - May 1 0:00 1:00 - +Rule Iraq 1982 1984 - Oct 1 0:00 0 - +Rule Iraq 1983 only - Mar 31 0:00 1:00 - +Rule Iraq 1984 1985 - Apr 1 0:00 1:00 - +Rule Iraq 1985 1990 - Sep lastSun 1:00s 0 - +Rule Iraq 1986 1990 - Mar lastSun 1:00s 1:00 - # IATA SSIM (1991/1996) says Apr 1 12:01am UTC; guess the ':01' is a typo. # Shanks & Pottenger say Iraq did not observe DST 1992/1997; ignore this. # -Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 D -Rule Iraq 1991 2007 - Oct 1 3:00s 0 S +Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 - +Rule Iraq 1991 2007 - Oct 1 3:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baghdad 2:57:40 - LMT 1890 2:57:36 - BMT 1918 # Baghdad Mean Time? @@ -1478,8 +1479,7 @@ Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical -# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s), -# 35 degrees 39' 16.0" N. +# Observatory: 139° 44' 40.90" E (9h 18m 58.727s), 35° 39' 16.0" N. # This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996' # edited by National Astronomical Observatory of Japan.... # JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST). @@ -1487,10 +1487,10 @@ Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-16): # The ordinance No. 51 (1886) established "standard time" in Japan, -# which stands for the time on 135 degrees E. +# which stands for the time on 135° E. # In the ordinance No. 167 (1895), "standard time" was renamed to "central # standard time". And the same ordinance also established "western standard -# time", which stands for the time on 120 degrees E.... But "western standard +# time", which stands for the time on 120° E.... But "western standard # time" was abolished in the ordinance No. 529 (1937). In the ordinance No. # 167, there is no mention regarding for what place western standard time is # standard.... @@ -1903,9 +1903,9 @@ Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk # From 2005-08-12 our GMT-offset is +6, w/o any daylight saving. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Kyrgyz 1992 1996 - Apr Sun>=7 0:00s 1:00 S +Rule Kyrgyz 1992 1996 - Apr Sun>=7 0:00s 1:00 - Rule Kyrgyz 1992 1996 - Sep lastSun 0:00 0 - -Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 S +Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 - Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 @@ -2037,7 +2037,7 @@ Zone Asia/Beirut 2:22:00 - LMT 1880 # Malaysia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NBorneo 1935 1941 - Sep 14 0:00 0:20 TS # one-Third Summer +Rule NBorneo 1935 1941 - Sep 14 0:00 0:20 - Rule NBorneo 1935 1941 - Dec 14 0:00 0 - # # peninsular Malaysia @@ -2182,7 +2182,7 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé # http://zasag.mn/news/view/8969 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S +Rule Mongol 1983 1984 - Apr 1 0:00 1:00 - Rule Mongol 1983 only - Oct 1 0:00 0 - # Shanks & Pottenger and IATA SSIM say 1990s switches occurred at 00:00, # but McDow says the 2001 switches occurred at 02:00. Also, IATA SSIM @@ -2199,13 +2199,13 @@ Rule Mongol 1983 only - Oct 1 0:00 0 - # Mongolian Government meeting has concluded today to cancel daylight # saving time adoption in Mongolia. Source: http://zasag.mn/news/view/16192 -Rule Mongol 1985 1998 - Mar lastSun 0:00 1:00 S +Rule Mongol 1985 1998 - Mar lastSun 0:00 1:00 - Rule Mongol 1984 1998 - Sep lastSun 0:00 0 - # IATA SSIM (1999-09) says Mongolia no longer observes DST. -Rule Mongol 2001 only - Apr lastSat 2:00 1:00 S +Rule Mongol 2001 only - Apr lastSat 2:00 1:00 - Rule Mongol 2001 2006 - Sep lastSat 2:00 0 - -Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 S -Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 S +Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 - +Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 - Rule Mongol 2015 2016 - Sep lastSat 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2639,9 +2639,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # [Google translation]: "The Council also decided to start daylight # saving in Palestine as of one o'clock on Saturday morning, # 2016-03-26, to provide the clock 60 minutes ahead." -# -# From Paul Eggert (2016-03-12): -# Predict spring transitions on March's last Saturday at 01:00 from now on. # From Sharef Mustafa (2016-10-19): # [T]he Palestinian cabinet decision (Mar 8th 2016) published on @@ -2658,6 +2655,16 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # https://www.timeanddate.com/time/change/gaza-strip/gaza # https://www.timeanddate.com/time/change/west-bank/hebron +# From Sharef Mustafa (2018-03-16): +# Palestine summer time will start on Mar 24th 2018 by advancing the +# clock by 60 minutes as per Palestinian cabinet decision published on +# the offical website, though the decree did not specify the exact +# time of the time shift. +# http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817 +# +# From Paul Eggert (2018-03-16): +# For 2016 on, predict spring transitions on March's fourth Saturday at 01:00. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -2687,7 +2694,7 @@ Rule Palestine 2012 only - Sep 21 1:00 0 - Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 - Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S -Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S +Rule Palestine 2016 max - Mar Sat>=22 1:00 1:00 S Rule Palestine 2016 max - Oct lastSat 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2737,11 +2744,11 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct # http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Phil 1936 only - Nov 1 0:00 1:00 S +Rule Phil 1936 only - Nov 1 0:00 1:00 - Rule Phil 1937 only - Feb 1 0:00 0 - -Rule Phil 1954 only - Apr 12 0:00 1:00 S +Rule Phil 1954 only - Apr 12 0:00 1:00 - Rule Phil 1954 only - Jul 1 0:00 0 - -Rule Phil 1978 only - Mar 22 0:00 1:00 S +Rule Phil 1978 only - Mar 22 0:00 1:00 - Rule Phil 1978 only - Sep 21 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 @@ -3097,9 +3104,9 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # and is the basis for the information below. # # The 1906 transition was effective July 1 and standardized Indochina to -# Phù Liễn Observatory, legally 104 deg. 17'17" east of Paris. +# Phù Liễn Observatory, legally 104° 17' 17" east of Paris. # It's unclear whether this meant legal Paris Mean Time (00:09:21) or -# the Paris Meridian (2 deg. 20'14.03" E); the former yields 07:06:30.1333... +# the Paris Meridian (2° 20' 14.03" E); the former yields 07:06:30.1333... # and the latter 07:06:29.333... so either way it rounds to 07:06:30, # which is used below even though the modern-day Phù Liễn Observatory # is closer to 07:06:31. Abbreviate Phù Liễn Mean Time as PLMT. Modified: head/contrib/tzdata/australasia ============================================================================== --- head/contrib/tzdata/australasia Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/australasia Sat Mar 24 04:52:29 2018 (r331481) @@ -196,20 +196,20 @@ Zone Australia/Broken_Hill 9:25:48 - LMT 1895 Feb # Lord Howe Island # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule LH 1981 1984 - Oct lastSun 2:00 1:00 D -Rule LH 1982 1985 - Mar Sun>=1 2:00 0 S -Rule LH 1985 only - Oct lastSun 2:00 0:30 D -Rule LH 1986 1989 - Mar Sun>=15 2:00 0 S -Rule LH 1986 only - Oct 19 2:00 0:30 D -Rule LH 1987 1999 - Oct lastSun 2:00 0:30 D -Rule LH 1990 1995 - Mar Sun>=1 2:00 0 S -Rule LH 1996 2005 - Mar lastSun 2:00 0 S -Rule LH 2000 only - Aug lastSun 2:00 0:30 D -Rule LH 2001 2007 - Oct lastSun 2:00 0:30 D -Rule LH 2006 only - Apr Sun>=1 2:00 0 S -Rule LH 2007 only - Mar lastSun 2:00 0 S -Rule LH 2008 max - Apr Sun>=1 2:00 0 S -Rule LH 2008 max - Oct Sun>=1 2:00 0:30 D +Rule LH 1981 1984 - Oct lastSun 2:00 1:00 - +Rule LH 1982 1985 - Mar Sun>=1 2:00 0 - +Rule LH 1985 only - Oct lastSun 2:00 0:30 - +Rule LH 1986 1989 - Mar Sun>=15 2:00 0 - +Rule LH 1986 only - Oct 19 2:00 0:30 - +Rule LH 1987 1999 - Oct lastSun 2:00 0:30 - +Rule LH 1990 1995 - Mar Sun>=1 2:00 0 - +Rule LH 1996 2005 - Mar lastSun 2:00 0 - +Rule LH 2000 only - Aug lastSun 2:00 0:30 - +Rule LH 2001 2007 - Oct lastSun 2:00 0:30 - +Rule LH 2006 only - Apr Sun>=1 2:00 0 - +Rule LH 2007 only - Mar lastSun 2:00 0 - +Rule LH 2008 max - Apr Sun>=1 2:00 0 - +Rule LH 2008 max - Oct Sun>=1 2:00 0:30 - Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb 10:00 - AEST 1981 Mar 10:30 LH +1030/+1130 1985 Jul @@ -367,15 +367,15 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # practice than guessing no DST. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S +Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - Rule Fiji 1999 2000 - Feb lastSun 3:00 0 - -Rule Fiji 2009 only - Nov 29 2:00 1:00 S +Rule Fiji 2009 only - Nov 29 2:00 1:00 - Rule Fiji 2010 only - Mar lastSun 3:00 0 - -Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 S +Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 - Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - -Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 S +Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - Rule Fiji 2015 max - Jan Sun>=14 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva @@ -406,11 +406,11 @@ Zone Pacific/Tarawa 11:32:04 - LMT 1901 # Bairiki 12:00 - +12 Zone Pacific/Enderbury -11:24:20 - LMT 1901 -12:00 - -12 1979 Oct - -11:00 - -11 1995 + -11:00 - -11 1994 Dec 31 13:00 - +13 Zone Pacific/Kiritimati -10:29:20 - LMT 1901 -10:40 - -1040 1979 Oct - -10:00 - -10 1995 + -10:00 - -10 1994 Dec 31 14:00 - +14 # N Mariana Is @@ -447,9 +447,9 @@ Zone Pacific/Nauru 11:07:40 - LMT 1921 Jan 15 # Uaobe # New Caledonia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 S +Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 - Rule NC 1978 1979 - Feb 27 0:00 0 - -Rule NC 1996 only - Dec 1 2:00s 1:00 S +Rule NC 1996 only - Dec 1 2:00s 1:00 - # Shanks & Pottenger say the following was at 2:00; go with IATA. Rule NC 1997 only - Mar 2 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -469,27 +469,28 @@ Rule NZ 1929 1933 - Mar Sun>=15 2:00 0 M Rule NZ 1934 1940 - Apr lastSun 2:00 0 M Rule NZ 1934 1940 - Sep lastSun 2:00 0:30 S Rule NZ 1946 only - Jan 1 0:00 0 S -# Since 1957 Chatham has been 45 minutes ahead of NZ, but there's no -# convenient single notation for the date and time of this transition -# so we must duplicate the Rule lines. +# Since 1957 Chatham has been 45 minutes ahead of NZ, but until 2018a +# there was no documented single notation for the date and time of this +# transition. Duplicate the Rule lines for now, to give the 2018a change *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Mar 24 09:10:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ED58F581AC; Sat, 24 Mar 2018 09:10:51 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2582A81C34; Sat, 24 Mar 2018 09:10:51 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2066050DF; Sat, 24 Mar 2018 09:10:51 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O9ApSn005562; Sat, 24 Mar 2018 09:10:51 GMT (envelope-from mfechner@FreeBSD.org) Received: (from mfechner@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O9ApMh005561; Sat, 24 Mar 2018 09:10:51 GMT (envelope-from mfechner@FreeBSD.org) Message-Id: <201803240910.w2O9ApMh005561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mfechner set sender to mfechner@FreeBSD.org using -f From: Matthias Fechner Date: Sat, 24 Mar 2018 09:10:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331482 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: mfechner X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 331482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 09:10:51 -0000 Author: mfechner (ports committer) Date: Sat Mar 24 09:10:50 2018 New Revision: 331482 URL: https://svnweb.freebsd.org/changeset/base/331482 Log: Added myself to committers-ports.dot. Reviewed by: tz (mentor) Approved by: tz (mentor) Differential Revision: https://reviews.freebsd.org/40631 Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sat Mar 24 04:52:29 2018 (r331481) +++ head/share/misc/committers-ports.dot Sat Mar 24 09:10:50 2018 (r331482) @@ -176,6 +176,7 @@ martymac [label="Ganael Laplanche\nmartymac@FreeBSD.or mat [label="Mathieu Arnold\nmat@FreeBSD.org\n2003/08/15"] matthew [label="Matthew Seaman\nmatthew@FreeBSD.org\n2012/02/07"] mezz [label="Jeremy Messenger\nmezz@FreeBSD.org\n2004/04/30"] +mfechner [label="Matthias Fechner\nmfechner@FreeBSD.org\n2018/03/01"] mharo [label="Michael Haro\nmharo@FreeBSD.org\n1999/04/13"] milki [label="Jonathan Chu\nmilki@FreeBSD.org\n2013/12/15"] misha [label="Mikhail Pchelin\nmisha@FreeBSD.org\n2016/11/15"] @@ -641,6 +642,7 @@ swills -> dch swills -> feld swills -> jmd swills -> jrm +swills -> mfechner swills -> milki swills -> pclin swills -> rezny @@ -678,6 +680,7 @@ tmclaugh -> xride tz -> joneum tz -> fernape +tz -> mfechner vsevolod -> eugen From owner-svn-src-all@freebsd.org Sat Mar 24 09:37:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 087E3F5A912; Sat, 24 Mar 2018 09:37:58 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72D0A83104; Sat, 24 Mar 2018 09:37:54 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2O9bowJ035462; Sat, 24 Mar 2018 02:37:50 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2O9boF2035461; Sat, 24 Mar 2018 02:37:50 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803240937.w2O9boF2035461@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331482 - head/share/misc In-Reply-To: <201803240910.w2O9ApMh005561@repo.freebsd.org> To: Matthias Fechner Date: Sat, 24 Mar 2018 02:37:50 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 09:37:58 -0000 > Author: mfechner (ports committer) > Date: Sat Mar 24 09:10:50 2018 > New Revision: 331482 > URL: https://svnweb.freebsd.org/changeset/base/331482 > > Log: > Added myself to committers-ports.dot. > > Reviewed by: tz (mentor) > Approved by: tz (mentor) > Differential Revision: https://reviews.freebsd.org/40631 Url not found? > Modified: > head/share/misc/committers-ports.dot > > Modified: head/share/misc/committers-ports.dot > ============================================================================== > --- head/share/misc/committers-ports.dot Sat Mar 24 04:52:29 2018 (r331481) > +++ head/share/misc/committers-ports.dot Sat Mar 24 09:10:50 2018 (r331482) > @@ -176,6 +176,7 @@ martymac [label="Ganael Laplanche\nmartymac@FreeBSD.or > mat [label="Mathieu Arnold\nmat@FreeBSD.org\n2003/08/15"] > matthew [label="Matthew Seaman\nmatthew@FreeBSD.org\n2012/02/07"] > mezz [label="Jeremy Messenger\nmezz@FreeBSD.org\n2004/04/30"] > +mfechner [label="Matthias Fechner\nmfechner@FreeBSD.org\n2018/03/01"] > mharo [label="Michael Haro\nmharo@FreeBSD.org\n1999/04/13"] > milki [label="Jonathan Chu\nmilki@FreeBSD.org\n2013/12/15"] > misha [label="Mikhail Pchelin\nmisha@FreeBSD.org\n2016/11/15"] > @@ -641,6 +642,7 @@ swills -> dch > swills -> feld > swills -> jmd > swills -> jrm > +swills -> mfechner > swills -> milki > swills -> pclin > swills -> rezny > @@ -678,6 +680,7 @@ tmclaugh -> xride > > tz -> joneum > tz -> fernape > +tz -> mfechner > > vsevolod -> eugen -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Mar 24 12:40:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99138F6A32E; Sat, 24 Mar 2018 12:40:46 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D17A69E38; Sat, 24 Mar 2018 12:40:46 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47FE8741E; Sat, 24 Mar 2018 12:40:46 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OCekiF008817; Sat, 24 Mar 2018 12:40:46 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OCekNe008816; Sat, 24 Mar 2018 12:40:46 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241240.w2OCekNe008816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 12:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331483 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 331483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:40:46 -0000 Author: jtl Date: Sat Mar 24 12:40:45 2018 New Revision: 331483 URL: https://svnweb.freebsd.org/changeset/base/331483 Log: Fix compilation for platforms that don't support atomic_fetchadd_64() after r331347. Reported by: avg, br, jhibbits Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_log_buf.c Modified: head/sys/netinet/tcp_log_buf.c ============================================================================== --- head/sys/netinet/tcp_log_buf.c Sat Mar 24 09:10:50 2018 (r331482) +++ head/sys/netinet/tcp_log_buf.c Sat Mar 24 12:40:45 2018 (r331483) @@ -72,8 +72,8 @@ static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_ STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); static struct mtx tcp_log_expireq_mtx; static struct callout tcp_log_expireq_callout; -static uint64_t tcp_log_auto_ratio = 0; -static uint64_t tcp_log_auto_ratio_cur = 0; +static u_long tcp_log_auto_ratio = 0; +static volatile u_long tcp_log_auto_ratio_cur = 0; static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; static bool tcp_log_auto_all = false; @@ -109,7 +109,7 @@ SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpc SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, 0, "Version of log formats exported"); -SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, +SYSCTL_ULONG(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, @@ -283,7 +283,7 @@ tcp_log_selectauto(void) * this session. */ if (tcp_log_auto_ratio && - (atomic_fetchadd_64(&tcp_log_auto_ratio_cur, 1) % + (atomic_fetchadd_long(&tcp_log_auto_ratio_cur, 1) % tcp_log_auto_ratio) == 0) return (true); return (false); From owner-svn-src-all@freebsd.org Sat Mar 24 12:43:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E449F6A776; Sat, 24 Mar 2018 12:43:35 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 518F66A12C; Sat, 24 Mar 2018 12:43:35 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C77C75A4; Sat, 24 Mar 2018 12:43:35 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OChZk2013573; Sat, 24 Mar 2018 12:43:35 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OChY5f013569; Sat, 24 Mar 2018 12:43:34 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241243.w2OChY5f013569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 12:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331484 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:43:36 -0000 Author: jtl Date: Sat Mar 24 12:43:34 2018 New Revision: 331484 URL: https://svnweb.freebsd.org/changeset/base/331484 Log: Remove some unneccessary variable sets in IPv6 code, as detected by clang's static analyzer. Reviewed by: bz MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D10940 Modified: head/sys/netinet6/dest6.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_output.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/dest6.c ============================================================================== --- head/sys/netinet6/dest6.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/dest6.c Sat Mar 24 12:43:34 2018 (r331484) @@ -93,7 +93,7 @@ dest6_input(struct mbuf **mp, int *offp, int proto) opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest); /* search header for all options. */ - for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { + for (; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { if (*opt != IP6OPT_PAD1 && (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) { IP6STAT_INC(ip6s_toosmall); Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/icmp6.c Sat Mar 24 12:43:34 2018 (r331484) @@ -594,7 +594,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n->m_pkthdr.len = n0len + (noff - off); n->m_next = n0; } else { - nip6 = mtod(n, struct ip6_hdr *); IP6_EXTHDR_GET(nicmp6, struct icmp6_hdr *, n, off, sizeof(*nicmp6)); noff = off; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/ip6_output.c Sat Mar 24 12:43:34 2018 (r331484) @@ -1048,7 +1048,7 @@ sendorfree: m = m0->m_nextpkt; m0->m_nextpkt = 0; m_freem(m0); - for (m0 = m; m; m = m0) { + for (; m; m = m0) { m0 = m->m_nextpkt; m->m_nextpkt = 0; if (error == 0) { Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/udp6_usrreq.c Sat Mar 24 12:43:34 2018 (r331484) @@ -220,7 +220,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto) uint8_t nxt; ifp = m->m_pkthdr.rcvif; - ip6 = mtod(m, struct ip6_hdr *); #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); @@ -230,6 +229,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(*uh)); if (!uh) return (IPPROTO_DONE); + ip6 = mtod(m, struct ip6_hdr *); #endif UDPSTAT_INC(udps_ipackets); From owner-svn-src-all@freebsd.org Sat Mar 24 12:48:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0D5EF6AC4C; Sat, 24 Mar 2018 12:48:11 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EECF6A330; Sat, 24 Mar 2018 12:48:11 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4579975C9; Sat, 24 Mar 2018 12:48:11 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OCmBw8013787; Sat, 24 Mar 2018 12:48:11 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OCmAHi013779; Sat, 24 Mar 2018 12:48:10 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241248.w2OCmAHi013779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 12:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331485 - in head/sys: amd64/conf conf dev/tcp_log netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: in head/sys: amd64/conf conf dev/tcp_log netinet X-SVN-Commit-Revision: 331485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:48:11 -0000 Author: jtl Date: Sat Mar 24 12:48:10 2018 New Revision: 331485 URL: https://svnweb.freebsd.org/changeset/base/331485 Log: Make the TCP blackbox code committed in r331347 be an optional feature controlled by the TCP_BLACKBOX option. Enable this as part of amd64 GENERIC. For now, leave it disabled on other platforms. Sponsored by: Netflix, Inc. Modified: head/sys/amd64/conf/GENERIC head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/dev/tcp_log/tcp_log_dev.h head/sys/netinet/tcp_log_buf.h head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_usrreq.c Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/amd64/conf/GENERIC Sat Mar 24 12:48:10 2018 (r331485) @@ -32,6 +32,7 @@ options INET6 # IPv6 communications protocols options IPSEC # IP (v4/v6) security options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 options TCP_OFFLOAD # TCP offload +options TCP_BLACKBOX # Enhanced TCP event logging options TCP_HHOOK # hhook(9) framework for TCP options TCP_RFC7413 # TCP Fast Open options SCTP # Stream Control Transmission Protocol Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/conf/NOTES Sat Mar 24 12:48:10 2018 (r331485) @@ -979,6 +979,8 @@ device lagg # TCPPCAP enables code which keeps the last n packets sent and received # on a TCP socket. # +# TCP_BLACKBOX enables enhanced TCP event logging. +# # TCP_HHOOK enables the hhook(9) framework hooks for the TCP stack. # # RADIX_MPATH provides support for equal-cost multi-path routing. @@ -1000,6 +1002,7 @@ options IPSTEALTH #support for stealth forwarding options PF_DEFAULT_TO_DROP #drop everything by default options TCPDEBUG options TCPPCAP +options TCP_BLACKBOX options TCP_HHOOK options RADIX_MPATH Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/conf/files Sat Mar 24 12:48:10 2018 (r331485) @@ -3163,7 +3163,7 @@ dev/syscons/star/star_saver.c optional star_saver dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/syscons/warp/warp_saver.c optional warp_saver -dev/tcp_log/tcp_log_dev.c optional inet | inet6 +dev/tcp_log/tcp_log_dev.c optional tcp_blackbox inet | tcp_blackbox inet6 dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux dev/tdfx/tdfx_pci.c optional tdfx pci dev/ti/if_ti.c optional ti pci @@ -4312,7 +4312,7 @@ netinet/tcp_debug.c optional tcpdebug netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 netinet/tcp_hostcache.c optional inet | inet6 netinet/tcp_input.c optional inet | inet6 -netinet/tcp_log_buf.c optional inet | inet6 +netinet/tcp_log_buf.c optional tcp_blackbox inet | tcp_blackbox inet6 netinet/tcp_lro.c optional inet | inet6 netinet/tcp_output.c optional inet | inet6 netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/conf/options Sat Mar 24 12:48:10 2018 (r331485) @@ -452,6 +452,7 @@ SLIP_IFF_OPTS opt_slip.h TCPDEBUG TCPPCAP opt_global.h SIFTR +TCP_BLACKBOX opt_global.h TCP_HHOOK opt_inet.h TCP_OFFLOAD opt_inet.h # Enable code to dispatch TCP offloading TCP_RFC7413 opt_inet.h Modified: head/sys/dev/tcp_log/tcp_log_dev.h ============================================================================== --- head/sys/dev/tcp_log/tcp_log_dev.h Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/dev/tcp_log/tcp_log_dev.h Sat Mar 24 12:48:10 2018 (r331485) @@ -81,8 +81,9 @@ struct tcp_log_dev_info { }; STAILQ_HEAD(log_infoh, tcp_log_dev_info); - +#ifdef TCP_BLACKBOX MALLOC_DECLARE(M_TCPLOGDEV); int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); +#endif /* TCP_BLACKBOX */ #endif /* _KERNEL */ #endif /* !__tcp_log_dev_h__ */ Modified: head/sys/netinet/tcp_log_buf.h ============================================================================== --- head/sys/netinet/tcp_log_buf.h Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/netinet/tcp_log_buf.h Sat Mar 24 12:48:10 2018 (r331485) @@ -331,6 +331,7 @@ struct tcp_log_dev_log_queue { } while (0) +#ifdef TCP_BLACKBOX extern bool tcp_log_verbose; void tcp_log_drain(struct tcpcb *tp); int tcp_log_dump_tp_logbuf(struct tcpcb *tp, char *reason, int how, bool force); @@ -348,6 +349,20 @@ int tcp_log_state_change(struct tcpcb *tp, int state); void tcp_log_tcpcbinit(struct tcpcb *tp); void tcp_log_tcpcbfini(struct tcpcb *tp); void tcp_log_flowend(struct tcpcb *tp); +#else /* !TCP_BLACKBOX */ +#define tcp_log_verbose (false) + +static inline struct tcp_log_buffer * +tcp_log_event_(struct tcpcb *tp, struct tcphdr *th, struct sockbuf *rxbuf, + struct sockbuf *txbuf, uint8_t eventid, int errornum, uint32_t len, + union tcp_log_stackspecific *stackinfo, int th_hostorder, + const char *output_caller, const char *func, int line, + const struct timeval *tv) +{ + + return (NULL); +} +#endif /* TCP_BLACKBOX */ #endif /* _KERNEL */ #endif /* __tcp_log_buf_h__ */ Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/netinet/tcp_subr.c Sat Mar 24 12:48:10 2018 (r331485) @@ -848,8 +848,10 @@ tcp_init(void) /* Setup the tcp function block list */ init_tcp_functions(); register_tcp_functions(&tcp_def_funcblk, M_WAITOK); +#ifdef TCP_BLACKBOX /* Initialize the TCP logging data. */ tcp_log_init(); +#endif if (tcp_soreceive_stream) { #ifdef INET @@ -1431,8 +1433,10 @@ tcp_newtcpcb(struct inpcb *inp) */ tcp_pcap_tcpcb_init(tp); #endif +#ifdef TCP_BLACKBOX /* Initialize the per-TCPCB log data. */ tcp_log_tcpcbinit(tp); +#endif if (tp->t_fb->tfb_tcp_fb_init) { (*tp->t_fb->tfb_tcp_fb_init)(tp); } @@ -1650,7 +1654,9 @@ tcp_discardcb(struct tcpcb *tp) inp->inp_ppcb = NULL; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on tcpcb, let's free it. */ +#ifdef TCP_BLACKBOX tcp_log_tcpcbfini(tp); +#endif TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); @@ -1681,7 +1687,9 @@ tcp_timer_discard(void *ptp) tp->t_timers->tt_draincnt--; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on this tcpcb, let's free it. */ +#ifdef TCP_BLACKBOX tcp_log_tcpcbfini(tp); +#endif TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); @@ -1775,7 +1783,9 @@ tcp_drain(void) if ((tcpb = intotcpcb(inpb)) != NULL) { tcp_reass_flush(tcpb); tcp_clean_sackreport(tcpb); +#ifdef TCP_BLACKBOX tcp_log_drain(tcpb); +#endif #ifdef TCPPCAP if (tcp_pcap_aggressive_free) { /* Free the TCP PCAP queues. */ @@ -2957,7 +2967,9 @@ tcp_inptoxtp(const struct inpcb *inp, struct xtcpcb *x bcopy(tp->t_fb->tfb_tcp_block_name, xt->xt_stack, TCP_FUNCTION_NAME_LEN_MAX); bzero(xt->xt_logid, TCP_LOG_ID_LEN); +#ifdef TCP_BLACKBOX (void)tcp_log_get_id(tp, xt->xt_logid); +#endif } xt->xt_len = sizeof(struct xtcpcb); Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/netinet/tcp_usrreq.c Sat Mar 24 12:48:10 2018 (r331485) @@ -1837,6 +1837,7 @@ unlock_and_done: goto unlock_and_done; } +#ifdef TCP_BLACKBOX case TCP_LOG: INP_WUNLOCK(inp); error = sooptcopyin(sopt, &optval, sizeof optval, @@ -1885,6 +1886,7 @@ unlock_and_done: */ } break; +#endif default: INP_WUNLOCK(inp); @@ -1971,6 +1973,7 @@ unlock_and_done: INP_WUNLOCK(inp); error = sooptcopyout(sopt, &optval, sizeof optval); break; +#ifdef TCP_BLACKBOX case TCP_LOG: optval = tp->t_logstate; INP_WUNLOCK(inp); @@ -1990,6 +1993,7 @@ unlock_and_done: INP_WUNLOCK(inp); error = EINVAL; break; +#endif default: INP_WUNLOCK(inp); error = ENOPROTOOPT; From owner-svn-src-all@freebsd.org Sat Mar 24 12:51:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E86F5F6B097; Sat, 24 Mar 2018 12:51:21 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wr0-x22c.google.com (mail-wr0-x22c.google.com [IPv6:2a00:1450:400c:c0c::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C6026A54F; Sat, 24 Mar 2018 12:51:21 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wr0-x22c.google.com with SMTP id d10so14607295wrf.3; Sat, 24 Mar 2018 05:51:21 -0700 (PDT) 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=0SEQ3RsZF7YuEqvq6G3LlHfNeBrCDew44CCDXX+t754=; b=rB9K+L16EufaSgHPe0bC9Ff5Ikty2N24585c6EkIy990A08upmlIc0S07f0ek/vYPn sKmBzy5rWFM4E3Bvk18S/22KD3F2V9CaihEkWmzOKDKpAE4pI3+9VZdHD+/Wahb5hY3F Qx/qlSOqUwVyvWUmHJYgYyYlKuJe0Ipzeph5uzI8V5PJ5zxfye6cbYw1dT3IGdIVbEwx WaFfyjlyJcsghQBynXA/rtXieNfRoCK2wd9GDmTjE07kOAW0jC/WPz3DvROqhTIv41Jy /NCAQjrGInmWu1N1gn+KhvxHjB7++FUtY2/npV+WugLjCJpbNXh6LQVBL9SFUj4Lj0ED 0e6Q== 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=0SEQ3RsZF7YuEqvq6G3LlHfNeBrCDew44CCDXX+t754=; b=p2MntvCj1ytUwmi4rK3v8Fb64afDXvLjHi6OWfY4cS+zBaOnBSnA7KGzJIkUHIizU3 wgt1Ov4b9p5gHNbzHYaDaSAVGdTD9hm7Yint+8exxJS+9UPcGCOQqDBEt5e6gPzgQtsT OBElD+WZ2jKGPMlEGfjnNg0rO0WdxE8LRFI3hx6J+PhflO6NX8+jE4cKdNMWWdX3FO+U 8saWvEcpYBlXYVmeLeVubDghKyMu+BYYqUOOOgHE1OzXbWx3xKwitTWb8xQOazYd8N1h 9sr3Ld/CZazy4IBkl2OHUFqtNO7hKrEccTivp3oWI94obqPCgGrPxNPYlgl1vG+YQS7U 6Bkw== X-Gm-Message-State: AElRT7HcujgMj+noAmqLURV29vwxnc4036hkdbZqZzxGmfITwGEuBTbd 3bZvfW2chzUTgDMIAb7goaHJ63CLNzpGiPBJoEE= X-Google-Smtp-Source: AG47ELvAmsn+/S9uQRRviTKzRmP15yqRTEdrDQbwJOqggOuxJjFZwVwYVduGDJbCCtVC7uqmDS1QkuEGwicaKIFGJqA= X-Received: by 10.223.184.219 with SMTP id c27mr27873955wrg.30.1521895880264; Sat, 24 Mar 2018 05:51:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.192.2 with HTTP; Sat, 24 Mar 2018 05:51:19 -0700 (PDT) In-Reply-To: References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> From: Jonathan Looney Date: Sat, 24 Mar 2018 12:51:19 +0000 Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Justin Hibbits Cc: Andriy Gapon , Ruslan Bukin , "Jonathan T. Looney" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:51:22 -0000 Compilation should be fixed as of r331483. I also made this an optional feature in r331485. If you find more problems, please let me know. Jonathan From owner-svn-src-all@freebsd.org Sat Mar 24 12:57:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4577BF6B662; Sat, 24 Mar 2018 12:57:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6C446A96D; Sat, 24 Mar 2018 12:57:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD4AC7770; Sat, 24 Mar 2018 12:57:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OCvwKu018534; Sat, 24 Mar 2018 12:57:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OCvwwT018532; Sat, 24 Mar 2018 12:57:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241257.w2OCvwwT018532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 12:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331486 - head/sys/amd64/ia32 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/ia32 X-SVN-Commit-Revision: 331486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:57:59 -0000 Author: kib Date: Sat Mar 24 12:57:58 2018 New Revision: 331486 URL: https://svnweb.freebsd.org/changeset/base/331486 Log: Improve the lcall $7,$0 syscall emulation on amd64. Current code, which copies the potential syscall arguments into the current frame, puts an arbitrary limit on the number of syscall arguments. Apparently, mmap(2) and lseek(2) (?) require larger number. But there is an issue that stack is only need to be mapped to contain the number of arguments required by the syscall, so copying arbitrary large number of words from the stack is not completely safe. Use different approach to convert lcall frame into int $0x80 frame in place, by doing the retl in kernel. This also allows to stop proceed vfork case specially, and stop making assumptions about %cs at the syscall time. Also, improve comments with the formulations provided by bde. Reviewed and tested by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/ia32/ia32_sigtramp.S head/sys/amd64/ia32/ia32_syscall.c Modified: head/sys/amd64/ia32/ia32_sigtramp.S ============================================================================== --- head/sys/amd64/ia32/ia32_sigtramp.S Sat Mar 24 12:48:10 2018 (r331485) +++ head/sys/amd64/ia32/ia32_sigtramp.S Sat Mar 24 12:57:58 2018 (r331486) @@ -78,44 +78,23 @@ ia32_osigcode: 1: jmp 1b - /* - * The lcall $7,$0 emulator cannot use the call gate that does an - * inter-privilege transition. The reason is that the call gate - * does not disable interrupts, and, before the swapgs is - * executed, we would have a window where the ring 0 code is - * executed with the wrong gsbase. + * Our lcall $7,$0 handler remains in user mode (ring 3), since lcalls + * don't change the interrupt mask, so if this one went directly to the + * kernel then there would be a window with interrupts enabled in kernel + * mode, and all interrupt handlers would have to be almost as complicated + * as the NMI handler to support this. * - * Instead, set LDT descriptor 0 as code segment, which reflects - * the lcall $7,$0 back to ring 3 trampoline. The trampoline sets up - * the frame for int $0x80. + * Instead, convert the lcall to an int0x80 call. The kernel does most + * of the conversion by popping the lcall return values off the user + * stack and returning to them instead of to here, except when the + * conversion itself fails. Adjusting the stack here is impossible for + * vfork() and harder for other syscalls. */ ALIGN_TEXT lcall_tramp: - cmpl $SYS_vfork,%eax - je 1f - pushl %ebp - movl %esp,%ebp - pushl 0x24(%ebp) /* arg 6 */ - pushl 0x20(%ebp) - pushl 0x1c(%ebp) - pushl 0x18(%ebp) - pushl 0x14(%ebp) - pushl 0x10(%ebp) /* arg 1 */ - subl $4,%esp /* gap */ int $0x80 - leavel - lretl -1: - /* - * vfork handling is special and relies on the libc stub saving - * the return ip in %ecx. Also, we assume that the call was done - * with ucode32 selector in %cs. - */ - int $0x80 - movl $0x33,4(%esp) /* GUCODE32_SEL | SEL_UPL */ - movl %ecx,(%esp) - lretl +1: jmp 1b #endif ALIGN_TEXT Modified: head/sys/amd64/ia32/ia32_syscall.c ============================================================================== --- head/sys/amd64/ia32/ia32_syscall.c Sat Mar 24 12:48:10 2018 (r331485) +++ head/sys/amd64/ia32/ia32_syscall.c Sat Mar 24 12:57:58 2018 (r331486) @@ -116,10 +116,38 @@ ia32_fetch_syscall_args(struct thread *td) caddr_t params; u_int32_t args[8], tmp; int error, i; +#ifdef COMPAT_43 + u_int32_t eip; + int cs; +#endif p = td->td_proc; frame = td->td_frame; sa = &td->td_sa; + +#ifdef COMPAT_43 + if (__predict_false(frame->tf_cs == 7 && frame->tf_rip == 2)) { + /* + * In lcall $7,$0 after int $0x80. Convert the user + * frame to what it would be for a direct int 0x80 instead + * of lcall $7,$0, by popping the lcall return address. + */ + error = fueword32((void *)frame->tf_rsp, &eip); + if (error == -1) + return (EFAULT); + cs = fuword16((void *)(frame->tf_rsp + sizeof(u_int32_t))); + if (cs == -1) + return (EFAULT); + + /* + * Unwind in-kernel frame after all stack frame pieces + * were successfully read. + */ + frame->tf_rip = eip; + frame->tf_cs = cs; + frame->tf_rsp += 2 * sizeof(u_int32_t); + } +#endif params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t); sa->code = frame->tf_rax; From owner-svn-src-all@freebsd.org Sat Mar 24 13:13:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B6D2F6C97D; Sat, 24 Mar 2018 13:13:53 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D39946B439; Sat, 24 Mar 2018 13:13:52 +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 B3E037AC2; Sat, 24 Mar 2018 13:13:52 +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 w2ODDq8D028460; Sat, 24 Mar 2018 13:13:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODDq3a028459; Sat, 24 Mar 2018 13:13:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241313.w2ODDq3a028459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 13:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331487 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:13:53 -0000 Author: kib Date: Sat Mar 24 13:13:52 2018 New Revision: 331487 URL: https://svnweb.freebsd.org/changeset/base/331487 Log: In vn_io_fault1(), reduce the scope where pagefaults are disabled. Most important for the future use, do not call vm_fault_quick_hold_pages() with disabled pagefaults. Reported and tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sat Mar 24 12:57:58 2018 (r331486) +++ head/sys/kern/vfs_vnops.c Sat Mar 24 13:13:52 2018 (r331487) @@ -956,23 +956,30 @@ static int vn_io_fault_doio(struct vn_io_fault_args *args, struct uio *uio, struct thread *td) { + int error, save; + error = 0; + save = vm_fault_disable_pagefaults(); switch (args->kind) { case VN_IO_FAULT_FOP: - return ((args->args.fop_args.doio)(args->args.fop_args.fp, - uio, args->cred, args->flags, td)); + error = (args->args.fop_args.doio)(args->args.fop_args.fp, + uio, args->cred, args->flags, td); + break; case VN_IO_FAULT_VOP: if (uio->uio_rw == UIO_READ) { - return (VOP_READ(args->args.vop_args.vp, uio, - args->flags, args->cred)); + error = VOP_READ(args->args.vop_args.vp, uio, + args->flags, args->cred); } else if (uio->uio_rw == UIO_WRITE) { - return (VOP_WRITE(args->args.vop_args.vp, uio, - args->flags, args->cred)); + error = VOP_WRITE(args->args.vop_args.vp, uio, + args->flags, args->cred); } break; + default: + panic("vn_io_fault_doio: unknown kind of io %d %d", + args->kind, uio->uio_rw); } - panic("vn_io_fault_doio: unknown kind of io %d %d", args->kind, - uio->uio_rw); + vm_fault_enable_pagefaults(save); + return (error); } static int @@ -1047,7 +1054,7 @@ vn_io_fault1(struct vnode *vp, struct uio *uio, struct vm_offset_t addr, end; size_t len, resid; ssize_t adv; - int error, cnt, save, saveheld, prev_td_ma_cnt; + int error, cnt, saveheld, prev_td_ma_cnt; if (vn_io_fault_prefault) { error = vn_io_fault_prefault_user(uio); @@ -1073,7 +1080,6 @@ vn_io_fault1(struct vnode *vp, struct uio *uio, struct short_uio.uio_rw = uio->uio_rw; short_uio.uio_td = uio->uio_td; - save = vm_fault_disable_pagefaults(); error = vn_io_fault_doio(args, uio, td); if (error != EFAULT) goto out; @@ -1144,7 +1150,6 @@ vn_io_fault1(struct vnode *vp, struct uio *uio, struct td->td_ma_cnt = prev_td_ma_cnt; curthread_pflags_restore(saveheld); out: - vm_fault_enable_pagefaults(save); free(uio_clone, M_IOV); return (error); } From owner-svn-src-all@freebsd.org Sat Mar 24 13:18:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3E05F6CF44; Sat, 24 Mar 2018 13:18:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 748766B7F0; Sat, 24 Mar 2018 13:18:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F5C37AD7; Sat, 24 Mar 2018 13:18:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ODI9J3028765; Sat, 24 Mar 2018 13:18:09 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODI9qT028764; Sat, 24 Mar 2018 13:18:09 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241318.w2ODI9qT028764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 13:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331488 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:18:10 -0000 Author: jtl Date: Sat Mar 24 13:18:09 2018 New Revision: 331488 URL: https://svnweb.freebsd.org/changeset/base/331488 Log: This change adds a flag to the DAD entry to indicate whether it is currently on the queue. This prevents accidentally doubly-removing a DAD entry from the queue, while also simplifying some of the logic in nd6_dad_stop(). Reviewed by: ae, hrs, vangyzen MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D10943 Modified: head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sat Mar 24 13:13:52 2018 (r331487) +++ head/sys/netinet6/nd6_nbr.c Sat Mar 24 13:18:09 2018 (r331488) @@ -1120,6 +1120,7 @@ struct dadq { #define ND_OPT_NONCE_LEN32 \ ((ND_OPT_NONCE_LEN + sizeof(uint32_t) - 1)/sizeof(uint32_t)) uint32_t dad_nonce[ND_OPT_NONCE_LEN32]; + bool dad_ondadq; /* on dadq? Protected by DADQ_WLOCK. */ }; static VNET_DEFINE(TAILQ_HEAD(, dadq), dadq); @@ -1138,6 +1139,7 @@ nd6_dad_add(struct dadq *dp) DADQ_WLOCK(); TAILQ_INSERT_TAIL(&V_dadq, dp, dad_list); + dp->dad_ondadq = true; DADQ_WUNLOCK(); } @@ -1146,9 +1148,17 @@ nd6_dad_del(struct dadq *dp) { DADQ_WLOCK(); - TAILQ_REMOVE(&V_dadq, dp, dad_list); - DADQ_WUNLOCK(); - nd6_dad_rele(dp); + if (dp->dad_ondadq) { + /* + * Remove dp from the dadq and release the dadq's + * reference. + */ + TAILQ_REMOVE(&V_dadq, dp, dad_list); + dp->dad_ondadq = false; + DADQ_WUNLOCK(); + nd6_dad_rele(dp); + } else + DADQ_WUNLOCK(); } static struct dadq * @@ -1281,6 +1291,8 @@ nd6_dad_start(struct ifaddr *ifa, int delay) dp->dad_ns_icount = dp->dad_na_icount = 0; dp->dad_ns_ocount = dp->dad_ns_tcount = 0; dp->dad_ns_lcount = dp->dad_loopbackprobe = 0; + + /* Add this to the dadq and add a reference for the dadq. */ refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); nd6_dad_starttimer(dp, delay, 0); @@ -1301,17 +1313,9 @@ nd6_dad_stop(struct ifaddr *ifa) } nd6_dad_stoptimer(dp); - - /* - * The DAD queue entry may have been removed by nd6_dad_timer() while - * we were waiting for it to stop, so re-do the lookup. - */ - nd6_dad_rele(dp); - dp = nd6_dad_find(ifa, NULL); - if (dp == NULL) - return; - nd6_dad_del(dp); + + /* Release this function's reference, acquired by nd6_dad_find(). */ nd6_dad_rele(dp); } From owner-svn-src-all@freebsd.org Sat Mar 24 13:48:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CBFDF6EF9D; Sat, 24 Mar 2018 13:48:54 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B2476C81E; Sat, 24 Mar 2018 13:48:54 +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 E021F7FD4; Sat, 24 Mar 2018 13:48:53 +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 w2ODmrmX043384; Sat, 24 Mar 2018 13:48:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODmrcC043383; Sat, 24 Mar 2018 13:48:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241348.w2ODmrcC043383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 13:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331489 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:48:54 -0000 Author: kib Date: Sat Mar 24 13:48:53 2018 New Revision: 331489 URL: https://svnweb.freebsd.org/changeset/base/331489 Log: For vm_zone_stats() sysctl handler, do not drain sbuf calling copyout(9) while owning zone lock. Despite old value sysctl buffer is wired, spurious faults might still occur. Note that we still own the uma_rwlock there, but this lock does not participate in sensitive lock orders. Reported and tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Mar 24 13:18:09 2018 (r331488) +++ head/sys/vm/uma_core.c Sat Mar 24 13:48:53 2018 (r331489) @@ -3692,7 +3692,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) { struct uma_stream_header ush; struct uma_type_header uth; - struct uma_percpu_stat ups; + struct uma_percpu_stat *ups; uma_bucket_t bucket; uma_zone_domain_t zdom; struct sbuf sbuf; @@ -3708,6 +3708,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) return (error); sbuf_new_for_sysctl(&sbuf, NULL, 128, req); sbuf_clear_flags(&sbuf, SBUF_INCLUDENUL); + ups = malloc((mp_maxid + 1) * sizeof(*ups), M_TEMP, M_WAITOK); count = 0; rw_rlock(&uma_rwlock); @@ -3760,7 +3761,6 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) uth.uth_frees = z->uz_frees; uth.uth_fails = z->uz_fails; uth.uth_sleeps = z->uz_sleeps; - (void)sbuf_bcat(&sbuf, &uth, sizeof(uth)); /* * While it is not normally safe to access the cache * bucket pointers while not on the CPU that owns the @@ -3769,30 +3769,31 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) * accept the possible race associated with bucket * exchange during monitoring. */ - for (i = 0; i < (mp_maxid + 1); i++) { - bzero(&ups, sizeof(ups)); - if (kz->uk_flags & UMA_ZFLAG_INTERNAL) - goto skip; - if (CPU_ABSENT(i)) - goto skip; + for (i = 0; i < mp_maxid + 1; i++) { + bzero(&ups[i], sizeof(*ups)); + if (kz->uk_flags & UMA_ZFLAG_INTERNAL || + CPU_ABSENT(i)) + continue; cache = &z->uz_cpu[i]; if (cache->uc_allocbucket != NULL) - ups.ups_cache_free += + ups[i].ups_cache_free += cache->uc_allocbucket->ub_cnt; if (cache->uc_freebucket != NULL) - ups.ups_cache_free += + ups[i].ups_cache_free += cache->uc_freebucket->ub_cnt; - ups.ups_allocs = cache->uc_allocs; - ups.ups_frees = cache->uc_frees; -skip: - (void)sbuf_bcat(&sbuf, &ups, sizeof(ups)); + ups[i].ups_allocs = cache->uc_allocs; + ups[i].ups_frees = cache->uc_frees; } ZONE_UNLOCK(z); + (void)sbuf_bcat(&sbuf, &uth, sizeof(uth)); + for (i = 0; i < mp_maxid + 1; i++) + (void)sbuf_bcat(&sbuf, &ups[i], sizeof(ups[i])); } } rw_runlock(&uma_rwlock); error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); + free(ups, M_TEMP); return (error); } From owner-svn-src-all@freebsd.org Sat Mar 24 13:51:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36DC6F6F32A; Sat, 24 Mar 2018 13:51:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E15316CA7A; Sat, 24 Mar 2018 13:51:27 +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 DC1691001A; Sat, 24 Mar 2018 13:51:27 +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 w2ODpRBt045220; Sat, 24 Mar 2018 13:51:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODpRdw045216; Sat, 24 Mar 2018 13:51:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241351.w2ODpRdw045216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 13:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331490 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 331490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:51:28 -0000 Author: kib Date: Sat Mar 24 13:51:27 2018 New Revision: 331490 URL: https://svnweb.freebsd.org/changeset/base/331490 Log: Account the size of the vslock-ed memory by the thread. Assert that all such memory is unwired on return to usermode. The count of the wired memory will be used to detect the copyout mode. Tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_thread.c head/sys/kern/subr_trap.c head/sys/sys/proc.h head/sys/vm/vm_glue.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/kern/kern_thread.c Sat Mar 24 13:51:27 2018 (r331490) @@ -81,9 +81,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x "struct thread KBI td_flags"); _Static_assert(offsetof(struct thread, td_pflags) == 0x104, "struct thread KBI td_pflags"); -_Static_assert(offsetof(struct thread, td_frame) == 0x468, +_Static_assert(offsetof(struct thread, td_frame) == 0x470, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x510, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x518, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb0, "struct proc KBI p_flag"); @@ -101,9 +101,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x "struct thread KBI td_flags"); _Static_assert(offsetof(struct thread, td_pflags) == 0xa0, "struct thread KBI td_pflags"); -_Static_assert(offsetof(struct thread, td_frame) == 0x2e4, +_Static_assert(offsetof(struct thread, td_frame) == 0x2e8, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x330, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x334, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0x68, "struct proc KBI p_flag"); Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/kern/subr_trap.c Sat Mar 24 13:51:27 2018 (r331490) @@ -178,6 +178,8 @@ userret(struct thread *td, struct trapframe *frame) ("userret: Returning with stop signals deferred")); KASSERT(td->td_su == NULL, ("userret: Returning with SU cleanup request not handled")); + KASSERT(td->td_vslock_sz == 0, + ("userret: Returning with vslock-wired space")); #ifdef VIMAGE /* Unfortunately td_vnet_lpush needs VNET_DEBUG. */ VNET_ASSERT(curvnet == NULL, Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/sys/proc.h Sat Mar 24 13:51:27 2018 (r331490) @@ -297,6 +297,7 @@ struct thread { void *td_su; /* (k) FFS SU private */ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ int td_rtcgen; /* (s) rtc_generation of abs. sleep */ + size_t td_vslock_sz; /* (k) amount of vslock-ed space */ #define td_endzero td_sigmask /* Copied during fork1() or create_thread(). */ Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/vm/vm_glue.c Sat Mar 24 13:51:27 2018 (r331490) @@ -196,11 +196,16 @@ vslock(void *addr, size_t len) #endif error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); + if (error == KERN_SUCCESS) { + curthread->td_vslock_sz += len; + return (0); + } + /* * Return EFAULT on error to match copy{in,out}() behaviour * rather than returning ENOMEM like mlock() would. */ - return (error == KERN_SUCCESS ? 0 : EFAULT); + return (EFAULT); } void @@ -208,6 +213,8 @@ vsunlock(void *addr, size_t len) { /* Rely on the parameter sanity checks performed by vslock(). */ + MPASS(curthread->td_vslock_sz >= len); + curthread->td_vslock_sz -= len; (void)vm_map_unwire(&curproc->p_vmspace->vm_map, trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len), VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); From owner-svn-src-all@freebsd.org Sat Mar 24 14:43:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D8F5F4FF15; Sat, 24 Mar 2018 14:43:49 +0000 (UTC) (envelope-from idefix@fechner.net) Received: from anny.lostinspace.de (anny.lostinspace.de [195.30.95.33]) (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 984EA6FB44; Sat, 24 Mar 2018 14:43:48 +0000 (UTC) (envelope-from idefix@fechner.net) Received: from server.idefix.lan (unknown [IPv6:2a01:5c0:1b:2d41:21b:21ff:fe7b:3468]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: idefix@fechner.net) by anny.lostinspace.de (Postfix) with ESMTPSA id 45D4310DDDFE; Sat, 24 Mar 2018 15:43:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fechner.net; s=default; t=1521902620; bh=dC70Gx2lRLy8SLLLcp9ZSQq8h4tBZQPyq82Aa9A73PI=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=aqrg2a04C19dsyYuiM9wqWt+uDFIxUHRKQTWj5qKhl2Ei7jrtbBWHwJww9+txAFmD tKOgusaQQjltDhkqrUWPnxlI1G9+rKjrviIVTJRSLfyCcGtRFbLU9V3sd6rO2JxZo2 ctGjG8V7mkB5ylh8DsaYc9aIYlfyq/weRGn5UByE= Received: from [192.168.0.151] (070-139-067-156.ip-addr.inexio.net [156.67.139.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by server.idefix.lan (Postfix) with ESMTPSA id 702BA1492FB0; Sat, 24 Mar 2018 15:43:39 +0100 (CET) Subject: Re: svn commit: r331482 - head/share/misc To: rgrimes@freebsd.org, Matthias Fechner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803240937.w2O9boF2035461@pdx.rh.CN85.dnsmgr.net> From: Matthias Fechner Message-ID: <3ed9375d-bc97-0aad-c8a9-91bcb4f7d1e4@fechner.net> Date: Sat, 24 Mar 2018 15:43:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201803240937.w2O9boF2035461@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 14:43:49 -0000 Dear Rodney, Am 24.03.2018 um 10:37 schrieb Rodney W. Grimes: >> Author: mfechner (ports committer) >> Date: Sat Mar 24 09:10:50 2018 >> New Revision: 331482 >> URL: https://svnweb.freebsd.org/changeset/base/331482 >> >> Log: >> Added myself to committers-ports.dot. >> >> Reviewed by: tz (mentor) >> Approved by: tz (mentor) >> Differential Revision: https://reviews.freebsd.org/40631 > Url not found? sry, I think I copied out a wrong id here, here is the correct URL: https://reviews.freebsd.org/D14806 Gruß Matthias -- "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning." -- Rich Cook From owner-svn-src-all@freebsd.org Sat Mar 24 14:53:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 291D6F50FEA; Sat, 24 Mar 2018 14:53:49 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A92C70344; Sat, 24 Mar 2018 14:53:48 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2OErXXi036849; Sat, 24 Mar 2018 07:53:33 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2OErX3x036848; Sat, 24 Mar 2018 07:53:33 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803241453.w2OErX3x036848@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331482 - head/share/misc In-Reply-To: <3ed9375d-bc97-0aad-c8a9-91bcb4f7d1e4@fechner.net> To: Matthias Fechner Date: Sat, 24 Mar 2018 07:53:33 -0700 (PDT) CC: rgrimes@freebsd.org, Matthias Fechner , 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-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 14:53:49 -0000 [ Charset UTF-8 unsupported, converting... ] > Dear Rodney, > > Am 24.03.2018 um 10:37 schrieb Rodney W. Grimes: > >> Author: mfechner (ports committer) > >> Date: Sat Mar 24 09:10:50 2018 > >> New Revision: 331482 > >> URL: https://svnweb.freebsd.org/changeset/base/331482 > >> > >> Log: > >> Added myself to committers-ports.dot. > >> > >> Reviewed by: tz (mentor) > >> Approved by: tz (mentor) > >> Differential Revision: https://reviews.freebsd.org/40631 > > Url not found? > > sry, I think I copied out a wrong id here, here is the correct URL: > https://reviews.freebsd.org/D14806 Thank you. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Mar 24 15:36:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3601CF5491D; Sat, 24 Mar 2018 15:36:26 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DFFE571D61; Sat, 24 Mar 2018 15:36:25 +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 DA6141121A; Sat, 24 Mar 2018 15:36:25 +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 w2OFaP9Q098075; Sat, 24 Mar 2018 15:36:25 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OFaPkw098073; Sat, 24 Mar 2018 15:36:25 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201803241536.w2OFaPkw098073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sat, 24 Mar 2018 15:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331491 - in head/sys/geom: journal label X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head/sys/geom: journal label X-SVN-Commit-Revision: 331491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 15:36:26 -0000 Author: mckusick Date: Sat Mar 24 15:36:25 2018 New Revision: 331491 URL: https://svnweb.freebsd.org/changeset/base/331491 Log: When freeing a superblock returned by ffs_sbget, be sure to also free the superblock summary information. Reported by: Peter Holm (pho@) Tested by: Peter Holm (pho@) Modified: head/sys/geom/journal/g_journal_ufs.c head/sys/geom/label/g_label_ufs.c Modified: head/sys/geom/journal/g_journal_ufs.c ============================================================================== --- head/sys/geom/journal/g_journal_ufs.c Sat Mar 24 13:51:27 2018 (r331490) +++ head/sys/geom/journal/g_journal_ufs.c Sat Mar 24 15:36:25 2018 (r331491) @@ -83,6 +83,7 @@ g_journal_ufs_dirty(struct g_consumer *cp) fs->fs_clean = 0; fs->fs_flags |= FS_NEEDSFSCK | FS_UNCLEAN; error = ffs_sbput(cp, fs, fs->fs_sblockloc, g_use_g_write_data); + g_free(fs->fs_csp); g_free(fs); if (error != 0) { GJ_DEBUG(0, "Cannot mark file system %s as dirty " Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Sat Mar 24 13:51:27 2018 (r331490) +++ head/sys/geom/label/g_label_ufs.c Sat Mar 24 15:36:25 2018 (r331491) @@ -103,8 +103,7 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { /* Valid UFS2. */ } else { - g_free(fs); - return; + goto out; } G_LABEL_DEBUG(1, "%s file system detected on %s.", fs->fs_magic == FS_UFS1_MAGIC ? "UFS1" : "UFS2", pp->name); @@ -120,6 +119,8 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * fs->fs_id[1]); break; } +out: + g_free(fs->fs_csp); g_free(fs); } From owner-svn-src-all@freebsd.org Sat Mar 24 18:06:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80C3EF615E3; Sat, 24 Mar 2018 18:06:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3006477CC2; Sat, 24 Mar 2018 18:06:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 264DF12B69; Sat, 24 Mar 2018 18:06:35 +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 w2OI6YR5072691; Sat, 24 Mar 2018 18:06:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OI6YCk072690; Sat, 24 Mar 2018 18:06:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241806.w2OI6YCk072690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 18:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331492 - stable/11/sys/powerpc/powerpc X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/powerpc/powerpc X-SVN-Commit-Revision: 331492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 18:06:35 -0000 Author: ian Date: Sat Mar 24 18:06:34 2018 New Revision: 331492 URL: https://svnweb.freebsd.org/changeset/base/331492 Log: To fix the powerpc build, back out r331184, which was this mfc: MFC r326859: Add identifier for POWER9 CPU to CPU list Without the identifier in the list booting FreeBSD results in printing the following (from a PowerKVM boot): cpu0: Unknown PowerPC CPU revision 0x1201, 2550.00 MHz For now, add the same feature list as POWER8. As new capabilities are added to support POWER9 specific features, they will be added to this. PR: 224344 Modified: stable/11/sys/powerpc/powerpc/cpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/11/sys/powerpc/powerpc/cpu.c Sat Mar 24 15:36:25 2018 (r331491) +++ stable/11/sys/powerpc/powerpc/cpu.c Sat Mar 24 18:06:34 2018 (r331492) @@ -163,12 +163,6 @@ static const struct cputab models[] = { PPC_FEATURE_HAS_VSX, PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_HAS_VCRYPTO, NULL }, - { "IBM POWER9", IBMPOWER9, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | - PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | - PPC_FEATURE_HAS_VSX, - PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_ISEL | - PPC_FEATURE2_HAS_VCRYPTO, NULL }, { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN, PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN, From owner-svn-src-all@freebsd.org Sat Mar 24 18:42:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0D4AF64974; Sat, 24 Mar 2018 18:42:46 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51E207963A; Sat, 24 Mar 2018 18:42:46 +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 4CC58131E2; Sat, 24 Mar 2018 18:42:46 +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 w2OIgkN3092713; Sat, 24 Mar 2018 18:42:46 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OIgj91092707; Sat, 24 Mar 2018 18:42:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241842.w2OIgj91092707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 18:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331493 - in stable/11/sys: arm/allwinner arm/freescale/imx arm/nvidia dev/ahci X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/allwinner arm/freescale/imx arm/nvidia dev/ahci X-SVN-Commit-Revision: 331493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 18:42:47 -0000 Author: ian Date: Sat Mar 24 18:42:45 2018 New Revision: 331493 URL: https://svnweb.freebsd.org/changeset/base/331493 Log: MFC r324186: Define a single instance of ahci_devclass and reference it from all the attachment code for various SOCs and busses. Remove all the static and should-have-been-static and named-differently instances of it. This should eliminate the recently-grown build warnings about multiple definitions when building arm kernels. Modified: stable/11/sys/arm/allwinner/a10_ahci.c stable/11/sys/arm/freescale/imx/imx6_ahci.c stable/11/sys/arm/nvidia/tegra_ahci.c stable/11/sys/dev/ahci/ahci.c stable/11/sys/dev/ahci/ahci.h stable/11/sys/dev/ahci/ahci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/a10_ahci.c ============================================================================== --- stable/11/sys/arm/allwinner/a10_ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/arm/allwinner/a10_ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -373,8 +373,6 @@ ahci_a10_detach(device_t dev) return (ahci_detach(dev)); } -static devclass_t ahci_devclass; - static device_method_t ahci_ata_methods[] = { DEVMETHOD(device_probe, ahci_a10_probe), DEVMETHOD(device_attach, ahci_a10_attach), Modified: stable/11/sys/arm/freescale/imx/imx6_ahci.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/arm/freescale/imx/imx6_ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -330,8 +330,6 @@ imx6_ahci_detach(device_t dev) return (ahci_detach(dev)); } -devclass_t ahci_devclass; - static device_method_t imx6_ahci_ata_methods[] = { /* device probe, attach and detach methods */ DEVMETHOD(device_probe, imx6_ahci_probe), Modified: stable/11/sys/arm/nvidia/tegra_ahci.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/arm/nvidia/tegra_ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -619,8 +619,7 @@ static device_method_t tegra_ahci_methods[] = { DEVMETHOD_END }; -static devclass_t tegra_ahci_devclass; static DEFINE_CLASS_0(ahci, tegra_ahci_driver, tegra_ahci_methods, sizeof(struct tegra_ahci_sc)); -DRIVER_MODULE(tegra_ahci, simplebus, tegra_ahci_driver, tegra_ahci_devclass, +DRIVER_MODULE(tegra_ahci, simplebus, tegra_ahci_driver, ahci_devclass, NULL, NULL); Modified: stable/11/sys/dev/ahci/ahci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/dev/ahci/ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -2740,5 +2740,8 @@ ahcipoll(struct cam_sim *sim) ahci_reset_to(ch); } } + +devclass_t ahci_devclass; + MODULE_VERSION(ahci, 1); MODULE_DEPEND(ahci, cam, 1, 1, 1); Modified: stable/11/sys/dev/ahci/ahci.h ============================================================================== --- stable/11/sys/dev/ahci/ahci.h Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/dev/ahci/ahci.h Sat Mar 24 18:42:45 2018 (r331493) @@ -648,3 +648,6 @@ bus_dma_tag_t ahci_get_dma_tag(device_t dev, device_t int ahci_ctlr_reset(device_t dev); int ahci_ctlr_setup(device_t dev); void ahci_free_mem(device_t dev); + +extern devclass_t ahci_devclass; + Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/dev/ahci/ahci_pci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -642,7 +642,6 @@ ahci_pci_resume(device_t dev) return (bus_generic_resume(dev)); } -devclass_t ahci_devclass; static device_method_t ahci_methods[] = { DEVMETHOD(device_probe, ahci_probe), DEVMETHOD(device_attach, ahci_pci_attach), From owner-svn-src-all@freebsd.org Sat Mar 24 19:06:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FAD9F66995; Sat, 24 Mar 2018 19:06:00 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 064F77A5A8; Sat, 24 Mar 2018 19:06:00 +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 DB93113525; Sat, 24 Mar 2018 19:05:59 +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 w2OJ5xRx003103; Sat, 24 Mar 2018 19:05:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OJ5x4n003102; Sat, 24 Mar 2018 19:05:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241905.w2OJ5x4n003102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 19:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331494 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 331494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 19:06:00 -0000 Author: ian Date: Sat Mar 24 19:05:59 2018 New Revision: 331494 URL: https://svnweb.freebsd.org/changeset/base/331494 Log: Record-only merge of r324416. The actual code was merged in 327633, but I forgot to add the merge info then (it wasn't so much a merge as recreating on the branch the same conceptual change as was done on head). Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Sat Mar 24 19:57:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7834F6ABEC; Sat, 24 Mar 2018 19:57:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83D447C5F9; Sat, 24 Mar 2018 19:57:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A7E213D5B; Sat, 24 Mar 2018 19:57:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OJv8GK028213; Sat, 24 Mar 2018 19:57:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OJv8ET028212; Sat, 24 Mar 2018 19:57:08 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241957.w2OJv8ET028212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 19:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331495 - stable/11/sys/dev/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/iicbus X-SVN-Commit-Revision: 331495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 19:57:09 -0000 Author: ian Date: Sat Mar 24 19:57:08 2018 New Revision: 331495 URL: https://svnweb.freebsd.org/changeset/base/331495 Log: MFC r327756-r327758 r327756: Bugfix: on RTC chips with a 32-bit binary counter, after reading the time, return immediately rather than falling through to the logic that reads BCD-encoded time. r327757: Bugfix: don't lose the am/pm mode flag when setting the time. Unlike most RTC chips that have a control register bit for am/pm mode, the DS13xx series uses one of the high bits in the hour register. Thus, when setting the time in am/pm mode, the am/pm mode flag has to be ORed into the hour. r327758: Convert a collection of unrelated bitwise flags to a collection of boolean vars in the softc. It makes the code more compact and readable, and actually uses less memory too. Modified: stable/11/sys/dev/iicbus/ds13rtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/ds13rtc.c ============================================================================== --- stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 19:05:59 2018 (r331494) +++ stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 19:57:08 2018 (r331495) @@ -162,16 +162,14 @@ struct time_regs { struct ds13rtc_softc { device_t dev; device_t busdev; - u_int flags; /* SC_F_* flags */ u_int chiptype; /* Type of DS13xx chip */ uint8_t secaddr; /* Address of seconds register */ uint8_t osfaddr; /* Address of register with OSF */ + bool use_ampm; /* Use AM/PM mode. */ + bool use_century; /* Use the Century bit. */ + bool is_binary_counter; /* Chip has 32-bit binary counter. */ }; -#define SC_F_BINARY (1u << 0) /* Time is 32-bit binary counter */ -#define SC_F_AMPM (1u << 1) /* Use PM flag in hours reg */ -#define SC_F_CENTURY (1u << 2) /* Use century bit */ - /* * We use the compat_data table to look up hint strings in the non-FDT case, so * define the struct locally when we don't get it from ofw_bus_subr.h. @@ -326,14 +324,14 @@ ds13rtc_start(void *arg) * chips that do AM/PM mode, the flag bit is in the hours register, * which is secaddr+2. */ - if ((sc->chiptype != TYPE_DS1340) && !(sc->flags & SC_F_BINARY)) { + if ((sc->chiptype != TYPE_DS1340) && !sc->is_binary_counter) { if (read_reg(sc, sc->secaddr + 2, &statreg) != 0) { device_printf(sc->dev, "cannot read RTC clock AM/PM bit\n"); return; } if (statreg & DS13xx_B_HOUR_AMPM) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } /* @@ -363,10 +361,9 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) return (EINVAL); /* hardware is good, time is not. */ /* If the chip counts time in binary, we just read and return it. */ - if (sc->flags & SC_F_BINARY) { - if ((err = read_timeword(sc, &ts->tv_sec)) != 0) - return (err); + if (sc->is_binary_counter) { ts->tv_nsec = 0; + return (read_timeword(sc, &ts->tv_sec)); } /* @@ -377,7 +374,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) return (err); } - if (sc->flags & SC_F_AMPM) + if (sc->use_ampm) hourmask = DS13xx_M_12HOUR; else hourmask = DS13xx_M_24HOUR; @@ -390,7 +387,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) ct.year = FROMBCD(tregs.year & DS13xx_M_YEAR); ct.nsec = 0; - if (sc->flags & SC_F_AMPM) { + if (sc->use_ampm) { if (ct.hour == 12) ct.hour = 0; if (tregs.hour & DS13xx_B_HOUR_PM) @@ -401,7 +398,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) * If this chip has a century bit, honor it. Otherwise let * clock_ct_to_ts() infer the century from the 2-digit year. */ - if (sc->flags & SC_F_CENTURY) + if (sc->use_century) ct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 2000 : 1900; err = clock_ct_to_ts(&ct, ts); @@ -416,7 +413,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts) struct time_regs tregs; struct ds13rtc_softc *sc; int err; - uint8_t cflag, statreg, pmflag; + uint8_t cflag, statreg, pmflags; sc = device_get_softc(dev); @@ -427,17 +424,18 @@ ds13rtc_settime(device_t dev, struct timespec *ts) ts->tv_sec -= utc_offset(); /* If the chip counts time in binary, store tv_sec and we're done. */ - if (sc->flags & SC_F_BINARY) + if (sc->is_binary_counter) return (write_timeword(sc, ts->tv_sec)); clock_ts_to_ct(ts, &ct); /* If the chip is in AMPM mode deal with the PM flag. */ - pmflag = 0; - if (sc->flags & SC_F_AMPM) { + pmflags = 0; + if (sc->use_ampm) { + pmflags = DS13xx_B_HOUR_AMPM; if (ct.hour >= 12) { ct.hour -= 12; - pmflag = DS13xx_B_HOUR_PM; + pmflags |= DS13xx_B_HOUR_PM; } if (ct.hour == 0) ct.hour = 12; @@ -445,14 +443,14 @@ ds13rtc_settime(device_t dev, struct timespec *ts) /* If the chip has a century bit, set it as needed. */ cflag = 0; - if (sc->flags & SC_F_CENTURY) { + if (sc->use_century) { if (ct.year >= 2000) cflag |= DS13xx_B_MONTH_CENTURY; } tregs.sec = TOBCD(ct.sec); tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflag; + tregs.hour = TOBCD(ct.hour) | pmflags; tregs.day = TOBCD(ct.day); tregs.month = TOBCD(ct.mon) | cflag; tregs.year = TOBCD(ct.year % 100); @@ -572,7 +570,7 @@ ds13rtc_attach(device_t dev) case TYPE_DS1342: case TYPE_DS1375: sc->osfaddr = DS133x_R_STATUS; - sc->flags |= SC_F_CENTURY; + sc->use_century = true; break; case TYPE_DS1340: sc->osfaddr = DS1340_R_STATUS; @@ -581,7 +579,7 @@ ds13rtc_attach(device_t dev) case TYPE_DS1372: case TYPE_DS1374: sc->osfaddr = DS137x_R_STATUS; - sc->flags |= SC_F_BINARY; + sc->is_binary_counter = true; break; case TYPE_DS1388: sc->osfaddr = DS1388_R_STATUS; From owner-svn-src-all@freebsd.org Sat Mar 24 20:40:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FE35F6DF32; Sat, 24 Mar 2018 20:40:17 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E19B27DCE8; Sat, 24 Mar 2018 20:40:16 +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 D8029143E5; Sat, 24 Mar 2018 20:40:16 +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 w2OKeGia048047; Sat, 24 Mar 2018 20:40:16 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OKeG3W048040; Sat, 24 Mar 2018 20:40:16 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242040.w2OKeG3W048040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 20:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331496 - in stable/11/sys: dev/iicbus kern sys x86/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: dev/iicbus kern sys x86/isa X-SVN-Commit-Revision: 331496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 20:40:17 -0000 Author: ian Date: Sat Mar 24 20:40:16 2018 New Revision: 331496 URL: https://svnweb.freebsd.org/changeset/base/331496 Log: MFC r306288, r314936, r325527, r327971, r328005, r328039, r328068-r328069, r328301-r328303 r306288: Fix ds1307 probing 'compat' can never be NULL, because the compatible check loop ends when compat->ocd_str is NULL. This causes ds1307 to attach to any unclaimed i2c device. r314936: Validate values read from the RTC before trying BCD decoding Submitted by: cem Reported by: Michael Gmelin Tested by: Oleksandr Tymoshenko Sponsored by: Dell EMC r325527: DS1307: Add the mcp7941x enable bit Summary: Existing code recognizes the mcp7941x RTC, but this RTC has an enable bit at the same location as the "Clock Halt" bit on the ds1307, with an opposite assertion (set == on, whereas CH set == clock stopped). Thus the current code halts the clock, with no way to enable it. Reviewed By: ian Differential Revision: https://reviews.freebsd.org/D12961 r327971: Add RTC clock conversions for BCD values, with non-panic validation. RTC clock hardware frequently uses BCD numbers. Currently the low-level bcd2bin() and bin2bcd() functions will KASSERT if given out-of-range BCD values. Every RTC driver must implement its own code for validating the unreliable data coming from the hardware to avoid a potential kernel panic. This change introduces two new functions, clock_bcd_to_ts() and clock_ts_to_bcd(). The former validates its inputs and returns EINVAL if any values are out of range. The latter guarantees the returned data will be valid BCD in a known format (4-digit years, etc). A new bcd_clocktime structure is used with the new functions. It is similar to the original clocktime structure, but defines the fields holding BCD values as uint8_t (uint16_t for year), and adds a PM flag for handling hours using AM/PM mode. PR: 224813 Differential Revision: https://reviews.freebsd.org/D13730 (no reviewers) r328005: Convert the x86 RTC driver to use new validated BCD<->timespec conversions. New common routines were added to kern/subr_clock.c for converting between calendrical time expressed in BCD and struct timespec. The new functions return EINVAL on error, as expected when the clock hardware does not provide valid time. PR: 224813 Differential Revision: https://reviews.freebsd.org/D13731 (no reviewers) r328039: Add static inline rtcin_locked() and rtcout_locked() functions for doing a related series of operations without doing a lock/unlock for each byte. Use them when reading and writing the entire set of time registers. The original rtcin() and writertc() functions which do lock/unlock on each byte still exist, because they are public and called by outside code. r328068: Move some code around and rename a couple variables; no functional changes. The static atrtc_set() function was called only from clock_settime(), so just move its contents entirely into clock_settime() and delete atrtc_set(). Rename the struct bcd_clocktime variables from 'ct' to 'bct'. I had originally wanted to emphasize how identical the clocktime and bcd_clocktime structs were, but things evolved to the point where the structs are not at all identical anymore, so now emphasizing the difference seems better. r328069: Remove redundant critical_enter/exit() calls. The block of code delimited by these calls is now protected by a spin mutex (obscured within the RTC_LOCK/RTC_UNLOCK macros). Reported by: bde@ r328301: Switch to using the bcd_clocktime conversion functinos that validate the BCD data without panicking, and have common code for handling AM/PM mode. r328302: Switch to using the bcd_clocktime conversion functions that validate the BCD data without panicking, and have common code for handling AM/PM mode. r328303: Switch to using the bcd_clocktime conversion functions that validate the BCD data without panicking, and have common code for handling AM/PM mode. Modified: stable/11/sys/dev/iicbus/ds1307.c stable/11/sys/dev/iicbus/ds1307reg.h stable/11/sys/dev/iicbus/ds13rtc.c stable/11/sys/dev/iicbus/nxprtc.c stable/11/sys/kern/subr_clock.c stable/11/sys/sys/clock.h stable/11/sys/x86/isa/atrtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/ds1307.c ============================================================================== --- stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 20:40:16 2018 (r331496) @@ -217,7 +217,7 @@ ds1307_probe(device_t dev) compat = ofw_bus_search_compatible(dev, ds1307_compat_data); - if (compat == NULL) + if (compat->ocd_str == NULL) return (ENXIO); device_set_desc(dev, (const char *)compat->ocd_data); @@ -272,6 +272,7 @@ ds1307_start(void *xdev) struct sysctl_oid *tree_node; struct sysctl_oid_list *tree; uint8_t secs; + uint8_t osc_en; dev = (device_t)xdev; sc = device_get_softc(dev); @@ -286,7 +287,12 @@ ds1307_start(void *xdev) device_printf(sc->sc_dev, "cannot read from RTC.\n"); return; } - if ((secs & DS1307_SECS_CH) != 0) { + if (sc->sc_mcp7941x) + osc_en = 0x80; + else + osc_en = 0x00; + + if (((secs & DS1307_SECS_CH) ^ osc_en) != 0) { device_printf(sc->sc_dev, "WARNING: RTC clock stopped, check the battery.\n"); } @@ -316,9 +322,9 @@ static int ds1307_gettime(device_t dev, struct timespec *ts) { int error; - struct clocktime ct; + struct bcd_clocktime bct; struct ds1307_softc *sc; - uint8_t data[7], hourmask; + uint8_t data[7], hourmask, st_mask; sc = device_get_softc(dev); error = iicdev_readfrom(sc->sc_dev, DS1307_SECS, data, sizeof(data), @@ -329,7 +335,12 @@ ds1307_gettime(device_t dev, struct timespec *ts) } /* If the clock halted, we don't have good data. */ - if (data[DS1307_SECS] & DS1307_SECS_CH) + if (sc->sc_mcp7941x) + st_mask = 0x80; + else + st_mask = 0x00; + + if (((data[DS1307_SECS] & DS1307_SECS_CH) ^ st_mask) != 0) return (EINVAL); /* If chip is in AM/PM mode remember that. */ @@ -339,30 +350,24 @@ ds1307_gettime(device_t dev, struct timespec *ts) } else hourmask = DS1307_HOUR_MASK_24HR; - ct.nsec = 0; - ct.sec = FROMBCD(data[DS1307_SECS] & DS1307_SECS_MASK); - ct.min = FROMBCD(data[DS1307_MINS] & DS1307_MINS_MASK); - ct.hour = FROMBCD(data[DS1307_HOUR] & hourmask); - ct.day = FROMBCD(data[DS1307_DATE] & DS1307_DATE_MASK); - ct.mon = FROMBCD(data[DS1307_MONTH] & DS1307_MONTH_MASK); - ct.year = FROMBCD(data[DS1307_YEAR] & DS1307_YEAR_MASK); + bct.nsec = 0; + bct.ispm = (data[DS1307_HOUR] & DS1307_HOUR_IS_PM) != 0; + bct.sec = data[DS1307_SECS] & DS1307_SECS_MASK; + bct.min = data[DS1307_MINS] & DS1307_MINS_MASK; + bct.hour = data[DS1307_HOUR] & hourmask; + bct.day = data[DS1307_DATE] & DS1307_DATE_MASK; + bct.mon = data[DS1307_MONTH] & DS1307_MONTH_MASK; + bct.year = data[DS1307_YEAR] & DS1307_YEAR_MASK; - if (sc->sc_use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (data[DS1307_HOUR] & DS1307_HOUR_IS_PM) - ct.hour += 12; - } - - return (clock_ct_to_ts(&ct, ts)); + return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm)); } static int ds1307_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct ds1307_softc *sc; - int error; + int error, year; uint8_t data[7]; uint8_t pmflags; @@ -373,27 +378,30 @@ ds1307_settime(device_t dev, struct timespec *ts) * disables utc adjustment, so apply that ourselves. */ ts->tv_sec -= utc_offset(); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm); /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ if (sc->sc_use_ampm) { pmflags = DS1307_HOUR_USE_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS1307_HOUR_IS_PM; - } - if (ct.hour == 0) - ct.hour = 12; } else pmflags = 0; - data[DS1307_SECS] = TOBCD(ct.sec); - data[DS1307_MINS] = TOBCD(ct.min); - data[DS1307_HOUR] = TOBCD(ct.hour) | pmflags; - data[DS1307_DATE] = TOBCD(ct.day); - data[DS1307_WEEKDAY] = ct.dow; - data[DS1307_MONTH] = TOBCD(ct.mon); - data[DS1307_YEAR] = TOBCD(ct.year % 100); + data[DS1307_SECS] = bct.sec; + data[DS1307_MINS] = bct.min; + data[DS1307_HOUR] = bct.hour | pmflags; + data[DS1307_DATE] = bct.day; + data[DS1307_WEEKDAY] = bct.dow; + data[DS1307_MONTH] = bct.mon; + data[DS1307_YEAR] = bct.year & 0xff; + if (sc->sc_mcp7941x) { + data[DS1307_SECS] |= MCP7941X_SECS_ST; + data[DS1307_WEEKDAY] |= MCP7941X_WEEKDAY_VBATEN; + year = bcd2bin(bct.year >> 8) * 100 + bcd2bin(bct.year & 0xff); + if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) + data[DS1307_MONTH] |= MCP7941X_MONTH_LPYR; + } /* Write the time back to RTC. */ error = iicdev_writeto(sc->sc_dev, DS1307_SECS, data, sizeof(data), IIC_INTRWAIT); Modified: stable/11/sys/dev/iicbus/ds1307reg.h ============================================================================== --- stable/11/sys/dev/iicbus/ds1307reg.h Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/ds1307reg.h Sat Mar 24 20:40:16 2018 (r331496) @@ -36,6 +36,7 @@ #define DS1307_SECS 0x00 #define DS1307_SECS_MASK 0x7f #define DS1307_SECS_CH 0x80 +#define MCP7941X_SECS_ST 0x80 #define DS1307_MINS 0x01 #define DS1307_MINS_MASK 0x7f #define DS1307_HOUR 0x02 @@ -44,10 +45,12 @@ #define DS1307_HOUR_IS_PM 0x20 #define DS1307_HOUR_USE_AMPM 0x40 #define DS1307_WEEKDAY 0x03 +#define MCP7941X_WEEKDAY_VBATEN 0x08 #define DS1307_WEEKDAY_MASK 0x07 #define DS1307_DATE 0x04 #define DS1307_DATE_MASK 0x3f #define DS1307_MONTH 0x05 +#define MCP7941X_MONTH_LPYR 0x20 #define DS1307_MONTH_MASK 0x1f #define DS1307_YEAR 0x06 #define DS1307_YEAR_MASK 0xff Modified: stable/11/sys/dev/iicbus/ds13rtc.c ============================================================================== --- stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 20:40:16 2018 (r331496) @@ -345,7 +345,7 @@ ds13rtc_start(void *arg) static int ds13rtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct ds13rtc_softc *sc; int err; @@ -379,29 +379,23 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) else hourmask = DS13xx_M_24HOUR; - ct.sec = FROMBCD(tregs.sec & DS13xx_M_SECOND); - ct.min = FROMBCD(tregs.min & DS13xx_M_MINUTE); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day & DS13xx_M_DAY); - ct.mon = FROMBCD(tregs.month & DS13xx_M_MONTH); - ct.year = FROMBCD(tregs.year & DS13xx_M_YEAR); - ct.nsec = 0; + bct.nsec = 0; + bct.ispm = tregs.hour & DS13xx_B_HOUR_PM; + bct.sec = tregs.sec & DS13xx_M_SECOND; + bct.min = tregs.min & DS13xx_M_MINUTE; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day & DS13xx_M_DAY; + bct.mon = tregs.month & DS13xx_M_MONTH; + bct.year = tregs.year & DS13xx_M_YEAR; - if (sc->use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & DS13xx_B_HOUR_PM) - ct.hour += 12; - } - /* * If this chip has a century bit, honor it. Otherwise let * clock_ct_to_ts() infer the century from the 2-digit year. */ if (sc->use_century) - ct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 2000 : 1900; + bct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 0x100 : 0; - err = clock_ct_to_ts(&ct, ts); + err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); return (err); } @@ -409,7 +403,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) static int ds13rtc_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct ds13rtc_softc *sc; int err; @@ -427,34 +421,30 @@ ds13rtc_settime(device_t dev, struct timespec *ts) if (sc->is_binary_counter) return (write_timeword(sc, ts->tv_sec)); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); /* If the chip is in AMPM mode deal with the PM flag. */ pmflags = 0; if (sc->use_ampm) { pmflags = DS13xx_B_HOUR_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS13xx_B_HOUR_PM; - } - if (ct.hour == 0) - ct.hour = 12; } /* If the chip has a century bit, set it as needed. */ cflag = 0; if (sc->use_century) { - if (ct.year >= 2000) + if (bct.year >= 2000) cflag |= DS13xx_B_MONTH_CENTURY; } - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflags; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon) | cflag; - tregs.year = TOBCD(ct.year % 100); - tregs.wday = ct.dow; + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | pmflags; + tregs.day = bct.day; + tregs.month = bct.mon | cflag; + tregs.year = bct.year & 0xff; + tregs.wday = bct.dow; /* * Set the time. Reset the OSF bit if it is on and it is not part of Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 20:40:16 2018 (r331496) @@ -192,10 +192,10 @@ struct nxprtc_softc { uint8_t secaddr; /* Address of seconds register */ uint8_t tmcaddr; /* Address of timer count register */ bool use_timer; /* Use timer for fractional sec */ + bool use_ampm; /* Chip is set to use am/pm mode */ }; #define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ -#define SC_F_AMPM (1 << 1) /* Use PM flag in hours reg */ /* * We use the compat_data table to look up hint strings in the non-FDT case, so @@ -382,10 +382,10 @@ pcf8523_start(struct nxprtc_softc *sc) /* Remember whether we're running in AM/PM mode. */ if (is2129) { if (cs1 & PCF2129_B_CS1_12HR) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } else { if (cs1 & PCF8523_B_CS1_12HR) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } return (0); @@ -543,7 +543,7 @@ nxprtc_start(void *dev) static int nxprtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct nxprtc_softc *sc; int err; @@ -570,21 +570,19 @@ nxprtc_gettime(device_t dev, struct timespec *ts) return (EINVAL); /* hardware is good, time is not. */ } - if (sc->flags & SC_F_AMPM) + if (sc->use_ampm) hourmask = PCF85xx_M_12HOUR; else hourmask = PCF85xx_M_24HOUR; - ct.nsec = ((uint64_t)tmrcount * 1000000000) / TMR_TICKS_SEC; - ct.sec = FROMBCD(tregs.sec & PCF85xx_M_SECOND); - ct.min = FROMBCD(tregs.min & PCF85xx_M_MINUTE); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day & PCF85xx_M_DAY); - ct.mon = FROMBCD(tregs.month & PCF85xx_M_MONTH); - ct.year = FROMBCD(tregs.year & PCF85xx_M_YEAR); - ct.year += 1900; - if (ct.year < POSIX_BASE_YEAR) - ct.year += 100; /* assume [1970, 2069] */ + bct.nsec = ((uint64_t)tmrcount * 1000000000) / TMR_TICKS_SEC; + bct.ispm = (tregs.hour & PCF8523_B_HOUR_PM) != 0; + bct.sec = tregs.sec & PCF85xx_M_SECOND; + bct.min = tregs.min & PCF85xx_M_MINUTE; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day & PCF85xx_M_DAY; + bct.mon = tregs.month & PCF85xx_M_MONTH; + bct.year = tregs.year & PCF85xx_M_YEAR; /* * Old PCF8563 datasheets recommended that the C bit be 1 for 19xx and 0 @@ -594,21 +592,13 @@ nxprtc_gettime(device_t dev, struct timespec *ts) */ if (sc->chiptype == TYPE_PCF8563) { if (tregs.month & PCF8563_B_MONTH_C) { - if (ct.year >= 2000) + if (bct.year < 0x70) sc->flags |= SC_F_CPOL; - } else if (ct.year < 2000) + } else if (bct.year >= 0x70) sc->flags |= SC_F_CPOL; } - /* If this chip is running in 12-hour/AMPM mode, deal with it. */ - if (sc->flags & SC_F_AMPM) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & PCF8523_B_HOUR_PM) - ct.hour += 12; - } - - err = clock_ct_to_ts(&ct, ts); + err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); ts->tv_sec += utc_offset(); return (err); @@ -617,11 +607,11 @@ nxprtc_gettime(device_t dev, struct timespec *ts) static int nxprtc_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct nxprtc_softc *sc; int err; - uint8_t cflag, cs1, pmflag; + uint8_t cflag, cs1; sc = device_get_softc(dev); @@ -647,36 +637,25 @@ nxprtc_settime(device_t dev, struct timespec *ts) getnanotime(ts); ts->tv_sec -= utc_offset(); ts->tv_nsec = 0; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); - /* If the chip is in AMPM mode deal with the PM flag. */ - pmflag = 0; - if (sc->flags & SC_F_AMPM) { - if (ct.hour >= 12) { - ct.hour -= 12; - pmflag = PCF8523_B_HOUR_PM; - } - if (ct.hour == 0) - ct.hour = 12; - } - /* On 8563 set the century based on the polarity seen when reading. */ cflag = 0; if (sc->chiptype == TYPE_PCF8563) { if ((sc->flags & SC_F_CPOL) != 0) { - if (ct.year >= 2000) + if (bct.year >= 0x2000) cflag = PCF8563_B_MONTH_C; - } else if (ct.year < 2000) + } else if (bct.year < 0x2000) cflag = PCF8563_B_MONTH_C; } - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflag; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon); - tregs.year = TOBCD(ct.year % 100) | cflag; - tregs.wday = ct.dow; + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | (bct.ispm ? PCF8523_B_HOUR_PM : 0); + tregs.day = bct.day; + tregs.month = bct.mon; + tregs.year = (bct.year & 0xff) | cflag; + tregs.wday = bct.dow; /* * Set the time, reset the timer count register, then start the clocks. Modified: stable/11/sys/kern/subr_clock.c ============================================================================== --- stable/11/sys/kern/subr_clock.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/kern/subr_clock.c Sat Mar 24 20:40:16 2018 (r331496) @@ -199,6 +199,55 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * return (0); } +int +clock_bcd_to_ts(struct bcd_clocktime *bct, struct timespec *ts, bool ampm) +{ + struct clocktime ct; + int bcent, byear; + + /* + * Year may come in as 2-digit or 4-digit BCD. Split the value into + * separate BCD century and year values for validation and conversion. + */ + bcent = bct->year >> 8; + byear = bct->year & 0xff; + + /* + * Ensure that all values are valid BCD numbers, to avoid assertions in + * the BCD-to-binary conversion routines. clock_ct_to_ts() will further + * validate the field ranges (such as 0 <= min <= 59) during conversion. + */ + if (!validbcd(bcent) || !validbcd(byear) || !validbcd(bct->mon) || + !validbcd(bct->day) || !validbcd(bct->hour) || + !validbcd(bct->min) || !validbcd(bct->sec)) { + if (ct_debug) + printf("clock_bcd_to_ts: bad BCD: " + "[%04x-%02x-%02x %02x:%02x:%02x]\n", + bct->year, bct->mon, bct->day, + bct->hour, bct->min, bct->sec); + return (EINVAL); + } + + ct.year = FROMBCD(byear) + FROMBCD(bcent) * 100; + ct.mon = FROMBCD(bct->mon); + ct.day = FROMBCD(bct->day); + ct.hour = FROMBCD(bct->hour); + ct.min = FROMBCD(bct->min); + ct.sec = FROMBCD(bct->sec); + ct.dow = bct->dow; + ct.nsec = bct->nsec; + + /* If asked to handle am/pm, convert from 12hr+pmflag to 24hr. */ + if (ampm) { + if (ct.hour == 12) + ct.hour = 0; + if (bct->ispm) + ct.hour += 12; + } + + return (clock_ct_to_ts(&ct, ts)); +} + void clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) { @@ -244,6 +293,34 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * print_ct(ct); printf("\n"); } +} + +void +clock_ts_to_bcd(struct timespec *ts, struct bcd_clocktime *bct, bool ampm) +{ + struct clocktime ct; + + clock_ts_to_ct(ts, &ct); + + /* If asked to handle am/pm, convert from 24hr to 12hr+pmflag. */ + bct->ispm = false; + if (ampm) { + if (ct.hour >= 12) { + ct.hour -= 12; + bct->ispm = true; + } + if (ct.hour == 0) + ct.hour = 12; + } + + bct->year = TOBCD(ct.year % 100) | (TOBCD(ct.year / 100) << 8); + bct->mon = TOBCD(ct.mon); + bct->day = TOBCD(ct.day); + bct->hour = TOBCD(ct.hour); + bct->min = TOBCD(ct.min); + bct->sec = TOBCD(ct.sec); + bct->dow = ct.dow; + bct->nsec = ct.nsec; } int Modified: stable/11/sys/sys/clock.h ============================================================================== --- stable/11/sys/sys/clock.h Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/sys/clock.h Sat Mar 24 20:40:16 2018 (r331496) @@ -60,9 +60,22 @@ extern int tz_dsttime; int utc_offset(void); /* - * Structure to hold the values typically reported by time-of-day clocks. - * This can be passed to the generic conversion functions to be converted - * to a struct timespec. + * Structure to hold the values typically reported by time-of-day clocks, + * expressed as binary integers (see below for a BCD version). This can be + * passed to the conversion functions to be converted to/from a struct timespec. + * + * On input, the year is interpreted as follows: + * 0 - 69 = 2000 - 2069 + * 70 - 99 = 1970 - 1999 + * 100 - 199 = 2000 - 2099 (Supports hardware "century bit".) + * 200 - 1969 = Invalid. + * 1970 - 9999 = Full 4-digit century+year. + * + * The dow field is ignored (not even validated) on input, but is always + * populated with day-of-week on output. + * + * clock_ct_to_ts() returns EINVAL if any values are out of range. The year + * field will always be 4-digit on output. */ struct clocktime { int year; /* year (4 digit year) */ @@ -77,6 +90,43 @@ struct clocktime { int clock_ct_to_ts(struct clocktime *, struct timespec *); void clock_ts_to_ct(struct timespec *, struct clocktime *); + +/* + * Structure to hold the values typically reported by time-of-day clocks, + * expressed as BCD. This can be passed to the conversion functions to be + * converted to/from a struct timespec. + * + * The clock_bcd_to_ts() function interprets the values in the year through sec + * fields as BCD numbers, and returns EINVAL if any BCD values are out of range. + * After conversion to binary, the values are passed to clock_ct_to_ts() and + * undergo further validation as described above. Year may be 2 or 4-digit BCD, + * interpreted as described above. The nsec field is binary. If the ampm arg + * is true, the incoming hour and ispm values are interpreted as 12-hour am/pm + * representation of the hour, otherwise hour is interpreted as 24-hour and ispm + * is ignored. + * + * The clock_ts_to_bcd() function converts the timespec to BCD values stored + * into year through sec. The value in year will be 4-digit BCD (e.g., + * 0x2017). The mon through sec values will be 2-digit BCD. The nsec field will + * be binary, and the range of dow makes its binary and BCD values identical. + * If the ampm arg is true, the hour and ispm fields are set to the 12-hour + * time plus a pm flag, otherwise the hour is set to 24-hour time and ispm is + * set to false. + */ +struct bcd_clocktime { + uint16_t year; /* year (2 or 4 digit year) */ + uint8_t mon; /* month (1 - 12) */ + uint8_t day; /* day (1 - 31) */ + uint8_t hour; /* hour (0 - 23 or 1 - 12) */ + uint8_t min; /* minute (0 - 59) */ + uint8_t sec; /* second (0 - 59) */ + uint8_t dow; /* day of week (0 - 6; 0 = Sunday) */ + long nsec; /* nanoseconds */ + bool ispm; /* true if hour represents pm time */ +}; + +int clock_bcd_to_ts(struct bcd_clocktime *, struct timespec *, bool ampm); +void clock_ts_to_bcd(struct timespec *, struct bcd_clocktime *, bool ampm); /* * Time-of-day clock functions and flags. These functions might sleep. Modified: stable/11/sys/x86/isa/atrtc.c ============================================================================== --- stable/11/sys/x86/isa/atrtc.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/x86/isa/atrtc.c Sat Mar 24 20:40:16 2018 (r331496) @@ -74,28 +74,23 @@ static u_char rtc_statusb = RTCSB_24HR; * RTC support routines */ -int -rtcin(int reg) +static inline u_char +rtcin_locked(int reg) { - u_char val; - RTC_LOCK; if (rtc_reg != reg) { inb(0x84); outb(IO_RTC, reg); rtc_reg = reg; inb(0x84); } - val = inb(IO_RTC + 1); - RTC_UNLOCK; - return (val); + return (inb(IO_RTC + 1)); } -void -writertc(int reg, u_char val) +static inline void +rtcout_locked(int reg, u_char val) { - RTC_LOCK; if (rtc_reg != reg) { inb(0x84); outb(IO_RTC, reg); @@ -104,13 +99,26 @@ writertc(int reg, u_char val) } outb(IO_RTC + 1, val); inb(0x84); +} + +int +rtcin(int reg) +{ + u_char val; + + RTC_LOCK; + val = rtcin_locked(reg); RTC_UNLOCK; + return (val); } -static __inline int -readrtc(int port) +void +writertc(int reg, u_char val) { - return(bcd2bin(rtcin(port))); + + RTC_LOCK; + rtcout_locked(reg, val); + RTC_UNLOCK; } static void @@ -159,37 +167,6 @@ atrtc_restore(void) rtcin(RTC_INTR); } -static void -atrtc_set(struct timespec *ts) -{ - struct clocktime ct; - - clock_ts_to_ct(ts, &ct); - - mtx_lock(&atrtc_time_lock); - - /* Disable RTC updates and interrupts. */ - writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); - - writertc(RTC_SEC, bin2bcd(ct.sec)); /* Write back Seconds */ - writertc(RTC_MIN, bin2bcd(ct.min)); /* Write back Minutes */ - writertc(RTC_HRS, bin2bcd(ct.hour)); /* Write back Hours */ - - writertc(RTC_WDAY, ct.dow + 1); /* Write back Weekday */ - writertc(RTC_DAY, bin2bcd(ct.day)); /* Write back Day */ - writertc(RTC_MONTH, bin2bcd(ct.mon)); /* Write back Month */ - writertc(RTC_YEAR, bin2bcd(ct.year % 100)); /* Write back Year */ -#ifdef USE_RTC_CENTURY - writertc(RTC_CENTURY, bin2bcd(ct.year / 100)); /* ... and Century */ -#endif - - /* Re-enable RTC updates and interrupts. */ - writertc(RTC_STATUSB, rtc_statusb); - rtcin(RTC_INTR); - - mtx_unlock(&atrtc_time_lock); -} - /********************************************************************** * RTC driver for subr_rtc */ @@ -336,15 +313,44 @@ atrtc_resume(device_t dev) static int atrtc_settime(device_t dev __unused, struct timespec *ts) { + struct bcd_clocktime bct; - atrtc_set(ts); + clock_ts_to_bcd(ts, &bct, false); + + mtx_lock(&atrtc_time_lock); + RTC_LOCK; + + /* Disable RTC updates and interrupts. */ + rtcout_locked(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); + + /* Write all the time registers. */ + rtcout_locked(RTC_SEC, bct.sec); + rtcout_locked(RTC_MIN, bct.min); + rtcout_locked(RTC_HRS, bct.hour); + rtcout_locked(RTC_WDAY, bct.dow + 1); + rtcout_locked(RTC_DAY, bct.day); + rtcout_locked(RTC_MONTH, bct.mon); + rtcout_locked(RTC_YEAR, bct.year & 0xff); +#ifdef USE_RTC_CENTURY + rtcout_locked(RTC_CENTURY, bct.year >> 8); +#endif + + /* + * Re-enable RTC updates and interrupts. + */ + rtcout_locked(RTC_STATUSB, rtc_statusb); + rtcin_locked(RTC_INTR); + + RTC_UNLOCK; + mtx_unlock(&atrtc_time_lock); + return (0); } static int atrtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; /* Look if we have a RTC present and the time is valid */ if (!(rtcin(RTC_STATUSD) & RTCSD_PWR)) { @@ -362,25 +368,22 @@ atrtc_gettime(device_t dev, struct timespec *ts) mtx_lock(&atrtc_time_lock); while (rtcin(RTC_STATUSA) & RTCSA_TUP) continue; - critical_enter(); - ct.nsec = 0; - ct.sec = readrtc(RTC_SEC); - ct.min = readrtc(RTC_MIN); - ct.hour = readrtc(RTC_HRS); - ct.day = readrtc(RTC_DAY); - ct.dow = readrtc(RTC_WDAY) - 1; - ct.mon = readrtc(RTC_MONTH); - ct.year = readrtc(RTC_YEAR); + RTC_LOCK; + bct.sec = rtcin_locked(RTC_SEC); + bct.min = rtcin_locked(RTC_MIN); + bct.hour = rtcin_locked(RTC_HRS); + bct.day = rtcin_locked(RTC_DAY); + bct.mon = rtcin_locked(RTC_MONTH); + bct.year = rtcin_locked(RTC_YEAR); #ifdef USE_RTC_CENTURY - ct.year += readrtc(RTC_CENTURY) * 100; -#else - ct.year += (ct.year < 80 ? 2000 : 1900); + bct.year |= rtcin_locked(RTC_CENTURY) << 8; #endif - critical_exit(); + RTC_UNLOCK; mtx_unlock(&atrtc_time_lock); - /* Set dow = -1 because some clocks don't set it correctly. */ - ct.dow = -1; - return (clock_ct_to_ts(&ct, ts)); + /* dow is unused in timespec conversion and we have no nsec info. */ + bct.dow = 0; + bct.nsec = 0; + return (clock_bcd_to_ts(&bct, ts, false)); } static device_method_t atrtc_methods[] = { From owner-svn-src-all@freebsd.org Sat Mar 24 21:22:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F246F4A476; Sat, 24 Mar 2018 21:22:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10D8B8069F; Sat, 24 Mar 2018 21:22:29 +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 0BCF614C28; Sat, 24 Mar 2018 21:22:29 +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 w2OLMSsx076297; Sat, 24 Mar 2018 21:22:28 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLMSF8076293; Sat, 24 Mar 2018 21:22:28 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242122.w2OLMSF8076293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 21:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331497 - stable/11/sys/dev/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/iicbus X-SVN-Commit-Revision: 331497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 21:22:29 -0000 Author: ian Date: Sat Mar 24 21:22:28 2018 New Revision: 331497 URL: https://svnweb.freebsd.org/changeset/base/331497 Log: MFC r328307, r328311-r328312 r328307: Fix a bug introduced with recursive bus ownership support in r321584. The recursive ownership support added in r321584 was unconditionally in effect all the time -- whenever a given i2c slave device instance tried to lock the i2c bus for exclusive use when it already owned the bus, the call returned immediately without waiting. However, many i2c slave drivers use bus ownership to enforce that only a single thread at a time can be using the slave device. The recursive locking changes broke this use case. Now there is a new flag, IIC_RECURSIVE, which can be mixed in with the other flags passed to iicbus_acquire_bus() to allow drivers to indicate when recursive locking is desired. Using the flag implies that the driver is managing concurrent access to the device by different threads in some way. This immediately fixes all existing i2c slave drivers except for the two i2c RTC drivers which use the recursive locking feature; those will be fixed in a followup commit. r328311 and r328312: Follow changes in r328307 by using new IIC_RECURSIVE flag. The driver now ensures only one thread at a time is running in the API functions (clock_gettime() and clock_settime()) by specifically requesting ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO using IIC_RECURSIVE so that each individual IO operation doesn't try to re-acquire the bus. The other IO done by the driver happens at attach or intr_config_hooks time, when there can't be multiple threads running with the same device instance. So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO done by the driver, because it's all either done in a single-threaded environment, or protected within a block bounded by explict iicbus_acquire_bus() and iicbus_release_bus() calls. Modified: stable/11/sys/dev/iicbus/iiconf.c stable/11/sys/dev/iicbus/iiconf.h stable/11/sys/dev/iicbus/isl12xx.c stable/11/sys/dev/iicbus/nxprtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/11/sys/dev/iicbus/iiconf.c Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/iiconf.c Sat Mar 24 21:22:28 2018 (r331497) @@ -84,7 +84,7 @@ iicbus_poll(struct iicbus_softc *sc, int how) int error; IICBUS_ASSERT_LOCKED(sc); - switch (how) { + switch (how & IIC_INTRWAIT) { case IIC_WAIT | IIC_INTR: error = mtx_sleep(sc, &sc->lock, IICPRI|PCATCH, "iicreq", 0); break; @@ -115,8 +115,14 @@ iicbus_request_bus(device_t bus, device_t dev, int how IICBUS_LOCK(sc); - while (error == 0 && sc->owner != NULL && sc->owner != dev) - error = iicbus_poll(sc, how); + for (;;) { + if (sc->owner == NULL) + break; + if ((how & IIC_RECURSIVE) && sc->owner == dev) + break; + if ((error = iicbus_poll(sc, how)) != 0) + break; + } if (error == 0) { ++sc->owncount; Modified: stable/11/sys/dev/iicbus/iiconf.h ============================================================================== --- stable/11/sys/dev/iicbus/iiconf.h Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/iiconf.h Sat Mar 24 21:22:28 2018 (r331497) @@ -39,13 +39,14 @@ #define LSB 0x1 /* - * How tsleep() is called in iic_request_bus(). + * Options affecting iicbus_request_bus() */ #define IIC_DONTWAIT 0 #define IIC_NOINTR 0 #define IIC_WAIT 0x1 #define IIC_INTR 0x2 #define IIC_INTRWAIT (IIC_INTR | IIC_WAIT) +#define IIC_RECURSIVE 0x4 /* * i2c modes Modified: stable/11/sys/dev/iicbus/isl12xx.c ============================================================================== --- stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 21:22:28 2018 (r331497) @@ -137,18 +137,27 @@ static struct ofw_compat_data compat_data[] = { }; #endif +/* + * When doing i2c IO, indicate that we need to wait for exclusive bus ownership, + * but that we should not wait if we already own the bus. This lets us put + * iicbus_acquire_bus() calls with a non-recursive wait at the entry of our API + * functions to ensure that only one client at a time accesses the hardware for + * the entire series of operations it takes to read or write the clock. + */ +#define WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) + static inline int isl12xx_read1(struct isl12xx_softc *sc, uint8_t reg, uint8_t *data) { - return (iicdev_readfrom(sc->dev, reg, data, 1, IIC_WAIT)); + return (iicdev_readfrom(sc->dev, reg, data, 1, WAITFLAGS)); } static inline int isl12xx_write1(struct isl12xx_softc *sc, uint8_t reg, uint8_t val) { - return (iicdev_writeto(sc->dev, reg, &val, 1, IIC_WAIT)); + return (iicdev_writeto(sc->dev, reg, &val, 1, WAITFLAGS)); } static void @@ -229,17 +238,23 @@ isl12xx_gettime(device_t dev, struct timespec *ts) int err; uint8_t hourmask, sreg; - /* If power failed, we can't provide valid time. */ - if ((err = isl12xx_read1(sc, ISL12XX_SR_REG, &sreg)) != 0) + /* + * Read the status and time registers. + */ + if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) == 0) { + if ((err = isl12xx_read1(sc, ISL12XX_SR_REG, &sreg)) == 0) { + err = iicdev_readfrom(sc->dev, ISL12XX_SC_REG, &tregs, + sizeof(tregs), WAITFLAGS); + } + iicbus_release_bus(sc->busdev, sc->dev); + } + if (err != 0) return (err); + + /* If power failed, we can't provide valid time. */ if (sreg & ISL12XX_SR_RTCF) return (EINVAL); - /* Read the bcd time registers. */ - if ((err = iicdev_readfrom(sc->dev, ISL12XX_SC_REG, &tregs, sizeof(tregs), - IIC_WAIT)) != 0) - return (EINVAL); - /* If chip is in AM/PM mode remember that for when we set time. */ if (tregs.hour & ISL12XX_24HR_FLAG) { hourmask = ISL12xx_24HR_MASK; @@ -319,7 +334,7 @@ isl12xx_settime(device_t dev, struct timespec *ts) sreg |= ISL12XX_SR_WRTC | ISL12XX_SR_W0C_BITS; if ((err = isl12xx_write1(sc, ISL12XX_SR_REG, sreg)) == 0) { err = iicdev_writeto(sc->dev, ISL12XX_SC_REG, &tregs, - sizeof(tregs), IIC_WAIT); + sizeof(tregs), WAITFLAGS); sreg &= ~ISL12XX_SR_WRTC; isl12xx_write1(sc, ISL12XX_SR_REG, sreg); } Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 21:22:28 2018 (r331497) @@ -198,6 +198,15 @@ struct nxprtc_softc { #define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ /* + * When doing i2c IO, indicate that we need to wait for exclusive bus ownership, + * but that we should not wait if we already own the bus. This lets us put + * iicbus_acquire_bus() calls with a non-recursive wait at the entry of our API + * functions to ensure that only one client at a time accesses the hardware for + * the entire series of operations it takes to read or write the clock. + */ +#define WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) + +/* * We use the compat_data table to look up hint strings in the non-FDT case, so * define the struct locally when we don't get it from ofw_bus_subr.h. */ @@ -230,14 +239,14 @@ static int read_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t *val) { - return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), IIC_WAIT)); + return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), WAITFLAGS)); } static int write_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t val) { - return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), IIC_WAIT)); + return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), WAITFLAGS)); } static int @@ -264,7 +273,7 @@ read_timeregs(struct nxprtc_softc *sc, struct time_reg continue; } if ((err = iicdev_readfrom(sc->dev, sc->secaddr, tregs, - sizeof(*tregs), IIC_WAIT)) != 0) + sizeof(*tregs), WAITFLAGS)) != 0) break; } while (sc->use_timer && tregs->sec != sec); @@ -294,7 +303,7 @@ write_timeregs(struct nxprtc_softc *sc, struct time_re { return (iicdev_writeto(sc->dev, sc->secaddr, tregs, - sizeof(*tregs), IIC_WAIT)); + sizeof(*tregs), WAITFLAGS)); } static int @@ -557,14 +566,15 @@ nxprtc_gettime(device_t dev, struct timespec *ts) * bit is not set in the control reg. The latter can happen if there * was an error when setting the time. */ - if ((err = read_timeregs(sc, &tregs, &tmrcount)) != 0) { - device_printf(dev, "cannot read RTC time\n"); - return (err); + if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) == 0) { + if ((err = read_timeregs(sc, &tregs, &tmrcount)) == 0) { + err = read_reg(sc, PCF85xx_R_CS1, &cs1); + } + iicbus_release_bus(sc->busdev, sc->dev); } - if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) { - device_printf(dev, "cannot read RTC time\n"); + if (err != 0) return (err); - } + if ((tregs.sec & PCF85xx_B_SECOND_OS) || (cs1 & PCF85xx_B_CS1_STOP)) { device_printf(dev, "RTC clock not running\n"); return (EINVAL); /* hardware is good, time is not. */ From owner-svn-src-all@freebsd.org Sat Mar 24 21:27:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88C9EF4AA34; Sat, 24 Mar 2018 21:27:11 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3278A8093C; Sat, 24 Mar 2018 21:27:11 +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 29D7114C34; Sat, 24 Mar 2018 21:27:11 +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 w2OLRBOs076519; Sat, 24 Mar 2018 21:27:11 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLRACu076515; Sat, 24 Mar 2018 21:27:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242127.w2OLRACu076515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 21:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331498 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 331498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 21:27:12 -0000 Author: ian Date: Sat Mar 24 21:27:10 2018 New Revision: 331498 URL: https://svnweb.freebsd.org/changeset/base/331498 Log: MFC r328345, r328349, r328405, r328407, r328442 r328345: Reformat indentation to match other imx5/6 register definition headers, and tweak some comments. No functional changes. r328349: Make the trivial imx_soc_family() function an inline in imx_machdep.h. The imx_machdep.c file is on the fast path to non-existance and this would be the only thing left in it after some watchdog changes are completed. r328405: Minor cleanups... Move DRIVER_MODULE() and other boilerplate stuff to the bottom of the file, where it is in most imx5/6 drivers. Switch from an RD2 macro using bus_space_read_2() to an inline function using bus_read_2(); likewise for WR2. Use RESOURCE_SPEC_END to end the resource_spec list. Net effect should be no functional changes. r328407: Fix return style in RD2. Remove bogus return value from a void function in WR2 (I have no idea why that didn't result in a compile error). r328442: Add support to the imx5/6 watchdog for the external reset signal. Also, if the "power down" watchdog used by the ROM boot code is still active when the regular watchdog is activated, turn off the power-down watchdog. This adds support for the "fsl,ext-reset-output" FDT property. When present, that property indicates that a chip reset is accomplished by asserting the WDOG1_B external signal, which is supposed to trigger some external component such as a PMIC to ready the hardware for reset (for example, adjusting voltages from idle to full-power levels), and assert the POR signal to SoC when ready. To guard against misconfiguation leading to a non-rebootable system, the external reset signal is backstopped by code that asserts a normal internal chip reset if nothing responds to the external reset signal within one second. Modified: stable/11/sys/arm/freescale/imx/imx_machdep.c stable/11/sys/arm/freescale/imx/imx_machdep.h stable/11/sys/arm/freescale/imx/imx_wdog.c stable/11/sys/arm/freescale/imx/imx_wdogreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_machdep.c Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_machdep.c Sat Mar 24 21:27:10 2018 (r331498) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -65,27 +66,51 @@ SYSCTL_STRING(_hw_imx, OID_AUTO, last_reset_reason, CT void imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr) { - volatile uint16_t * pcr; + volatile uint16_t cr, *pcr; + if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { + printf("imx_wdog_cpu_reset(): " + "cannot find control register... locking up now."); + for (;;) + cpu_spinwait(); + } + cr = *pcr; + /* - * Trigger an immediate reset by clearing the SRS bit in the watchdog - * control register. The reset happens on the next cycle of the wdog - * 32KHz clock, so hang out in a spin loop until the reset takes effect. + * If the watchdog hardware has been set up to trigger an external reset + * signal on watchdog timeout, then we do software-requested rebooting + * the same way, by asserting the external reset signal. * + * Asserting external reset is supposed to result in some external + * component asserting the POR pin on the SoC, possibly after adjusting + * and stabilizing system voltages, or taking other system-wide reset + * actions. Just in case there is some kind of misconfiguration, we + * hang out and do nothing for a full second, then continue on into + * the code to assert a software reset as well. + */ + if (cr & WDOG_CR_WDT) { + cr &= ~WDOG_CR_WDA; /* Assert active-low ext reset bit. */ + *pcr = cr; + DELAY(1000000); + printf("imx_wdog_cpu_reset(): " + "External reset failed, trying internal cpu-reset\n"); + DELAY(10000); /* Time for printf to appear */ + } + + /* * Imx6 erratum ERR004346 says the SRS bit has to be cleared twice * within the same cycle of the 32khz clock to reliably trigger the * reset. Writing it 3 times in a row ensures at least 2 of the writes * happen in the same 32k clock cycle. */ - if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { - printf("cpu_reset() can't find its control register... locking up now."); - } else { - *pcr &= ~WDOG_CR_SRS; - *pcr &= ~WDOG_CR_SRS; - *pcr &= ~WDOG_CR_SRS; - } + cr &= ~WDOG_CR_SRS; /* Assert active-low software reset bit. */ + *pcr = cr; + *pcr = cr; + *pcr = cr; + + /* Reset happens on the next tick of the 32khz clock, wait for it. */ for (;;) - continue; + cpu_spinwait(); } void @@ -104,11 +129,4 @@ imx_wdog_init_last_reset(vm_offset_t wdsr_phys) sysctl___hw_imx_last_reset_reason.oid_arg1 = "PowerOnReset"; } } - -u_int -imx_soc_family(void) -{ - return (imx_soc_type() >> IMXSOC_FAMSHIFT); -} - Modified: stable/11/sys/arm/freescale/imx/imx_machdep.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_machdep.h Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_machdep.h Sat Mar 24 21:27:10 2018 (r331498) @@ -61,7 +61,12 @@ void imx_wdog_init_last_reset(vm_offset_t _wdsr_phys); #define IMXSOC_FAMSHIFT 28 u_int imx_soc_type(void); -u_int imx_soc_family(void); + +static inline u_int +imx_soc_family(void) +{ + return (imx_soc_type() >> IMXSOC_FAMSHIFT); +} #endif Modified: stable/11/sys/arm/freescale/imx/imx_wdog.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_wdog.c Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_wdog.c Sat Mar 24 21:27:10 2018 (r331498) @@ -50,23 +50,27 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include struct imx_wdog_softc { struct mtx sc_mtx; device_t sc_dev; - bus_space_tag_t sc_bst; - bus_space_handle_t sc_bsh; struct resource *sc_res[2]; + void *sc_ih; uint32_t sc_timeout; + bool sc_pde_enabled; }; static struct resource_spec imx_wdog_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, - { -1, 0 } + RESOURCE_SPEC_END }; +#define MEMRES 0 +#define IRQRES 1 + static struct ofw_compat_data compat_data[] = { {"fsl,imx6sx-wdt", 1}, {"fsl,imx6sl-wdt", 1}, @@ -81,28 +85,19 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0} }; -static void imx_watchdog(void *, u_int, int *); -static int imx_wdog_probe(device_t); -static int imx_wdog_attach(device_t); +static inline uint16_t +RD2(struct imx_wdog_softc *sc, bus_size_t offs) +{ -static device_method_t imx_wdog_methods[] = { - DEVMETHOD(device_probe, imx_wdog_probe), - DEVMETHOD(device_attach, imx_wdog_attach), - DEVMETHOD_END -}; + return (bus_read_2(sc->sc_res[MEMRES], offs)); +} -static driver_t imx_wdog_driver = { - "imx_wdog", - imx_wdog_methods, - sizeof(struct imx_wdog_softc), -}; -static devclass_t imx_wdog_devclass; -DRIVER_MODULE(imx_wdog, simplebus, imx_wdog_driver, imx_wdog_devclass, 0, 0); +static inline void +WR2(struct imx_wdog_softc *sc, bus_size_t offs, uint16_t val) +{ -#define RD2(_sc, _r) \ - bus_space_read_2((_sc)->sc_bst, (_sc)->sc_bsh, (_r)) -#define WR2(_sc, _r, _v) \ - bus_space_write_2((_sc)->sc_bst, (_sc)->sc_bsh, (_r), (_v)) + bus_write_2(sc->sc_res[MEMRES], offs, val); +} static void imx_watchdog(void *arg, u_int cmd, int *error) @@ -131,6 +126,12 @@ imx_watchdog(void *arg, u_int cmd, int *error) /* Refresh counter */ WR2(sc, WDOG_SR_REG, WDOG_SR_STEP1); WR2(sc, WDOG_SR_REG, WDOG_SR_STEP2); + /* Watchdog active, can disable rom-boot watchdog. */ + if (sc->sc_pde_enabled) { + sc->sc_pde_enabled = false; + reg = RD2(sc, WDOG_MCR_REG); + WR2(sc, WDOG_MCR_REG, reg & ~WDOG_MCR_PDE); + } *error = 0; } } @@ -138,6 +139,27 @@ imx_watchdog(void *arg, u_int cmd, int *error) } static int +imx_wdog_intr(void *arg) +{ + struct imx_wdog_softc *sc = arg; + + /* + * When configured for external reset, the actual reset is supposed to + * happen when some external device responds to the assertion of the + * WDOG_B signal by asserting the POR signal to the chip. This + * interrupt handler is a backstop mechanism; it is set up to fire + * simultaneously with WDOG_B, and if the external reset happens we'll + * never actually make it to here. If we do make it here, just trigger + * a software reset. That code will see that external reset is + * configured, and it will wait for 1 second for it to take effect, then + * it will do a software reset as a fallback. + */ + imx_wdog_cpu_reset(BUS_SPACE_PHYSADDR(sc->sc_res[MEMRES], WDOG_CR_REG)); + + return (FILTER_HANDLED); /* unreached */ +} + +static int imx_wdog_probe(device_t dev) { @@ -166,12 +188,43 @@ imx_wdog_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "imx_wdt", MTX_DEF); - sc->sc_dev = dev; - sc->sc_bst = rman_get_bustag(sc->sc_res[0]); - sc->sc_bsh = rman_get_bushandle(sc->sc_res[0]); + /* + * If we're configured to assert an external reset signal, set up the + * hardware to do so, and install an interrupt handler whose only + * purpose is to backstop the external reset. Don't worry if the + * interrupt setup fails, since it's only a backstop measure. + */ + if (ofw_bus_has_prop(sc->sc_dev, "fsl,ext-reset-output")) { + WR2(sc, WDOG_CR_REG, WDOG_CR_WDT | RD2(sc, WDOG_CR_REG)); + bus_setup_intr(sc->sc_dev, sc->sc_res[IRQRES], + INTR_TYPE_MISC | INTR_MPSAFE, imx_wdog_intr, NULL, sc, + &sc->sc_ih); + WR2(sc, WDOG_ICR_REG, WDOG_ICR_WIE); /* Enable, count is 0. */ + } - /* TODO: handle interrupt */ + /* + * Note whether the rom-boot so-called "power-down" watchdog is active, + * so we can disable it when the regular watchdog is first enabled. + */ + if (RD2(sc, WDOG_MCR_REG) & WDOG_MCR_PDE) + sc->sc_pde_enabled = true; EVENTHANDLER_REGISTER(watchdog_list, imx_watchdog, sc, 0); return (0); } + +static device_method_t imx_wdog_methods[] = { + DEVMETHOD(device_probe, imx_wdog_probe), + DEVMETHOD(device_attach, imx_wdog_attach), + DEVMETHOD_END +}; + +static driver_t imx_wdog_driver = { + "imx_wdog", + imx_wdog_methods, + sizeof(struct imx_wdog_softc), +}; + +static devclass_t imx_wdog_devclass; + +DRIVER_MODULE(imx_wdog, simplebus, imx_wdog_driver, imx_wdog_devclass, 0, 0); Modified: stable/11/sys/arm/freescale/imx/imx_wdogreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_wdogreg.h Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_wdogreg.h Sat Mar 24 21:27:10 2018 (r331498) @@ -34,31 +34,31 @@ #define WDOG_CLK_FREQ 32768 #define WDOG_CR_REG 0x00 /* Control Register */ -#define WDOG_CR_WT_MASK 0xff00 /* Count of 0.5 sec */ -#define WDOG_CR_WT_SHIFT 8 -#define WDOG_CR_WDW (1 << 7) /* Suspend WDog */ -#define WDOG_CR_WDA (1 << 5) /* Don't touch ipp_wdog */ -#define WDOG_CR_SRS (1 << 4) /* Don't touch sys_reset */ -#define WDOG_CR_WDT (1 << 3) /* Assert ipp_wdog on tout */ -#define WDOG_CR_WDE (1 << 2) /* WDog Enable */ -#define WDOG_CR_WDBG (1 << 1) /* Suspend when DBG mode */ -#define WDOG_CR_WDZST (1 << 0) /* Suspend when LP mode */ +#define WDOG_CR_WT_MASK 0xff00 /* Count; 0.5 sec units */ +#define WDOG_CR_WT_SHIFT 8 +#define WDOG_CR_WDW (1u << 7) /* Suspend when in WAIT mode */ +#define WDOG_CR_WDA (1u << 5) /* Don't assert ext reset */ +#define WDOG_CR_SRS (1u << 4) /* Don't assert soft reset */ +#define WDOG_CR_WDT (1u << 3) /* Assert ext reset on timeout */ +#define WDOG_CR_WDE (1u << 2) /* Watchdog Enable */ +#define WDOG_CR_WDBG (1u << 1) /* Suspend when DBG mode */ +#define WDOG_CR_WDZST (1u << 0) /* Suspend when LP mode */ #define WDOG_SR_REG 0x02 /* Service Register */ -#define WDOG_SR_STEP1 0x5555 -#define WDOG_SR_STEP2 0xaaaa +#define WDOG_SR_STEP1 0x5555 +#define WDOG_SR_STEP2 0xaaaa #define WDOG_RSR_REG 0x04 /* Reset Status Register */ -#define WDOG_RSR_POR (1 << 4) /* Due to Power-On Reset */ -#define WDOG_RSR_TOUT (1 << 1) /* Due WDog timeout reset */ -#define WDOG_RSR_SFTW (1 << 0) /* Due Soft reset */ +#define WDOG_RSR_POR (1u << 4) /* Due to Power-On Reset */ +#define WDOG_RSR_TOUT (1u << 1) /* Due WDog timeout reset */ +#define WDOG_RSR_SFTW (1u << 0) /* Due Soft reset */ #define WDOG_ICR_REG 0x06 /* Interrupt Control Register */ -#define WDOG_ICR_WIE (1 << 15) /* Enable Interrupt */ -#define WDOG_ICR_WTIS (1 << 14) /* Interrupt has occurred */ -#define WDOG_ICR_WTCT_MASK 0x00ff -#define WDOG_ICR_WTCT_SHIFT 0 /* Interrupt hold time */ +#define WDOG_ICR_WIE (1u << 15) /* Enable Interrupt */ +#define WDOG_ICR_WTIS (1u << 14) /* Interrupt has occurred */ +#define WDOG_ICR_WTCT_MASK 0x00ff /* Interrupt lead time in 0.5s */ +#define WDOG_ICR_WTCT_SHIFT 0 /* units before reset occurs */ #define WDOG_MCR_REG 0x08 /* Miscellaneous Control Register */ -#define WDOG_MCR_PDE (1 << 0) +#define WDOG_MCR_PDE (1u << 0) /* Power-down enable */ From owner-svn-src-all@freebsd.org Sat Mar 24 21:30:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA4C5F4AE47; Sat, 24 Mar 2018 21:30:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F64380B46; Sat, 24 Mar 2018 21:30:25 +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 58BDB14C3C; Sat, 24 Mar 2018 21:30:25 +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 w2OLUPZV076715; Sat, 24 Mar 2018 21:30:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLUOx0076707; Sat, 24 Mar 2018 21:30:24 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201803242130.w2OLUOx0076707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 24 Mar 2018 21:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331499 - in head: share/mk sys/arm/conf sys/conf sys/dts sys/dts/arm/overlays sys/modules/dtb/overlays sys/tools/fdt X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head: share/mk sys/arm/conf sys/conf sys/dts sys/dts/arm/overlays sys/modules/dtb/overlays sys/tools/fdt X-SVN-Commit-Revision: 331499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 21:30:26 -0000 Author: manu Date: Sat Mar 24 21:30:24 2018 New Revision: 331499 URL: https://svnweb.freebsd.org/changeset/base/331499 Log: Add dtb overlays support DTB Overlays are useful to change/add nodes to a dtb without the need to modify it. Add support for building dtbo during buildkernel. The goal of DTBO present in the FreeBSD source tree is to fill a gap in time when we submit changes upstream (Linux). Instead of waiting 2 to 4 months we can add a DTBO in tree in the meantime. This is not for adding DTBO for capes/hat/addon boards, those will be better to put in a ports. This is also not for enabling a i2c/spi/pwm controller on certain pins, each user have a different use case for those (which pins to use etc ...) and we cannot have all possible configuration. Add a dtbo for sun8i-h3-sid which add the SID node missing in upstream dts. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D14782 Added: head/sys/dts/arm/overlays/ head/sys/dts/arm/overlays/Makefile (contents, props changed) head/sys/dts/arm/overlays/sun8i-h3-sid.dtso (contents, props changed) head/sys/modules/dtb/overlays/ head/sys/modules/dtb/overlays/Makefile (contents, props changed) head/sys/tools/fdt/make_dtbo.sh (contents, props changed) Modified: head/share/mk/bsd.own.mk head/sys/arm/conf/GENERIC head/sys/conf/dtb.mk head/sys/dts/Makefile.inc Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Sat Mar 24 21:27:10 2018 (r331498) +++ head/share/mk/bsd.own.mk Sat Mar 24 21:30:24 2018 (r331499) @@ -146,6 +146,7 @@ KMODOWN?= ${BINOWN} KMODGRP?= ${BINGRP} KMODMODE?= ${BINMODE} DTBDIR?= /boot/dtb +DTBODIR?= /boot/dtb/overlays DTBOWN?= root DTBGRP?= wheel DTBMODE?= 444 Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sat Mar 24 21:27:10 2018 (r331498) +++ head/sys/arm/conf/GENERIC Sat Mar 24 21:30:24 2018 (r331499) @@ -246,4 +246,4 @@ options EFI # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/imx6 dtb/nvidia dtb/rpi dtb/zynq dtb/omap4" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/imx6 dtb/nvidia dtb/rpi dtb/zynq dtb/omap4 dtb/overlays" Modified: head/sys/conf/dtb.mk ============================================================================== --- head/sys/conf/dtb.mk Sat Mar 24 21:27:10 2018 (r331498) +++ head/sys/conf/dtb.mk Sat Mar 24 21:30:24 2018 (r331499) @@ -45,13 +45,14 @@ SYSDIR= ${_dir:tA} .error "can't find kernel source tree" .endif -.SUFFIXES: .dtb .dts +.SUFFIXES: .dtb .dts .dtbo .dtso -.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} +.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}/overlays DTB=${DTS:R:S/$/.dtb/} +DTBO=${DTSO:R:S/$/.dtbo/} -all: ${DTB} +all: ${DTB} ${DTBO} .if defined(DTS) .export DTC @@ -63,6 +64,16 @@ CLEANFILES+=${_dts:R:S/$/.dtb/} .endfor .endif +.if defined(DTSO) +.export DTC +.for _dtso in ${DTSO} +${_dtso:R:S/$/.dtbo/}: ${_dtso} ${OP_META} + @echo Generating ${.TARGET} from ${_dtso} + @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} overlays/${_dtso} ${.OBJDIR} +CLEANFILES+=${_dtso:R:S/$/.dtbo/} +.endfor +.endif + .if !target(install) .if !target(realinstall) realinstall: _dtbinstall @@ -75,6 +86,11 @@ _dtbinstall: .for _dtb in ${DTB} ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/ +.endfor + test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR} +.for _dtbo in ${DTBO} + ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ + ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/ .endfor .endif # !target(realinstall) .endif # !target(install) Modified: head/sys/dts/Makefile.inc ============================================================================== --- head/sys/dts/Makefile.inc Sat Mar 24 21:27:10 2018 (r331498) +++ head/sys/dts/Makefile.inc Sat Mar 24 21:30:24 2018 (r331499) @@ -6,5 +6,8 @@ test-dts: .for dts in ${DTS} @env MACHINE=`basename ${.CURDIR}` ${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${dts} /tmp -.endfor +test-dtso: +.for dtso in ${DTSO} + @env MACHINE=`basename ${.CURDIR}` ${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${dtso} /tmp +.endfor Added: head/sys/dts/arm/overlays/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm/overlays/Makefile Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +DTSO!=ls *.dtso + +all: test-dtso + +.include Added: head/sys/dts/arm/overlays/sun8i-h3-sid.dtso ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm/overlays/sun8i-h3-sid.dtso Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,18 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun8i-h3"; + + fragment@0 { + target-path = "/soc"; + + __overlay__ { + sid: eeprom@1c14000 { + compatible = "allwinner,sun8i-h3-sid"; + reg = <0x1c14000 0x400>; + status = "okay"; + }; + }; + }; +}; Added: head/sys/modules/dtb/overlays/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/dtb/overlays/Makefile Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,5 @@ +# $FreeBSD$ +# All the dtso files +DTSO= sun8i-h3-sid.dtso + +.include Added: head/sys/tools/fdt/make_dtbo.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/tools/fdt/make_dtbo.sh Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD$ + +# Script generates dtbo file ($3) from dtso source ($2) in build tree S ($1) +S=$1 +dtso="$2" +dtbo_path=$3 + +if [ -z "$dtso" ]; then + echo "No DTS overlays specified" + exit 1 +fi + +if [ -z "${MACHINE}" ]; then + MACHINE=$(uname -m) +fi + +: ${DTC:=dtc} + +for d in ${dtso}; do + dtb=${dtbo_path}/`basename $d .dtso`.dtbo + echo "converting $d -> $dtb" + cpp -P -x assembler-with-cpp -I $S/gnu/dts/include -I $S/dts/${MACHINE} -I $S/gnu/dts/${MACHINE} -include $d /dev/null | + ${DTC} -@ -O dtb -o $dtb -i $S/dts/${MACHINE} -i $S/gnu/dts/${MACHINE} +done From owner-svn-src-all@freebsd.org Sat Mar 24 21:53:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 932D1F4E128; Sat, 24 Mar 2018 21:53:02 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 311FC81A3D; Sat, 24 Mar 2018 21:53:02 +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 2BAA91512E; Sat, 24 Mar 2018 21:53:02 +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 w2OLr1ak090973; Sat, 24 Mar 2018 21:53:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLr1NV090970; Sat, 24 Mar 2018 21:53:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242153.w2OLr1NV090970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 21:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331500 - in stable/11: etc/devd sys/dev/usb sys/dev/usb/serial X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11: etc/devd sys/dev/usb sys/dev/usb/serial X-SVN-Commit-Revision: 331500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 21:53:02 -0000 Author: ian Date: Sat Mar 24 21:53:01 2018 New Revision: 331500 URL: https://svnweb.freebsd.org/changeset/base/331500 Log: MFC r329125-r329126 r329125: Add a device ID to uftdi for TIAO USB Multi Protocol Adapter (TUMPA). PR: 225810 r329126: Regenerate devd/usb.conf after the recent addition of several new device IDs. Modified: stable/11/etc/devd/usb.conf stable/11/sys/dev/usb/serial/uftdi.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/devd/usb.conf ============================================================================== --- stable/11/etc/devd/usb.conf Sat Mar 24 21:30:24 2018 (r331499) +++ stable/11/etc/devd/usb.conf Sat Mar 24 21:53:01 2018 (r331500) @@ -145,7 +145,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0403"; - match "product" "(0x5259|0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x6015|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xa6d1|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed7 4|0xee18|0xeee8|0xeee9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; + match "product" "(0x5259|0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x6015|0x8372|0x8a98|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xa6d1|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed7 3|0xed74|0xee18|0xeee8|0xeee9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; action "kldload -n uftdi"; }; @@ -1361,6 +1361,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x067b"; + match "product" "0x27a1"; + action "kldload -n udbp"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x067b"; match "product" "(0x331a|0xaaa0|0xaaa2)"; action "kldload -n uplcom"; }; @@ -3617,7 +3625,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x10c4"; - match "product" "(0x8066|0x806f|0x807a|0x80c4|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x815f|0x818b|0x819f|0x81a6|0x81a9|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x83d8|0x8411|0x8418|0x846e|0x8477|0x85ea|0x85eb|0x85f8|0x8664|0x8665|0x88a4|0x88a5|0xea60|0xea61|0xea70|0xea71|0xea80|0xf001|0xf002|0xf003|0xf004)"; + match "product" "(0x8066|0x806f|0x807a|0x80c4|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x815f|0x818b|0x819f|0x81a6|0x81a9|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x83d8|0x8411|0x8418|0x846e|0x8477|0x85ea|0x85eb|0x85f8|0x8664|0x8665|0x88a4|0x88a5|0x8a2a|0xea60|0xea61|0xea70|0xea71|0xea80|0xf001|0xf002|0xf003|0xf004)"; action "kldload -n uslcom"; }; @@ -3745,7 +3753,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1199"; - match "product" "(0x68aa|0x68c0|0x9041)"; + match "product" "(0x68aa|0x68c0|0x9041|0x9071)"; action "kldload -n u3g"; }; @@ -3857,7 +3865,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x12d1"; - match "product" "(0x1573|0x1803|0x1c05|0x1c0b)"; + match "product" "(0x155b|0x1573|0x15c1|0x1803|0x1c05|0x1c0b|0x1c1e)"; action "kldload -n u3g"; }; @@ -4360,6 +4368,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x15eb"; + match "product" "0x7d0e"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1614"; match "product" "(0x0800|0x0802|0x7002)"; action "kldload -n u3g"; @@ -5248,6 +5264,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x2c7c"; + match "product" "0x0125"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x3195"; match "product" "(0xf190|0xf280|0xf281)"; action "kldload -n uslcom"; @@ -5623,6 +5647,46 @@ nomatch 32 { match "vendor" "0x12d1"; match "intclass" "0xff"; match "intsubclass" "0x02"; + match "intprotocol" "0x01"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x02"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x10"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x12"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; match "intprotocol" "0x16"; action "kldload -n if_cdce"; }; @@ -5643,12 +5707,42 @@ nomatch 32 { match "vendor" "0x12d1"; match "intclass" "0xff"; match "intsubclass" "0x02"; + match "intprotocol" "0x61"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x62"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; match "intprotocol" "0x76"; action "kldload -n if_cdce"; }; nomatch 32 { match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x03"; + match "intprotocol" "0x16"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; match "mode" "(host|device)"; match "intclass" "0x02"; match "intsubclass" "0x02"; @@ -5817,5 +5911,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2722 USB entries processed +# 2738 USB entries processed Modified: stable/11/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/11/sys/dev/usb/serial/uftdi.c Sat Mar 24 21:30:24 2018 (r331499) +++ stable/11/sys/dev/usb/serial/uftdi.c Sat Mar 24 21:53:01 2018 (r331500) @@ -522,6 +522,7 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = { UFTDI_DEV(FTDI, TERATRONIK_D2XX, 0), UFTDI_DEV(FTDI, TERATRONIK_VCP, 0), UFTDI_DEV(FTDI, THORLABS, 0), + UFTDI_DEV(FTDI, TIAO, 0), UFTDI_DEV(FTDI, TNC_X, 0), UFTDI_DEV(FTDI, TTUSB, 0), UFTDI_DEV(FTDI, TURTELIZER2, UFTDI_JTAG_IFACE(0)), Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Sat Mar 24 21:30:24 2018 (r331499) +++ stable/11/sys/dev/usb/usbdevs Sat Mar 24 21:53:01 2018 (r331500) @@ -2136,6 +2136,7 @@ product FTDI TAVIR_STK500 0xfa33 FTDI compatible adapt product FTDI TERATRONIK_D2XX 0xec89 FTDI compatible adapter product FTDI TERATRONIK_VCP 0xec88 FTDI compatible adapter product FTDI THORLABS 0xfaf0 FTDI compatible adapter +product FTDI TIAO 0x8a98 FTDI compatible adapter product FTDI TNC_X 0xebe0 FTDI compatible adapter product FTDI TTUSB 0xff20 FTDI compatible adapter product FTDI USBX_707 0xf857 FTDI compatible adapter From owner-svn-src-all@freebsd.org Sat Mar 24 22:39:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0345DF51E7D; Sat, 24 Mar 2018 22:39:40 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93E2E838A3; Sat, 24 Mar 2018 22:39: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 88F56157C8; Sat, 24 Mar 2018 22:39: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 w2OMddMd011851; Sat, 24 Mar 2018 22:39:39 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OMdct9011839; Sat, 24 Mar 2018 22:39:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242239.w2OMdct9011839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 22:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331501 - in stable/11/sys: arm/conf arm/freescale/imx dev/iicbus dev/sdhci dev/usb/controller modules modules/i2c/iicbus modules/imx modules/imx/imx_i2c X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/conf arm/freescale/imx dev/iicbus dev/sdhci dev/usb/controller modules modules/i2c/iicbus modules/imx modules/imx/imx_i2c X-SVN-Commit-Revision: 331501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 22:39:40 -0000 Author: ian Date: Sat Mar 24 22:39:38 2018 New Revision: 331501 URL: https://svnweb.freebsd.org/changeset/base/331501 Log: MFC r329479-r329480, r329483, r329506-r329507, r329526, r329529, r329536, r329541, r329730, r329841, r329988, r330397 r329479: Do not try to deallocate memory that wasn't allocated (you'd think that would be safe, but the function also tries to destroy mutexes that never got created). I guess this can only happen when imx_ehci_detach() is called on the error-exit path from imx_ehci_attach(), and that path never got exercised before today. r329480: Don't call sdhci_cleanup_slot() if sdhci_init_slot() never got called. Also, do callout_init() very early in attach, so that callout_drain() can be called in detach without worrying about whether it ever got init'd. r329483: Fix fallout from the import of fresh dts source files from linux 4.15. It appears that node names no longer include leading zeroes in the @address qualifiers, so we have to search for the nodes involved in interrupt fixup using both flavors of name to be compatible with old and new .dtb files. (You know you're in a bad place when you're applying a workaround to code that exists only as a workaround for another problem.) r329506: Add a detach method so that this can be a kldunload-friendly module. r329507: Build modules specific to imx5/imx6 only when building those kernels. This adds sys/modules/imx with a SUBDIR makefile to make the whole collection of modules that are specific to these SoCs. Initially, that "whole collection" consists of the if_ffec and imx_i2c drivers. The if_ffec driver is referenced in its existing home in ../ffec rather than moving it into the imx directory, because it's used by powerpc too, but it is no longer built for all armv6/7 systems. The imx_i2c driver is newly added as a module. r329526: Allow i2c hardware drivers to declare their own relationships to ofw_iicbus rather than relying on a set of canned EARLY_DRIVER_MODULE() statements in the ofw_iicbus source. This means hw drivers will no longer be required to use one of a few predefined driver names. They will also now be able to decide themselves if they want to use DRIVER_MODULE or EARLY_DRIVER_MODULE and to set which pass to attach on for early modules. Mainly, this adds extern declarations for the driver and devclass variables. It also renames ofwiicbus_devclass to ofw_iicbus_devclass to be consistant with the way we use ofw_ prefixes on this stuff. r329529: Give the imx_i2c driver its own name, set up its relationship to ofw_iicbus. Previously it called itself 'iichb' to link up with the EARLY_DRIVER_MODULE declaration in ofw_iicbus.c. r329536: Add the MODULE_DEPEND()s needed so that the kernel linker can resolve all the symbols at load time when iicbus is not compiled into the kernel. r329541: Build ofw_iicbus as a module if OPT_FDT is defined. r329730: Add required header files. Reported by: andreast@ r329841: Add a missing line continuation. How many commits does it take to get a simple module makefile working? Apparently at least three. Pointy hat to: ian r329988: Instead of building ofw_iicbus as a separate module, just compile it in to the iicbus module for FDT-based systems. The primary motivation for this is that host controller drivers which declare DRIVER_MODULE(ofw_iicbus, thisdriver, etc, etc) now only need a single MODULE_DEPEND(thisdriver, ofw_iicbus) for runtime linking to resolve all the symbols. With ofw_iicbus and iicbus in separate modules, drivers would need to declare a MODULE_DEPEND() on both, because symbol lookup is non-recursive through the dependency chain. Requiring a driver to have MODULE_DEPENDS() on both amounts to requiring the drivers to understand the kobj inheritence details of how ofw_iicbus is implemented, which seems like something they shouldn't have to know (and could even change some day). Also, this is somewhat analogous to how the drivers get built when compiled into the kernel. You don't have to ask for ofw_iicbus separately, it just gets built in along with iicbus when option FDT is in effect. r330397: Fix a paste-o: use the IICBUS version constants, not IICBB bitbang driver's. Added: stable/11/sys/modules/imx/ - copied from r329507, head/sys/modules/imx/ Modified: stable/11/sys/arm/conf/IMX53 stable/11/sys/arm/conf/IMX6 stable/11/sys/arm/freescale/imx/imx6_machdep.c stable/11/sys/arm/freescale/imx/imx_i2c.c stable/11/sys/dev/iicbus/iicbus.h stable/11/sys/dev/iicbus/nxprtc.c stable/11/sys/dev/iicbus/ofw_iicbus.c stable/11/sys/dev/sdhci/fsl_sdhci.c stable/11/sys/dev/usb/controller/ehci_imx.c stable/11/sys/modules/Makefile stable/11/sys/modules/i2c/iicbus/Makefile stable/11/sys/modules/imx/imx_i2c/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/IMX53 ============================================================================== --- stable/11/sys/arm/conf/IMX53 Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/conf/IMX53 Sat Mar 24 22:39:38 2018 (r331501) @@ -117,6 +117,6 @@ device wlan_amrr # AMRR transmit rate control algori # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA=dtb/imx5 +makeoptions MODULES_EXTRA="dtb/imx5 imx" options INTRNG Modified: stable/11/sys/arm/conf/IMX6 ============================================================================== --- stable/11/sys/arm/conf/IMX6 Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/conf/IMX6 Sat Mar 24 22:39:38 2018 (r331501) @@ -117,7 +117,7 @@ device hdmi # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA=dtb/imx6 +makeoptions MODULES_EXTRA="dtb/imx6 imx" # SoC-specific devices device ffec # Freescale Fast Ethernet Controller Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_machdep.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/freescale/imx/imx6_machdep.c Sat Mar 24 22:39:38 2018 (r331501) @@ -80,6 +80,12 @@ __FBSDID("$FreeBSD$"); * per-soc logic. We handle this at platform attach time rather than via the * fdt_fixup_table, because the latter requires matching on the FDT "model" * property, and this applies to all boards including those not yet invented. + * + * This just in: as of the import of dts files from linux 4.15 on 2018-02-10, + * they appear to have applied a new style rule to the dts which forbids leading + * zeroes in the @address qualifiers on node names. Since we have to find those + * nodes by string matching we now have to search for both flavors of each node + * name involved. */ static void fix_fdt_interrupt_data(void) @@ -99,9 +105,13 @@ fix_fdt_interrupt_data(void) /* GIC node may be child of soc node, or appear directly at root. */ gicnode = OF_finddevice("/soc/interrupt-controller@00a01000"); + if (gicnode == -1) + gicnode = OF_finddevice("/soc/interrupt-controller@a01000"); if (gicnode == -1) { gicnode = OF_finddevice("/interrupt-controller@00a01000"); if (gicnode == -1) + gicnode = OF_finddevice("/interrupt-controller@a01000"); + if (gicnode == -1) return; } gicxref = OF_xref_from_node(gicnode); @@ -113,6 +123,8 @@ fix_fdt_interrupt_data(void) gicipar = gicxref; gpcnode = OF_finddevice("/soc/aips-bus@02000000/gpc@020dc000"); + if (gpcnode == -1) + gpcnode = OF_finddevice("/soc/aips-bus@2000000/gpc@20dc000"); if (gpcnode == -1) return; result = OF_getencprop(gpcnode, "interrupt-parent", &gpcipar, Modified: stable/11/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_i2c.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/freescale/imx/imx_i2c.c Sat Mar 24 22:39:38 2018 (r331501) @@ -155,6 +155,7 @@ struct i2c_softc { static phandle_t i2c_get_node(device_t, device_t); static int i2c_probe(device_t); static int i2c_attach(device_t); +static int i2c_detach(device_t); static int i2c_repeated_start(device_t, u_char, int); static int i2c_start(device_t, u_char, int); @@ -166,6 +167,7 @@ static int i2c_write(device_t, const char *, int, int static device_method_t i2c_methods[] = { DEVMETHOD(device_probe, i2c_probe), DEVMETHOD(device_attach, i2c_attach), + DEVMETHOD(device_detach, i2c_detach), /* OFW methods */ DEVMETHOD(ofw_bus_get_node, i2c_get_node), @@ -183,14 +185,16 @@ static device_method_t i2c_methods[] = { }; static driver_t i2c_driver = { - "iichb", + "imx_i2c", i2c_methods, sizeof(struct i2c_softc), }; static devclass_t i2c_devclass; -DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); -DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); +DRIVER_MODULE(imx_i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); +DRIVER_MODULE(ofw_iicbus, imx_i2c, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); +MODULE_DEPEND(imx_i2c, iicbus, 1, 1, 1); +MODULE_DEPEND(imx_i2c, ofw_iicbus, 1, 1, 1); static phandle_t i2c_get_node(device_t bus, device_t dev) @@ -446,6 +450,28 @@ no_recovery: /* Probe and attach the iicbus when interrupts are available. */ config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); + return (0); +} + +static int +i2c_detach(device_t dev) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + if ((error = bus_generic_detach(sc->dev)) != 0) { + device_printf(sc->dev, "cannot detach child devices\n"); + return (error); + } + + if (sc->iicbus != NULL) + device_delete_child(dev, sc->iicbus); + + if (sc->res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res); + return (0); } Modified: stable/11/sys/dev/iicbus/iicbus.h ============================================================================== --- stable/11/sys/dev/iicbus/iicbus.h Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/iicbus/iicbus.h Sat Mar 24 22:39:38 2018 (r331501) @@ -77,5 +77,7 @@ void iicbus_init_frequency(device_t dev, u_int bus_fre extern driver_t iicbus_driver; extern devclass_t iicbus_devclass; +extern driver_t ofw_iicbus_driver; +extern devclass_t ofw_iicbus_devclass; #endif Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 22:39:38 2018 (r331501) @@ -823,4 +823,4 @@ static devclass_t nxprtc_devclass; DRIVER_MODULE(nxprtc, iicbus, nxprtc_driver, nxprtc_devclass, NULL, NULL); MODULE_VERSION(nxprtc, 1); -MODULE_DEPEND(nxprtc, iicbus, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); +MODULE_DEPEND(nxprtc, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); Modified: stable/11/sys/dev/iicbus/ofw_iicbus.c ============================================================================== --- stable/11/sys/dev/iicbus/ofw_iicbus.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/iicbus/ofw_iicbus.c Sat Mar 24 22:39:38 2018 (r331501) @@ -76,13 +76,15 @@ struct ofw_iicbus_devinfo { struct ofw_bus_devinfo opd_obdinfo; }; -devclass_t ofwiicbus_devclass; +devclass_t ofw_iicbus_devclass; DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods, sizeof(struct iicbus_softc), iicbus_driver); -EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass, +EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0, BUS_PASS_BUS); -EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, +EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofw_iicbus_devclass, + 0, 0, BUS_PASS_BUS); +EARLY_DRIVER_MODULE(ofw_iicbus, twsi, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_iicbus, 1); MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1); Modified: stable/11/sys/dev/sdhci/fsl_sdhci.c ============================================================================== --- stable/11/sys/dev/sdhci/fsl_sdhci.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/sdhci/fsl_sdhci.c Sat Mar 24 22:39:38 2018 (r331501) @@ -86,6 +86,7 @@ struct fsl_sdhci_softc { uint16_t sdclockreg_freq_bits; uint8_t r1bfix_type; uint8_t hwtype; + bool slot_init_done; }; #define R1BFIX_NONE 0 /* No fix needed at next interrupt. */ @@ -814,6 +815,9 @@ fsl_sdhci_detach(device_t dev) callout_drain(&sc->r1bfix_callout); + if (sc->slot_init_done) + sdhci_cleanup_slot(&sc->slot); + if (sc->intr_cookie != NULL) bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); if (sc->irq_res != NULL) @@ -821,7 +825,6 @@ fsl_sdhci_detach(device_t dev) rman_get_rid(sc->irq_res), sc->irq_res); if (sc->mem_res != NULL) { - sdhci_cleanup_slot(&sc->slot); bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem_res), sc->mem_res); } @@ -841,6 +844,8 @@ fsl_sdhci_attach(device_t dev) sc->dev = dev; + callout_init(&sc->r1bfix_callout, 1); + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; if (sc->hwtype == HWTYPE_NONE) panic("Impossible: not compatible in fsl_sdhci_attach()"); @@ -928,8 +933,8 @@ fsl_sdhci_attach(device_t dev) WR4(sc, SDHC_PROT_CTRL, protctl); #endif - callout_init(&sc->r1bfix_callout, 1); sdhci_init_slot(dev, &sc->slot, 0); + sc->slot_init_done = true; bus_generic_probe(dev); bus_generic_attach(dev); Modified: stable/11/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_imx.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/usb/controller/ehci_imx.c Sat Mar 24 22:39:38 2018 (r331501) @@ -268,6 +268,7 @@ struct imx_ehci_softc { device_t dev; struct resource *ehci_mem_res; /* EHCI core regs. */ struct resource *ehci_irq_res; /* EHCI core IRQ. */ + bool usb_mem_allocated; }; static struct ofw_compat_data compat_data[] = { @@ -331,7 +332,8 @@ imx_ehci_detach(device_t dev) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->ehci_mem_res); - usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); + if (sc->usb_mem_allocated) + usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); /* During module unload there are lots of children leftover */ device_delete_children(dev); @@ -413,6 +415,7 @@ imx_ehci_attach(device_t dev) err = ENOMEM; goto out; } + sc->usb_mem_allocated = true; /* * Set handle to USB related registers subregion used by Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/modules/Makefile Sat Mar 24 22:39:38 2018 (r331501) @@ -824,8 +824,9 @@ _cloudabi64= cloudabi64 .endif -.if ${MACHINE_ARCH} == "armv6" -_ffec= ffec +.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" +_bcm283x_clkman= bcm283x_clkman +_bcm283x_pwm= bcm283x_pwm .endif SUBDIR+=${MODULES_EXTRA} Modified: stable/11/sys/modules/i2c/iicbus/Makefile ============================================================================== --- stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 22:39:38 2018 (r331501) @@ -5,4 +5,8 @@ KMOD = iicbus SRCS = device_if.h bus_if.h iicbus_if.h iicbus_if.c \ iiconf.h iiconf.c iicbus.h iicbus.c +.if !empty(OPT_FDT) +SRCS+= ofw_iicbus.c ofw_bus_if.h +.endif + .include Modified: stable/11/sys/modules/imx/imx_i2c/Makefile ============================================================================== --- head/sys/modules/imx/imx_i2c/Makefile Sun Feb 18 02:48:54 2018 (r329507) +++ stable/11/sys/modules/imx/imx_i2c/Makefile Sat Mar 24 22:39:38 2018 (r331501) @@ -8,6 +8,8 @@ SRCS= imx_i2c.c SRCS+= \ bus_if.h \ device_if.h \ + fdt_pinctrl_if.h \ + gpio_if.h \ iicbus_if.h \ ofw_bus_if.h \ opt_platform.h \ From owner-svn-src-all@freebsd.org Sat Mar 24 22:51:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D390F52CF1; Sat, 24 Mar 2018 22:51:00 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF1E383F69; Sat, 24 Mar 2018 22:50:59 +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 DA01715994; Sat, 24 Mar 2018 22:50:59 +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 w2OMoxKX016780; Sat, 24 Mar 2018 22:50:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OMoxNl016779; Sat, 24 Mar 2018 22:50:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242250.w2OMoxNl016779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 22:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331502 - stable/11/sys/modules/i2c/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/modules/i2c/iicbus X-SVN-Commit-Revision: 331502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 22:51:00 -0000 Author: ian Date: Sat Mar 24 22:50:59 2018 New Revision: 331502 URL: https://svnweb.freebsd.org/changeset/base/331502 Log: MFC r329534-r329535 r329534: Arrange SRCS= as 1 file per line, alphabetical, so it's easier to maintain. Whitespace only, no functional changes. r329535: Add iic_recover_bus.c, now part of iicbus. This should have been added as part of r320463. Modified: stable/11/sys/modules/i2c/iicbus/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/i2c/iicbus/Makefile ============================================================================== --- stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 22:39:38 2018 (r331501) +++ stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 22:50:59 2018 (r331502) @@ -1,9 +1,18 @@ # $FreeBSD$ -.PATH: ${SRCTOP}/sys/dev/iicbus -KMOD = iicbus -SRCS = device_if.h bus_if.h iicbus_if.h iicbus_if.c \ - iiconf.h iiconf.c iicbus.h iicbus.c +.PATH: ${SRCTOP}/sys/dev/iicbus + +KMOD= iicbus +SRCS= \ + bus_if.h \ + device_if.h \ + iic_recover_bus.c \ + iicbus.c \ + iicbus.h \ + iicbus_if.c \ + iicbus_if.h \ + iiconf.c \ + iiconf.h \ .if !empty(OPT_FDT) SRCS+= ofw_iicbus.c ofw_bus_if.h From owner-svn-src-all@freebsd.org Sat Mar 24 23:01:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A228F539F9; Sat, 24 Mar 2018 23:01:12 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27277846CB; Sat, 24 Mar 2018 23:01:12 +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 21DF515B55; Sat, 24 Mar 2018 23:01:12 +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 w2ON1CSf023487; Sat, 24 Mar 2018 23:01:12 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ON1AiX023472; Sat, 24 Mar 2018 23:01:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242301.w2ON1AiX023472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331503 - in stable/11/sys: conf dev/iicbus kern modules/i2c modules/i2c/ds1672 modules/i2c/rtc8583 sys x86/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: conf dev/iicbus kern modules/i2c modules/i2c/ds1672 modules/i2c/rtc8583 sys x86/isa X-SVN-Commit-Revision: 331503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 23:01:12 -0000 Author: ian Date: Sat Mar 24 23:01:10 2018 New Revision: 331503 URL: https://svnweb.freebsd.org/changeset/base/331503 Log: MFC r325233, r328956, r329170, r329172-r329173, r329224, r330403-r330407, r330411-r330412, r330416, r330430-r330431, r330433, r330528-r330529, r330767 r325233: [i2c/clock] add support for EPSON RTC-8583 RTC-8583 is time-of-day clock used in some SOHO routers. This clock has only 2 bits for year values, but thanks to user SRAM it's possible to save year value and keep it up to date via driver code. Tested on Planex_MZK-W300NAG (SoC is RT2880) Submitted by: Hiroki Mori Differential Revision: https://reviews.freebsd.org/D12833 r328956: Use const pointers for input data not modified by clock utility functions. r329170: Replace the existing print_ct() private debugging function with a set of three public functions to format and print the three major data structures used by realtime clock drivers (clocktime, bcd_clocktime, and timespec). r329172: Add a set of convenience routines for RTC drivers to use for debug output, and a debug.clock_show_io sysctl to control debugging output. r329173: Add a new sysctl, debug.clock_do_io, to allow manully triggering a one-shot read or write of all registered realtime clocks. In the read case, the values read are simply discarded. For writes, there's no alternative but to actually write the current system time to the device. r329224: Fix bad indentation. Whitespace only, no functional changes. Reported by: bde@ r330403: Add calls to the new clock_dbgprint_xxx() functions. r330404: Add calls to the new clock_dbgprint_xxx() functions. r330405: Oops, fix a paste-o. r330406: Add calls to the new clock_dbgprint_xxx() functions. r330407: Add calls to the new clock_dbgprint_xxx() functions. Also, stop applying a local .5 second adjustment to the time, since that is now done by the code in subr_rtc.c. r330411: Convert to the new(ish) bcd_clocktime conversion functions, add calls to the new debug output functions, and when setting the clock, propagate the timespec nsecs to the 1/100ths register. r330412: Build iicbus/rtc8583 as a module. r330416: The year is stored in a single byte in sram, in binary format, as a count of years since the century, so strip the century out when converting to or from bcd_clocktime format (the conversion routines will infer century by pivoting on 70). r330430: Switch to the new bcd_clocktime conversion routines, and add calls to the new clock_dbgprint_xxx() functions. r330431: Switch to the new bcd_clocktime conversion routines, and add calls to the new clock_dbgprint_xxx() functions. r330433: Switch to the new bcd_clocktime conversion routines, and add calls to the new clock_dbgprint_xxx() functions. r330528: Fix a paste-o that broke the build. There is no softc pointer here, just use the dev arg. Reported by: Jonathan Looney Pointy hat: ian@ r330529: Build the ds1672 driver as a module. Add a detach() to unregister the rtc. r330767: Convert atrtc the new style rtc debugging output. Remove the db show command handler which provided much the same information. Removing the possibility of accessing the hardware regs from the debugger context paves the way for simplifying the locking code in the driver. Added: stable/11/sys/dev/iicbus/rtc8583.c - copied, changed from r325233, head/sys/dev/iicbus/rtc8583.c stable/11/sys/modules/i2c/ds1672/ - copied from r330529, head/sys/modules/i2c/ds1672/ stable/11/sys/modules/i2c/rtc8583/ - copied from r330412, head/sys/modules/i2c/rtc8583/ Modified: stable/11/sys/conf/files stable/11/sys/dev/iicbus/ds1307.c stable/11/sys/dev/iicbus/ds13rtc.c stable/11/sys/dev/iicbus/ds1672.c stable/11/sys/dev/iicbus/ds3231.c stable/11/sys/dev/iicbus/isl12xx.c stable/11/sys/dev/iicbus/nxprtc.c stable/11/sys/dev/iicbus/s35390a.c stable/11/sys/kern/subr_clock.c stable/11/sys/kern/subr_fattime.c stable/11/sys/kern/subr_rtc.c stable/11/sys/modules/i2c/Makefile stable/11/sys/sys/clock.h stable/11/sys/x86/isa/atrtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/conf/files Sat Mar 24 23:01:10 2018 (r331503) @@ -1768,6 +1768,7 @@ dev/iicbus/ds1307.c optional ds1307 dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/ds3231.c optional ds3231 +dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic Modified: stable/11/sys/dev/iicbus/ds1307.c ============================================================================== --- stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 23:01:10 2018 (r331503) @@ -359,6 +359,7 @@ ds1307_gettime(device_t dev, struct timespec *ts) bct.mon = data[DS1307_MONTH] & DS1307_MONTH_MASK; bct.year = data[DS1307_YEAR] & DS1307_YEAR_MASK; + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm)); } @@ -379,6 +380,7 @@ ds1307_settime(device_t dev, struct timespec *ts) */ ts->tv_sec -= utc_offset(); clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm); + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct); /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ if (sc->sc_use_ampm) { Modified: stable/11/sys/dev/iicbus/ds13rtc.c ============================================================================== --- stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -395,6 +395,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) if (sc->use_century) bct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 0x100 : 0; + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); return (err); @@ -422,6 +423,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts) return (write_timeword(sc, ts->tv_sec)); clock_ts_to_bcd(ts, &bct, sc->use_ampm); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); /* If the chip is in AMPM mode deal with the PM flag. */ pmflags = 0; Modified: stable/11/sys/dev/iicbus/ds1672.c ============================================================================== --- stable/11/sys/dev/iicbus/ds1672.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds1672.c Sat Mar 24 23:01:10 2018 (r331503) @@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$"); #define DS1672_CTRL_EOSC (1 << 7) /* Stop/start flag. */ -#define NANOSEC 1000000000 - #define MAX_IIC_DATA_SIZE 4 struct ds1672_softc { @@ -120,6 +118,14 @@ ds1672_init(device_t dev) } static int +ds1672_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + +static int ds1672_attach(device_t dev) { struct ds1672_softc *sc = device_get_softc(dev); @@ -144,8 +150,9 @@ ds1672_gettime(device_t dev, struct timespec *ts) /* counter has seconds since epoch */ ts->tv_sec = (secs[3] << 24) | (secs[2] << 16) | (secs[1] << 8) | (secs[0] << 0); - ts->tv_nsec = NANOSEC / 2; + ts->tv_nsec = 0; } + clock_dbgprint_ts(dev, CLOCK_DBG_READ, ts); return (error); } @@ -159,12 +166,15 @@ ds1672_settime(device_t dev, struct timespec *ts) data[2] = (ts->tv_sec >> 16) & 0xff; data[3] = (ts->tv_sec >> 24) & 0xff; + ts->tv_nsec = 0; + clock_dbgprint_ts(dev, CLOCK_DBG_WRITE, ts); return (ds1672_write(dev, DS1672_COUNTER, data, 4)); } static device_method_t ds1672_methods[] = { DEVMETHOD(device_probe, ds1672_probe), DEVMETHOD(device_attach, ds1672_attach), + DEVMETHOD(device_detach, ds1672_detach), DEVMETHOD(clock_gettime, ds1672_gettime), DEVMETHOD(clock_settime, ds1672_settime), Modified: stable/11/sys/dev/iicbus/ds3231.c ============================================================================== --- stable/11/sys/dev/iicbus/ds3231.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds3231.c Sat Mar 24 23:01:10 2018 (r331503) @@ -377,7 +377,7 @@ ds3231_attach(device_t dev) sc->sc_dev = dev; sc->sc_addr = iicbus_get_addr(dev); sc->sc_last_c = -1; - sc->sc_year0 = 1900; + sc->sc_year0 = 0; sc->enum_hook.ich_func = ds3231_start; sc->enum_hook.ich_arg = dev; @@ -477,7 +477,7 @@ static int ds3231_gettime(device_t dev, struct timespec *ts) { int c, error; - struct clocktime ct; + struct bcd_clocktime bct; struct ds3231_softc *sc; uint8_t data[7], hourmask; @@ -505,13 +505,14 @@ ds3231_gettime(device_t dev, struct timespec *ts) } else hourmask = DS3231_HOUR_MASK_24HR; - ct.nsec = 0; - ct.sec = FROMBCD(data[DS3231_SECS] & DS3231_SECS_MASK); - ct.min = FROMBCD(data[DS3231_MINS] & DS3231_MINS_MASK); - ct.hour = FROMBCD(data[DS3231_HOUR] & hourmask); - ct.day = FROMBCD(data[DS3231_DATE] & DS3231_DATE_MASK); - ct.mon = FROMBCD(data[DS3231_MONTH] & DS3231_MONTH_MASK); - ct.year = FROMBCD(data[DS3231_YEAR] & DS3231_YEAR_MASK); + bct.nsec = 0; + bct.sec = data[DS3231_SECS] & DS3231_SECS_MASK; + bct.min = data[DS3231_MINS] & DS3231_MINS_MASK; + bct.hour = data[DS3231_HOUR] & hourmask; + bct.day = data[DS3231_DATE] & DS3231_DATE_MASK; + bct.mon = data[DS3231_MONTH] & DS3231_MONTH_MASK; + bct.year = data[DS3231_YEAR] & DS3231_YEAR_MASK; + bct.ispm = data[DS3231_HOUR] & DS3231_HOUR_IS_PM; /* * If the century flag has toggled since we last saw it, there has been @@ -522,29 +523,20 @@ ds3231_gettime(device_t dev, struct timespec *ts) if (sc->sc_last_c == -1) sc->sc_last_c = c; else if (c != sc->sc_last_c) { - sc->sc_year0 += 100; + sc->sc_year0 += 0x100; sc->sc_last_c = c; } - ct.year += sc->sc_year0; - if (ct.year < POSIX_BASE_YEAR) - ct.year += 100; /* assume [1970, 2069] */ + bct.year |= sc->sc_year0; - /* If running in AM/PM mode, deal with it. */ - if (sc->sc_use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (data[DS3231_HOUR] & DS3231_HOUR_IS_PM) - ct.hour += 12; - } - - return (clock_ct_to_ts(&ct, ts)); + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm)); } static int ds3231_settime(device_t dev, struct timespec *ts) { int error; - struct clocktime ct; + struct bcd_clocktime bct; struct ds3231_softc *sc; uint8_t data[7]; uint8_t pmflags; @@ -556,27 +548,24 @@ ds3231_settime(device_t dev, struct timespec *ts) * disables utc adjustment, so apply that ourselves. */ ts->tv_sec -= utc_offset(); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm); + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct); /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ if (sc->sc_use_ampm) { pmflags = DS3231_HOUR_USE_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS3231_HOUR_IS_PM; - } - if (ct.hour == 0) - ct.hour = 12; } else pmflags = 0; - data[DS3231_SECS] = TOBCD(ct.sec); - data[DS3231_MINS] = TOBCD(ct.min); - data[DS3231_HOUR] = TOBCD(ct.hour) | pmflags; - data[DS3231_DATE] = TOBCD(ct.day); - data[DS3231_WEEKDAY] = ct.dow + 1; - data[DS3231_MONTH] = TOBCD(ct.mon); - data[DS3231_YEAR] = TOBCD(ct.year % 100); + data[DS3231_SECS] = bct.sec; + data[DS3231_MINS] = bct.min; + data[DS3231_HOUR] = bct.hour | pmflags; + data[DS3231_DATE] = bct.day; + data[DS3231_WEEKDAY] = bct.dow + 1; + data[DS3231_MONTH] = bct.mon; + data[DS3231_YEAR] = bct.year & 0xff; if (sc->sc_last_c) data[DS3231_MONTH] |= DS3231_C_MASK; Modified: stable/11/sys/dev/iicbus/isl12xx.c ============================================================================== --- stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 23:01:10 2018 (r331503) @@ -233,7 +233,7 @@ static int isl12xx_gettime(device_t dev, struct timespec *ts) { struct isl12xx_softc *sc = device_get_softc(dev); - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; int err; uint8_t hourmask, sreg; @@ -263,29 +263,24 @@ isl12xx_gettime(device_t dev, struct timespec *ts) hourmask = ISL12xx_12HR_MASK; } - ct.nsec = 0; - ct.sec = FROMBCD(tregs.sec); - ct.min = FROMBCD(tregs.min); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day); - ct.mon = FROMBCD(tregs.month); - ct.year = FROMBCD(tregs.year); + bct.nsec = 0; + bct.sec = tregs.sec; + bct.min = tregs.min; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day; + bct.mon = tregs.month; + bct.year = tregs.year; + bct.ispm = tregs.hour & ISL12XX_PM_FLAG; - if (sc->use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & ISL12XX_PM_FLAG) - ct.hour += 12; - } - - return (clock_ct_to_ts(&ct, ts)); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, sc->use_ampm)); } static int isl12xx_settime(device_t dev, struct timespec *ts) { struct isl12xx_softc *sc = device_get_softc(dev); - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; int err; uint8_t ampmflags, sreg; @@ -296,27 +291,21 @@ isl12xx_settime(device_t dev, struct timespec *ts) */ ts->tv_sec -= utc_offset(); ts->tv_nsec = 0; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); - /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ - if (!sc->use_ampm) { + /* If the chip is in AM/PM mode, set flags as needed. */ + if (!sc->use_ampm) ampmflags = ISL12XX_24HR_FLAG; - } else { - ampmflags = 0; - if (ct.hour >= 12) { - ct.hour -= 12; - ampmflags |= ISL12XX_PM_FLAG; - } - if (ct.hour == 0) - ct.hour = 12; - } + else + ampmflags = bct.ispm ? ISL12XX_PM_FLAG : 0; - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | ampmflags; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon); - tregs.year = TOBCD(ct.year % 100); + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | ampmflags; + tregs.day = bct.day; + tregs.month = bct.mon; + tregs.year = bct.year % 100; /* * To set the time we have to set the WRTC enable bit in the control Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -608,6 +608,7 @@ nxprtc_gettime(device_t dev, struct timespec *ts) sc->flags |= SC_F_CPOL; } + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); ts->tv_sec += utc_offset(); @@ -648,6 +649,7 @@ nxprtc_settime(device_t dev, struct timespec *ts) ts->tv_sec -= utc_offset(); ts->tv_nsec = 0; clock_ts_to_bcd(ts, &bct, sc->use_ampm); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); /* On 8563 set the century based on the polarity seen when reading. */ cflag = 0; Copied and modified: stable/11/sys/dev/iicbus/rtc8583.c (from r325233, head/sys/dev/iicbus/rtc8583.c) ============================================================================== --- head/sys/dev/iicbus/rtc8583.c Tue Oct 31 12:15:00 2017 (r325233, copy source) +++ stable/11/sys/dev/iicbus/rtc8583.c Sat Mar 24 23:01:10 2018 (r331503) @@ -190,7 +190,7 @@ static int rtc8583_gettime(device_t dev, struct timespec *ts) { struct rtc8583_softc *sc; - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; uint8_t y, ytmp, sreg; int err; @@ -227,42 +227,49 @@ rtc8583_gettime(device_t dev, struct timespec *ts) iicbus_release_bus(sc->busdev, sc->dev); } - ct.nsec = FROMBCD(tregs.msec) * 10 * 1000 * 1000; - ct.sec = FROMBCD(tregs.sec); - ct.min = FROMBCD(tregs.min); - ct.hour = FROMBCD(tregs.hour & 0x3f); - ct.day = FROMBCD(tregs.day & 0x3f); - ct.mon = FROMBCD(tregs.month & 0x1f); - ct.year = 2000 + sreg; + if (!validbcd(tregs.msec)) + return (EINVAL); - return (clock_ct_to_ts(&ct, ts)); + /* The 'msec' reg is actually 1/100ths, in bcd. */ + bct.nsec = bcd2bin(tregs.msec) * 10 * 1000 * 1000; + bct.sec = tregs.sec; + bct.min = tregs.min; + bct.hour = tregs.hour & 0x3f; + bct.day = tregs.day & 0x3f; + bct.mon = tregs.month & 0x1f; + bct.year = bin2bcd(sreg % 100); + + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, false)); } static int rtc8583_settime(device_t dev, struct timespec *ts) { struct rtc8583_softc *sc; - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; uint8_t sreg; int err; sc = device_get_softc(dev); ts->tv_sec -= utc_offset(); - ts->tv_nsec = 0; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, false); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour); - tregs.day = TOBCD(ct.day) | ((ct.year & 0x03) << 6); - tregs.month = TOBCD(ct.mon); + /* The 'msec' reg is actually 1/100ths, in bcd. */ + tregs.msec = bin2bcd(ts->tv_nsec / (10 * 1000 * 1000)); + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour; + tregs.day = bct.day | (bct.year & 0x03 << 6); + tregs.month = bct.mon; if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) != 0) return (err); err = rtc8583_writeto(sc->dev, RTC8583_SC_REG, &tregs, sizeof(tregs), IIC_WAIT); - sreg = ct.year - 2000; + sreg = bcd2bin(bct.year & 0xff); /* save to year to sram */ rtc8583_write1(sc, RTC8583_USERSRAM_REG, sreg); iicbus_release_bus(sc->busdev, sc->dev); Modified: stable/11/sys/dev/iicbus/s35390a.c ============================================================================== --- stable/11/sys/dev/iicbus/s35390a.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/s35390a.c Sat Mar 24 23:01:10 2018 (r331503) @@ -297,7 +297,7 @@ static int s390rtc_gettime(device_t dev, struct timespec *ts) { uint8_t bcd[S390_RT1_NBYTES]; - struct clocktime ct; + struct bcd_clocktime bct; int error; error = s390rtc_read(dev, S390_REALTIME1, bcd, S390_RT1_NBYTES); @@ -310,37 +310,39 @@ s390rtc_gettime(device_t dev, struct timespec *ts) /* * Convert the register values into something useable. */ - ct.nsec = 0; - ct.sec = FROMBCD(bcd[S390_RT1_SECOND]); - ct.min = FROMBCD(bcd[S390_RT1_MINUTE]); - ct.hour = FROMBCD(bcd[S390_RT1_HOUR] & 0x3f); - ct.day = FROMBCD(bcd[S390_RT1_DAY]); - ct.dow = bcd[S390_RT1_WDAY] & 0x07; - ct.mon = FROMBCD(bcd[S390_RT1_MONTH]); - ct.year = FROMBCD(bcd[S390_RT1_YEAR]) + 2000; + bct.nsec = 0; + bct.sec = bcd[S390_RT1_SECOND]; + bct.min = bcd[S390_RT1_MINUTE]; + bct.hour = bcd[S390_RT1_HOUR] & 0x3f; + bct.day = bcd[S390_RT1_DAY]; + bct.dow = bcd[S390_RT1_WDAY] & 0x07; + bct.mon = bcd[S390_RT1_MONTH]; + bct.year = bcd[S390_RT1_YEAR]; - return (clock_ct_to_ts(&ct, ts)); + clock_dbgprint_bcd(dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, false)); } static int s390rtc_settime(device_t dev, struct timespec *ts) { uint8_t bcd[S390_RT1_NBYTES]; - struct clocktime ct; + struct bcd_clocktime bct; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, false); + clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); /* * Convert our time representation into something the S-xx390 * can understand. */ - bcd[S390_RT1_SECOND] = TOBCD(ct.sec); - bcd[S390_RT1_MINUTE] = TOBCD(ct.min); - bcd[S390_RT1_HOUR] = TOBCD(ct.hour); - bcd[S390_RT1_DAY] = TOBCD(ct.day); - bcd[S390_RT1_WDAY] = ct.dow; - bcd[S390_RT1_MONTH] = TOBCD(ct.mon); - bcd[S390_RT1_YEAR] = TOBCD(ct.year % 100); + bcd[S390_RT1_SECOND] = bct.sec; + bcd[S390_RT1_MINUTE] = bct.min; + bcd[S390_RT1_HOUR] = bct.hour; + bcd[S390_RT1_DAY] = bct.day; + bcd[S390_RT1_WDAY] = bct.dow; + bcd[S390_RT1_MONTH] = bct.mon; + bcd[S390_RT1_YEAR] = bct.year & 0xff; return (s390rtc_write(dev, S390_REALTIME1, bcd, S390_RT1_NBYTES)); } Modified: stable/11/sys/kern/subr_clock.c ============================================================================== --- stable/11/sys/kern/subr_clock.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/kern/subr_clock.c Sat Mar 24 23:01:10 2018 (r331503) @@ -108,6 +108,14 @@ static const int recent_base_year = 2017; static const int recent_base_days = 17167; /* + * Table to 'calculate' pow(10, 9 - nsdigits) via lookup of nsdigits. + * Before doing the lookup, the code asserts 0 <= nsdigits <= 9. + */ +static u_int nsdivisors[] = { + 1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1 +}; + +/* * This inline avoids some unnecessary modulo operations * as compared with the usual macro: * ( ((year % 4) == 0 && @@ -131,23 +139,15 @@ leapyear(int year) return (rv); } -static void -print_ct(struct clocktime *ct) -{ - printf("[%04d-%02d-%02d %02d:%02d:%02d]", - ct->year, ct->mon, ct->day, - ct->hour, ct->min, ct->sec); -} - int -clock_ct_to_ts(struct clocktime *ct, struct timespec *ts) +clock_ct_to_ts(const struct clocktime *ct, struct timespec *ts) { int i, year, days; if (ct_debug) { - printf("ct_to_ts("); - print_ct(ct); - printf(")"); + printf("ct_to_ts(["); + clock_print_ct(ct, 9); + printf("])"); } /* @@ -200,7 +200,7 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * } int -clock_bcd_to_ts(struct bcd_clocktime *bct, struct timespec *ts, bool ampm) +clock_bcd_to_ts(const struct bcd_clocktime *bct, struct timespec *ts, bool ampm) { struct clocktime ct; int bcent, byear; @@ -249,7 +249,7 @@ clock_bcd_to_ts(struct bcd_clocktime *bct, struct time } void -clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) +clock_ts_to_ct(const struct timespec *ts, struct clocktime *ct) { int i, year, days; time_t rsec; /* remainder seconds */ @@ -288,15 +288,15 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * ct->sec = rsec; ct->nsec = ts->tv_nsec; if (ct_debug) { - printf("ts_to_ct(%jd.%09ld) = ", + printf("ts_to_ct(%jd.%09ld) = [", (intmax_t)ts->tv_sec, ts->tv_nsec); - print_ct(ct); - printf("\n"); + clock_print_ct(ct, 9); + printf("]\n"); } } void -clock_ts_to_bcd(struct timespec *ts, struct bcd_clocktime *bct, bool ampm) +clock_ts_to_bcd(const struct timespec *ts, struct bcd_clocktime *bct, bool ampm) { struct clocktime ct; @@ -321,6 +321,51 @@ clock_ts_to_bcd(struct timespec *ts, struct bcd_clockt bct->sec = TOBCD(ct.sec); bct->dow = ct.dow; bct->nsec = ct.nsec; +} + +void +clock_print_bcd(const struct bcd_clocktime *bct, int nsdigits) +{ + + KASSERT(nsdigits >= 0 && nsdigits <= 9, ("bad nsdigits %d", nsdigits)); + + if (nsdigits > 0) { + printf("%4.4x-%2.2x-%2.2x %2.2x:%2.2x:%2.2x.%*.*ld", + bct->year, bct->mon, bct->day, + bct->hour, bct->min, bct->sec, + nsdigits, nsdigits, bct->nsec / nsdivisors[nsdigits]); + } else { + printf("%4.4x-%2.2x-%2.2x %2.2x:%2.2x:%2.2x", + bct->year, bct->mon, bct->day, + bct->hour, bct->min, bct->sec); + } +} + +void +clock_print_ct(const struct clocktime *ct, int nsdigits) +{ + + KASSERT(nsdigits >= 0 && nsdigits <= 9, ("bad nsdigits %d", nsdigits)); + + if (nsdigits > 0) { + printf("%04d-%02d-%02d %02d:%02d:%02d.%*.*ld", + ct->year, ct->mon, ct->day, + ct->hour, ct->min, ct->sec, + nsdigits, nsdigits, ct->nsec / nsdivisors[nsdigits]); + } else { + printf("%04d-%02d-%02d %02d:%02d:%02d", + ct->year, ct->mon, ct->day, + ct->hour, ct->min, ct->sec); + } +} + +void +clock_print_ts(const struct timespec *ts, int nsdigits) +{ + struct clocktime ct; + + clock_ts_to_ct(ts, &ct); + clock_print_ct(&ct, nsdigits); } int Modified: stable/11/sys/kern/subr_fattime.c ============================================================================== --- stable/11/sys/kern/subr_fattime.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/kern/subr_fattime.c Sat Mar 24 23:01:10 2018 (r331503) @@ -135,7 +135,8 @@ static const struct { void -timespec2fattime(struct timespec *tsp, int utc, uint16_t *ddp, uint16_t *dtp, uint8_t *dhp) +timespec2fattime(const struct timespec *tsp, int utc, uint16_t *ddp, + uint16_t *dtp, uint8_t *dhp) { time_t t1; unsigned t2, l, m; @@ -215,7 +216,8 @@ static const uint16_t daytab[64] = { }; void -fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct timespec *tsp) +fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, + struct timespec *tsp) { unsigned day; Modified: stable/11/sys/kern/subr_rtc.c ============================================================================== --- stable/11/sys/kern/subr_rtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/kern/subr_rtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -76,6 +76,15 @@ __FBSDID("$FreeBSD$"); #include "clock_if.h" +static int show_io; +SYSCTL_INT(_debug, OID_AUTO, clock_show_io, CTLFLAG_RWTUN, &show_io, 0, + "Enable debug printing of RTC clock I/O; 1=reads, 2=writes, 3=both."); + +static int sysctl_clock_do_io(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_debug, OID_AUTO, clock_do_io, CTLTYPE_INT | CTLFLAG_RW, + 0, 0, sysctl_clock_do_io, "I", + "Trigger one-time IO on RTC clocks; 1=read (and discard), 2=write"); + /* XXX: should be kern. now, it's no longer machdep. */ static int disable_rtc_set; SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, @@ -144,7 +153,61 @@ settime_task_func(void *arg, int pending) CLOCK_SETTIME(rtc->clockdev, &ts); } +static void +clock_dbgprint_hdr(device_t dev, int rw) +{ + struct timespec now; + + getnanotime(&now); + device_printf(dev, "%s at ", (rw & CLOCK_DBG_READ) ? "read " : "write"); + clock_print_ts(&now, 9); + printf(": "); +} + void +clock_dbgprint_bcd(device_t dev, int rw, const struct bcd_clocktime *bct) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + clock_print_bcd(bct, 9); + printf("\n"); + } +} + +void +clock_dbgprint_ct(device_t dev, int rw, const struct clocktime *ct) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + clock_print_ct(ct, 9); + printf("\n"); + } +} + +void +clock_dbgprint_err(device_t dev, int rw, int err) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + printf("error = %d\n", err); + } +} + +void +clock_dbgprint_ts(device_t dev, int rw, const struct timespec *ts) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + clock_print_ts(ts, 9); + printf("\n"); + } +} + +void clock_register_flags(device_t clockdev, long resolution, int flags) { struct rtc_instance *rtc, *newrtc; @@ -203,7 +266,7 @@ clock_unregister(device_t clockdev) if (rtc != NULL) { taskqueue_cancel_timeout(taskqueue_thread, &rtc->stask, NULL); taskqueue_drain_timeout(taskqueue_thread, &rtc->stask); - free(rtc, M_DEVBUF); + free(rtc, M_DEVBUF); } } @@ -222,6 +285,36 @@ clock_schedule(device_t clockdev, u_int offsetns) sx_xunlock(&rtc_list_lock); } +static int +read_clocks(struct timespec *ts, bool debug_read) +{ + struct rtc_instance *rtc; + int error; + + error = ENXIO; + sx_xlock(&rtc_list_lock); + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if ((error = CLOCK_GETTIME(rtc->clockdev, ts)) != 0) + continue; + if (ts->tv_sec < 0 || ts->tv_nsec < 0) { + error = EINVAL; + continue; + } + if (!(rtc->flags & CLOCKF_GETTIME_NO_ADJ)) { + timespecadd(ts, &rtc->resadj); + ts->tv_sec += utc_offset(); + } + if (!debug_read) { + if (bootverbose) + device_printf(rtc->clockdev, + "providing initial system time\n"); + break; + } + } + sx_xunlock(&rtc_list_lock); + return (error); +} + /* * Initialize the system time. Must be called from a context which does not * restrict any locking or sleeping that clock drivers may need to do. @@ -238,28 +331,9 @@ void inittodr(time_t base) { struct timespec ts; - struct rtc_instance *rtc; int error; - error = ENXIO; - sx_xlock(&rtc_list_lock); - LIST_FOREACH(rtc, &rtc_list, rtc_entries) { - if ((error = CLOCK_GETTIME(rtc->clockdev, &ts)) != 0) - continue; - if (ts.tv_sec < 0 || ts.tv_nsec < 0) { - error = EINVAL; - continue; - } - if (!(rtc->flags & CLOCKF_GETTIME_NO_ADJ)) { - timespecadd(&ts, &rtc->resadj); - ts.tv_sec += utc_offset(); - } - if (bootverbose) - device_printf(rtc->clockdev, - "providing initial system time\n"); - break; - } - sx_xunlock(&rtc_list_lock); + error = read_clocks(&ts, false); /* * Do not report errors from each clock; it is expected that some clocks @@ -321,4 +395,30 @@ resettodr(void) &rtc->stask, -sbt, 0, C_PREL(31)); } sx_xunlock(&rtc_list_lock); +} + +static int +sysctl_clock_do_io(SYSCTL_HANDLER_ARGS) +{ + struct timespec ts_discard; + int error, value; + + value = 0; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + + switch (value) { + case CLOCK_DBG_READ: + if (read_clocks(&ts_discard, true) == ENXIO) + printf("No registered RTC clocks\n"); + break; + case CLOCK_DBG_WRITE: + resettodr(); + break; + default: + return (EINVAL); + } + + return (0); } Modified: stable/11/sys/modules/i2c/Makefile ============================================================================== --- stable/11/sys/modules/i2c/Makefile Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/modules/i2c/Makefile Sat Mar 24 23:01:10 2018 (r331503) @@ -5,6 +5,7 @@ SUBDIR = \ cyapa \ ds1307 \ ds13rtc \ + ds1672 \ ds3231 \ icee \ if_ic \ @@ -17,6 +18,7 @@ SUBDIR = \ jedec_dimm \ jedec_ts \ nxprtc \ + rtc8583 \ s35390a \ smb \ smbus \ Modified: stable/11/sys/sys/clock.h ============================================================================== --- stable/11/sys/sys/clock.h Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/sys/clock.h Sat Mar 24 23:01:10 2018 (r331503) @@ -88,8 +88,8 @@ struct clocktime { long nsec; /* nano seconds */ }; -int clock_ct_to_ts(struct clocktime *, struct timespec *); -void clock_ts_to_ct(struct timespec *, struct clocktime *); +int clock_ct_to_ts(const struct clocktime *, struct timespec *); +void clock_ts_to_ct(const struct timespec *, struct clocktime *); /* * Structure to hold the values typically reported by time-of-day clocks, @@ -125,8 +125,8 @@ struct bcd_clocktime { bool ispm; /* true if hour represents pm time */ }; -int clock_bcd_to_ts(struct bcd_clocktime *, struct timespec *, bool ampm); -void clock_ts_to_bcd(struct timespec *, struct bcd_clocktime *, bool ampm); +int clock_bcd_to_ts(const struct bcd_clocktime *, struct timespec *, bool ampm); +void clock_ts_to_bcd(const struct timespec *, struct bcd_clocktime *, bool ampm); /* * Time-of-day clock functions and flags. These functions might sleep. @@ -177,8 +177,31 @@ void clock_unregister(device_t _clockdev); /* Traditional POSIX base year */ #define POSIX_BASE_YEAR 1970 -void timespec2fattime(struct timespec *tsp, int utc, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp); -void fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct timespec *tsp); +void timespec2fattime(const struct timespec *tsp, int utc, u_int16_t *ddp, + u_int16_t *dtp, u_int8_t *dhp); +void fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, + struct timespec *tsp); + +/* + * Print a [bcd_]clocktime or timespec, optionally with fractional seconds. The + * nsdig argument can range from 0-9, and specifies how many decimal digits to + * display for fractional seconds. + */ +void clock_print_bcd(const struct bcd_clocktime *bct, int nsdig); +void clock_print_ct(const struct clocktime *ct, int nsdig); +void clock_print_ts(const struct timespec *ts, int nsdig); + +/* + * Debugging helpers for RTC clock drivers. Print a [bcd_]clocktime or + * timespec, only if rtc clock debugging has been enabled. The rw argument is + * one of CLOCK_DBG_READ or CLOCK_DBG_WRITE. + */ +#define CLOCK_DBG_READ 0x01 +#define CLOCK_DBG_WRITE 0x02 +void clock_dbgprint_bcd(device_t dev, int rw, const struct bcd_clocktime *bct); +void clock_dbgprint_ct(device_t dev, int rw, const struct clocktime *ct); +void clock_dbgprint_err(device_t dev, int rw, int err); +void clock_dbgprint_ts(device_t dev, int rw, const struct timespec *ts); #endif /* _KERNEL */ Modified: stable/11/sys/x86/isa/atrtc.c ============================================================================== --- stable/11/sys/x86/isa/atrtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/x86/isa/atrtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -316,6 +316,7 @@ atrtc_settime(device_t dev __unused, struct timespec * struct bcd_clocktime bct; clock_ts_to_bcd(ts, &bct, false); + clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); mtx_lock(&atrtc_time_lock); RTC_LOCK; @@ -383,6 +384,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) /* dow is unused in timespec conversion and we have no nsec info. */ bct.dow = 0; bct.nsec = 0; + clock_dbgprint_bcd(dev, CLOCK_DBG_READ, &bct); return (clock_bcd_to_ts(&bct, ts, false)); } @@ -413,16 +415,3 @@ static devclass_t atrtc_devclass; DRIVER_MODULE(atrtc, isa, atrtc_driver, atrtc_devclass, 0, 0); DRIVER_MODULE(atrtc, acpi, atrtc_driver, atrtc_devclass, 0, 0); - -#include "opt_ddb.h" -#ifdef DDB -#include - -DB_SHOW_COMMAND(rtc, rtc) -{ - printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n", - rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY), - rtcin(RTC_HRS), rtcin(RTC_MIN), rtcin(RTC_SEC), - rtcin(RTC_STATUSA), rtcin(RTC_STATUSB), rtcin(RTC_INTR)); -} -#endif /* DDB */ From owner-svn-src-all@freebsd.org Sat Mar 24 23:04:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3437F53D7F; Sat, 24 Mar 2018 23:03:59 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A69DE8499A; Sat, 24 Mar 2018 23:03:59 +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 A179415CB2; Sat, 24 Mar 2018 23:03:59 +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 w2ON3xOB026663; Sat, 24 Mar 2018 23:03:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ON3x5t026661; Sat, 24 Mar 2018 23:03:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242303.w2ON3x5t026661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331504 - stable/11/sys/dev/gpio X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/gpio X-SVN-Commit-Revision: 331504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 23:04:00 -0000 Author: ian Date: Sat Mar 24 23:03:59 2018 New Revision: 331504 URL: https://svnweb.freebsd.org/changeset/base/331504 Log: MFC r329537: Provide a public function to acquire a gpio pin by giving the property name and index. A private function to do exactly that already existed, so this renames gpio_pin_get_by_ofw_impl() to gpio_pin_get_by_ofw_propidx() and provides a declaration for it in a public header. Previously there were functions to get a pin by property name (assuming there would only be one pin defined for the name), or by index (asuming the property has the standard name "gpios"). It turns out there are devicetree bindings that describe properties with names other than "gpios" which can describe multiple pins. Hence the need to retrieve the Nth item from a named property. Modified: stable/11/sys/dev/gpio/gpiobusvar.h stable/11/sys/dev/gpio/ofw_gpiobus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/gpio/gpiobusvar.h ============================================================================== --- stable/11/sys/dev/gpio/gpiobusvar.h Sat Mar 24 23:01:10 2018 (r331503) +++ stable/11/sys/dev/gpio/gpiobusvar.h Sat Mar 24 23:03:59 2018 (r331504) @@ -133,6 +133,8 @@ int gpio_pin_get_by_ofw_idx(device_t consumer, phandle int idx, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_property(device_t consumer, phandle_t node, char *name, gpio_pin_t *gpio); +int gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t node, + char *name, int idx, gpio_pin_t *gpio); void gpio_pin_release(gpio_pin_t gpio); int gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps); int gpio_pin_is_active(gpio_pin_t pin, bool *active); Modified: stable/11/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- stable/11/sys/dev/gpio/ofw_gpiobus.c Sat Mar 24 23:01:10 2018 (r331503) +++ stable/11/sys/dev/gpio/ofw_gpiobus.c Sat Mar 24 23:03:59 2018 (r331504) @@ -57,8 +57,8 @@ static int ofw_gpiobus_parse_gpios_impl(device_t, phan * tree consumers. * */ -static int -gpio_pin_get_by_ofw_impl(device_t consumer, phandle_t cnode, +int +gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t cnode, char *prop_name, int idx, gpio_pin_t *out_pin) { phandle_t xref; @@ -112,7 +112,7 @@ gpio_pin_get_by_ofw_idx(device_t consumer, phandle_t n int idx, gpio_pin_t *pin) { - return (gpio_pin_get_by_ofw_impl(consumer, node, "gpios", idx, pin)); + return (gpio_pin_get_by_ofw_propidx(consumer, node, "gpios", idx, pin)); } int @@ -120,7 +120,7 @@ gpio_pin_get_by_ofw_property(device_t consumer, phandl char *name, gpio_pin_t *pin) { - return (gpio_pin_get_by_ofw_impl(consumer, node, name, 0, pin)); + return (gpio_pin_get_by_ofw_propidx(consumer, node, name, 0, pin)); } int From owner-svn-src-all@freebsd.org Sat Mar 24 23:07:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A27F541D7; Sat, 24 Mar 2018 23:07:10 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85BA784BD2; Sat, 24 Mar 2018 23:07:10 +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 7C69915CB4; Sat, 24 Mar 2018 23:07:10 +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 w2ON7AdH026813; Sat, 24 Mar 2018 23:07:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ON7AT4026812; Sat, 24 Mar 2018 23:07:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242307.w2ON7AT4026812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331505 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 331505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 23:07:11 -0000 Author: ian Date: Sat Mar 24 23:07:10 2018 New Revision: 331505 URL: https://svnweb.freebsd.org/changeset/base/331505 Log: MFC r329642: Adjust whitespace of things added in the past couple years to match the original style of the file. No functional changes. Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:03:59 2018 (r331504) +++ stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:07:10 2018 (r331505) @@ -31,113 +31,113 @@ #ifndef IMX6_CCMREG_H #define IMX6_CCMREG_H -#define CCM_CACCR 0x010 -#define CCM_CBCDR 0x014 -#define CBCDR_MMDC_CH1_AXI_PODF_SHIFT 3 -#define CBCDR_MMDC_CH1_AXI_PODF_MASK (7 << 3) -#define CCM_CSCMR1 0x01C -#define SSI1_CLK_SEL_S 10 -#define SSI2_CLK_SEL_S 12 -#define SSI3_CLK_SEL_S 14 -#define SSI_CLK_SEL_M 0x3 -#define SSI_CLK_SEL_508_PFD 0 -#define SSI_CLK_SEL_454_PFD 1 -#define SSI_CLK_SEL_PLL4 2 -#define CCM_CSCMR2 0x020 -#define CSCMR2_LDB_DI0_IPU_DIV_SHIFT 10 -#define CCM_CS1CDR 0x028 -#define SSI1_CLK_PODF_SHIFT 0 -#define SSI1_CLK_PRED_SHIFT 6 -#define SSI3_CLK_PODF_SHIFT 16 -#define SSI3_CLK_PRED_SHIFT 22 -#define SSI_CLK_PODF_MASK 0x3f -#define SSI_CLK_PRED_MASK 0x7 -#define CCM_CS2CDR 0x02C -#define SSI2_CLK_PODF_SHIFT 0 -#define SSI2_CLK_PRED_SHIFT 6 -#define LDB_DI0_CLK_SEL_SHIFT 9 -#define LDB_DI0_CLK_SEL_MASK (3 << LDB_DI0_CLK_SEL_SHIFT) -#define CCM_CHSCCDR 0x034 -#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK (0x7 << 6) -#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT 6 -#define CHSCCDR_IPU1_DI0_PODF_MASK (0x7 << 3) -#define CHSCCDR_IPU1_DI0_PODF_SHIFT 3 -#define CHSCCDR_IPU1_DI0_CLK_SEL_MASK (0x7) -#define CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT 0 -#define CHSCCDR_CLK_SEL_LDB_DI0 3 -#define CHSCCDR_PODF_DIVIDE_BY_3 2 -#define CHSCCDR_IPU_PRE_CLK_540M_PFD 5 -#define CCM_CSCDR2 0x038 -#define CCM_CLPCR 0x054 -#define CCM_CLPCR_LPM_MASK 0x03 -#define CCM_CLPCR_LPM_RUN 0x00 -#define CCM_CLPCR_LPM_WAIT 0x01 -#define CCM_CLPCR_LPM_STOP 0x02 -#define CCM_CGPR 0x064 -#define CCM_CGPR_INT_MEM_CLK_LPM (1 << 17) -#define CCM_CCGR0 0x068 -#define CCGR0_AIPS_TZ1 (0x3 << 0) -#define CCGR0_AIPS_TZ2 (0x3 << 2) -#define CCGR0_ABPHDMA (0x3 << 4) -#define CCM_CCGR1 0x06C -#define CCGR1_ENET (0x3 << 10) -#define CCGR1_EPIT1 (0x3 << 12) -#define CCGR1_EPIT2 (0x3 << 14) -#define CCGR1_GPT (0x3 << 20) -#define CCGR1_GPT_SERIAL (0x3 << 22) -#define CCM_CCGR2 0x070 -#define CCGR2_HDMI_TX (0x3 << 0) -#define CCGR2_HDMI_TX_ISFR (0x3 << 4) -#define CCGR2_I2C1 (0x3 << 6) -#define CCGR2_I2C2 (0x3 << 8) -#define CCGR2_I2C3 (0x3 << 10) -#define CCGR2_IIM (0x3 << 12) -#define CCGR2_IOMUX_IPT (0x3 << 14) -#define CCGR2_IPMUX1 (0x3 << 16) -#define CCGR2_IPMUX2 (0x3 << 18) -#define CCGR2_IPMUX3 (0x3 << 20) -#define CCGR2_IPSYNC_IP2APB_TZASC1 (0x3 << 22) -#define CCGR2_IPSYNC_IP2APB_TZASC2 (0x3 << 24) -#define CCGR2_IPSYNC_VDOA (0x3 << 26) -#define CCM_CCGR3 0x074 -#define CCGR3_IPU1_IPU (0x3 << 0) -#define CCGR3_IPU1_DI0 (0x3 << 2) -#define CCGR3_IPU1_DI1 (0x3 << 4) -#define CCGR3_IPU2_IPU (0x3 << 6) -#define CCGR3_IPU2_DI0 (0x3 << 8) -#define CCGR3_IPU2_DI1 (0x3 << 10) -#define CCGR3_LDB_DI0 (0x3 << 12) -#define CCGR3_LDB_DI1 (0x3 << 14) -#define CCGR3_MMDC_CORE_ACLK_FAST (0x3 << 20) -#define CCGR3_CG11 (0x3 << 22) -#define CCGR3_MMDC_CORE_IPG (0x3 << 24) -#define CCGR3_CG13 (0x3 << 26) -#define CCGR3_OCRAM (0x3 << 28) -#define CCM_CCGR4 0x078 -#define CCGR4_PL301_MX6QFAST1_S133 (0x3 << 8) -#define CCGR4_PL301_MX6QPER1_BCH (0x3 << 12) -#define CCGR4_PL301_MX6QPER2_MAIN (0x3 << 14) -#define CCM_CCGR5 0x07C -#define CCGR5_SATA (0x3 << 4) -#define CCGR5_SDMA (0x3 << 6) -#define CCGR5_SSI1 (0x3 << 18) -#define CCGR5_SSI2 (0x3 << 20) -#define CCGR5_SSI3 (0x3 << 22) -#define CCGR5_UART (0x3 << 24) -#define CCGR5_UART_SERIAL (0x3 << 26) -#define CCM_CCGR6 0x080 -#define CCGR6_USBOH3 (0x3 << 0) -#define CCGR6_USDHC1 (0x3 << 2) -#define CCGR6_USDHC2 (0x3 << 4) -#define CCGR6_USDHC3 (0x3 << 6) -#define CCGR6_USDHC4 (0x3 << 8) -#define CCM_CMEOR 0x088 - -#define CCM_ANALOG_PLL_ENET 0x000040e0 -#define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) -#define CCM_ANALOG_PLL_ENET_ENABLE_100M (1u << 20) /* SATA */ -#define CCM_ANALOG_PLL_ENET_BYPASS (1u << 16) -#define CCM_ANALOG_PLL_ENET_ENABLE (1u << 13) /* Ether */ -#define CCM_ANALOG_PLL_ENET_POWERDOWN (1u << 12) +#define CCM_CACCR 0x010 +#define CCM_CBCDR 0x014 +#define CBCDR_MMDC_CH1_AXI_PODF_SHIFT 3 +#define CBCDR_MMDC_CH1_AXI_PODF_MASK (7 << 3) +#define CCM_CSCMR1 0x01C +#define SSI1_CLK_SEL_S 10 +#define SSI2_CLK_SEL_S 12 +#define SSI3_CLK_SEL_S 14 +#define SSI_CLK_SEL_M 0x3 +#define SSI_CLK_SEL_508_PFD 0 +#define SSI_CLK_SEL_454_PFD 1 +#define SSI_CLK_SEL_PLL4 2 +#define CCM_CSCMR2 0x020 +#define CSCMR2_LDB_DI0_IPU_DIV_SHIFT 10 +#define CCM_CS1CDR 0x028 +#define SSI1_CLK_PODF_SHIFT 0 +#define SSI1_CLK_PRED_SHIFT 6 +#define SSI3_CLK_PODF_SHIFT 16 +#define SSI3_CLK_PRED_SHIFT 22 +#define SSI_CLK_PODF_MASK 0x3f +#define SSI_CLK_PRED_MASK 0x7 +#define CCM_CS2CDR 0x02C +#define SSI2_CLK_PODF_SHIFT 0 +#define SSI2_CLK_PRED_SHIFT 6 +#define LDB_DI0_CLK_SEL_SHIFT 9 +#define LDB_DI0_CLK_SEL_MASK (3 << LDB_DI0_CLK_SEL_SHIFT) +#define CCM_CHSCCDR 0x034 +#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK (0x7 << 6) +#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT 6 +#define CHSCCDR_IPU1_DI0_PODF_MASK (0x7 << 3) +#define CHSCCDR_IPU1_DI0_PODF_SHIFT 3 +#define CHSCCDR_IPU1_DI0_CLK_SEL_MASK (0x7) +#define CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT 0 +#define CHSCCDR_CLK_SEL_LDB_DI0 3 +#define CHSCCDR_PODF_DIVIDE_BY_3 2 +#define CHSCCDR_IPU_PRE_CLK_540M_PFD 5 +#define CCM_CSCDR2 0x038 +#define CCM_CLPCR 0x054 +#define CCM_CLPCR_LPM_MASK 0x03 +#define CCM_CLPCR_LPM_RUN 0x00 +#define CCM_CLPCR_LPM_WAIT 0x01 +#define CCM_CLPCR_LPM_STOP 0x02 +#define CCM_CGPR 0x064 +#define CCM_CGPR_INT_MEM_CLK_LPM (1 << 17) +#define CCM_CCGR0 0x068 +#define CCGR0_AIPS_TZ1 (0x3 << 0) +#define CCGR0_AIPS_TZ2 (0x3 << 2) +#define CCGR0_ABPHDMA (0x3 << 4) +#define CCM_CCGR1 0x06C +#define CCGR1_ENET (0x3 << 10) +#define CCGR1_EPIT1 (0x3 << 12) +#define CCGR1_EPIT2 (0x3 << 14) +#define CCGR1_GPT (0x3 << 20) +#define CCGR1_GPT_SERIAL (0x3 << 22) +#define CCM_CCGR2 0x070 +#define CCGR2_HDMI_TX (0x3 << 0) +#define CCGR2_HDMI_TX_ISFR (0x3 << 4) +#define CCGR2_I2C1 (0x3 << 6) +#define CCGR2_I2C2 (0x3 << 8) +#define CCGR2_I2C3 (0x3 << 10) +#define CCGR2_IIM (0x3 << 12) +#define CCGR2_IOMUX_IPT (0x3 << 14) +#define CCGR2_IPMUX1 (0x3 << 16) +#define CCGR2_IPMUX2 (0x3 << 18) +#define CCGR2_IPMUX3 (0x3 << 20) +#define CCGR2_IPSYNC_IP2APB_TZASC1 (0x3 << 22) +#define CCGR2_IPSYNC_IP2APB_TZASC2 (0x3 << 24) +#define CCGR2_IPSYNC_VDOA (0x3 << 26) +#define CCM_CCGR3 0x074 +#define CCGR3_IPU1_IPU (0x3 << 0) +#define CCGR3_IPU1_DI0 (0x3 << 2) +#define CCGR3_IPU1_DI1 (0x3 << 4) +#define CCGR3_IPU2_IPU (0x3 << 6) +#define CCGR3_IPU2_DI0 (0x3 << 8) +#define CCGR3_IPU2_DI1 (0x3 << 10) +#define CCGR3_LDB_DI0 (0x3 << 12) +#define CCGR3_LDB_DI1 (0x3 << 14) +#define CCGR3_MMDC_CORE_ACLK_FAST (0x3 << 20) +#define CCGR3_CG11 (0x3 << 22) +#define CCGR3_MMDC_CORE_IPG (0x3 << 24) +#define CCGR3_CG13 (0x3 << 26) +#define CCGR3_OCRAM (0x3 << 28) +#define CCM_CCGR4 0x078 +#define CCGR4_PL301_MX6QFAST1_S133 (0x3 << 8) +#define CCGR4_PL301_MX6QPER1_BCH (0x3 << 12) +#define CCGR4_PL301_MX6QPER2_MAIN (0x3 << 14) +#define CCM_CCGR5 0x07C +#define CCGR5_SATA (0x3 << 4) +#define CCGR5_SDMA (0x3 << 6) +#define CCGR5_SSI1 (0x3 << 18) +#define CCGR5_SSI2 (0x3 << 20) +#define CCGR5_SSI3 (0x3 << 22) +#define CCGR5_UART (0x3 << 24) +#define CCGR5_UART_SERIAL (0x3 << 26) +#define CCM_CCGR6 0x080 +#define CCGR6_USBOH3 (0x3 << 0) +#define CCGR6_USDHC1 (0x3 << 2) +#define CCGR6_USDHC2 (0x3 << 4) +#define CCGR6_USDHC3 (0x3 << 6) +#define CCGR6_USDHC4 (0x3 << 8) +#define CCM_CMEOR 0x088 + +#define CCM_ANALOG_PLL_ENET 0x000040e0 +#define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) +#define CCM_ANALOG_PLL_ENET_ENABLE_100M (1u << 20) /* SATA */ +#define CCM_ANALOG_PLL_ENET_BYPASS (1u << 16) +#define CCM_ANALOG_PLL_ENET_ENABLE (1u << 13) /* Ether */ +#define CCM_ANALOG_PLL_ENET_POWERDOWN (1u << 12) #endif From owner-svn-src-all@freebsd.org Sat Mar 24 23:23:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22024F5575C; Sat, 24 Mar 2018 23:23:34 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3F15858E9; Sat, 24 Mar 2018 23:23:33 +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 AD19F15FEC; Sat, 24 Mar 2018 23:23:33 +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 w2ONNXnd036281; Sat, 24 Mar 2018 23:23:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ONNVMg036256; Sat, 24 Mar 2018 23:23:31 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242323.w2ONNVMg036256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331506 - in stable/11/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/samsung/exynos arm/ti dev/flash dev/spibus dev/xilinx mips/atheros mips/medi... X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/samsung/exynos arm/ti dev/flash dev/spibus dev/xilinx mips/atheros mips/mediatek mips/rt305x modules ... X-SVN-Commit-Revision: 331506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 23:23:34 -0000 Author: ian Date: Sat Mar 24 23:23:31 2018 New Revision: 331506 URL: https://svnweb.freebsd.org/changeset/base/331506 Log: MFC r310017, r310229, r312289, r327260, r329539, r329544-r329546, r329620, r329729, r329911, r329999 r310017: [spi] reformat message This commit corrects print of nomatch (newline was too early) Submitted by: Hiroki Mori Reviewed by: ray, loos, mizhka Differential Revision: https://reviews.freebsd.org/D8749 r310229: ofw_spi: Parse property for the SPI mode and CS polarity. As cs is stored in a uint32_t, use the last bit to store the active high flag as it's unlikely that we will have that much CS. Reviewed by: loos Differential Revision: https://reviews.freebsd.org/D8614 r312289: [spibus] small code refactoring Merge 3 sequential printf calls into one. Reported by: rpokala Reviewed by: rpokala, adrian Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8795 r327260: SPDX: fix wrong license ID tag in dev/spibus. r329539: Provide public declarations for ofw_spibus_driver and ofw_spibus_devclass so other drivers can refer to them in DRIVER_MODULE() decls. r329544: Add modules/spi as a gathering point for SPI-related modules, analagous to modules/i2c for i2c/iicbus modules. Build spibus as a module. r329545: Add ofw_bus_if.h to SRCS. r329546: Build at45d and mx25l SPI flash drivers as modules. r329620: Add missing MODULE_DEPENDS(). r329729: Remove some files that snuck in via cut and paste. Having these compiled into the module causes the kobj method descriptors to be resolved incorrectly (by the compile-time linker instead of the kernel linker), which then leads to hours of frustrating debugging. r329911: Add a functional detach() routine, to make things kldunload-friendly. r329999: Add a SPI driver for imx5 and imx6. It can be compiled into the kernel with "device imx_spi" or loaded as a module, which is also named "imx_spi". Added: stable/11/sys/arm/freescale/imx/imx_spi.c - copied unchanged from r329999, head/sys/arm/freescale/imx/imx_spi.c stable/11/sys/modules/imx/imx_spi/ - copied from r329999, head/sys/modules/imx/imx_spi/ stable/11/sys/modules/spi/ - copied from r329546, head/sys/modules/spi/ Modified: stable/11/sys/arm/at91/at91_spi.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c stable/11/sys/arm/freescale/imx/files.imx5 stable/11/sys/arm/freescale/imx/files.imx6 stable/11/sys/arm/freescale/imx/imx51_ccm.c stable/11/sys/arm/freescale/imx/imx6_ccm.c stable/11/sys/arm/freescale/imx/imx6_ccmreg.h stable/11/sys/arm/freescale/imx/imx_ccmvar.h stable/11/sys/arm/freescale/vybrid/vf_spi.c stable/11/sys/arm/lpc/lpc_spi.c stable/11/sys/arm/samsung/exynos/exynos5_spi.c stable/11/sys/arm/ti/ti_spi.c stable/11/sys/dev/flash/at45d.c stable/11/sys/dev/flash/mx25l.c stable/11/sys/dev/spibus/ofw_spibus.c stable/11/sys/dev/spibus/spibusvar.h stable/11/sys/dev/xilinx/axi_quad_spi.c stable/11/sys/mips/atheros/ar71xx_spi.c stable/11/sys/mips/mediatek/mtk_spi_v1.c stable/11/sys/mips/mediatek/mtk_spi_v2.c stable/11/sys/mips/rt305x/rt305x_spi.c stable/11/sys/modules/Makefile stable/11/sys/modules/imx/Makefile stable/11/sys/modules/spi/at45d/Makefile stable/11/sys/modules/spi/mx25l/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/at91/at91_spi.c ============================================================================== --- stable/11/sys/arm/at91/at91_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/at91/at91_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -304,6 +304,8 @@ at91_spi_transfer(device_t dev, device_t child, struct /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + sc = device_get_softc(dev); i = 0; Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -436,6 +436,9 @@ bcm_spi_transfer(device_t dev, device_t child, struct /* Get the proper chip select for this child. */ spibus_get_cs(child, &cs); + + cs &= ~SPIBUS_CS_HIGH; + if (cs > 2) { device_printf(dev, "Invalid chip select %d requested by %s\n", cs, Modified: stable/11/sys/arm/freescale/imx/files.imx5 ============================================================================== --- stable/11/sys/arm/freescale/imx/files.imx5 Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/files.imx5 Sat Mar 24 23:23:31 2018 (r331506) @@ -52,3 +52,6 @@ dev/vt/hw/fb/vt_early_fb.c optional vt # Fast Ethernet Controller dev/ffec/if_ffec.c optional ffec +# SPI +arm/freescale/imx/imx_spi.c optional imx_spi + Modified: stable/11/sys/arm/freescale/imx/files.imx6 ============================================================================== --- stable/11/sys/arm/freescale/imx/files.imx6 Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/files.imx6 Sat Mar 24 23:23:31 2018 (r331506) @@ -22,6 +22,7 @@ arm/freescale/imx/imx_machdep.c standard arm/freescale/imx/imx_gpt.c optional imx_gpt arm/freescale/imx/imx_gpio.c optional gpio arm/freescale/imx/imx_i2c.c optional fsliic +arm/freescale/imx/imx_spi.c optional imx_spi arm/freescale/imx/imx6_sdma.c optional sdma arm/freescale/imx/imx6_audmux.c optional sound arm/freescale/imx/imx6_ssi.c optional sound Modified: stable/11/sys/arm/freescale/imx/imx51_ccm.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx51_ccm.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx51_ccm.c Sat Mar 24 23:23:31 2018 (r331506) @@ -622,6 +622,13 @@ imx_ccm_usbphy_enable(device_t dev) } uint32_t +imx_ccm_ecspi_hz(void) +{ + + return (imx51_get_clock(IMX51CLK_CSPI_CLK_ROOT)); +} + +uint32_t imx_ccm_ipg_hz(void) { @@ -655,3 +662,4 @@ imx_ccm_ahb_hz(void) return (imx51_get_clock(IMX51CLK_AHB_CLK_ROOT)); } + Modified: stable/11/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccm.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx6_ccm.c Sat Mar 24 23:23:31 2018 (r331506) @@ -96,8 +96,9 @@ ccm_init_gates(struct ccm_softc *sc) reg = CCGR0_AIPS_TZ1 | CCGR0_AIPS_TZ2 | CCGR0_ABPHDMA; WR4(sc, CCM_CCGR0, reg); - /* enet, epit, gpt */ - reg = CCGR1_ENET | CCGR1_EPIT1 | CCGR1_GPT; + /* enet, epit, gpt, spi */ + reg = CCGR1_ENET | CCGR1_EPIT1 | CCGR1_GPT | CCGR1_ECSPI1 | + CCGR1_ECSPI2 | CCGR1_ECSPI3 | CCGR1_ECSPI4 | CCGR1_ECSPI5; WR4(sc, CCM_CCGR1, reg); /* ipmux & ipsync (bridges), iomux, i2c */ @@ -349,6 +350,13 @@ imx6_ccm_sata_enable(void) WR4(ccm_sc, CCM_ANALOG_PLL_ENET, v); return 0; +} + +uint32_t +imx_ccm_ecspi_hz(void) +{ + + return (60000000); } uint32_t Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:23:31 2018 (r331506) @@ -80,9 +80,15 @@ #define CCGR0_AIPS_TZ2 (0x3 << 2) #define CCGR0_ABPHDMA (0x3 << 4) #define CCM_CCGR1 0x06C +#define CCGR1_ECSPI1 (0x3 << 0) +#define CCGR1_ECSPI2 (0x3 << 2) +#define CCGR1_ECSPI3 (0x3 << 4) +#define CCGR1_ECSPI4 (0x3 << 6) +#define CCGR1_ECSPI5 (0x3 << 8) #define CCGR1_ENET (0x3 << 10) #define CCGR1_EPIT1 (0x3 << 12) #define CCGR1_EPIT2 (0x3 << 14) +#define CCGR1_ESAI (0x3 << 16) #define CCGR1_GPT (0x3 << 20) #define CCGR1_GPT_SERIAL (0x3 << 22) #define CCM_CCGR2 0x070 Modified: stable/11/sys/arm/freescale/imx/imx_ccmvar.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_ccmvar.h Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx_ccmvar.h Sat Mar 24 23:23:31 2018 (r331506) @@ -43,6 +43,7 @@ * board setup code has to handle those things. */ +uint32_t imx_ccm_ecspi_hz(void); uint32_t imx_ccm_ipg_hz(void); uint32_t imx_ccm_perclk_hz(void); uint32_t imx_ccm_sdhci_hz(void); Copied: stable/11/sys/arm/freescale/imx/imx_spi.c (from r329999, head/sys/arm/freescale/imx/imx_spi.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/freescale/imx/imx_spi.c Sat Mar 24 23:23:31 2018 (r331506, copy of r329999, head/sys/arm/freescale/imx/imx_spi.c) @@ -0,0 +1,604 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Ian Lepore + * 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$"); + +/* + * Driver for imx Enhanced Configurable SPI; master-mode only. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include "spibus_if.h" + +#define ECSPI_RXDATA 0x00 +#define ECSPI_TXDATA 0x04 +#define ECSPI_CTLREG 0x08 +#define CTLREG_BLEN_SHIFT 20 +#define CTLREG_BLEN_MASK 0x0fff +#define CTLREG_CSEL_SHIFT 18 +#define CTLREG_CSEL_MASK 0x03 +#define CTLREG_DRCTL_SHIFT 16 +#define CTLREG_DRCTL_MASK 0x03 +#define CTLREG_PREDIV_SHIFT 12 +#define CTLREG_PREDIV_MASK 0x0f +#define CTLREG_POSTDIV_SHIFT 8 +#define CTLREG_POSTDIV_MASK 0x0f +#define CTLREG_CMODE_SHIFT 4 +#define CTLREG_CMODE_MASK 0x0f +#define CTLREG_CMODES_MASTER (CTLREG_CMODE_MASK << CTLREG_CMODE_SHIFT) +#define CTLREG_SMC (1u << 3) +#define CTLREG_XCH (1u << 2) +#define CTLREG_HT (1u << 1) +#define CTLREG_EN (1u << 0) +#define ECSPI_CFGREG 0x0c +#define CFGREG_HTLEN_SHIFT 24 +#define CFGREG_SCLKCTL_SHIFT 20 +#define CFGREG_DATACTL_SHIFT 16 +#define CFGREG_SSPOL_SHIFT 12 +#define CFGREG_SSCTL_SHIFT 8 +#define CFGREG_SCLKPOL_SHIFT 4 +#define CFGREG_SCLKPHA_SHIFT 0 +#define CFGREG_MASK 0x0f /* all CFGREG fields are 4 bits */ +#define ECSPI_INTREG 0x10 +#define INTREG_TCEN (1u << 7) +#define INTREG_ROEN (1u << 6) +#define INTREG_RFEN (1u << 5) +#define INTREG_RDREN (1u << 4) +#define INTREG_RREN (1u << 3) +#define INTREG_TFEN (1u << 2) +#define INTREG_TDREN (1u << 1) +#define INTREG_TEEN (1u << 0) +#define ECSPI_DMAREG 0x14 +#define DMA_RX_THRESH_SHIFT 16 +#define DMA_RX_THRESH_MASK 0x3f +#define DMA_TX_THRESH_SHIFT 0 +#define DMA_TX_THRESH_MASK 0x3f +#define ECSPI_STATREG 0x18 +#define SREG_TC (1u << 7) +#define SREG_RO (1u << 6) +#define SREG_RF (1u << 5) +#define SREG_RDR (1u << 4) +#define SREG_RR (1u << 3) +#define SREG_TF (1u << 2) +#define SREG_TDR (1u << 1) +#define SREG_TE (1u << 0) +#define ECSPI_PERIODREG 0x1c +#define ECSPI_TESTREG 0x20 + +#define CS_MAX 4 /* Max number of chip selects. */ +#define CS_MASK 0x03 /* Mask flag bits out of chipsel. */ + +#define FIFO_SIZE 64 +#define FIFO_RXTHRESH 32 +#define FIFO_TXTHRESH 32 + +struct spi_softc { + device_t dev; + device_t spibus; + struct mtx mtx; + struct resource *memres; + struct resource *intres; + void *inthandle; + gpio_pin_t cspins[CS_MAX]; + u_int debug; + u_int basefreq; + uint32_t ctlreg; + uint32_t intreg; + uint32_t fifocnt; + uint8_t *rxbuf; + uint32_t rxidx; + uint32_t rxlen; + uint8_t *txbuf; + uint32_t txidx; + uint32_t txlen; +}; + +static struct ofw_compat_data compat_data[] = { + {"fsl,imx51-ecspi", true}, + {"fsl,imx53-ecspi", true}, + {"fsl,imx6dl-ecspi", true}, + {"fsl,imx6q-ecspi", true}, + {"fsl,imx6sx-ecspi", true}, + {"fsl,imx6ul-ecspi", true}, + {NULL, false} +}; + +static inline uint32_t +RD4(struct spi_softc *sc, bus_size_t offset) +{ + + return (bus_read_4(sc->memres, offset)); +} + +static inline void +WR4(struct spi_softc *sc, bus_size_t offset, uint32_t value) +{ + + bus_write_4(sc->memres, offset, value); +} + +static u_int +spi_calc_clockdiv(struct spi_softc *sc, u_int busfreq) +{ + u_int post, pre; + + /* Returning 0 effectively sets both dividers to 1. */ + if (sc->basefreq <= busfreq) + return (0); + + /* + * Brute-force this; all real-world bus speeds are going to be found on + * the 1st or 2nd time through this loop. + */ + for (post = 0; post < 16; ++post) { + pre = ((sc->basefreq >> post) / busfreq) - 1; + if (pre < 16) + break; + } + if (post == 16) { + /* The lowest we can go is ~115 Hz. */ + pre = 15; + post = 15; + } + + if (sc->debug >= 2) { + device_printf(sc->dev, + "base %u bus %u; pre %u, post %u; actual busfreq %u\n", + sc->basefreq, busfreq, pre, post, + (sc->basefreq / (pre + 1)) / (1 << post)); + } + + return (pre << CTLREG_PREDIV_SHIFT) | (post << CTLREG_POSTDIV_SHIFT); +} + +static void +spi_set_chipsel(struct spi_softc *sc, u_int cs, bool active) +{ + bool pinactive; + + /* + * This is kinda crazy... the gpio pins for chipsel are defined as + * active-high in the dts, but are supposed to be treated as active-low + * by this driver. So to turn on chipsel we have to invert the value + * passed to gpio_pin_set_active(). Then, to make it more fun, any + * slave can say its chipsel is active-high, so if that option is + * on, we have to invert the value again. + */ + pinactive = !active ^ (bool)(cs & SPIBUS_CS_HIGH); + + if (sc->debug >= 2) { + device_printf(sc->dev, "chipsel %u changed to %u\n", + (cs & ~SPIBUS_CS_HIGH), pinactive); + } + + /* + * Change the pin, then do a dummy read of its current state to ensure + * that the state change reaches the hardware before proceeding. + */ + gpio_pin_set_active(sc->cspins[cs & ~SPIBUS_CS_HIGH], pinactive); + gpio_pin_is_active(sc->cspins[cs & ~SPIBUS_CS_HIGH], &pinactive); +} + +static void +spi_hw_setup(struct spi_softc *sc, u_int cs, u_int mode, u_int freq) +{ + uint32_t reg; + + /* + * Set up control register, and write it first to bring the device out + * of reset. + */ + sc->ctlreg = CTLREG_EN | CTLREG_CMODES_MASTER | CTLREG_SMC; + sc->ctlreg |= spi_calc_clockdiv(sc, freq); + sc->ctlreg |= 7 << CTLREG_BLEN_SHIFT; /* XXX byte at a time */ + WR4(sc, ECSPI_CTLREG, sc->ctlreg); + + /* + * Set up the config register. Note that we do all transfers with the + * SPI hardware's chip-select set to zero. The actual chip select is + * handled with a gpio pin. + */ + reg = 0; + if (cs & SPIBUS_CS_HIGH) + reg |= 1u << CFGREG_SSPOL_SHIFT; + if (mode & SPIBUS_MODE_CPHA) + reg |= 1u << CFGREG_SCLKPHA_SHIFT; + if (mode & SPIBUS_MODE_CPOL) { + reg |= 1u << CFGREG_SCLKPOL_SHIFT; + reg |= 1u << CFGREG_SCLKCTL_SHIFT; + } + WR4(sc, ECSPI_CFGREG, reg); + + /* + * Set up the rx/tx FIFO interrupt thresholds. + */ + reg = (FIFO_RXTHRESH << DMA_RX_THRESH_SHIFT); + reg |= (FIFO_TXTHRESH << DMA_TX_THRESH_SHIFT); + WR4(sc, ECSPI_DMAREG, reg); + + /* + * Do a dummy read, to make sure the preceding writes reach the spi + * hardware before we assert any gpio chip select. + */ + (void)RD4(sc, ECSPI_CFGREG); +} + +static void +spi_empty_rxfifo(struct spi_softc *sc) +{ + + while (sc->rxidx < sc->rxlen && (RD4(sc, ECSPI_STATREG) & SREG_RR)) { + sc->rxbuf[sc->rxidx++] = (uint8_t)RD4(sc, ECSPI_RXDATA); + --sc->fifocnt; + } +} + +static void +spi_fill_txfifo(struct spi_softc *sc) +{ + + while (sc->txidx < sc->txlen && sc->fifocnt < FIFO_SIZE) { + WR4(sc, ECSPI_TXDATA, sc->txbuf[sc->txidx++]); + ++sc->fifocnt; + } + + /* + * If we're out of data, disable tx data ready (threshold) interrupts, + * and enable tx fifo empty interrupts. + */ + if (sc->txidx == sc->txlen) + sc->intreg = (sc->intreg & ~INTREG_TDREN) | INTREG_TEEN; +} + +static void +spi_intr(void *arg) +{ + struct spi_softc *sc = arg; + uint32_t intreg, status; + + mtx_lock(&sc->mtx); + + sc = arg; + intreg = sc->intreg; + status = RD4(sc, ECSPI_STATREG); + WR4(sc, ECSPI_STATREG, status); /* Clear w1c bits. */ + + /* + * If we get an overflow error, just signal that the transfer is done + * and wakeup the waiting thread, which will see that txidx != txlen and + * return an IO error to the caller. + */ + if (__predict_false(status & SREG_RO)) { + if (sc->debug || bootverbose) { + device_printf(sc->dev, "rxoverflow rxidx %u txidx %u\n", + sc->rxidx, sc->txidx); + } + sc->intreg = 0; + wakeup(sc); + mtx_unlock(&sc->mtx); + return; + } + + if (status & SREG_RR) + spi_empty_rxfifo(sc); + + if (status & SREG_TDR) + spi_fill_txfifo(sc); + + /* + * If we're out of bytes to send... + * - If Transfer Complete is set (shift register is empty) and we've + * received everything we expect, we're all done. + * - Else if Tx Fifo Empty is set, we need to stop waiting for that and + * switch to waiting for Transfer Complete (wait for shift register + * to empty out), and also for Receive Ready (last of incoming data). + */ + if (sc->txidx == sc->txlen) { + if ((status & SREG_TC) && sc->fifocnt == 0) { + sc->intreg = 0; + wakeup(sc); + } else if (status & SREG_TE) { + sc->intreg &= ~(sc->intreg & ~INTREG_TEEN); + sc->intreg |= INTREG_TCEN | INTREG_RREN; + } + } + + /* + * If interrupt flags changed, write the new flags to the hardware and + * do a dummy readback to ensure the changes reach the hardware before + * we exit the isr. + */ + if (sc->intreg != intreg) { + WR4(sc, ECSPI_INTREG, sc->intreg); + (void)RD4(sc, ECSPI_INTREG); + } + + if (sc->debug >= 3) { + device_printf(sc->dev, + "spi_intr, sreg 0x%08x intreg was 0x%08x now 0x%08x\n", + status, intreg, sc->intreg); + } + + mtx_unlock(&sc->mtx); +} + +static int +spi_xfer_buf(struct spi_softc *sc, void *rxbuf, void *txbuf, uint32_t len) +{ + int err; + + if (sc->debug >= 1) { + device_printf(sc->dev, + "spi_xfer_buf, rxbuf %p txbuf %p len %u\n", + rxbuf, txbuf, len); + } + + if (len == 0) + return (0); + + sc->rxbuf = rxbuf; + sc->rxlen = len; + sc->rxidx = 0; + sc->txbuf = txbuf; + sc->txlen = len; + sc->txidx = 0; + sc->intreg = INTREG_RDREN | INTREG_TDREN; + spi_fill_txfifo(sc); + + /* Enable interrupts last; spi_fill_txfifo() can change sc->intreg */ + WR4(sc, ECSPI_INTREG, sc->intreg); + + err = 0; + while (err == 0 && sc->intreg != 0) + err = msleep(sc, &sc->mtx, 0, "imxspi", 10 * hz); + + if (sc->rxidx != sc->rxlen || sc->txidx != sc->txlen) + err = EIO; + + return (err); +} + +static int +spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct spi_softc *sc = device_get_softc(dev); + uint32_t cs, mode, clock; + int err; + + spibus_get_cs(child, &cs); + spibus_get_clock(child, &clock); + spibus_get_mode(child, &mode); + + if (cs > CS_MAX || sc->cspins[cs] == NULL) { + if (sc->debug || bootverbose) + device_printf(sc->dev, "Invalid chip select %u\n", cs); + return (EINVAL); + } + + mtx_lock(&sc->mtx); + + if (sc->debug >= 1) { + device_printf(sc->dev, + "spi_transfer, cs 0x%x clock %u mode %u\n", + cs, clock, mode); + } + + /* Set up the hardware and select the device. */ + spi_hw_setup(sc, cs, mode, clock); + spi_set_chipsel(sc, cs, true); + + /* Transfer command then data bytes. */ + err = 0; + if (cmd->tx_cmd_sz > 0) + err = spi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, + cmd->tx_cmd_sz); + if (cmd->tx_data_sz > 0 && err == 0) + err = spi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, + cmd->tx_data_sz); + + /* Deselect the device, turn off (and reset) hardware. */ + spi_set_chipsel(sc, cs, false); + WR4(sc, ECSPI_CTLREG, 0); + + mtx_unlock(&sc->mtx); + + return (err); +} + +static phandle_t +spi_get_node(device_t bus, device_t dev) +{ + + /* + * Share our controller node with our spibus child; it instantiates + * devices by walking the children contained within our node. + */ + return ofw_bus_get_node(bus); +} + +static int +spi_detach(device_t dev) +{ + struct spi_softc *sc = device_get_softc(dev); + int idx; + + mtx_lock(&sc->mtx); + + bus_generic_detach(sc->dev); + if (sc->spibus != NULL) + device_delete_child(dev, sc->spibus); + + for (idx = 0; idx < nitems(sc->cspins); ++idx) { + if (sc->cspins[idx] != NULL) + gpio_pin_release(sc->cspins[idx]); + } + + if (sc->inthandle != NULL) + bus_teardown_intr(sc->dev, sc->intres, sc->inthandle); + if (sc->intres != NULL) + bus_release_resource(sc->dev, SYS_RES_IRQ, 0, sc->intres); + if (sc->memres != NULL) + bus_release_resource(sc->dev, SYS_RES_MEMORY, 0, sc->memres); + + mtx_unlock(&sc->mtx); + mtx_destroy(&sc->mtx); + + return (0); +} + +static int +spi_attach(device_t dev) +{ + struct spi_softc *sc = device_get_softc(dev); + phandle_t node; + int err, idx, rid; + + sc->dev = dev; + sc->basefreq = imx_ccm_ecspi_hz(); + + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + /* Set up debug-enable sysctl. */ + SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), + OID_AUTO, "debug", CTLFLAG_RWTUN, &sc->debug, 0, + "Enable debug, higher values = more info"); + + /* Allocate mmio register access resources. */ + rid = 0; + sc->memres = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->memres == NULL) { + device_printf(sc->dev, "could not allocate registers\n"); + spi_detach(sc->dev); + return (ENXIO); + } + + /* Allocate interrupt resources and set up handler. */ + rid = 0; + sc->intres = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->intres == NULL) { + device_printf(sc->dev, "could not allocate interrupt\n"); + device_detach(sc->dev); + return (ENXIO); + } + err = bus_setup_intr(sc->dev, sc->intres, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, spi_intr, sc, &sc->inthandle); + if (err != 0) { + device_printf(sc->dev, "could not setup interrupt handler"); + device_detach(sc->dev); + return (ENXIO); + } + + /* Allocate gpio pins for configured chip selects. */ + node = ofw_bus_get_node(sc->dev); + for (err = 0, idx = 0; err == 0 && idx < nitems(sc->cspins); ++idx) { + err = gpio_pin_get_by_ofw_propidx(sc->dev, node, "cs-gpios", + idx, &sc->cspins[idx]); + if (err == 0) { + gpio_pin_setflags(sc->cspins[idx], GPIO_PIN_OUTPUT); + } else if (sc->debug >= 2) { + device_printf(sc->dev, + "cannot configure gpio for chip select %u\n", idx); + } + } + + /* + * Hardware init: put all channels into Master mode, turn off the enable + * bit (gates off clocks); we only enable the hardware while xfers run. + */ + WR4(sc, ECSPI_CTLREG, CTLREG_CMODES_MASTER); + + /* Attach the bus driver. */ + sc->spibus = device_add_child(dev, "spibus", -1); + return (bus_generic_attach(sc->dev)); +} + +static int +spi_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "i.MX ECSPI Master"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t spi_methods[] = { + DEVMETHOD(device_probe, spi_probe), + DEVMETHOD(device_attach, spi_attach), + DEVMETHOD(device_detach, spi_detach), + + /* spibus_if */ + DEVMETHOD(spibus_transfer, spi_transfer), + + /* ofw_bus_if */ + DEVMETHOD(ofw_bus_get_node, spi_get_node), + + DEVMETHOD_END +}; + +static driver_t spi_driver = { + "imx_spi", + spi_methods, + sizeof(struct spi_softc), +}; + +static devclass_t spi_devclass; + +DRIVER_MODULE(imx_spi, simplebus, spi_driver, spi_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, imx_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); +MODULE_DEPEND(imx_spi, ofw_spibus, 1, 1, 1); Modified: stable/11/sys/arm/freescale/vybrid/vf_spi.c ============================================================================== --- stable/11/sys/arm/freescale/vybrid/vf_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/vybrid/vf_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -263,6 +263,8 @@ spi_transfer(device_t dev, device_t child, struct spi_ /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Command */ spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs); Modified: stable/11/sys/arm/lpc/lpc_spi.c ============================================================================== --- stable/11/sys/arm/lpc/lpc_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/lpc/lpc_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -149,6 +149,8 @@ lpc_spi_transfer(device_t dev, device_t child, struct spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Set CS active */ lpc_gpio_set_state(child, cs, 0); Modified: stable/11/sys/arm/samsung/exynos/exynos5_spi.c ============================================================================== --- stable/11/sys/arm/samsung/exynos/exynos5_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/samsung/exynos/exynos5_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -204,6 +204,8 @@ spi_transfer(device_t dev, device_t child, struct spi_ /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Command */ spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs); Modified: stable/11/sys/arm/ti/ti_spi.c ============================================================================== --- stable/11/sys/arm/ti/ti_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/ti/ti_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -458,6 +458,9 @@ ti_spi_transfer(device_t dev, device_t child, struct s /* Get the proper chip select for this child. */ spibus_get_cs(child, &cs); + + cs &= ~SPIBUS_CS_HIGH; + if (cs > sc->sc_numcs) { device_printf(dev, "Invalid chip select %d requested by %s\n", cs, device_get_nameunit(child)); Modified: stable/11/sys/dev/flash/at45d.c ============================================================================== --- stable/11/sys/dev/flash/at45d.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/flash/at45d.c Sat Mar 24 23:23:31 2018 (r331506) @@ -450,3 +450,4 @@ static driver_t at45d_driver = { }; DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, NULL, NULL); +MODULE_DEPEND(at45d, spibus, 1, 1, 1); Modified: stable/11/sys/dev/flash/mx25l.c ============================================================================== --- stable/11/sys/dev/flash/mx25l.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/flash/mx25l.c Sat Mar 24 23:23:31 2018 (r331506) @@ -89,8 +89,13 @@ struct mx25l_softc struct proc *sc_p; struct bio_queue_head sc_bio_queue; unsigned int sc_flags; + unsigned int sc_taskstate; }; +#define TSTATE_STOPPED 0 +#define TSTATE_STOPPING 1 +#define TSTATE_RUNNING 2 + #define M25PXX_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define M25PXX_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define M25PXX_LOCK_INIT(_sc) \ @@ -527,6 +532,8 @@ mx25l_attach(device_t dev) bioq_init(&sc->sc_bio_queue); kproc_create(&mx25l_task, sc, &sc->sc_p, 0, 0, "task: mx25l flash"); + sc->sc_taskstate = TSTATE_RUNNING; + device_printf(sc->sc_dev, "%s, sector %d bytes, %d sectors\n", ident->name, ident->sectorsize, ident->sectorcount); @@ -536,8 +543,33 @@ mx25l_attach(device_t dev) static int mx25l_detach(device_t dev) { + struct mx25l_softc *sc; + int err; - return (EIO); + sc = device_get_softc(dev); + err = 0; + + M25PXX_LOCK(sc); + if (sc->sc_taskstate == TSTATE_RUNNING) { + sc->sc_taskstate = TSTATE_STOPPING; + wakeup(sc); + while (err == 0 && sc->sc_taskstate != TSTATE_STOPPED) { + err = msleep(sc, &sc->sc_mtx, 0, "mx25dt", hz * 3); + if (err != 0) { + sc->sc_taskstate = TSTATE_RUNNING; + device_printf(dev, + "Failed to stop queue task\n"); + } + } + } + M25PXX_UNLOCK(sc); + + if (err == 0 && sc->sc_taskstate == TSTATE_STOPPED) { + disk_destroy(sc->sc_disk); + bioq_flush(&sc->sc_bio_queue, NULL, ENXIO); + M25PXX_LOCK_DESTROY(sc); + } + return (err); } static int @@ -605,9 +637,15 @@ mx25l_task(void *arg) dev = sc->sc_dev; M25PXX_LOCK(sc); do { + if (sc->sc_taskstate == TSTATE_STOPPING) { + sc->sc_taskstate = TSTATE_STOPPED; + M25PXX_UNLOCK(sc); + wakeup(sc); + kproc_exit(0); + } bp = bioq_first(&sc->sc_bio_queue); if (bp == NULL) - msleep(sc, &sc->sc_mtx, PRIBIO, "jobqueue", 0); + msleep(sc, &sc->sc_mtx, PRIBIO, "mx25jq", 0); } while (bp == NULL); bioq_remove(&sc->sc_bio_queue, bp); M25PXX_UNLOCK(sc); @@ -648,3 +686,4 @@ static driver_t mx25l_driver = { }; DRIVER_MODULE(mx25l, spibus, mx25l_driver, mx25l_devclass, 0, 0); +MODULE_DEPEND(mx25l, spibus, 1, 1, 1); Modified: stable/11/sys/dev/spibus/ofw_spibus.c ============================================================================== --- stable/11/sys/dev/spibus/ofw_spibus.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/spibus/ofw_spibus.c Sat Mar 24 23:23:31 2018 (r331506) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2009, Nathan Whitehorn * Copyright (c) 2013 The FreeBSD Foundation @@ -82,6 +82,7 @@ ofw_spibus_attach(device_t dev) phandle_t child; pcell_t clock, paddr; device_t childdev; + uint32_t mode = SPIBUS_MODE_NONE; sc->dev = dev; @@ -105,6 +106,24 @@ ofw_spibus_attach(device_t dev) } /* + * Try to get the cpol/cpha mode + */ + if (OF_hasprop(child, "spi-cpol")) + mode = SPIBUS_MODE_CPOL; + if (OF_hasprop(child, "spi-cpha")) { + if (mode == SPIBUS_MODE_CPOL) + mode = SPIBUS_MODE_CPOL_CPHA; + else + mode = SPIBUS_MODE_CPHA; + } + + /* + * Try to get the CS polarity + */ + if (OF_hasprop(child, "spi-cs-high")) + paddr |= SPIBUS_CS_HIGH; + + /* * Get the maximum clock frequency for device, zero means * use the default bus speed. */ @@ -122,6 +141,7 @@ ofw_spibus_attach(device_t dev) continue; dinfo->opd_dinfo.cs = paddr; dinfo->opd_dinfo.clock = clock; + dinfo->opd_dinfo.mode = mode; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF); @@ -194,10 +214,10 @@ static device_method_t ofw_spibus_methods[] = { DEVMETHOD_END }; -static devclass_t ofwspibus_devclass; +devclass_t ofw_spibus_devclass; DEFINE_CLASS_1(spibus, ofw_spibus_driver, ofw_spibus_methods, sizeof(struct spibus_softc), spibus_driver); -DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, ofwspibus_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); MODULE_VERSION(ofw_spibus, 1); MODULE_DEPEND(ofw_spibus, spibus, 1, 1, 1); Modified: stable/11/sys/dev/spibus/spibusvar.h ============================================================================== --- stable/11/sys/dev/spibus/spibusvar.h Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/spibus/spibusvar.h Sat Mar 24 23:23:31 2018 (r331506) @@ -46,6 +46,8 @@ struct spibus_ivar uint32_t clock; }; +#define SPIBUS_CS_HIGH (1U << 31) + enum { SPIBUS_IVAR_CS, /* chip select that we're on */ SPIBUS_IVAR_MODE, /* SPI mode (0-3) */ @@ -66,3 +68,5 @@ SPIBUS_ACCESSOR(clock, CLOCK, uint32_t) extern driver_t spibus_driver; extern devclass_t spibus_devclass; +extern driver_t ofw_spibus_driver; +extern devclass_t ofw_spibus_devclass; Modified: stable/11/sys/dev/xilinx/axi_quad_spi.c ============================================================================== --- stable/11/sys/dev/xilinx/axi_quad_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/xilinx/axi_quad_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -193,6 +193,8 @@ spi_transfer(device_t dev, device_t child, struct spi_ /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Assert CS */ reg = READ4(sc, SPI_SSR); reg &= ~(1 << cs); Modified: stable/11/sys/mips/atheros/ar71xx_spi.c ============================================================================== --- stable/11/sys/mips/atheros/ar71xx_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/atheros/ar71xx_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -214,6 +214,8 @@ ar71xx_spi_transfer(device_t dev, device_t child, stru spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + ar71xx_spi_chip_activate(sc, cs); KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, Modified: stable/11/sys/mips/mediatek/mtk_spi_v1.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_spi_v1.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/mediatek/mtk_spi_v1.c Sat Mar 24 23:23:31 2018 (r331506) @@ -231,6 +231,8 @@ mtk_spi_transfer(device_t dev, device_t child, struct spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: stable/11/sys/mips/mediatek/mtk_spi_v2.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_spi_v2.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/mediatek/mtk_spi_v2.c Sat Mar 24 23:23:31 2018 (r331506) @@ -236,6 +236,8 @@ mtk_spi_transfer(device_t dev, device_t child, struct spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: stable/11/sys/mips/rt305x/rt305x_spi.c ============================================================================== --- stable/11/sys/mips/rt305x/rt305x_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/rt305x/rt305x_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -226,6 +226,8 @@ rt305x_spi_transfer(device_t dev, device_t child, stru spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/modules/Makefile Sat Mar 24 23:23:31 2018 (r331506) @@ -360,7 +360,7 @@ SUBDIR= \ snp \ sound \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Mar 24 23:26:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37F8DF55BC1; Sat, 24 Mar 2018 23:26:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE67A85BD2; Sat, 24 Mar 2018 23:26:54 +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 D8BB615FF1; Sat, 24 Mar 2018 23:26:54 +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 w2ONQsGT036431; Sat, 24 Mar 2018 23:26:54 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ONQsC1036430; Sat, 24 Mar 2018 23:26:54 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242326.w2ONQsC1036430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331507 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 331507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 23:26:55 -0000 Author: ian Date: Sat Mar 24 23:26:54 2018 New Revision: 331507 URL: https://svnweb.freebsd.org/changeset/base/331507 Log: MFC r330361: Correct a misplaced closing paren. Does not affect the result, but does clarify (at least for me) that the multiplication happens before the shift. Modified: stable/11/sys/sys/time.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/time.h ============================================================================== --- stable/11/sys/sys/time.h Sat Mar 24 23:23:31 2018 (r331506) +++ stable/11/sys/sys/time.h Sat Mar 24 23:26:54 2018 (r331507) @@ -173,7 +173,7 @@ static __inline sbintime_t nstosbt(int64_t _ns) { - return ((_ns * (((uint64_t)1 << 63) / 500000000) >> 32)); + return ((_ns * (((uint64_t)1 << 63) / 500000000)) >> 32); } static __inline int64_t @@ -187,7 +187,7 @@ static __inline sbintime_t ustosbt(int64_t _us) { - return ((_us * (((uint64_t)1 << 63) / 500000) >> 32)); + return ((_us * (((uint64_t)1 << 63) / 500000)) >> 32); } static __inline int64_t @@ -201,7 +201,7 @@ static __inline sbintime_t mstosbt(int64_t _ms) { - return ((_ms * (((uint64_t)1 << 63) / 500) >> 32)); + return ((_ms * (((uint64_t)1 << 63) / 500)) >> 32); } /*- From owner-svn-src-all@freebsd.org Sat Mar 24 23:58:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1510F58883; Sat, 24 Mar 2018 23:58:45 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ECEF86EA1; Sat, 24 Mar 2018 23:58:45 +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 499AC164D7; Sat, 24 Mar 2018 23:58:45 +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 w2ONwjpk051362; Sat, 24 Mar 2018 23:58:45 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ONwiuu051354; Sat, 24 Mar 2018 23:58:44 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803242358.w2ONwiuu051354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 24 Mar 2018 23:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331508 - in head: lib/libc/sys share/man/man9 usr.bin/cpuset X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head: lib/libc/sys share/man/man9 usr.bin/cpuset X-SVN-Commit-Revision: 331508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 23:58:45 -0000 Author: jeff Date: Sat Mar 24 23:58:44 2018 New Revision: 331508 URL: https://svnweb.freebsd.org/changeset/base/331508 Log: Document new NUMA related syscalls and utility options. Sponsored by: Netflix, Dell/EMC Isilon Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/cpuset.2 head/lib/libc/sys/cpuset_getaffinity.2 head/share/man/man9/Makefile head/share/man/man9/malloc.9 head/share/man/man9/zone.9 head/usr.bin/cpuset/cpuset.1 Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Sat Mar 24 23:26:54 2018 (r331507) +++ head/lib/libc/sys/Makefile.inc Sat Mar 24 23:58:44 2018 (r331508) @@ -174,6 +174,7 @@ MAN+= abort2.2 \ connectat.2 \ cpuset.2 \ cpuset_getaffinity.2 \ + cpuset_getdomain.2 \ dup.2 \ execve.2 \ _exit.2 \ @@ -371,6 +372,7 @@ MLINKS+=nanosleep.2 clock_nanosleep.2 MLINKS+=cpuset.2 cpuset_getid.2 \ cpuset.2 cpuset_setid.2 MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2 +MLINKS+=cpuset_getdomain.2 cpuset_setdomain.2 MLINKS+=dup.2 dup2.2 MLINKS+=execve.2 fexecve.2 MLINKS+=extattr_get_file.2 extattr.2 \ Modified: head/lib/libc/sys/cpuset.2 ============================================================================== --- head/lib/libc/sys/cpuset.2 Sat Mar 24 23:26:54 2018 (r331507) +++ head/lib/libc/sys/cpuset.2 Sat Mar 24 23:58:44 2018 (r331508) @@ -48,21 +48,21 @@ The .Nm family of system calls allow applications to control sets of processors and -assign processes and threads to these sets. -Processor sets contain lists of CPUs that members may run on and exist only -as long as some process is a member of the set. +memory domains and assign processes and threads to these sets. +Processor sets contain lists of CPUs and domains that members may run on +and exist only as long as some process is a member of the set. All processes in the system have an assigned set. The default set for all processes in the system is the set numbered 1. Threads belong to the same set as the process which contains them, however, they may further restrict their set with the anonymous -per-thread mask. +per-thread mask to bind to a specific CPU or subset of CPUs and memory domains. .Pp Sets are referenced by a number of type .Ft cpuset_id_t . Each thread has a root set, an assigned set, and an anonymous mask. Only the root and assigned sets are numbered. -The root set is the set of all CPUs available in the system or in the -system partition the thread is running in. +The root set is the set of all CPUs and memory domains available in the system +or in the system partition the thread is running in. The assigned set is a subset of the root set and is administratively assignable on a per-process basis. Many processes and threads may be members of a numbered set. @@ -72,7 +72,8 @@ set. It is intended that administrators will manipulate numbered sets using .Xr cpuset 1 while application developers will manipulate anonymous sets using -.Xr cpuset_setaffinity 2 . +.Xr cpuset_setaffinity 2 and +.Xr cpuset_setdomain 2 . .Pp To select the correct set a value of type .Ft cpulevel_t @@ -175,9 +176,10 @@ with a process or thread is unsupported since this references the unnumbered anonymous mask. .Pp The actual contents of the sets may be retrieved or manipulated using -.Xr cpuset_getaffinity 2 -and -.Xr cpuset_setaffinity 2 . +.Xr cpuset_getaffinity 2 , +.Xr cpuset_setaffinity 2 , +.Xr cpuset_getdomain 2 , and +.Xr cpuset_setdomain 2 . See those manual pages for more detail. .Sh RETURN VALUES .Rv -std @@ -220,6 +222,8 @@ for allocation. .Xr cpuset 1 , .Xr cpuset_getaffinity 2 , .Xr cpuset_setaffinity 2 , +.Xr cpuset_getdomain 2 , +.Xr cpuset_setdomain 2 , .Xr pthread_affinity_np 3 , .Xr pthread_attr_affinity_np 3 , .Xr cpuset 9 Modified: head/lib/libc/sys/cpuset_getaffinity.2 ============================================================================== --- head/lib/libc/sys/cpuset_getaffinity.2 Sat Mar 24 23:26:54 2018 (r331507) +++ head/lib/libc/sys/cpuset_getaffinity.2 Sat Mar 24 23:58:44 2018 (r331508) @@ -160,6 +160,8 @@ See .Xr cpuset 2 , .Xr cpuset_getid 2 , .Xr cpuset_setid 2 , +.Xr cpuset_getdomain 2 , +.Xr cpuset_setdomain 2 , .Xr pthread_affinity_np 3 , .Xr pthread_attr_affinity_np 3 , .Xr cpuset 9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat Mar 24 23:26:54 2018 (r331507) +++ head/share/man/man9/Makefile Sat Mar 24 23:58:44 2018 (r331508) @@ -1271,6 +1271,8 @@ MLINKS+=make_dev.9 destroy_dev.9 \ make_dev.9 make_dev_p.9 \ make_dev.9 make_dev_s.9 MLINKS+=malloc.9 free.9 \ + malloc.9 malloc_domain.9 \ + malloc.9 free_domain.9 \ malloc.9 mallocarray.9 \ malloc.9 MALLOC_DECLARE.9 \ malloc.9 MALLOC_DEFINE.9 \ @@ -2213,10 +2215,12 @@ MLINKS+=vslock.9 vsunlock.9 MLINKS+=zone.9 uma.9 \ zone.9 uma_zalloc.9 \ zone.9 uma_zalloc_arg.9 \ + zone.9 uma_zalloc_domain.9 \ zone.9 uma_zcreate.9 \ zone.9 uma_zdestroy.9 \ zone.9 uma_zfree.9 \ zone.9 uma_zfree_arg.9 \ + zone.9 uma_zfree_domain.9 \ zone.9 uma_zone_get_cur.9 \ zone.9 uma_zone_get_max.9 \ zone.9 uma_zone_set_max.9 \ Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Sat Mar 24 23:26:54 2018 (r331507) +++ head/share/man/man9/malloc.9 Sat Mar 24 23:58:44 2018 (r331508) @@ -46,9 +46,13 @@ .Ft void * .Fn malloc "size_t size" "struct malloc_type *type" "int flags" .Ft void * +.Fn malloc_domain "size_t size" "struct malloc_type *type" "int domain" "int flags" +.Ft void * .Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Ft void .Fn free "void *addr" "struct malloc_type *type" +.Ft void +.Fn free_domain "void *addr" "struct malloc_type *type" .Ft void * .Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" .Ft void * @@ -64,6 +68,14 @@ The function allocates uninitialized memory in kernel address space for an object whose size is specified by .Fa size . +.Pp +The +.Fn malloc_domain +variant allocates the object from the specified memory domain. Memory allocated +with this function should be returned with +.Fn free_domain . +See +.Xr numa 9 for more details. .Pp The .Fn mallocarray Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Sat Mar 24 23:26:54 2018 (r331507) +++ head/share/man/man9/zone.9 Sat Mar 24 23:58:44 2018 (r331508) @@ -32,8 +32,10 @@ .Nm uma_zcreate , .Nm uma_zalloc , .Nm uma_zalloc_arg , +.Nm uma_zalloc_domain , .Nm uma_zfree , .Nm uma_zfree_arg , +.Nm uma_zfree_domain , .Nm uma_zdestroy , .Nm uma_zone_set_max , .Nm uma_zone_get_max , @@ -55,11 +57,15 @@ .Fn uma_zalloc "uma_zone_t zone" "int flags" .Ft "void *" .Fn uma_zalloc_arg "uma_zone_t zone" "void *arg" "int flags" +.Ft "void *" +.Fn uma_zalloc_domain "uma_zone_t zone" "void *arg" "int domain" "int flags" .Ft void .Fn uma_zfree "uma_zone_t zone" "void *item" .Ft void .Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg" .Ft void +.Fn uma_zfree_domain "uma_zone_t zone" "void *item" "void *arg" +.Ft void .Fn uma_zdestroy "uma_zone_t zone" .Ft int .Fn uma_zone_set_max "uma_zone_t zone" "int nitems" @@ -78,10 +84,13 @@ .Fn SYSCTL_ADD_UMA_CUR ctx parent nbr name access zone descr .Sh DESCRIPTION The zone allocator provides an efficient interface for managing -dynamically-sized collections of items of similar size. +dynamically-sized collections of items of identical size. The zone allocator can work with preallocated zones as well as with runtime-allocated ones, and is therefore available much earlier in the -boot process than other memory management routines. +boot process than other memory management routines. The zone allocator +provides per-cpu allocation caches with linear scalability on SMP +systems as well as round-robin and first-touch policies for NUMA +systems. .Pp A zone is an extensible collection of items of identical size. The zone allocator keeps track of which items are in use and which @@ -209,6 +218,11 @@ The zone is for the subsystem. .It Dv UMA_ZONE_VM The zone is for the VM subsystem. +.It Dv UMA_ZONE_NUMA +The zone should use a first-touch NUMA policy rather than the round-robin +default. Callers that do not free memory on the same domain it is allocated +from will cause mixing in per-cpu caches. See +.Xr numa 9 for more details. .El .Pp To allocate an item from a zone, simply call @@ -243,12 +257,21 @@ The variations .Fn uma_zalloc_arg and .Fn uma_zfree_arg -allow to +allow callers to specify an argument for the .Dv ctor and .Dv dtor functions, respectively. +The +.Fn uma_zalloc_domain +function allows callers to specify a fixed +.Xr numa 9 domain to allocate from. This uses a guaranteed but slow path in +the allocator which reduces concurrency. The +.Fn uma_zfree_domain +function should be used to return memory allocated in this fashion. This +function infers the domain from the pointer and does not require it as an +argument. .Pp Created zones, which are empty, Modified: head/usr.bin/cpuset/cpuset.1 ============================================================================== --- head/usr.bin/cpuset/cpuset.1 Sat Mar 24 23:26:54 2018 (r331507) +++ head/usr.bin/cpuset/cpuset.1 Sat Mar 24 23:58:44 2018 (r331508) @@ -34,20 +34,24 @@ .Sh SYNOPSIS .Nm .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Op Fl s Ar setid .Ar cmd ... .Nm .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Op Fl s Ar setid .Fl p Ar pid .Nm .Op Fl c .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Fl C .Fl p Ar pid .Nm .Op Fl c .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq .Nm .Fl g @@ -57,8 +61,9 @@ The .Nm command can be used to assign processor sets to processes, run commands -constrained to a given set or list of processors, and query information -about processor binding, sets, and available processors in the system. +constrained to a given set or list of processors and memory domains, and query +information about processor binding, memory binding and policy, sets, and +available processors and memory domains in the system. .Pp .Nm requires a target to modify or query. @@ -92,6 +97,15 @@ This last set is the list of all possible CPUs in the queried using .Fl r . .Pp +Most sets include NUMA memory domain and policy information. This can be +inspected with +.Fl g +and set with +.Fl n . +This will specify which NUMA domains are visible to the process and +affect where anonymous memory and file pages will be stored on first access. +Files accessed first by other processes may specify conflicting policy. +.Pp When running a command it may join a set specified with .Fl s otherwise a new set is created. @@ -110,7 +124,8 @@ Create a new cpuset and assign the target process to t The requested operation should reference the cpuset available via the target specifier. .It Fl d Ar domain -Specifies a NUMA domain id as the target of the operation. +Specifies a NUMA domain id as the target of the operation. This can only +be used to query the cpus visible in each numberd domain. .It Fl g Causes .Nm @@ -130,6 +145,13 @@ numbers separated by '-' for ranges and commas separat A special list of .Dq all may be specified in which case the list includes all CPUs from the root set. +.It Fl n Ar domain-list:policy +Specifies a list of domains and allocation policy to apply to a target. Ranges +may be specified as in +.Fl l . +Valid policies include first-touch, ft, round-robin, rr, and prefer. The prefer +policy accepts only a single domain in the set. The parent of the set is +consulted if the preferred domain is unavailable. .It Fl p Ar pid Specifies a pid as the target of the operation. .It Fl s Ar setid